x86: intel-iommu: Convert detect_intel_iommu to use iommu_init hook
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Tue, 10 Nov 2009 10:46:16 +0000 (19:46 +0900)
committerIngo Molnar <mingo@elte.hu>
Tue, 10 Nov 2009 11:31:36 +0000 (12:31 +0100)
This changes detect_intel_iommu() to set intel_iommu_init() to
iommu_init hook if detect_intel_iommu() finds the IOMMU.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: chrisw@sous-sol.org
Cc: dwmw2@infradead.org
Cc: joerg.roedel@amd.com
Cc: muli@il.ibm.com
LKML-Reference: <1257849980-22640-6-git-send-email-fujita.tomonori@lab.ntt.co.jp>
[ -v2: build fix for the !CONFIG_DMAR case ]
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/pci-dma.c
drivers/pci/dmar.c
include/linux/dmar.h

index 5ca44a9301a05f4b60b98fae0bff5c1b1c434137..bed05e2e589052d5f1f1c7e7b16f60d8b1d500ca 100644 (file)
@@ -294,8 +294,6 @@ static int __init pci_iommu_init(void)
 
        x86_init.iommu.iommu_init();
 
-       intel_iommu_init();
-
        no_iommu_init();
        return 0;
 }
index 22b02c6df8542138a27fcad4511eb008f0afbb0c..bce9cd7c755a81b8a35d65dcd7a6b5723a854107 100644 (file)
@@ -616,6 +616,10 @@ void __init detect_intel_iommu(void)
                if (ret && !no_iommu && !iommu_detected && !swiotlb &&
                    !dmar_disabled)
                        iommu_detected = 1;
+#endif
+#ifdef CONFIG_X86
+               if (ret)
+                       x86_init.iommu.iommu_init = intel_iommu_init;
 #endif
        }
        early_acpi_os_unmap_memory(dmar_tbl, dmar_tbl_size);
index 4a2b162c256aac373afa166638fbed5938b773db..5de4c9e5856d52d670cd3160d038d94ae9a976ee 100644 (file)
@@ -208,16 +208,9 @@ struct dmar_atsr_unit {
        u8 include_all:1;               /* include all ports */
 };
 
-/* Intel DMAR  initialization functions */
 extern int intel_iommu_init(void);
-#else
-static inline int intel_iommu_init(void)
-{
-#ifdef CONFIG_INTR_REMAP
-       return dmar_dev_scope_init();
-#else
-       return -ENODEV;
-#endif
-}
-#endif /* !CONFIG_DMAR */
+#else /* !CONFIG_DMAR: */
+static inline int intel_iommu_init(void) { return -ENODEV; }
+#endif /* CONFIG_DMAR */
+
 #endif /* __DMAR_H__ */