[PATCH] x86: default to physical mode on hotplug CPU kernels
authorIngo Molnar <mingo@elte.hu>
Wed, 2 May 2007 17:27:04 +0000 (19:27 +0200)
committerAndi Kleen <andi@basil.nowhere.org>
Wed, 2 May 2007 17:27:04 +0000 (19:27 +0200)
Default to physical mode on hotplug CPU kernels.  Furher simplify and clean up
the APIC initialization code.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: Andi Kleen <ak@suse.de>
Cc: "Li, Shaohua" <shaohua.li@intel.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
13 files changed:
arch/i386/kernel/acpi/boot.c
arch/i386/kernel/mpparse.c
arch/x86_64/kernel/genapic.c
arch/x86_64/kernel/mpparse.c
include/asm-i386/genapic.h
include/asm-i386/mach-bigsmp/mach_apic.h
include/asm-i386/mach-default/mach_apic.h
include/asm-i386/mach-es7000/mach_apic.h
include/asm-i386/mach-generic/mach_apic.h
include/asm-i386/mach-numaq/mach_apic.h
include/asm-i386/mach-summit/mach_apic.h
include/asm-i386/mach-visws/mach_apic.h
include/asm-x86_64/apic.h

index 9ea5b8ecc7e1d61918da7043a15b55400c121735..280898b045b2a76f921b3867b9e415652378d4f7 100644 (file)
@@ -874,7 +874,7 @@ static void __init acpi_process_madt(void)
                                acpi_ioapic = 1;
 
                                smp_found_config = 1;
-                               clustered_apic_check();
+                               setup_apic_routing();
                        }
                }
                if (error == -EINVAL) {
index 4f5983c98669ad3ac42969c0fbc9b91ebd8e3472..0952eccd8f28feca563a8ce9eed1339f916cf245 100644 (file)
@@ -477,7 +477,7 @@ static int __init smp_read_mpc(struct mp_config_table *mpc)
                }
                ++mpc_record;
        }
-       clustered_apic_check();
+       setup_apic_routing();
        if (!num_processors)
                printk(KERN_ERR "SMP mptable: no processors registered!\n");
        return num_processors;
index 025f26ebb8d705d769b8a125ecbb7eb83d458c9b..c08650a427e2e5f2fb849b08b758b64c997960a8 100644 (file)
@@ -35,11 +35,8 @@ struct genapic __read_mostly *genapic = &apic_flat;
 /*
  * Check the APIC IDs in bios_cpu_apicid and choose the APIC mode.
  */
-void __init clustered_apic_check(void)
+void __init setup_apic_routing(void)
 {
-       unsigned int i, max_apic = 0;
-       u8 id;
-
 #ifdef CONFIG_ACPI
        /*
         * Quirk: some x86_64 machines can only use physical APIC mode
@@ -49,17 +46,10 @@ void __init clustered_apic_check(void)
        if (acpi_gbl_FADT.header.revision > FADT2_REVISION_ID &&
                        (acpi_gbl_FADT.flags & ACPI_FADT_APIC_PHYSICAL))
                genapic = &apic_physflat;
+       else
 #endif
 
-       for (i = 0; i < NR_CPUS; i++) {
-               id = bios_cpu_apicid[i];
-               if (id == BAD_APICID)
-                       continue;
-               if (id > max_apic)
-                       max_apic = id;
-       }
-
-       if (max_apic < 8)
+       if (cpus_weight(cpu_possible_map) <= 8)
                genapic = &apic_flat;
        else
                genapic = &apic_physflat;
index 455aa0b932f0fd05b5b98908daef2b8cca674d44..d0dc4891599b8e6e0d25501f6abb7ab9de065120 100644 (file)
@@ -300,7 +300,7 @@ static int __init smp_read_mpc(struct mp_config_table *mpc)
                        }
                }
        }
-       clustered_apic_check();
+       setup_apic_routing();
        if (!num_processors)
                printk(KERN_ERR "MPTABLE: no processors registered!\n");
        return num_processors;
index 8ffbb0f0745760f7747d850faf89d884c4cd93eb..33e3ffe1766ccc4fc493d7c0ee623c7e66dd0ef7 100644 (file)
@@ -36,7 +36,7 @@ struct genapic {
        void (*init_apic_ldr)(void);
        physid_mask_t (*ioapic_phys_id_map)(physid_mask_t map);
 
-       void (*clustered_apic_check)(void);
+       void (*setup_apic_routing)(void);
        int (*multi_timer_check)(int apic, int irq);
        int (*apicid_to_node)(int logical_apicid); 
        int (*cpu_to_logical_apicid)(int cpu);
@@ -99,7 +99,7 @@ struct genapic {
        APICFUNC(check_apicid_present) \
        APICFUNC(init_apic_ldr) \
        APICFUNC(ioapic_phys_id_map) \
-       APICFUNC(clustered_apic_check) \
+       APICFUNC(setup_apic_routing) \
        APICFUNC(multi_timer_check) \
        APICFUNC(apicid_to_node) \
        APICFUNC(cpu_to_logical_apicid) \
index 18b19a7734409708768702a73f5e685f6f82b670..ebd319f838ab5644392759e863fb284274993e82 100644 (file)
@@ -71,7 +71,7 @@ static inline void init_apic_ldr(void)
        apic_write_around(APIC_LDR, val);
 }
 
-static inline void clustered_apic_check(void)
+static inline void setup_apic_routing(void)
 {
        printk("Enabling APIC mode:  %s.  Using %d I/O APICs\n",
                "Physflat", nr_ioapics);
index 3ef6292db780b5c23d0a89572f51111250561f5d..6db1c3babe9abe7612c2f3b034def7b1a33a558f 100644 (file)
@@ -54,7 +54,7 @@ static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map)
        return phys_map;
 }
 
-static inline void clustered_apic_check(void)
+static inline void setup_apic_routing(void)
 {
        printk("Enabling APIC mode:  %s.  Using %d I/O APICs\n",
                                        "Flat", nr_ioapics);
index 26333685a7fbe50974475026bced9b4ae9c13ca8..8e8b3949173a3cf2e245ee16a241d32e1b51818c 100644 (file)
@@ -81,7 +81,7 @@ static inline void enable_apic_mode(void)
 }
 
 extern int apic_version [MAX_APICS];
-static inline void clustered_apic_check(void)
+static inline void setup_apic_routing(void)
 {
        int apic = bios_cpu_apicid[smp_processor_id()];
        printk("Enabling APIC mode:  %s.  Using %d I/O APICs, target cpus %lx\n",
index d9dc039da94a3a12b4902d477bb48c0e6d8f205e..a236e702152805b842c06dea1f1971b8f2062b0a 100644 (file)
@@ -13,7 +13,7 @@
 #define apic_id_registered (genapic->apic_id_registered)
 #define init_apic_ldr (genapic->init_apic_ldr)
 #define ioapic_phys_id_map (genapic->ioapic_phys_id_map)
-#define clustered_apic_check (genapic->clustered_apic_check) 
+#define setup_apic_routing (genapic->setup_apic_routing)
 #define multi_timer_check (genapic->multi_timer_check)
 #define apicid_to_node (genapic->apicid_to_node)
 #define cpu_to_logical_apicid (genapic->cpu_to_logical_apicid) 
index 9d158095da8236a76c2045d2275015d9d2789e12..5e5e7dd2692ef91a888ee4c3c7e586627219f656 100644 (file)
@@ -34,7 +34,7 @@ static inline void init_apic_ldr(void)
        /* Already done in NUMA-Q firmware */
 }
 
-static inline void clustered_apic_check(void)
+static inline void setup_apic_routing(void)
 {
        printk("Enabling APIC mode:  %s.  Using %d I/O APICs\n",
                "NUMA-Q", nr_ioapics);
index 43e5bd8f4a196d32db7460afe927e1a83f08ce72..732f776aab8e68ca8501e314cfdc8cd39e14250b 100644 (file)
@@ -80,7 +80,7 @@ static inline int apic_id_registered(void)
        return 1;
 }
 
-static inline void clustered_apic_check(void)
+static inline void setup_apic_routing(void)
 {
        printk("Enabling APIC mode:  Summit.  Using %d I/O APICs\n",
                                                nr_ioapics);
index 18afe6b6fc4d35288ebdbd0be7dfad1091fb8a84..efac6f0d139f91e48a5219e47cef3ba5b285ca5d 100644 (file)
@@ -47,7 +47,7 @@ static inline void summit_check(char *oem, char *productid)
 {
 }
 
-static inline void clustered_apic_check(void)
+static inline void setup_apic_routing(void)
 {
 }
 
index 7cfb39cbd91854ab952420b02eb311d0cd7277c1..2f3b013595ab755e4795295905b2acdad83c431c 100644 (file)
@@ -83,7 +83,7 @@ extern void setup_secondary_APIC_clock (void);
 extern int APIC_init_uniprocessor (void);
 extern void disable_APIC_timer(void);
 extern void enable_APIC_timer(void);
-extern void clustered_apic_check(void);
+extern void setup_apic_routing(void);
 
 extern void setup_APIC_extened_lvt(unsigned char lvt_off, unsigned char vector,
                                   unsigned char msg_type, unsigned char mask);