diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2009-10-27 03:34:44 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-11-08 07:12:26 -0500 |
commit | 338bac527ed0e35b4cb50390972f15d3cbce92ca (patch) | |
tree | c959878378523ba7f3bb0e30e98336549cadbdc0 /arch/x86/kernel | |
parent | 7c9abfb884b8737f0afdc8a88bcea77526f0da87 (diff) |
x86: Use x86_platform for iommu_shutdown
This patch cleans up pci_iommu_shutdown() a bit to use
x86_platform (similar to how IA64 initializes an IOMMU driver).
This adds iommu_shutdown() to x86_platform to avoid calling
every IOMMUs' shutdown functions in pci_iommu_shutdown() in
order. The IOMMU shutdown functions are platform specific (we
don't have multiple different IOMMU hardware) so the current way
is pointless.
An IOMMU driver sets x86_platform.iommu_shutdown to the shutdown
function if necessary.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: joerg.roedel@amd.com
LKML-Reference: <20091027163358F.fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r-- | arch/x86/kernel/amd_iommu_init.c | 6 | ||||
-rw-r--r-- | arch/x86/kernel/crash.c | 5 | ||||
-rw-r--r-- | arch/x86/kernel/pci-dma.c | 7 | ||||
-rw-r--r-- | arch/x86/kernel/pci-gart_64.c | 6 | ||||
-rw-r--r-- | arch/x86/kernel/reboot.c | 4 | ||||
-rw-r--r-- | arch/x86/kernel/x86_init.c | 2 |
6 files changed, 11 insertions, 19 deletions
diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c index c20001e4f556..6acd43e9afd7 100644 --- a/arch/x86/kernel/amd_iommu_init.c +++ b/arch/x86/kernel/amd_iommu_init.c | |||
@@ -1297,6 +1297,7 @@ int __init amd_iommu_init(void) | |||
1297 | else | 1297 | else |
1298 | printk(KERN_INFO "AMD-Vi: Lazy IO/TLB flushing enabled\n"); | 1298 | printk(KERN_INFO "AMD-Vi: Lazy IO/TLB flushing enabled\n"); |
1299 | 1299 | ||
1300 | x86_platform.iommu_shutdown = disable_iommus; | ||
1300 | out: | 1301 | out: |
1301 | return ret; | 1302 | return ret; |
1302 | 1303 | ||
@@ -1323,11 +1324,6 @@ free: | |||
1323 | goto out; | 1324 | goto out; |
1324 | } | 1325 | } |
1325 | 1326 | ||
1326 | void amd_iommu_shutdown(void) | ||
1327 | { | ||
1328 | disable_iommus(); | ||
1329 | } | ||
1330 | |||
1331 | /**************************************************************************** | 1327 | /**************************************************************************** |
1332 | * | 1328 | * |
1333 | * Early detect code. This code runs at IOMMU detection time in the DMA | 1329 | * Early detect code. This code runs at IOMMU detection time in the DMA |
diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index 5e409dc298a4..a4849c10a77e 100644 --- a/arch/x86/kernel/crash.c +++ b/arch/x86/kernel/crash.c | |||
@@ -27,8 +27,7 @@ | |||
27 | #include <asm/cpu.h> | 27 | #include <asm/cpu.h> |
28 | #include <asm/reboot.h> | 28 | #include <asm/reboot.h> |
29 | #include <asm/virtext.h> | 29 | #include <asm/virtext.h> |
30 | #include <asm/iommu.h> | 30 | #include <asm/x86_init.h> |
31 | |||
32 | 31 | ||
33 | #if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC) | 32 | #if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC) |
34 | 33 | ||
@@ -106,7 +105,7 @@ void native_machine_crash_shutdown(struct pt_regs *regs) | |||
106 | #endif | 105 | #endif |
107 | 106 | ||
108 | #ifdef CONFIG_X86_64 | 107 | #ifdef CONFIG_X86_64 |
109 | pci_iommu_shutdown(); | 108 | x86_platform.iommu_shutdown(); |
110 | #endif | 109 | #endif |
111 | 110 | ||
112 | crash_save_cpu(regs, safe_smp_processor_id()); | 111 | crash_save_cpu(regs, safe_smp_processor_id()); |
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c index b2a71dca5642..ce2fb91bbed1 100644 --- a/arch/x86/kernel/pci-dma.c +++ b/arch/x86/kernel/pci-dma.c | |||
@@ -303,13 +303,6 @@ static int __init pci_iommu_init(void) | |||
303 | no_iommu_init(); | 303 | no_iommu_init(); |
304 | return 0; | 304 | return 0; |
305 | } | 305 | } |
306 | |||
307 | void pci_iommu_shutdown(void) | ||
308 | { | ||
309 | gart_iommu_shutdown(); | ||
310 | |||
311 | amd_iommu_shutdown(); | ||
312 | } | ||
313 | /* Must execute after PCI subsystem */ | 306 | /* Must execute after PCI subsystem */ |
314 | rootfs_initcall(pci_iommu_init); | 307 | rootfs_initcall(pci_iommu_init); |
315 | 308 | ||
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c index a7f1b64f86e0..a9bcdf7c8801 100644 --- a/arch/x86/kernel/pci-gart_64.c +++ b/arch/x86/kernel/pci-gart_64.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <asm/swiotlb.h> | 39 | #include <asm/swiotlb.h> |
40 | #include <asm/dma.h> | 40 | #include <asm/dma.h> |
41 | #include <asm/k8.h> | 41 | #include <asm/k8.h> |
42 | #include <asm/x86_init.h> | ||
42 | 43 | ||
43 | static unsigned long iommu_bus_base; /* GART remapping area (physical) */ | 44 | static unsigned long iommu_bus_base; /* GART remapping area (physical) */ |
44 | static unsigned long iommu_size; /* size of remapping area bytes */ | 45 | static unsigned long iommu_size; /* size of remapping area bytes */ |
@@ -688,12 +689,12 @@ static struct dma_map_ops gart_dma_ops = { | |||
688 | .free_coherent = gart_free_coherent, | 689 | .free_coherent = gart_free_coherent, |
689 | }; | 690 | }; |
690 | 691 | ||
691 | void gart_iommu_shutdown(void) | 692 | static void gart_iommu_shutdown(void) |
692 | { | 693 | { |
693 | struct pci_dev *dev; | 694 | struct pci_dev *dev; |
694 | int i; | 695 | int i; |
695 | 696 | ||
696 | if (no_agp && (dma_ops != &gart_dma_ops)) | 697 | if (no_agp) |
697 | return; | 698 | return; |
698 | 699 | ||
699 | for (i = 0; i < num_k8_northbridges; i++) { | 700 | for (i = 0; i < num_k8_northbridges; i++) { |
@@ -838,6 +839,7 @@ void __init gart_iommu_init(void) | |||
838 | 839 | ||
839 | flush_gart(); | 840 | flush_gart(); |
840 | dma_ops = &gart_dma_ops; | 841 | dma_ops = &gart_dma_ops; |
842 | x86_platform.iommu_shutdown = gart_iommu_shutdown; | ||
841 | } | 843 | } |
842 | 844 | ||
843 | void __init gart_parse_options(char *p) | 845 | void __init gart_parse_options(char *p) |
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index f93078746e00..2b97fc5b124e 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c | |||
@@ -23,7 +23,7 @@ | |||
23 | # include <linux/ctype.h> | 23 | # include <linux/ctype.h> |
24 | # include <linux/mc146818rtc.h> | 24 | # include <linux/mc146818rtc.h> |
25 | #else | 25 | #else |
26 | # include <asm/iommu.h> | 26 | # include <asm/x86_init.h> |
27 | #endif | 27 | #endif |
28 | 28 | ||
29 | /* | 29 | /* |
@@ -622,7 +622,7 @@ void native_machine_shutdown(void) | |||
622 | #endif | 622 | #endif |
623 | 623 | ||
624 | #ifdef CONFIG_X86_64 | 624 | #ifdef CONFIG_X86_64 |
625 | pci_iommu_shutdown(); | 625 | x86_platform.iommu_shutdown(); |
626 | #endif | 626 | #endif |
627 | } | 627 | } |
628 | 628 | ||
diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c index 4449a4a2c2ed..bc9b230ef402 100644 --- a/arch/x86/kernel/x86_init.c +++ b/arch/x86/kernel/x86_init.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <asm/time.h> | 14 | #include <asm/time.h> |
15 | #include <asm/irq.h> | 15 | #include <asm/irq.h> |
16 | #include <asm/tsc.h> | 16 | #include <asm/tsc.h> |
17 | #include <asm/iommu.h> | ||
17 | 18 | ||
18 | void __cpuinit x86_init_noop(void) { } | 19 | void __cpuinit x86_init_noop(void) { } |
19 | void __init x86_init_uint_noop(unsigned int unused) { } | 20 | void __init x86_init_uint_noop(unsigned int unused) { } |
@@ -72,4 +73,5 @@ struct x86_platform_ops x86_platform = { | |||
72 | .calibrate_tsc = native_calibrate_tsc, | 73 | .calibrate_tsc = native_calibrate_tsc, |
73 | .get_wallclock = mach_get_cmos_time, | 74 | .get_wallclock = mach_get_cmos_time, |
74 | .set_wallclock = mach_set_rtc_mmss, | 75 | .set_wallclock = mach_set_rtc_mmss, |
76 | .iommu_shutdown = iommu_shutdown_noop, | ||
75 | }; | 77 | }; |