]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
x86, apic: Use probe routines to simplify apic selection
authorSuresh Siddha <suresh.b.siddha@intel.com>
Thu, 19 May 2011 23:45:46 +0000 (16:45 -0700)
committerIngo Molnar <mingo@elte.hu>
Fri, 20 May 2011 11:41:04 +0000 (13:41 +0200)
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>
arch/x86/kernel/apic/apic_flat_64.c
arch/x86/kernel/apic/probe_64.c
arch/x86/kernel/apic/x2apic_cluster.c
arch/x86/kernel/apic/x2apic_phys.c
arch/x86/kernel/apic/x2apic_uv_x.c

index 5652d31fe108a74206c71af583b79c11d4891777..025921f03eb37d331f72d87513a69b4e595a0a34 100644 (file)
@@ -312,10 +312,18 @@ physflat_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
        return per_cpu(x86_cpu_to_apicid, cpu);
 }
 
+static int physflat_probe(void)
+{
+       if (apic == &apic_physflat || num_possible_cpus() > 8)
+               return 1;
+
+       return 0;
+}
+
 struct apic apic_physflat =  {
 
        .name                           = "physical flat",
-       .probe                          = NULL,
+       .probe                          = physflat_probe,
        .acpi_madt_oem_check            = physflat_acpi_madt_oem_check,
        .apic_id_registered             = flat_apic_id_registered,
 
index d8c4a6feb2862f3a967f7eb4dcc4f503f2dac2f8..39fb42b51f6a9cf6e07ef973ac98b5d098ee21ea 100644 (file)
@@ -54,26 +54,18 @@ static int apicid_phys_pkg_id(int initial_apic_id, int index_msb)
  */
 void __init default_setup_apic_routing(void)
 {
+       int i;
 
        enable_IR_x2apic();
 
-#ifdef CONFIG_X86_X2APIC
-       if (x2apic_mode
-#ifdef CONFIG_X86_UV
-                      && apic != &apic_x2apic_uv_x
-#endif
-                      ) {
-               if (x2apic_phys)
-                       apic = &apic_x2apic_phys;
-               else
-                       apic = &apic_x2apic_cluster;
+       for (i = 0; apic_probe[i]; ++i) {
+               if (apic_probe[i]->probe()) {
+                       apic = apic_probe[i];
+                       break;
+               }
        }
-#endif
-
-       if (apic == &apic_flat && num_possible_cpus() > 8)
-                       apic = &apic_physflat;
 
-       printk(KERN_INFO "Setting APIC routing to %s\n", apic->name);
+       printk(KERN_INFO "APIC routing finalized to %s.\n", apic->name);
 
        if (is_vsmp_box()) {
                /* need to update phys_pkg_id */
index 90949bbd566df155e6596c975caa9cff6e2f8a63..2967bab775e55072ddb1a6ca7bf5580e57d7856e 100644 (file)
@@ -184,10 +184,15 @@ static void init_x2apic_ldr(void)
        per_cpu(x86_cpu_to_logical_apicid, cpu) = apic_read(APIC_LDR);
 }
 
+static int x2apic_cluster_probe(void)
+{
+       return x2apic_mode;
+}
+
 struct apic apic_x2apic_cluster = {
 
        .name                           = "cluster x2apic",
-       .probe                          = NULL,
+       .probe                          = x2apic_cluster_probe,
        .acpi_madt_oem_check            = x2apic_acpi_madt_oem_check,
        .apic_id_registered             = x2apic_apic_id_registered,
 
index c7e6d6645bf47f44df8d71419d120ad032b82275..8f21771249f635d89daf92afbc2da4d622e7f1e7 100644 (file)
@@ -173,10 +173,18 @@ static void init_x2apic_ldr(void)
 {
 }
 
+static int x2apic_phys_probe(void)
+{
+       if (x2apic_mode && x2apic_phys)
+               return 1;
+
+       return apic == &apic_x2apic_phys;
+}
+
 struct apic apic_x2apic_phys = {
 
        .name                           = "physical x2apic",
-       .probe                          = NULL,
+       .probe                          = x2apic_phys_probe,
        .acpi_madt_oem_check            = x2apic_acpi_madt_oem_check,
        .apic_id_registered             = x2apic_apic_id_registered,
 
index 7acd2d2ac965f9932f39986ab1fe23361c6de90e..6bb80b1c8a7acda8177266518daeefe13df633bd 100644 (file)
@@ -326,10 +326,15 @@ static void uv_send_IPI_self(int vector)
        apic_write(APIC_SELF_IPI, vector);
 }
 
+static int uv_probe(void)
+{
+       return apic == &apic_x2apic_uv_x;
+}
+
 struct apic __refdata apic_x2apic_uv_x = {
 
        .name                           = "UV large system",
-       .probe                          = NULL,
+       .probe                          = uv_probe,
        .acpi_madt_oem_check            = uv_acpi_madt_oem_check,
        .apic_id_registered             = uv_apic_id_registered,