Previously, the BIOS would probe the CPUs for SMP guests.  This tends to be
very unreliably because of startup timing issues.  By passing the number of
CPUs in the CMOS, the BIOS can detect the number of CPUs much more reliably.

Index: qemu/hw/pc.c
===================================================================
--- qemu.orig/hw/pc.c   2008-01-30 13:47:37.000000000 -0600
+++ qemu/hw/pc.c        2008-01-30 13:47:40.000000000 -0600
@@ -182,7 +182,8 @@
 
 /* hd_table must contain 4 block drivers */
 static void cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
-                     const char *boot_device, BlockDriverState **hd_table)
+                     const char *boot_device, BlockDriverState **hd_table,
+                     int smp_cpus)
 {
     RTCState *s = rtc_state;
     int nbds, bds[3] = { 0, };
@@ -210,6 +211,7 @@
         rtc_set_memory(s, 0x5c, (unsigned int)above_4g_mem_size >> 24);
         rtc_set_memory(s, 0x5d, above_4g_mem_size >> 32);
     }
+    rtc_set_memory(s, 0x5f, smp_cpus - 1);
 
     if (ram_size > (16 * 1024 * 1024))
         val = (ram_size / 65536) - ((16 * 1024 * 1024) / 65536);
@@ -989,7 +991,7 @@
     }
     floppy_controller = fdctrl_init(i8259[6], 2, 0, 0x3f0, fd);
 
-    cmos_init(ram_size, above_4g_mem_size, boot_device, hd);
+    cmos_init(ram_size, above_4g_mem_size, boot_device, hd, smp_cpus);
 
     if (pci_enabled && usb_enabled) {
         usb_uhci_piix3_init(pci_bus, piix3_devfn + 2);


Reply via email to