From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JKi5M-0004IV-Jn for qemu-devel@nongnu.org; Thu, 31 Jan 2008 17:40:44 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JKi5L-0004I4-PG for qemu-devel@nongnu.org; Thu, 31 Jan 2008 17:40:44 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JKi5L-0004I0-MT for qemu-devel@nongnu.org; Thu, 31 Jan 2008 17:40:43 -0500 Received: from e5.ny.us.ibm.com ([32.97.182.145]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JKi5L-0001wC-A6 for qemu-devel@nongnu.org; Thu, 31 Jan 2008 17:40:43 -0500 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e5.ny.us.ibm.com (8.13.8/8.13.8) with ESMTP id m0VMarEN020312 for ; Thu, 31 Jan 2008 17:36:53 -0500 Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v8.7) with ESMTP id m0VMarKc240220 for ; Thu, 31 Jan 2008 17:36:53 -0500 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m0VMapbT029459 for ; Thu, 31 Jan 2008 17:36:52 -0500 From: Anthony Liguori Date: Thu, 31 Jan 2008 16:36:18 -0600 Message-Id: <1201818980-27534-5-git-send-email-aliguori@us.ibm.com> In-Reply-To: <1201818980-27534-1-git-send-email-aliguori@us.ibm.com> References: <1201818980-27534-1-git-send-email-aliguori@us.ibm.com> Subject: [Qemu-devel] [PATCH 4/6] Tell BIOS about the number of CPUs Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kvm-devel@lists.sourceforge.net, Paul Brook 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);