diff --git a/xen/drivers/passthrough/amd/pci_amd_iommu.c b/xen/drivers/passthrough/amd/pci_amd_iommu.c index 330f9ce386..4a633ca940 100644 --- a/xen/drivers/passthrough/amd/pci_amd_iommu.c +++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c @@ -300,6 +300,8 @@ static void __hwdom_init amd_iommu_hwdom_init(struct domain *d) IOMMU_MMIO_REGION_LENGTH - 1)) ) BUG(); + /* Make sure workarounds are applied (if needed) before adding devices. */ + arch_iommu_hwdom_init(d); setup_hwdom_pci_devices(d, amd_iommu_add_device); } diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/arm/smmu.c index 43ece42a50..8f91807b1b 100644 --- a/xen/drivers/passthrough/arm/smmu.c +++ b/xen/drivers/passthrough/arm/smmu.c @@ -2736,6 +2736,8 @@ static void __hwdom_init arm_smmu_iommu_hwdom_init(struct domain *d) printk(XENLOG_WARNING "map-reserved dom0-iommu option is not supported on ARM\n"); iommu_hwdom_reserved = 0; + + arch_iommu_hwdom_init(d); } static void arm_smmu_iommu_domain_teardown(struct domain *d) diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c index ee3f523fdf..ae6cf2f0ff 100644 --- a/xen/drivers/passthrough/iommu.c +++ b/xen/drivers/passthrough/iommu.c @@ -238,16 +238,6 @@ void __hwdom_init iommu_hwdom_init(struct domain *d) } hd->platform_ops->hwdom_init(d); - - ASSERT(iommu_hwdom_inclusive != -1 && iommu_hwdom_inclusive != -1); - if ( iommu_hwdom_inclusive && !is_pv_domain(d) ) - { - printk(XENLOG_WARNING - "IOMMU inclusive mappings are only supported on PV Dom0\n"); - iommu_hwdom_inclusive = 0; - } - - arch_iommu_hwdom_init(d); } void iommu_teardown(struct domain *d) diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index adc70f205a..bb422ec58c 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -1313,6 +1313,8 @@ static void __hwdom_init intel_iommu_hwdom_init(struct domain *d) setup_hwdom_pci_devices(d, setup_hwdom_device); setup_hwdom_rmrr(d); + /* Make sure workarounds are applied before enabling the IOMMU(s). */ + arch_iommu_hwdom_init(d); if ( iommu_flush_all() ) printk(XENLOG_WARNING VTDPREFIX diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c index 47a078272a..b7c8b5be41 100644 --- a/xen/drivers/passthrough/x86/iommu.c +++ b/xen/drivers/passthrough/x86/iommu.c @@ -210,6 +210,14 @@ void __hwdom_init arch_iommu_hwdom_init(struct domain *d) BUG_ON(!is_hardware_domain(d)); + ASSERT(iommu_hwdom_inclusive != -1 && iommu_hwdom_inclusive != -1); + if ( iommu_hwdom_inclusive && !is_pv_domain(d) ) + { + printk(XENLOG_WARNING + "IOMMU inclusive mappings are only supported on PV Dom0\n"); + iommu_hwdom_inclusive = 0; + } + if ( iommu_hwdom_passthrough ) return;