]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
x86: GART: Convert gart_iommu_hole_init() to use iommu_init hook
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Tue, 10 Nov 2009 10:46:14 +0000 (19:46 +0900)
committerIngo Molnar <mingo@elte.hu>
Tue, 10 Nov 2009 11:31:23 +0000 (12:31 +0100)
This changes gart_iommu_hole_init() to set gart_iommu_init() to
iommu_init hook if gart_iommu_hole_init() finds the GART IOMMU.

We can kill the code to check if we found the IOMMU in
gart_iommu_init() since gart_iommu_hole_init() sets
gart_iommu_init() only when it found 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-4-git-send-email-fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/include/asm/gart.h
arch/x86/kernel/aperture_64.c
arch/x86/kernel/pci-dma.c
arch/x86/kernel/pci-gart_64.c

index 4fdd5b3f87b1e3f7cb256950118432bb0bb0038b..4ac5b0f33fc1017b3760eb01b1a4ed7f7155dbce 100644 (file)
@@ -35,7 +35,7 @@ extern int gart_iommu_aperture_allowed;
 extern int gart_iommu_aperture_disabled;
 
 extern void early_gart_iommu_check(void);
-extern void gart_iommu_init(void);
+extern int gart_iommu_init(void);
 extern void __init gart_parse_options(char *);
 extern void gart_iommu_hole_init(void);
 
@@ -47,9 +47,6 @@ extern void gart_iommu_hole_init(void);
 static inline void early_gart_iommu_check(void)
 {
 }
-static inline void gart_iommu_init(void)
-{
-}
 static inline void gart_parse_options(char *options)
 {
 }
index 128111d8ffe0de7ffcdaf0891221ff37d0ae61f8..03933cf0b63ced2dfcb3a119588653933275bc06 100644 (file)
@@ -28,6 +28,7 @@
 #include <asm/pci-direct.h>
 #include <asm/dma.h>
 #include <asm/k8.h>
+#include <asm/x86_init.h>
 
 int gart_iommu_aperture;
 int gart_iommu_aperture_disabled __initdata;
@@ -400,6 +401,7 @@ void __init gart_iommu_hole_init(void)
 
                        iommu_detected = 1;
                        gart_iommu_aperture = 1;
+                       x86_init.iommu.iommu_init = gart_iommu_init;
 
                        aper_order = (read_pci_config(bus, slot, 3, AMD64_GARTAPERTURECTL) >> 1) & 7;
                        aper_size = (32 * 1024 * 1024) << aper_order;
index 0224da88256aea296d4138a09d056628793713de..ecde8543537f7faf5421e5ca6acc2c0f01322825 100644 (file)
@@ -298,8 +298,6 @@ static int __init pci_iommu_init(void)
 
        amd_iommu_init();
 
-       gart_iommu_init();
-
        no_iommu_init();
        return 0;
 }
index eb46ab3f52b2bf6888a1fd5d772d8561c13fecb9..0410bd30060d1ac19bad2e1f87d127c6d32c6ddb 100644 (file)
@@ -709,7 +709,7 @@ static void gart_iommu_shutdown(void)
        }
 }
 
-void __init gart_iommu_init(void)
+int __init gart_iommu_init(void)
 {
        struct agp_kern_info info;
        unsigned long iommu_start;
@@ -719,7 +719,7 @@ void __init gart_iommu_init(void)
        long i;
 
        if (cache_k8_northbridges() < 0 || num_k8_northbridges == 0)
-               return;
+               return 0;
 
 #ifndef CONFIG_AGP_AMD64
        no_agp = 1;
@@ -731,13 +731,6 @@ void __init gart_iommu_init(void)
                (agp_copy_info(agp_bridge, &info) < 0);
 #endif
 
-       if (swiotlb)
-               return;
-
-       /* Did we detect a different HW IOMMU? */
-       if (iommu_detected && !gart_iommu_aperture)
-               return;
-
        if (no_iommu ||
            (!force_iommu && max_pfn <= MAX_DMA32_PFN) ||
            !gart_iommu_aperture ||
@@ -747,7 +740,7 @@ void __init gart_iommu_init(void)
                               "but GART IOMMU not available.\n");
                        printk(KERN_WARNING "falling back to iommu=soft.\n");
                }
-               return;
+               return 0;
        }
 
        /* need to map that range */
@@ -840,6 +833,8 @@ void __init gart_iommu_init(void)
        flush_gart();
        dma_ops = &gart_dma_ops;
        x86_platform.iommu_shutdown = gart_iommu_shutdown;
+
+       return 0;
 }
 
 void __init gart_parse_options(char *p)