diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-01-30 21:36:17 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-02-05 16:27:54 -0500 |
commit | 65a4e574d2382d83f71b30ea92f86d2e40a6ef8d (patch) | |
tree | d265ad2f64a3ae35ee3a9ad43b8c55b0e87f6c99 | |
parent | d8106d2e24d54497233ca9cd97fa9bec807de458 (diff) |
smp, generic: introduce arch_disable_smp_support() instead of disable_ioapic_setup()
Impact: cleanup
disable_ioapic_setup() in init/main.c is ugly as the function is
x86-specific. The #ifdef inline prototype there is ugly too.
Replace it with a generic arch_disable_smp_support() function - which
has a weak alias for non-x86 architectures and for non-ioapic x86 builds.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | arch/x86/include/asm/io_apic.h | 9 | ||||
-rw-r--r-- | arch/x86/kernel/apic.c | 4 | ||||
-rw-r--r-- | arch/x86/kernel/io_apic.c | 11 | ||||
-rw-r--r-- | arch/x86/kernel/smpboot.c | 2 | ||||
-rw-r--r-- | include/linux/smp.h | 6 | ||||
-rw-r--r-- | init/main.c | 12 |
6 files changed, 24 insertions, 20 deletions
diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h index 08ec793aa04..309d0e23193 100644 --- a/arch/x86/include/asm/io_apic.h +++ b/arch/x86/include/asm/io_apic.h | |||
@@ -143,15 +143,6 @@ extern int noioapicreroute; | |||
143 | /* 1 if the timer IRQ uses the '8259A Virtual Wire' mode */ | 143 | /* 1 if the timer IRQ uses the '8259A Virtual Wire' mode */ |
144 | extern int timer_through_8259; | 144 | extern int timer_through_8259; |
145 | 145 | ||
146 | static inline void disable_ioapic_setup(void) | ||
147 | { | ||
148 | #ifdef CONFIG_PCI | ||
149 | noioapicquirk = 1; | ||
150 | noioapicreroute = -1; | ||
151 | #endif | ||
152 | skip_ioapic_setup = 1; | ||
153 | } | ||
154 | |||
155 | /* | 146 | /* |
156 | * If we use the IO-APIC for IRQ routing, disable automatic | 147 | * If we use the IO-APIC for IRQ routing, disable automatic |
157 | * assignment of PCI IRQ's. | 148 | * assignment of PCI IRQ's. |
diff --git a/arch/x86/kernel/apic.c b/arch/x86/kernel/apic.c index 85d8b50d1af..a04a73a51d2 100644 --- a/arch/x86/kernel/apic.c +++ b/arch/x86/kernel/apic.c | |||
@@ -1138,9 +1138,7 @@ void __cpuinit setup_local_APIC(void) | |||
1138 | int i, j; | 1138 | int i, j; |
1139 | 1139 | ||
1140 | if (disable_apic) { | 1140 | if (disable_apic) { |
1141 | #ifdef CONFIG_X86_IO_APIC | 1141 | arch_disable_smp_support(); |
1142 | disable_ioapic_setup(); | ||
1143 | #endif | ||
1144 | return; | 1142 | return; |
1145 | } | 1143 | } |
1146 | 1144 | ||
diff --git a/arch/x86/kernel/io_apic.c b/arch/x86/kernel/io_apic.c index 57d60c741e3..84bccac4619 100644 --- a/arch/x86/kernel/io_apic.c +++ b/arch/x86/kernel/io_apic.c | |||
@@ -98,10 +98,19 @@ DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES); | |||
98 | 98 | ||
99 | int skip_ioapic_setup; | 99 | int skip_ioapic_setup; |
100 | 100 | ||
101 | void arch_disable_smp_support(void) | ||
102 | { | ||
103 | #ifdef CONFIG_PCI | ||
104 | noioapicquirk = 1; | ||
105 | noioapicreroute = -1; | ||
106 | #endif | ||
107 | skip_ioapic_setup = 1; | ||
108 | } | ||
109 | |||
101 | static int __init parse_noapic(char *str) | 110 | static int __init parse_noapic(char *str) |
102 | { | 111 | { |
103 | /* disable IO-APIC */ | 112 | /* disable IO-APIC */ |
104 | disable_ioapic_setup(); | 113 | arch_disable_smp_support(); |
105 | return 0; | 114 | return 0; |
106 | } | 115 | } |
107 | early_param("noapic", parse_noapic); | 116 | early_param("noapic", parse_noapic); |
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index f40f86fec2f..96f7d304f5c 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -1071,7 +1071,7 @@ static int __init smp_sanity_check(unsigned max_cpus) | |||
1071 | printk(KERN_ERR "... forcing use of dummy APIC emulation." | 1071 | printk(KERN_ERR "... forcing use of dummy APIC emulation." |
1072 | "(tell your hw vendor)\n"); | 1072 | "(tell your hw vendor)\n"); |
1073 | smpboot_clear_io_apic(); | 1073 | smpboot_clear_io_apic(); |
1074 | disable_ioapic_setup(); | 1074 | arch_disable_smp_support(); |
1075 | return -1; | 1075 | return -1; |
1076 | } | 1076 | } |
1077 | 1077 | ||
diff --git a/include/linux/smp.h b/include/linux/smp.h index 715196b09d6..d41a3a865fe 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h | |||
@@ -67,6 +67,12 @@ extern int __cpu_up(unsigned int cpunum); | |||
67 | extern void smp_cpus_done(unsigned int max_cpus); | 67 | extern void smp_cpus_done(unsigned int max_cpus); |
68 | 68 | ||
69 | /* | 69 | /* |
70 | * Callback to arch code if there's nosmp or maxcpus=0 on the | ||
71 | * boot command line: | ||
72 | */ | ||
73 | extern void arch_disable_smp_support(void); | ||
74 | |||
75 | /* | ||
70 | * Call a function on all other processors | 76 | * Call a function on all other processors |
71 | */ | 77 | */ |
72 | int smp_call_function(void(*func)(void *info), void *info, int wait); | 78 | int smp_call_function(void(*func)(void *info), void *info, int wait); |
diff --git a/init/main.c b/init/main.c index bfe4fb0c984..6441083f827 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -136,14 +136,14 @@ unsigned int __initdata setup_max_cpus = NR_CPUS; | |||
136 | * greater than 0, limits the maximum number of CPUs activated in | 136 | * greater than 0, limits the maximum number of CPUs activated in |
137 | * SMP mode to <NUM>. | 137 | * SMP mode to <NUM>. |
138 | */ | 138 | */ |
139 | #ifndef CONFIG_X86_IO_APIC | 139 | |
140 | static inline void disable_ioapic_setup(void) {}; | 140 | void __weak arch_disable_smp_support(void) { } |
141 | #endif | ||
142 | 141 | ||
143 | static int __init nosmp(char *str) | 142 | static int __init nosmp(char *str) |
144 | { | 143 | { |
145 | setup_max_cpus = 0; | 144 | setup_max_cpus = 0; |
146 | disable_ioapic_setup(); | 145 | arch_disable_smp_support(); |
146 | |||
147 | return 0; | 147 | return 0; |
148 | } | 148 | } |
149 | 149 | ||
@@ -153,14 +153,14 @@ static int __init maxcpus(char *str) | |||
153 | { | 153 | { |
154 | get_option(&str, &setup_max_cpus); | 154 | get_option(&str, &setup_max_cpus); |
155 | if (setup_max_cpus == 0) | 155 | if (setup_max_cpus == 0) |
156 | disable_ioapic_setup(); | 156 | arch_disable_smp_support(); |
157 | 157 | ||
158 | return 0; | 158 | return 0; |
159 | } | 159 | } |
160 | 160 | ||
161 | early_param("maxcpus", maxcpus); | 161 | early_param("maxcpus", maxcpus); |
162 | #else | 162 | #else |
163 | #define setup_max_cpus NR_CPUS | 163 | const unsigned int setup_max_cpus = NR_CPUS; |
164 | #endif | 164 | #endif |
165 | 165 | ||
166 | /* | 166 | /* |