Don't turn off apic after smp detect; use cmos for smp count on emulators.
authorKevin O'Connor <kevin@koconnor.net>
Wed, 17 Dec 2008 04:50:52 +0000 (23:50 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Wed, 17 Dec 2008 04:50:52 +0000 (23:50 -0500)
Don't restor the APIC_SVR value - doing so confuses kvm.
When running on an emulator, get the smp count from cmos (timing on an
    emulator - especially when simulating large cpu counts - is too
    unreliable to do a count based on timers.)

src/cmos.h
src/smpdetect.c

index f66316365a4f0dff5447cba27df48dbb34dd50ad..5c7b39dd4ecdd53834816803fd32343c6f345941 100644 (file)
@@ -39,6 +39,7 @@
 #define CMOS_MEM_HIGHMEM_LOW     0x5b
 #define CMOS_MEM_HIGHMEM_MID     0x5c
 #define CMOS_MEM_HIGHMEM_HIGH    0x5d
+#define CMOS_BIOS_SMP_COUNT      0x5f
 
 // CMOS_FLOPPY_DRIVE_TYPE bitdefs
 #define CFD_NO_DRIVE 0
index 7f0c7aaaec15084d30586d423e932a3ea0858a92..027402637b17cb6591dbd3b960875ed628e3e5f5 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "util.h" // dprintf
 #include "config.h" // CONFIG_*
+#include "cmos.h" // CMOS_BIOS_SMP_COUNT
 
 #define CPUID_APIC (1 << 9)
 
@@ -96,10 +97,13 @@ smp_probe(void)
     writel(APIC_ICR_LOW, 0x000C4600 | sipi_vector);
 
     // Wait for other CPUs to process the SIPI.
-    mdelay(10);
+    if (CONFIG_COREBOOT)
+        mdelay(10);
+    else
+        while (inb_cmos(CMOS_BIOS_SMP_COUNT) + 1 != readl(&smp_cpus))
+            ;
 
     // Restore memory.
-    writel(APIC_SVR, val);
     *(u64*)BUILD_AP_BOOT_ADDR = old;
 
     u32 count = readl(&smp_cpus);