diff options
author | Jes Sorensen <jes@sgi.com> | 2009-07-23 17:03:42 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-07-27 14:09:14 -0500 |
commit | 6be68d7eb9037fa3b8ef18901e5c02c120463efd (patch) | |
tree | 437edcdccb370dabe02689387a6283df341e3a72 /vl.c | |
parent | 96c1606b33a64ea6d5e1a988f9eb234a58947002 (diff) |
Introduce -smp , maxcpus= flag to specify maximum number of CPUS.
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>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'vl.c')
-rw-r--r-- | vl.c | 27 |
1 files changed, 26 insertions, 1 deletions
@@ -222,6 +222,7 @@ int rtc_td_hack = 0; int usb_enabled = 0; int singlestep = 0; int smp_cpus = 1; +int max_cpus = 0; const char *vnc_display; int acpi_enabled = 1; int no_hpet = 0; @@ -5453,12 +5454,29 @@ int main(int argc, char **argv, char **envp) add_device_config(DEV_GENERIC, optarg); 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; @@ -5639,6 +5657,13 @@ int main(int argc, char **argv, char **envp) } #endif + /* + * Default to max_cpus = smp_cpus, in case the user doesn't + * specify a max_cpus value. + */ + if (!max_cpus) + max_cpus = smp_cpus; + machine->max_cpus = machine->max_cpus ?: 1; /* Default to UP */ if (smp_cpus > machine->max_cpus) { fprintf(stderr, "Number of SMP cpus requested (%d), exceeds max cpus " |