diff --git a/xen/drivers/passthrough/amd/pci_amd_iommu.c b/xen/drivers/passthrough/amd/pci_amd_iommu.c index 03228a9952..9642bba43a 100644 --- a/xen/drivers/passthrough/amd/pci_amd_iommu.c +++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c @@ -183,9 +183,6 @@ int __init acpi_ivrs_init(void) { int rc; - if ( !iommu_enable && !iommu_intremap ) - return 0; - rc = amd_iommu_get_supported_ivhd_type(); if ( rc < 0 ) return rc; @@ -193,10 +190,7 @@ int __init acpi_ivrs_init(void) ivhd_type = rc; if ( (amd_iommu_detect_acpi() !=0) || (iommu_found() == 0) ) - { - iommu_intremap = iommu_intremap_off; return -ENODEV; - } iommu_init_ops = &_iommu_init_ops; diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c index d5ee367599..33a12b2ae9 100644 --- a/xen/drivers/passthrough/vtd/dmar.c +++ b/xen/drivers/passthrough/vtd/dmar.c @@ -777,11 +777,7 @@ static int __init acpi_parse_dmar(struct acpi_table_header *table) dmar = (struct acpi_table_dmar *)table; dmar_flags = dmar->flags; - if ( !iommu_enable && !iommu_intremap ) - { - ret = -EINVAL; - goto out; - } + ASSERT(iommu_enable || iommu_intremap); if ( !dmar->width ) { diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c index 01dbd9b098..b2284ae001 100644 --- a/xen/drivers/passthrough/x86/iommu.c +++ b/xen/drivers/passthrough/x86/iommu.c @@ -41,6 +41,24 @@ enum iommu_intremap __read_mostly iommu_intremap = iommu_intremap_full; bool __read_mostly iommu_intpost; #endif +void __init acpi_iommu_init(void) +{ + int ret; + + if ( !iommu_enable && !iommu_intremap ) + return; + + ret = acpi_dmar_init(); + if ( ret == -ENODEV ) + ret = acpi_ivrs_init(); + + if ( ret ) + { + iommu_enable = false; + iommu_intremap = iommu_intremap_off; + } +} + int __init iommu_hardware_setup(void) { struct IO_APIC_route_entry **ioapic_entries = NULL; diff --git a/xen/include/asm-x86/acpi.h b/xen/include/asm-x86/acpi.h index 7032f3a001..9a9cc4c240 100644 --- a/xen/include/asm-x86/acpi.h +++ b/xen/include/asm-x86/acpi.h @@ -141,16 +141,10 @@ extern u32 x86_acpiid_to_apicid[]; extern u32 pmtmr_ioport; extern unsigned int pmtmr_width; +void acpi_iommu_init(void); int acpi_dmar_init(void); int acpi_ivrs_init(void); -static inline int acpi_iommu_init(void) -{ - int ret = acpi_dmar_init(); - - return ret == -ENODEV ? acpi_ivrs_init() : ret; -} - void acpi_mmcfg_init(void); /* Incremented whenever we transition through S3. Value is 1 during boot. */