aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-04-21 16:31:26 +0100
committerKeir Fraser <keir.fraser@citrix.com>2009-04-21 16:31:26 +0100
commit946a02890ce9adf18da2abc45f93f055732f9318 (patch)
tree234881e22410a316383170c02dfdd26666907398
parent23eab25ed025f877b300f72673f98b73bc375357 (diff)
downloadxen-946a02890ce9adf18da2abc45f93f055732f9318.tar.gz
xen-946a02890ce9adf18da2abc45f93f055732f9318.tar.bz2
xen-946a02890ce9adf18da2abc45f93f055732f9318.zip
intel vtd: Remove the BUG_ON in domain_context_mapping().
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
-rw-r--r--xen/drivers/passthrough/vtd/iommu.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c
index dc18b3fde5..ff56a19b36 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1196,7 +1196,20 @@ static int domain_context_mapping(struct domain *domain, u8 bus, u8 devfn)
u8 secbus, secdevfn;
struct pci_dev *pdev = pci_get_pdev(bus, devfn);
- BUG_ON(!pdev);
+ if ( pdev == NULL )
+ {
+ /* We can reach here by setup_dom0_rmrr() -> iommu_prepare_rmrr_dev()
+ * -> domain_context_mapping().
+ * In the case a user enables VT-d and disables USB (that usually needs
+ * RMRR) in BIOS, we can't discover the BDF of the USB controller in
+ * setup_dom0_devices(), but the ACPI RMRR structures may still contain
+ * the BDF and at last pci_get_pdev() returns NULL here.
+ */
+ gdprintk(XENLOG_WARNING VTDPREFIX,
+ "domain_context_mapping: can't find bdf = %x:%x.%x\n",
+ bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+ return 0;
+ }
drhd = acpi_find_matched_drhd_unit(pdev);
if ( !drhd )