From: "Andi Kleen" This patch removes the assumption that LAPIC entries contain the BSP as its first entry. This is a slight improvement to the temporary fix submitted by Suresh Siddha. - Removes assumption that LAPIC entries contain BSP first. - Builds x86_acpiid_to_apicid[] and bios_cpu_apicid[] properly with BSP as first entry. - Made maxcpus=1 boot on these systems. Since the parsing earlier in arch/x86_64/kernel/mpparse.c stopped after maxcpus entries, other entries were not processed, this causes kernel not to boot on these systems. TBD: x86_acpiid_to_apicid and bios_cpu_apicid[] seem to be exactly the same. This could be removed, but might need more work to cleanup. Signed-off-by: Ashok Raj Signed-off-by: Andi Kleen Signed-off-by: Andrew Morton --- arch/x86_64/kernel/mpparse.c | 20 ++++++++++++++------ arch/x86_64/kernel/smpboot.c | 2 -- 2 files changed, 14 insertions(+), 8 deletions(-) diff -puN arch/x86_64/kernel/mpparse.c~x86_64-dont-assume-bsp-has-id-0-in-new-smp-bootup arch/x86_64/kernel/mpparse.c --- 25/arch/x86_64/kernel/mpparse.c~x86_64-dont-assume-bsp-has-id-0-in-new-smp-bootup 2005-05-13 22:55:06.000000000 -0700 +++ 25-akpm/arch/x86_64/kernel/mpparse.c 2005-05-13 22:55:06.000000000 -0700 @@ -107,6 +107,7 @@ static int __init mpf_checksum(unsigned static void __init MP_processor_info (struct mpc_config_processor *m) { int ver; + static int found_bsp=0; if (!(m->mpc_cpuflag & CPU_ENABLED)) return; @@ -126,11 +127,6 @@ static void __init MP_processor_info (st " Processor ignored.\n", NR_CPUS); return; } - if (num_processors >= maxcpus) { - printk(KERN_WARNING "WARNING: maxcpus limit of %i reached." - " Processor ignored.\n", maxcpus); - return; - } num_processors++; @@ -150,7 +146,19 @@ static void __init MP_processor_info (st ver = 0x10; } apic_version[m->mpc_apicid] = ver; - bios_cpu_apicid[num_processors - 1] = m->mpc_apicid; + if (m->mpc_cpuflag & CPU_BOOTPROCESSOR) { + /* + * bios_cpu_apicid is required to have processors listed + * in same order as logical cpu numbers. Hence the first + * entry is BSP, and so on. + */ + bios_cpu_apicid[0] = m->mpc_apicid; + x86_cpu_to_apicid[0] = m->mpc_apicid; + found_bsp = 1; + } else { + bios_cpu_apicid[num_processors - found_bsp] = m->mpc_apicid; + x86_cpu_to_apicid[num_processors - found_bsp] = m->mpc_apicid; + } } static void __init MP_bus_info (struct mpc_config_bus *m) diff -puN arch/x86_64/kernel/smpboot.c~x86_64-dont-assume-bsp-has-id-0-in-new-smp-bootup arch/x86_64/kernel/smpboot.c --- 25/arch/x86_64/kernel/smpboot.c~x86_64-dont-assume-bsp-has-id-0-in-new-smp-bootup 2005-05-13 22:55:06.000000000 -0700 +++ 25-akpm/arch/x86_64/kernel/smpboot.c 2005-05-13 22:55:06.000000000 -0700 @@ -644,7 +644,6 @@ static int __cpuinit do_boot_cpu(int cpu printk("failed fork for CPU %d\n", cpu); return PTR_ERR(idle); } - x86_cpu_to_apicid[cpu] = apicid; cpu_pda[cpu].pcurrent = idle; @@ -953,7 +952,6 @@ void __cpuinit smp_prepare_cpus(unsigned GET_APIC_ID(apic_read(APIC_ID)), boot_cpu_id); /* Or can we switch back to PIC here? */ } - x86_cpu_to_apicid[0] = boot_cpu_id; /* * Now start the IO-APICs _