From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MJ3f8-0001Xy-VJ for qemu-devel@nongnu.org; Tue, 23 Jun 2009 06:55:39 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MJ3f4-0001TT-Qg for qemu-devel@nongnu.org; Tue, 23 Jun 2009 06:55:35 -0400 Received: from [199.232.76.173] (port=55160 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MJ3f4-0001TM-Dy for qemu-devel@nongnu.org; Tue, 23 Jun 2009 06:55:34 -0400 Received: from mx20.gnu.org ([199.232.41.8]:2352) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MJ3f3-0000tk-Q1 for qemu-devel@nongnu.org; Tue, 23 Jun 2009 06:55:33 -0400 Received: from 77-59-223-90.static.cablecom.ch ([77.59.223.90] helo=eye3.emea.sgi.com) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MJ3f2-0005lg-Qv for qemu-devel@nongnu.org; Tue, 23 Jun 2009 06:55:33 -0400 Message-Id: <20090623100358.262526646@sgi.com> Date: Tue, 23 Jun 2009 12:00:10 +0200 From: Jes Sorensen References: <20090623100009.827553739@sgi.com> Content-Disposition: inline; filename=0001-qemu-cfg-maxcpus.patch Subject: [Qemu-devel] [patch 1/2] Introduce -maxcpus flag to QEMU and pass the value to the BIOS through FW_CFG. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori , Avi Kivity Follow on patch will use it to determine the size of the MADT and other BIOS tables. Signed-off-by: Jes Sorensen --- hw/fw_cfg.c | 1 + hw/fw_cfg.h | 1 + qemu-options.hx | 9 +++++++++ sysemu.h | 1 + vl.c | 8 ++++++++ 5 files changed, 20 insertions(+) Index: qemu/hw/fw_cfg.c =================================================================== --- qemu.orig/hw/fw_cfg.c +++ qemu/hw/fw_cfg.c @@ -279,6 +279,7 @@ void *fw_cfg_init(uint32_t ctl_port, uin fw_cfg_add_bytes(s, FW_CFG_UUID, qemu_uuid, 16); fw_cfg_add_i16(s, FW_CFG_NOGRAPHIC, (uint16_t)(display_type == DT_NOGRAPHIC)); fw_cfg_add_i16(s, FW_CFG_NB_CPUS, (uint16_t)smp_cpus); + fw_cfg_add_i16(s, FW_CFG_MAX_CPUS, (uint16_t)max_cpus); register_savevm("fw_cfg", -1, 1, fw_cfg_save, fw_cfg_load, s); qemu_register_reset(fw_cfg_reset, 0, s); Index: qemu/hw/fw_cfg.h =================================================================== --- qemu.orig/hw/fw_cfg.h +++ qemu/hw/fw_cfg.h @@ -15,6 +15,7 @@ #define FW_CFG_INITRD_SIZE 0x0b #define FW_CFG_BOOT_DEVICE 0x0c #define FW_CFG_NUMA 0x0d +#define FW_CFG_MAX_CPUS 0x0e #define FW_CFG_MAX_ENTRY 0x10 #define FW_CFG_WRITE_CHANNEL 0x4000 Index: qemu/qemu-options.hx =================================================================== --- qemu.orig/qemu-options.hx +++ qemu/qemu-options.hx @@ -47,6 +47,15 @@ CPUs are supported. On Sparc32 target, L to 4. ETEXI +DEF("maxcpus", HAS_ARG, QEMU_OPTION_maxcpus, + "-maxcpus n set maximum number of possibly CPUs to 'n'\n") +STEXI +@item -maxcpus @var{n} +Set the maximum number of possible CPUs to @var(n). @var(n) has to be +bigger or equal to the value of -smp. If @var(n) is equal to -smp, +there will be no space for hotplug cpus to be added later. +ETEXI + DEF("numa", HAS_ARG, QEMU_OPTION_numa, "-numa node[,mem=size][,cpus=cpu[-cpu]][,nodeid=node]\n") STEXI Index: qemu/sysemu.h =================================================================== --- qemu.orig/sysemu.h +++ qemu/sysemu.h @@ -118,6 +118,7 @@ extern int alt_grab; extern int usb_enabled; extern int no_virtio_balloon; extern int smp_cpus; +extern int max_cpus; extern int cursor_hide; extern int graphic_rotate; extern int no_quit; Index: qemu/vl.c =================================================================== --- qemu.orig/vl.c +++ qemu/vl.c @@ -241,6 +241,7 @@ int rtc_td_hack = 0; int usb_enabled = 0; int singlestep = 0; int smp_cpus = 1; +int max_cpus = 16; const char *vnc_display; int acpi_enabled = 1; int no_hpet = 0; @@ -5556,6 +5557,13 @@ int main(int argc, char **argv, char **e exit(1); } break; + case QEMU_OPTION_maxcpus: + max_cpus = atoi(optarg); + if ((max_cpus < 1) || (max_cpus > machine->max_cpus)) { + fprintf(stderr, "Invalid number of CPUs\n"); + exit(1); + } + break; case QEMU_OPTION_vnc: display_type = DT_VNC; vnc_display = optarg;