]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
x86/platform: Move APIC ID validity check into platform APIC code
authorDaniel J Blueman <daniel@numascale-asia.com>
Wed, 14 Mar 2012 07:17:34 +0000 (15:17 +0800)
committerIngo Molnar <mingo@elte.hu>
Wed, 14 Mar 2012 08:49:48 +0000 (09:49 +0100)
Move APIC ID validity check into platform APIC code, so it can
be overridden when needed. For NumaChip systems, always trust
MADT, as it's constructed with high APIC IDs.

Behaviour verifies on standard x86 systems and on NumaChip
systems with this, and compile-tested with allyesconfig.

Signed-off-by: Daniel J Blueman <daniel@numascale-asia.com>
Reviewed-by: Steffen Persvold <sp@numascale.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: H. Peter Anvin <hpa@linux.intel.com>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>
Link: http://lkml.kernel.org/r/1331709454-27966-1-git-send-email-daniel@numascale-asia.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
13 files changed:
arch/x86/include/asm/apic.h
arch/x86/kernel/apic/apic_flat_64.c
arch/x86/kernel/apic/apic_noop.c
arch/x86/kernel/apic/apic_numachip.c
arch/x86/kernel/apic/bigsmp_32.c
arch/x86/kernel/apic/es7000_32.c
arch/x86/kernel/apic/numaq_32.c
arch/x86/kernel/apic/probe_32.c
arch/x86/kernel/apic/summit_32.c
arch/x86/kernel/apic/x2apic_cluster.c
arch/x86/kernel/apic/x2apic_phys.c
arch/x86/kernel/apic/x2apic_uv_x.c
arch/x86/kernel/smpboot.c

index 3ab9bdd87e79969c8a56b2811dd0deb761d8ca7a..a9371c91718c6a29e9845d12932a6c5239ab6870 100644 (file)
@@ -288,6 +288,7 @@ struct apic {
 
        int (*probe)(void);
        int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id);
+       int (*apic_id_valid)(int apicid);
        int (*apic_id_registered)(void);
 
        u32 irq_delivery_mode;
@@ -532,6 +533,11 @@ static inline unsigned int read_apic_id(void)
        return apic->get_apic_id(reg);
 }
 
+static inline int default_apic_id_valid(int apicid)
+{
+       return x2apic_mode || (apicid < 255);
+}
+
 extern void default_setup_apic_routing(void);
 
 extern struct apic apic_noop;
index 8c3cdded6f2b3704d14f27bfe00a1f5b4e535e9b..359b6899a36cb3653fc2f6b263000caa3d6df9af 100644 (file)
@@ -180,6 +180,7 @@ static struct apic apic_flat =  {
        .name                           = "flat",
        .probe                          = flat_probe,
        .acpi_madt_oem_check            = flat_acpi_madt_oem_check,
+       .apic_id_valid                  = default_apic_id_valid,
        .apic_id_registered             = flat_apic_id_registered,
 
        .irq_delivery_mode              = dest_LowestPrio,
@@ -337,6 +338,7 @@ static struct apic apic_physflat =  {
        .name                           = "physical flat",
        .probe                          = physflat_probe,
        .acpi_madt_oem_check            = physflat_acpi_madt_oem_check,
+       .apic_id_valid                  = default_apic_id_valid,
        .apic_id_registered             = flat_apic_id_registered,
 
        .irq_delivery_mode              = dest_Fixed,
index 775b82bc655cbe49ba16afdc6aa03cdd0395990c..634ae6cdd5c909a39f13fa8417710f0a29a7e125 100644 (file)
@@ -124,6 +124,7 @@ struct apic apic_noop = {
        .probe                          = noop_probe,
        .acpi_madt_oem_check            = NULL,
 
+       .apic_id_valid                  = default_apic_id_valid,
        .apic_id_registered             = noop_apic_id_registered,
 
        .irq_delivery_mode              = dest_LowestPrio,
index 09d3d8c1cd996d4fec3b13cbdd3a41dbdabd1856..d9ea5f331ac5930d02dfb8c48905c468aa0330fc 100644 (file)
@@ -56,6 +56,12 @@ static unsigned int read_xapic_id(void)
        return get_apic_id(apic_read(APIC_ID));
 }
 
+static int numachip_apic_id_valid(int apicid)
+{
+       /* Trust what bootloader passes in MADT */
+       return 1;
+}
+
 static int numachip_apic_id_registered(void)
 {
        return physid_isset(read_xapic_id(), phys_cpu_present_map);
@@ -223,10 +229,11 @@ static int __init numachip_system_init(void)
 }
 early_initcall(numachip_system_init);
 
-static int numachip_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
+static int __cpuinit numachip_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
 {
        if (!strncmp(oem_id, "NUMASC", 6)) {
                numachip_system = 1;
+               setup_force_cpu_cap(X86_FEATURE_X2APIC);
                return 1;
        }
 
@@ -238,6 +245,7 @@ static struct apic apic_numachip __refconst = {
        .name                           = "NumaConnect system",
        .probe                          = numachip_probe,
        .acpi_madt_oem_check            = numachip_acpi_madt_oem_check,
+       .apic_id_valid                  = numachip_apic_id_valid,
        .apic_id_registered             = numachip_apic_id_registered,
 
        .irq_delivery_mode              = dest_Fixed,
index 521bead01137f2921fc53473e7bdcebcd31ce61e..0cdec7065aff7d226923f74bfc5e2819db7f750a 100644 (file)
@@ -198,6 +198,7 @@ static struct apic apic_bigsmp = {
        .name                           = "bigsmp",
        .probe                          = probe_bigsmp,
        .acpi_madt_oem_check            = NULL,
+       .apic_id_valid                  = default_apic_id_valid,
        .apic_id_registered             = bigsmp_apic_id_registered,
 
        .irq_delivery_mode              = dest_Fixed,
index 5d513bc47b6ba519e322035b28948e038de3b829..e42d1d3b9134b3fa51c037108ae1411253a58a2f 100644 (file)
@@ -625,6 +625,7 @@ static struct apic __refdata apic_es7000_cluster = {
        .name                           = "es7000",
        .probe                          = probe_es7000,
        .acpi_madt_oem_check            = es7000_acpi_madt_oem_check_cluster,
+       .apic_id_valid                  = default_apic_id_valid,
        .apic_id_registered             = es7000_apic_id_registered,
 
        .irq_delivery_mode              = dest_LowestPrio,
@@ -690,6 +691,7 @@ static struct apic __refdata apic_es7000 = {
        .name                           = "es7000",
        .probe                          = probe_es7000,
        .acpi_madt_oem_check            = es7000_acpi_madt_oem_check,
+       .apic_id_valid                  = default_apic_id_valid,
        .apic_id_registered             = es7000_apic_id_registered,
 
        .irq_delivery_mode              = dest_Fixed,
index c4a61ca1349a5ce4b1e00d8bbcb326e7bd1203e2..00d2422ca7c9d9193432493c08e10f80fd7e470f 100644 (file)
@@ -478,6 +478,7 @@ static struct apic __refdata apic_numaq = {
        .name                           = "NUMAQ",
        .probe                          = probe_numaq,
        .acpi_madt_oem_check            = NULL,
+       .apic_id_valid                  = default_apic_id_valid,
        .apic_id_registered             = numaq_apic_id_registered,
 
        .irq_delivery_mode              = dest_LowestPrio,
index 0787bb3412f4fe98d55479c813c792705043dbe2..ff2c1b9aac4d3257fff390b7ce40cd80f7390a2a 100644 (file)
@@ -92,6 +92,7 @@ static struct apic apic_default = {
        .name                           = "default",
        .probe                          = probe_default,
        .acpi_madt_oem_check            = NULL,
+       .apic_id_valid                  = default_apic_id_valid,
        .apic_id_registered             = default_apic_id_registered,
 
        .irq_delivery_mode              = dest_LowestPrio,
index 19114423c58ccee6ba19d5b033c072013e51903d..fea000b27f07afd4cc90b533b5388d01161b5234 100644 (file)
@@ -496,6 +496,7 @@ static struct apic apic_summit = {
        .name                           = "summit",
        .probe                          = probe_summit,
        .acpi_madt_oem_check            = summit_acpi_madt_oem_check,
+       .apic_id_valid                  = default_apic_id_valid,
        .apic_id_registered             = summit_apic_id_registered,
 
        .irq_delivery_mode              = dest_LowestPrio,
index 5007958758273fab8e8fbe32d5de364e495ed286..9193713060a921bcf820a8cd6fedb84d77be7664 100644 (file)
@@ -213,6 +213,7 @@ static struct apic apic_x2apic_cluster = {
        .name                           = "cluster x2apic",
        .probe                          = x2apic_cluster_probe,
        .acpi_madt_oem_check            = x2apic_acpi_madt_oem_check,
+       .apic_id_valid                  = default_apic_id_valid,
        .apic_id_registered             = x2apic_apic_id_registered,
 
        .irq_delivery_mode              = dest_LowestPrio,
index f5373dfde21e277cfd033a11dd8c7bcad306c407..bcd1db6eaca9a6a4aeb5b44f6b0f7a566d985dae 100644 (file)
@@ -119,6 +119,7 @@ static struct apic apic_x2apic_phys = {
        .name                           = "physical x2apic",
        .probe                          = x2apic_phys_probe,
        .acpi_madt_oem_check            = x2apic_acpi_madt_oem_check,
+       .apic_id_valid                  = default_apic_id_valid,
        .apic_id_registered             = x2apic_apic_id_registered,
 
        .irq_delivery_mode              = dest_Fixed,
index 79b05b88aa193900ceead712dd2f36e3c6e25c9c..fc47714258524ddce82163eaf11aef32189a6f84 100644 (file)
@@ -351,6 +351,7 @@ static struct apic __refdata apic_x2apic_uv_x = {
        .name                           = "UV large system",
        .probe                          = uv_probe,
        .acpi_madt_oem_check            = uv_acpi_madt_oem_check,
+       .apic_id_valid                  = default_apic_id_valid,
        .apic_id_registered             = uv_apic_id_registered,
 
        .irq_delivery_mode              = dest_Fixed,
index 66d250c00d115bbaae4c7ab0917ce9c0dfe89643..d279e6e1d1b7aeafc66ac0241866708f3bf4cd4a 100644 (file)
@@ -847,7 +847,7 @@ int __cpuinit native_cpu_up(unsigned int cpu)
 
        if (apicid == BAD_APICID || apicid == boot_cpu_physical_apicid ||
            !physid_isset(apicid, phys_cpu_present_map) ||
-           (!x2apic_mode && apicid >= 255)) {
+           !apic->apic_id_valid(apicid)) {
                printk(KERN_ERR "%s: bad cpu %d\n", __func__, cpu);
                return -EINVAL;
        }