diff options
author | Suresh Siddha <suresh.b.siddha@intel.com> | 2011-05-19 19:45:46 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-05-20 07:41:04 -0400 |
commit | 9ebd680bd029a9fc47399ca61c950f8b6730ac40 (patch) | |
tree | 41b5c8ae4a13b51536ead20f6e4b4b380748072a /arch/x86/kernel/apic | |
parent | 8f18c9711ed31c257d4f00a094b2fdbe72a741da (diff) |
x86, apic: Use probe routines to simplify apic selection
Use the unused probe routine in the apic driver to finalize the
apic model selection. This cleans up the
default_setup_apic_routing() and this probe routine in future
can also be used for doing any apic model specific
initialisation.
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: steiner@sgi.com
Cc: yinghai@kernel.org
Link: http://lkml.kernel.org/r/20110519234637.247458931@sbsiddha-MOBL3.sc.intel.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/apic')
-rw-r--r-- | arch/x86/kernel/apic/apic_flat_64.c | 10 | ||||
-rw-r--r-- | arch/x86/kernel/apic/probe_64.c | 22 | ||||
-rw-r--r-- | arch/x86/kernel/apic/x2apic_cluster.c | 7 | ||||
-rw-r--r-- | arch/x86/kernel/apic/x2apic_phys.c | 10 | ||||
-rw-r--r-- | arch/x86/kernel/apic/x2apic_uv_x.c | 7 |
5 files changed, 37 insertions, 19 deletions
diff --git a/arch/x86/kernel/apic/apic_flat_64.c b/arch/x86/kernel/apic/apic_flat_64.c index 5652d31fe108..025921f03eb3 100644 --- a/arch/x86/kernel/apic/apic_flat_64.c +++ b/arch/x86/kernel/apic/apic_flat_64.c | |||
@@ -312,10 +312,18 @@ physflat_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | |||
312 | return per_cpu(x86_cpu_to_apicid, cpu); | 312 | return per_cpu(x86_cpu_to_apicid, cpu); |
313 | } | 313 | } |
314 | 314 | ||
315 | static int physflat_probe(void) | ||
316 | { | ||
317 | if (apic == &apic_physflat || num_possible_cpus() > 8) | ||
318 | return 1; | ||
319 | |||
320 | return 0; | ||
321 | } | ||
322 | |||
315 | struct apic apic_physflat = { | 323 | struct apic apic_physflat = { |
316 | 324 | ||
317 | .name = "physical flat", | 325 | .name = "physical flat", |
318 | .probe = NULL, | 326 | .probe = physflat_probe, |
319 | .acpi_madt_oem_check = physflat_acpi_madt_oem_check, | 327 | .acpi_madt_oem_check = physflat_acpi_madt_oem_check, |
320 | .apic_id_registered = flat_apic_id_registered, | 328 | .apic_id_registered = flat_apic_id_registered, |
321 | 329 | ||
diff --git a/arch/x86/kernel/apic/probe_64.c b/arch/x86/kernel/apic/probe_64.c index d8c4a6feb286..39fb42b51f6a 100644 --- a/arch/x86/kernel/apic/probe_64.c +++ b/arch/x86/kernel/apic/probe_64.c | |||
@@ -54,26 +54,18 @@ static int apicid_phys_pkg_id(int initial_apic_id, int index_msb) | |||
54 | */ | 54 | */ |
55 | void __init default_setup_apic_routing(void) | 55 | void __init default_setup_apic_routing(void) |
56 | { | 56 | { |
57 | int i; | ||
57 | 58 | ||
58 | enable_IR_x2apic(); | 59 | enable_IR_x2apic(); |
59 | 60 | ||
60 | #ifdef CONFIG_X86_X2APIC | 61 | for (i = 0; apic_probe[i]; ++i) { |
61 | if (x2apic_mode | 62 | if (apic_probe[i]->probe()) { |
62 | #ifdef CONFIG_X86_UV | 63 | apic = apic_probe[i]; |
63 | && apic != &apic_x2apic_uv_x | 64 | break; |
64 | #endif | 65 | } |
65 | ) { | ||
66 | if (x2apic_phys) | ||
67 | apic = &apic_x2apic_phys; | ||
68 | else | ||
69 | apic = &apic_x2apic_cluster; | ||
70 | } | 66 | } |
71 | #endif | ||
72 | |||
73 | if (apic == &apic_flat && num_possible_cpus() > 8) | ||
74 | apic = &apic_physflat; | ||
75 | 67 | ||
76 | printk(KERN_INFO "Setting APIC routing to %s\n", apic->name); | 68 | printk(KERN_INFO "APIC routing finalized to %s.\n", apic->name); |
77 | 69 | ||
78 | if (is_vsmp_box()) { | 70 | if (is_vsmp_box()) { |
79 | /* need to update phys_pkg_id */ | 71 | /* need to update phys_pkg_id */ |
diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c index 90949bbd566d..2967bab775e5 100644 --- a/arch/x86/kernel/apic/x2apic_cluster.c +++ b/arch/x86/kernel/apic/x2apic_cluster.c | |||
@@ -184,10 +184,15 @@ static void init_x2apic_ldr(void) | |||
184 | per_cpu(x86_cpu_to_logical_apicid, cpu) = apic_read(APIC_LDR); | 184 | per_cpu(x86_cpu_to_logical_apicid, cpu) = apic_read(APIC_LDR); |
185 | } | 185 | } |
186 | 186 | ||
187 | static int x2apic_cluster_probe(void) | ||
188 | { | ||
189 | return x2apic_mode; | ||
190 | } | ||
191 | |||
187 | struct apic apic_x2apic_cluster = { | 192 | struct apic apic_x2apic_cluster = { |
188 | 193 | ||
189 | .name = "cluster x2apic", | 194 | .name = "cluster x2apic", |
190 | .probe = NULL, | 195 | .probe = x2apic_cluster_probe, |
191 | .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, | 196 | .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, |
192 | .apic_id_registered = x2apic_apic_id_registered, | 197 | .apic_id_registered = x2apic_apic_id_registered, |
193 | 198 | ||
diff --git a/arch/x86/kernel/apic/x2apic_phys.c b/arch/x86/kernel/apic/x2apic_phys.c index c7e6d6645bf4..8f21771249f6 100644 --- a/arch/x86/kernel/apic/x2apic_phys.c +++ b/arch/x86/kernel/apic/x2apic_phys.c | |||
@@ -173,10 +173,18 @@ static void init_x2apic_ldr(void) | |||
173 | { | 173 | { |
174 | } | 174 | } |
175 | 175 | ||
176 | static int x2apic_phys_probe(void) | ||
177 | { | ||
178 | if (x2apic_mode && x2apic_phys) | ||
179 | return 1; | ||
180 | |||
181 | return apic == &apic_x2apic_phys; | ||
182 | } | ||
183 | |||
176 | struct apic apic_x2apic_phys = { | 184 | struct apic apic_x2apic_phys = { |
177 | 185 | ||
178 | .name = "physical x2apic", | 186 | .name = "physical x2apic", |
179 | .probe = NULL, | 187 | .probe = x2apic_phys_probe, |
180 | .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, | 188 | .acpi_madt_oem_check = x2apic_acpi_madt_oem_check, |
181 | .apic_id_registered = x2apic_apic_id_registered, | 189 | .apic_id_registered = x2apic_apic_id_registered, |
182 | 190 | ||
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c index 7acd2d2ac965..6bb80b1c8a7a 100644 --- a/arch/x86/kernel/apic/x2apic_uv_x.c +++ b/arch/x86/kernel/apic/x2apic_uv_x.c | |||
@@ -326,10 +326,15 @@ static void uv_send_IPI_self(int vector) | |||
326 | apic_write(APIC_SELF_IPI, vector); | 326 | apic_write(APIC_SELF_IPI, vector); |
327 | } | 327 | } |
328 | 328 | ||
329 | static int uv_probe(void) | ||
330 | { | ||
331 | return apic == &apic_x2apic_uv_x; | ||
332 | } | ||
333 | |||
329 | struct apic __refdata apic_x2apic_uv_x = { | 334 | struct apic __refdata apic_x2apic_uv_x = { |
330 | 335 | ||
331 | .name = "UV large system", | 336 | .name = "UV large system", |
332 | .probe = NULL, | 337 | .probe = uv_probe, |
333 | .acpi_madt_oem_check = uv_acpi_madt_oem_check, | 338 | .acpi_madt_oem_check = uv_acpi_madt_oem_check, |
334 | .apic_id_registered = uv_apic_id_registered, | 339 | .apic_id_registered = uv_apic_id_registered, |
335 | 340 | ||