Commit 90af668a authored by Yinghai Lu's avatar Yinghai Lu Committed by Greg Kroah-Hartman

APIC routing fix

commit e0da3364 upstream

x86: introduce max_physical_apicid for bigsmp switching

a multi-socket test-system with 3 or 4 ioapics, when 4 dualcore cpus or
2 quadcore cpus installed, needs to switch to bigsmp or physflat.

CPU apic id is [4,11] instead of [0,7], and we need to check max apic
id instead of cpu numbers.

also add check for 32 bit when acpi is not compiled in or acpi=off.
Signed-off-by: default avatarYinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 092609f3
...@@ -1536,6 +1536,9 @@ void __cpuinit generic_processor_info(int apicid, int version) ...@@ -1536,6 +1536,9 @@ void __cpuinit generic_processor_info(int apicid, int version)
*/ */
cpu = 0; cpu = 0;
if (apicid > max_physical_apicid)
max_physical_apicid = apicid;
/* /*
* Would be preferable to switch to bigsmp when CONFIG_HOTPLUG_CPU=y * Would be preferable to switch to bigsmp when CONFIG_HOTPLUG_CPU=y
* but we need to work other dependencies like SMP_SUSPEND etc * but we need to work other dependencies like SMP_SUSPEND etc
...@@ -1543,7 +1546,7 @@ void __cpuinit generic_processor_info(int apicid, int version) ...@@ -1543,7 +1546,7 @@ void __cpuinit generic_processor_info(int apicid, int version)
* if (CPU_HOTPLUG_ENABLED || num_processors > 8) * if (CPU_HOTPLUG_ENABLED || num_processors > 8)
* - Ashok Raj <ashok.raj@intel.com> * - Ashok Raj <ashok.raj@intel.com>
*/ */
if (num_processors > 8) { if (max_physical_apicid >= 8) {
switch (boot_cpu_data.x86_vendor) { switch (boot_cpu_data.x86_vendor) {
case X86_VENDOR_INTEL: case X86_VENDOR_INTEL:
if (!APIC_XAPIC(version)) { if (!APIC_XAPIC(version)) {
......
...@@ -1090,6 +1090,9 @@ void __cpuinit generic_processor_info(int apicid, int version) ...@@ -1090,6 +1090,9 @@ void __cpuinit generic_processor_info(int apicid, int version)
*/ */
cpu = 0; cpu = 0;
} }
if (apicid > max_physical_apicid)
max_physical_apicid = apicid;
/* are we being called early in kernel startup? */ /* are we being called early in kernel startup? */
if (x86_cpu_to_apicid_early_ptr) { if (x86_cpu_to_apicid_early_ptr) {
u16 *cpu_to_apicid = x86_cpu_to_apicid_early_ptr; u16 *cpu_to_apicid = x86_cpu_to_apicid_early_ptr;
......
...@@ -51,7 +51,7 @@ void __init setup_apic_routing(void) ...@@ -51,7 +51,7 @@ void __init setup_apic_routing(void)
else else
#endif #endif
if (num_possible_cpus() <= 8) if (max_physical_apicid < 8)
genapic = &apic_flat; genapic = &apic_flat;
else else
genapic = &apic_physflat; genapic = &apic_physflat;
......
...@@ -402,6 +402,11 @@ static int __init smp_read_mpc(struct mp_config_table *mpc, unsigned early) ...@@ -402,6 +402,11 @@ static int __init smp_read_mpc(struct mp_config_table *mpc, unsigned early)
++mpc_record; ++mpc_record;
#endif #endif
} }
#ifdef CONFIG_X86_GENERICARCH
generic_bigsmp_probe();
#endif
setup_apic_routing(); setup_apic_routing();
if (!num_processors) if (!num_processors)
printk(KERN_ERR "MPTABLE: no processors registered!\n"); printk(KERN_ERR "MPTABLE: no processors registered!\n");
......
...@@ -17,6 +17,7 @@ unsigned int num_processors; ...@@ -17,6 +17,7 @@ unsigned int num_processors;
unsigned disabled_cpus __cpuinitdata; unsigned disabled_cpus __cpuinitdata;
/* Processor that is doing the boot up */ /* Processor that is doing the boot up */
unsigned int boot_cpu_physical_apicid = -1U; unsigned int boot_cpu_physical_apicid = -1U;
unsigned int max_physical_apicid;
EXPORT_SYMBOL(boot_cpu_physical_apicid); EXPORT_SYMBOL(boot_cpu_physical_apicid);
DEFINE_PER_CPU(u16, x86_cpu_to_apicid) = BAD_APICID; DEFINE_PER_CPU(u16, x86_cpu_to_apicid) = BAD_APICID;
......
...@@ -914,6 +914,12 @@ void __init setup_arch(char **cmdline_p) ...@@ -914,6 +914,12 @@ void __init setup_arch(char **cmdline_p)
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
acpi_boot_init(); acpi_boot_init();
#endif
#ifdef CONFIG_X86_LOCAL_APIC
if (smp_found_config)
get_smp_config();
#endif
#if defined(CONFIG_SMP) && defined(CONFIG_X86_PC) #if defined(CONFIG_SMP) && defined(CONFIG_X86_PC)
if (def_to_bigsmp) if (def_to_bigsmp)
...@@ -921,11 +927,6 @@ void __init setup_arch(char **cmdline_p) ...@@ -921,11 +927,6 @@ void __init setup_arch(char **cmdline_p)
"CONFIG_X86_PC cannot handle it.\nUse " "CONFIG_X86_PC cannot handle it.\nUse "
"CONFIG_X86_GENERICARCH or CONFIG_X86_BIGSMP.\n"); "CONFIG_X86_GENERICARCH or CONFIG_X86_BIGSMP.\n");
#endif #endif
#endif
#ifdef CONFIG_X86_LOCAL_APIC
if (smp_found_config)
get_smp_config();
#endif
e820_register_memory(); e820_register_memory();
e820_mark_nosave_regions(); e820_mark_nosave_regions();
......
...@@ -48,7 +48,7 @@ static const struct dmi_system_id bigsmp_dmi_table[] = { ...@@ -48,7 +48,7 @@ static const struct dmi_system_id bigsmp_dmi_table[] = {
static int probe_bigsmp(void) static int probe_bigsmp(void)
{ {
if (def_to_bigsmp) if (def_to_bigsmp)
dmi_bigsmp = 1; dmi_bigsmp = 1;
else else
dmi_check_system(bigsmp_dmi_table); dmi_check_system(bigsmp_dmi_table);
return dmi_bigsmp; return dmi_bigsmp;
......
...@@ -35,6 +35,7 @@ extern DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES); ...@@ -35,6 +35,7 @@ extern DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES);
extern int mp_bus_id_to_pci_bus[MAX_MP_BUSSES]; extern int mp_bus_id_to_pci_bus[MAX_MP_BUSSES];
extern unsigned int boot_cpu_physical_apicid; extern unsigned int boot_cpu_physical_apicid;
extern unsigned int max_physical_apicid;
extern int smp_found_config; extern int smp_found_config;
extern int mpc_default_type; extern int mpc_default_type;
extern unsigned long mp_lapic_addr; extern unsigned long mp_lapic_addr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment