]> xenbits.xensource.com Git - people/dwmw2/xen.git/commitdiff
iommu / x86: move call to scan_pci_devices() out of vendor code
authorPaul Durrant <paul.durrant@citrix.com>
Thu, 25 Jul 2019 10:16:21 +0000 (12:16 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 25 Jul 2019 10:16:21 +0000 (12:16 +0200)
It's not vendor specific so it doesn't really belong there.

Scanning the PCI topology also really doesn't have much to do with IOMMU
initialization. It doesn't depend on there even being an IOMMU. This patch
moves to the call to the beginning of iommu_hardware_setup() but only
places it there because the topology information would be otherwise unused.

Subsequent patches will actually make use of the PCI topology during
(x86) IOMMU initialization.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: "Roger Pau Monné" <roger.pau@citrix.com>
Acked-by: Brian Woods <brian.woods@amd.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/drivers/passthrough/amd/pci_amd_iommu.c
xen/drivers/passthrough/vtd/iommu.c
xen/drivers/passthrough/x86/iommu.c

index 4afbcd1609c620f13ee1fc3f39b687c7efccedb4..3338a8e0e83f93ee699d98222f4629f1e65f152c 100644 (file)
@@ -180,7 +180,8 @@ static int __init iov_detect(void)
 
     if ( !amd_iommu_perdev_intremap )
         printk(XENLOG_WARNING "AMD-Vi: Using global interrupt remap table is not recommended (see XSA-36)!\n");
-    return scan_pci_devices();
+
+    return 0;
 }
 
 int amd_iommu_alloc_root(struct domain_iommu *hd)
index 4cf1e0980eeae6b755a331c0c271251dcad6c4be..5d72270c5b8c2ce8917f6441bf140cb99ef6d5a5 100644 (file)
@@ -2377,10 +2377,6 @@ static int __init vtd_setup(void)
     P(iommu_hap_pt_share, "Shared EPT tables");
 #undef P
 
-    ret = scan_pci_devices();
-    if ( ret )
-        goto error;
-
     ret = init_vtd_hw();
     if ( ret )
         goto error;
index 0fa6dcc3fdef281ca33c49015ca76909aa446e24..a7438c9c253bea09a6b6c23cae261a4b5c83a5d1 100644 (file)
@@ -28,9 +28,15 @@ struct iommu_ops __read_mostly iommu_ops;
 
 int __init iommu_hardware_setup(void)
 {
+    int rc;
+
     if ( !iommu_init_ops )
         return -ENODEV;
 
+    rc = scan_pci_devices();
+    if ( rc )
+        return rc;
+
     if ( !iommu_ops.init )
         iommu_ops = *iommu_init_ops->ops;
     else