diff options
author | Suresh Siddha <suresh.b.siddha@intel.com> | 2011-05-20 20:51:19 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-05-22 05:48:03 -0400 |
commit | 69c252ffce77f4e38347d536ee4eab4aa162dc67 (patch) | |
tree | 070307e0c400d5e4d98f07a8199cc5b62b42b4ce | |
parent | 8b37e88061e229e78959fe3257649fd5ce05f8af (diff) |
x86, apic: Clean up bigsmp apic selection code
Make generic_bigsmp_probe() return struct apic *. This will
avoid exporting apic_bigsmp, which will be consistent with
others.
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Tested-by: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: steiner@sgi.com
Cc: gorcunov@openvz.org
Cc: yinghai@kernel.org
Link: http://lkml.kernel.org/r/20110521005526.252703851@sbsiddha-MOBL3.sc.intel.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | arch/x86/include/asm/apic.h | 2 | ||||
-rw-r--r-- | arch/x86/kernel/apic/bigsmp_32.c | 8 | ||||
-rw-r--r-- | arch/x86/kernel/apic/probe_32.c | 52 |
3 files changed, 32 insertions, 30 deletions
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index 80b243c7f0f0..f37703dc69fe 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h | |||
@@ -500,7 +500,7 @@ static inline void default_wait_for_init_deassert(atomic_t *deassert) | |||
500 | return; | 500 | return; |
501 | } | 501 | } |
502 | 502 | ||
503 | extern void generic_bigsmp_probe(void); | 503 | extern struct apic *generic_bigsmp_probe(void); |
504 | 504 | ||
505 | 505 | ||
506 | #ifdef CONFIG_X86_LOCAL_APIC | 506 | #ifdef CONFIG_X86_LOCAL_APIC |
diff --git a/arch/x86/kernel/apic/bigsmp_32.c b/arch/x86/kernel/apic/bigsmp_32.c index cfb13c3e5451..479a06c233d0 100644 --- a/arch/x86/kernel/apic/bigsmp_32.c +++ b/arch/x86/kernel/apic/bigsmp_32.c | |||
@@ -255,4 +255,12 @@ struct apic apic_bigsmp = { | |||
255 | .x86_32_early_logical_apicid = bigsmp_early_logical_apicid, | 255 | .x86_32_early_logical_apicid = bigsmp_early_logical_apicid, |
256 | }; | 256 | }; |
257 | 257 | ||
258 | struct apic * __init generic_bigsmp_probe(void) | ||
259 | { | ||
260 | if (probe_bigsmp()) | ||
261 | return &apic_bigsmp; | ||
262 | |||
263 | return NULL; | ||
264 | } | ||
265 | |||
258 | apic_driver(apic_bigsmp); | 266 | apic_driver(apic_bigsmp); |
diff --git a/arch/x86/kernel/apic/probe_32.c b/arch/x86/kernel/apic/probe_32.c index 8796e1d25f0c..c81756d8d4ec 100644 --- a/arch/x86/kernel/apic/probe_32.c +++ b/arch/x86/kernel/apic/probe_32.c | |||
@@ -52,31 +52,6 @@ static int __init print_ipi_mode(void) | |||
52 | } | 52 | } |
53 | late_initcall(print_ipi_mode); | 53 | late_initcall(print_ipi_mode); |
54 | 54 | ||
55 | void __init default_setup_apic_routing(void) | ||
56 | { | ||
57 | int version = apic_version[boot_cpu_physical_apicid]; | ||
58 | |||
59 | if (num_possible_cpus() > 8) { | ||
60 | switch (boot_cpu_data.x86_vendor) { | ||
61 | case X86_VENDOR_INTEL: | ||
62 | if (!APIC_XAPIC(version)) { | ||
63 | def_to_bigsmp = 0; | ||
64 | break; | ||
65 | } | ||
66 | /* If P4 and above fall through */ | ||
67 | case X86_VENDOR_AMD: | ||
68 | def_to_bigsmp = 1; | ||
69 | } | ||
70 | } | ||
71 | |||
72 | #ifdef CONFIG_X86_BIGSMP | ||
73 | generic_bigsmp_probe(); | ||
74 | #endif | ||
75 | |||
76 | if (apic->setup_apic_routing) | ||
77 | apic->setup_apic_routing(); | ||
78 | } | ||
79 | |||
80 | static int default_x86_32_early_logical_apicid(int cpu) | 55 | static int default_x86_32_early_logical_apicid(int cpu) |
81 | { | 56 | { |
82 | return 1 << cpu; | 57 | return 1 << cpu; |
@@ -224,24 +199,43 @@ static int __init parse_apic(char *arg) | |||
224 | } | 199 | } |
225 | early_param("apic", parse_apic); | 200 | early_param("apic", parse_apic); |
226 | 201 | ||
227 | void __init generic_bigsmp_probe(void) | 202 | void __init default_setup_apic_routing(void) |
228 | { | 203 | { |
204 | int version = apic_version[boot_cpu_physical_apicid]; | ||
205 | |||
206 | if (num_possible_cpus() > 8) { | ||
207 | switch (boot_cpu_data.x86_vendor) { | ||
208 | case X86_VENDOR_INTEL: | ||
209 | if (!APIC_XAPIC(version)) { | ||
210 | def_to_bigsmp = 0; | ||
211 | break; | ||
212 | } | ||
213 | /* If P4 and above fall through */ | ||
214 | case X86_VENDOR_AMD: | ||
215 | def_to_bigsmp = 1; | ||
216 | } | ||
217 | } | ||
218 | |||
229 | #ifdef CONFIG_X86_BIGSMP | 219 | #ifdef CONFIG_X86_BIGSMP |
230 | /* | 220 | /* |
231 | * This routine is used to switch to bigsmp mode when | 221 | * This is used to switch to bigsmp mode when |
232 | * - There is no apic= option specified by the user | 222 | * - There is no apic= option specified by the user |
233 | * - generic_apic_probe() has chosen apic_default as the sub_arch | 223 | * - generic_apic_probe() has chosen apic_default as the sub_arch |
234 | * - we find more than 8 CPUs in acpi LAPIC listing with xAPIC support | 224 | * - we find more than 8 CPUs in acpi LAPIC listing with xAPIC support |
235 | */ | 225 | */ |
236 | 226 | ||
237 | if (!cmdline_apic && apic == &apic_default) { | 227 | if (!cmdline_apic && apic == &apic_default) { |
238 | if (apic_bigsmp.probe()) { | 228 | struct apic *bigsmp = generic_bigsmp_probe(); |
239 | apic = &apic_bigsmp; | 229 | if (bigsmp) { |
230 | apic = bigsmp; | ||
240 | printk(KERN_INFO "Overriding APIC driver with %s\n", | 231 | printk(KERN_INFO "Overriding APIC driver with %s\n", |
241 | apic->name); | 232 | apic->name); |
242 | } | 233 | } |
243 | } | 234 | } |
244 | #endif | 235 | #endif |
236 | |||
237 | if (apic->setup_apic_routing) | ||
238 | apic->setup_apic_routing(); | ||
245 | } | 239 | } |
246 | 240 | ||
247 | void __init generic_apic_probe(void) | 241 | void __init generic_apic_probe(void) |