]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
amd/iommu: assign iommu devices to Xen
authorRoger Pau Monne <roger.pau@citrix.com>
Tue, 20 Nov 2018 15:19:43 +0000 (16:19 +0100)
committerRoger Pau Monne <roger.pau@citrix.com>
Tue, 27 Nov 2018 11:37:13 +0000 (12:37 +0100)
AMD IOMMU devices are exposed on the PCI bus, and thus are assigned by
default to the hardware domain. This can cause issues because the
IOMMU devices themselves are not behind an IOMMU, so update_paging_mode will
return an error if Xen tries to expand the page tables of a domain
that has assigned devices not behind an IOMMU. update_paging_mode
failing will cause the domain to be destroyed.

Fix this by hiding PCI IOMMU devices, so they are not assigned to the
hardware domain.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Cc: Brian Woods <brian.woods@amd.com>
---
Changes since v4:
 - Use pci_hide_device.
 - Expand commit message.

xen/drivers/passthrough/amd/iommu_init.c

index 15c10b0929e6920714347d64fa6710853757b9ff..17f39552a9ab12455a7c3b410c16b15820dfd7f8 100644 (file)
@@ -993,6 +993,8 @@ static void * __init allocate_ppr_log(struct amd_iommu *iommu)
 
 static int __init amd_iommu_init_one(struct amd_iommu *iommu)
 {
+    pci_hide_device(iommu->seg, PCI_BUS(iommu->bdf), PCI_DEVFN2(iommu->bdf));
+
     if ( map_iommu_mmio_region(iommu) != 0 )
         goto error_out;