aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2009-11-10 05:46:14 -0500
committerIngo Molnar <mingo@elte.hu>2009-11-10 06:31:23 -0500
commitde957628ce7c84764ff41331111036b3ae5bad0f (patch)
treed13dcb1c152e738e079a03fc3bb0b87d1a4d3dab /arch/x86
parentd7b9f7be216b04ff9d108f856bc03d96e7b3439c (diff)
x86: GART: Convert gart_iommu_hole_init() to use iommu_init hook
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>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/include/asm/gart.h5
-rw-r--r--arch/x86/kernel/aperture_64.c2
-rw-r--r--arch/x86/kernel/pci-dma.c2
-rw-r--r--arch/x86/kernel/pci-gart_64.c15
4 files changed, 8 insertions, 16 deletions
diff --git a/arch/x86/include/asm/gart.h b/arch/x86/include/asm/gart.h
index 4fdd5b3f87b1..4ac5b0f33fc1 100644
--- a/arch/x86/include/asm/gart.h
+++ b/arch/x86/include/asm/gart.h
@@ -35,7 +35,7 @@ extern int gart_iommu_aperture_allowed;
35extern int gart_iommu_aperture_disabled; 35extern int gart_iommu_aperture_disabled;
36 36
37extern void early_gart_iommu_check(void); 37extern void early_gart_iommu_check(void);
38extern void gart_iommu_init(void); 38extern int gart_iommu_init(void);
39extern void __init gart_parse_options(char *); 39extern void __init gart_parse_options(char *);
40extern void gart_iommu_hole_init(void); 40extern void gart_iommu_hole_init(void);
41 41
@@ -47,9 +47,6 @@ extern void gart_iommu_hole_init(void);
47static inline void early_gart_iommu_check(void) 47static inline void early_gart_iommu_check(void)
48{ 48{
49} 49}
50static inline void gart_iommu_init(void)
51{
52}
53static inline void gart_parse_options(char *options) 50static inline void gart_parse_options(char *options)
54{ 51{
55} 52}
diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c
index 128111d8ffe0..03933cf0b63c 100644
--- a/arch/x86/kernel/aperture_64.c
+++ b/arch/x86/kernel/aperture_64.c
@@ -28,6 +28,7 @@
28#include <asm/pci-direct.h> 28#include <asm/pci-direct.h>
29#include <asm/dma.h> 29#include <asm/dma.h>
30#include <asm/k8.h> 30#include <asm/k8.h>
31#include <asm/x86_init.h>
31 32
32int gart_iommu_aperture; 33int gart_iommu_aperture;
33int gart_iommu_aperture_disabled __initdata; 34int gart_iommu_aperture_disabled __initdata;
@@ -400,6 +401,7 @@ void __init gart_iommu_hole_init(void)
400 401
401 iommu_detected = 1; 402 iommu_detected = 1;
402 gart_iommu_aperture = 1; 403 gart_iommu_aperture = 1;
404 x86_init.iommu.iommu_init = gart_iommu_init;
403 405
404 aper_order = (read_pci_config(bus, slot, 3, AMD64_GARTAPERTURECTL) >> 1) & 7; 406 aper_order = (read_pci_config(bus, slot, 3, AMD64_GARTAPERTURECTL) >> 1) & 7;
405 aper_size = (32 * 1024 * 1024) << aper_order; 407 aper_size = (32 * 1024 * 1024) << aper_order;
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 0224da88256a..ecde8543537f 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -298,8 +298,6 @@ static int __init pci_iommu_init(void)
298 298
299 amd_iommu_init(); 299 amd_iommu_init();
300 300
301 gart_iommu_init();
302
303 no_iommu_init(); 301 no_iommu_init();
304 return 0; 302 return 0;
305} 303}
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
index eb46ab3f52b2..0410bd30060d 100644
--- a/arch/x86/kernel/pci-gart_64.c
+++ b/arch/x86/kernel/pci-gart_64.c
@@ -709,7 +709,7 @@ static void gart_iommu_shutdown(void)
709 } 709 }
710} 710}
711 711
712void __init gart_iommu_init(void) 712int __init gart_iommu_init(void)
713{ 713{
714 struct agp_kern_info info; 714 struct agp_kern_info info;
715 unsigned long iommu_start; 715 unsigned long iommu_start;
@@ -719,7 +719,7 @@ void __init gart_iommu_init(void)
719 long i; 719 long i;
720 720
721 if (cache_k8_northbridges() < 0 || num_k8_northbridges == 0) 721 if (cache_k8_northbridges() < 0 || num_k8_northbridges == 0)
722 return; 722 return 0;
723 723
724#ifndef CONFIG_AGP_AMD64 724#ifndef CONFIG_AGP_AMD64
725 no_agp = 1; 725 no_agp = 1;
@@ -731,13 +731,6 @@ void __init gart_iommu_init(void)
731 (agp_copy_info(agp_bridge, &info) < 0); 731 (agp_copy_info(agp_bridge, &info) < 0);
732#endif 732#endif
733 733
734 if (swiotlb)
735 return;
736
737 /* Did we detect a different HW IOMMU? */
738 if (iommu_detected && !gart_iommu_aperture)
739 return;
740
741 if (no_iommu || 734 if (no_iommu ||
742 (!force_iommu && max_pfn <= MAX_DMA32_PFN) || 735 (!force_iommu && max_pfn <= MAX_DMA32_PFN) ||
743 !gart_iommu_aperture || 736 !gart_iommu_aperture ||
@@ -747,7 +740,7 @@ void __init gart_iommu_init(void)
747 "but GART IOMMU not available.\n"); 740 "but GART IOMMU not available.\n");
748 printk(KERN_WARNING "falling back to iommu=soft.\n"); 741 printk(KERN_WARNING "falling back to iommu=soft.\n");
749 } 742 }
750 return; 743 return 0;
751 } 744 }
752 745
753 /* need to map that range */ 746 /* need to map that range */
@@ -840,6 +833,8 @@ void __init gart_iommu_init(void)
840 flush_gart(); 833 flush_gart();
841 dma_ops = &gart_dma_ops; 834 dma_ops = &gart_dma_ops;
842 x86_platform.iommu_shutdown = gart_iommu_shutdown; 835 x86_platform.iommu_shutdown = gart_iommu_shutdown;
836
837 return 0;
843} 838}
844 839
845void __init gart_parse_options(char *p) 840void __init gart_parse_options(char *p)