qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jes Sorensen <jes@sgi.com>
To: qemu-devel@nongnu.org
Cc: Anthony Liguori <aliguori@us.ibm.com>, Avi Kivity <avi@redhat.com>
Subject: [Qemu-devel] [patch 1/2] Introduce -smp , maxcpus= flag to specify maximum number of CPUS.
Date: Wed, 24 Jun 2009 10:35:13 +0200	[thread overview]
Message-ID: <20090624083725.117898545@sgi.com> (raw)
In-Reply-To: 20090624083512.766907560@sgi.com

[-- Attachment #1: 0001-qemu-cfg-maxcpus.patch --]
[-- Type: text/plain, Size: 3781 bytes --]

Follow on patch will use it to determine the size of the MADT and
other BIOS tables.

Signed-off-by: Jes Sorensen <jes@sgi.com>

---
 hw/fw_cfg.c     |    1 +
 hw/fw_cfg.h     |    1 +
 qemu-options.hx |    5 ++++-
 sysemu.h        |    1 +
 vl.c            |   20 +++++++++++++++++++-
 5 files changed, 26 insertions(+), 2 deletions(-)

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
@@ -39,7 +39,10 @@ Select CPU model (-cpu ? for list and ad
 ETEXI
 
 DEF("smp", HAS_ARG, QEMU_OPTION_smp,
-    "-smp n          set the number of CPUs to 'n' [default=1]\n")
+    "-smp n[,maxcpus=cpus]\n"
+    "                set the number of CPUs to 'n' [default=1]\n"
+    "                maxcpus= maximum number of total cpus, including\n"
+    "                offline CPUs for hotplug etc.\n")
 STEXI
 @item -smp @var{n}
 Simulate an SMP system with @var{n} CPUs. On the PC target, up to 255
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;
@@ -5550,12 +5551,29 @@ int main(int argc, char **argv, char **e
                 usb_devices_index++;
                 break;
             case QEMU_OPTION_smp:
-                smp_cpus = atoi(optarg);
+            {
+                char *p;
+                char option[128];
+                smp_cpus = strtol(optarg, &p, 10);
                 if (smp_cpus < 1) {
                     fprintf(stderr, "Invalid number of CPUs\n");
                     exit(1);
                 }
+                if (*p++ != ',')
+                    break;
+                if (get_param_value(option, 128, "maxcpus", p))
+                    max_cpus = strtol(option, NULL, 0);
+                if (max_cpus < smp_cpus) {
+                    fprintf(stderr, "maxcpus must be equal to or greater than "
+                            "smp\n");
+                    exit(1);
+                }
+                if (max_cpus > 255) {
+                    fprintf(stderr, "Unsupported number of maxcpus\n");
+                    exit(1);
+                }
                 break;
+            }
 	    case QEMU_OPTION_vnc:
                 display_type = DT_VNC;
 		vnc_display = optarg;

  reply	other threads:[~2009-06-24  8:40 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-24  8:35 [Qemu-devel] [patch 0/2] QEMU maxcpus support v2 Jes Sorensen
2009-06-24  8:35 ` Jes Sorensen [this message]
2009-06-24  9:02   ` [Qemu-devel] Re: [patch 1/2] Introduce -smp , maxcpus= flag to specify maximum number of CPUS Avi Kivity
2009-06-24  9:02     ` Jes Sorensen
2009-06-24  9:15       ` Avi Kivity
2009-06-24 12:04         ` Jes Sorensen
2009-06-24  8:35 ` [Qemu-devel] [patch 2/2] QEMU BOCHS bios patches to use maxcpus value Jes Sorensen
2009-07-09 21:57   ` Anthony Liguori
2009-07-12  9:39     ` Avi Kivity
2009-07-12 13:23       ` Anthony Liguori
2009-07-12 13:36         ` Avi Kivity
2009-07-14  8:38     ` Jes Sorensen
2009-07-14  9:21       ` Filip Navara
2009-07-14  9:32         ` Gleb Natapov
2009-07-14 10:16           ` Alexander Graf
2009-07-14 11:15             ` Filip Navara
2009-07-14 11:21         ` Jes Sorensen
  -- strict thread matches above, loose matches on Subject: below --
2009-07-14 12:53 [Qemu-devel] [PATCH 0/2] QEMU maxcpus support v2 Jes Sorensen
2009-07-14 12:53 ` [Qemu-devel] [PATCH 1/2] Introduce -smp , maxcpus= flag to specify maximum number of CPUS Jes Sorensen
2009-07-20 14:43 [Qemu-devel] [PATCH 0/2] QEMU maxcpus support v3 Jes Sorensen
2009-07-20 14:43 ` [Qemu-devel] [PATCH 1/2] Introduce -smp , maxcpus= flag to specify maximum number of CPUS Jes Sorensen
2009-07-23 15:03 [Qemu-devel] [PATCH 0/2] QEMU maxcpus support v4 Jes Sorensen
2009-07-23 15:03 ` [Qemu-devel] [PATCH 1/2] Introduce -smp , maxcpus= flag to specify maximum number of CPUS Jes Sorensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090624083725.117898545@sgi.com \
    --to=jes@sgi.com \
    --cc=aliguori@us.ibm.com \
    --cc=avi@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).