From: Suresh Siddha Date: Wed, 24 Aug 2011 00:05:22 +0000 (-0700) Subject: iommu: Cleanup ifdefs in detect_intel_iommu() X-Git-Tag: firefly_0821_release~3680^2~4311^2~6 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f5d1b97bcdd8ac195f48c645bffcb88bcea533e4;p=firefly-linux-kernel-4.4.55.git iommu: Cleanup ifdefs in detect_intel_iommu() Signed-off-by: Suresh Siddha Cc: yinghai@kernel.org Cc: youquan.song@intel.com Cc: joerg.roedel@amd.com Cc: tony.luck@intel.com Cc: dwmw2@infradead.org Link: http://lkml.kernel.org/r/20110824001456.386003047@sbsiddha-desk.sc.intel.com Signed-off-by: Ingo Molnar --- diff --git a/arch/ia64/include/asm/iommu.h b/arch/ia64/include/asm/iommu.h index 745e095fe82e..95461bb0b8e6 100644 --- a/arch/ia64/include/asm/iommu.h +++ b/arch/ia64/include/asm/iommu.h @@ -7,12 +7,14 @@ extern void pci_iommu_shutdown(void); extern void no_iommu_init(void); -extern int force_iommu, no_iommu; -extern int iommu_detected; #ifdef CONFIG_DMAR +extern int force_iommu, no_iommu; extern int iommu_pass_through; +extern int iommu_detected; #else #define iommu_pass_through (0) +#define no_iommu (1) +#define iommu_detected (0) #endif extern void iommu_dma_init(void); extern void machvec_init(const char *name); diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c index 6f0422dcd0f5..587e8f2d38d8 100644 --- a/drivers/iommu/dmar.c +++ b/drivers/iommu/dmar.c @@ -551,22 +551,21 @@ int __init detect_intel_iommu(void) if (ret) ret = check_zero_address(); { -#ifdef CONFIG_INTR_REMAP struct acpi_table_dmar *dmar; dmar = (struct acpi_table_dmar *) dmar_tbl; - if (ret && cpu_has_x2apic && dmar->flags & 0x1) + + if (ret && intr_remapping_enabled && cpu_has_x2apic && + dmar->flags & 0x1) printk(KERN_INFO - "Queued invalidation will be enabled to support " - "x2apic and Intr-remapping.\n"); -#endif -#ifdef CONFIG_DMAR + "Queued invalidation will be enabled to support x2apic and Intr-remapping.\n"); + if (ret && !no_iommu && !iommu_detected && !dmar_disabled) { iommu_detected = 1; /* Make sure ACS will be enabled */ pci_request_acs(); } -#endif + #ifdef CONFIG_X86 if (ret) x86_init.iommu.iommu_init = intel_iommu_init; diff --git a/include/linux/dma_remapping.h b/include/linux/dma_remapping.h index aaa12cb8227a..b98b61b3743e 100644 --- a/include/linux/dma_remapping.h +++ b/include/linux/dma_remapping.h @@ -30,6 +30,7 @@ struct root_entry; extern void free_dmar_iommu(struct intel_iommu *iommu); extern int iommu_calculate_agaw(struct intel_iommu *iommu); extern int iommu_calculate_max_sagaw(struct intel_iommu *iommu); +extern int dmar_disabled; #else static inline int iommu_calculate_agaw(struct intel_iommu *iommu) { @@ -42,8 +43,8 @@ static inline int iommu_calculate_max_sagaw(struct intel_iommu *iommu) static inline void free_dmar_iommu(struct intel_iommu *iommu) { } +#define dmar_disabled (1) #endif -extern int dmar_disabled; #endif