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>
This commit is contained in:
parent
96c1606b33
commit
6be68d7eb9
@ -279,6 +279,7 @@ void *fw_cfg_init(uint32_t ctl_port, uint32_t data_port,
|
|||||||
fw_cfg_add_bytes(s, FW_CFG_UUID, qemu_uuid, 16);
|
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_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_NB_CPUS, (uint16_t)smp_cpus);
|
||||||
|
fw_cfg_add_i16(s, FW_CFG_MAX_CPUS, (uint16_t)max_cpus);
|
||||||
fw_cfg_add_i16(s, FW_CFG_BOOT_MENU, (uint16_t)boot_menu);
|
fw_cfg_add_i16(s, FW_CFG_BOOT_MENU, (uint16_t)boot_menu);
|
||||||
|
|
||||||
register_savevm("fw_cfg", -1, 1, fw_cfg_save, fw_cfg_load, s);
|
register_savevm("fw_cfg", -1, 1, fw_cfg_save, fw_cfg_load, s);
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#define FW_CFG_BOOT_DEVICE 0x0c
|
#define FW_CFG_BOOT_DEVICE 0x0c
|
||||||
#define FW_CFG_NUMA 0x0d
|
#define FW_CFG_NUMA 0x0d
|
||||||
#define FW_CFG_BOOT_MENU 0x0e
|
#define FW_CFG_BOOT_MENU 0x0e
|
||||||
|
#define FW_CFG_MAX_CPUS 0x0f
|
||||||
#define FW_CFG_MAX_ENTRY 0x10
|
#define FW_CFG_MAX_ENTRY 0x10
|
||||||
|
|
||||||
#define FW_CFG_WRITE_CHANNEL 0x4000
|
#define FW_CFG_WRITE_CHANNEL 0x4000
|
||||||
|
@ -39,7 +39,10 @@ Select CPU model (-cpu ? for list and additional feature selection)
|
|||||||
ETEXI
|
ETEXI
|
||||||
|
|
||||||
DEF("smp", HAS_ARG, QEMU_OPTION_smp,
|
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
|
STEXI
|
||||||
@item -smp @var{n}
|
@item -smp @var{n}
|
||||||
Simulate an SMP system with @var{n} CPUs. On the PC target, up to 255
|
Simulate an SMP system with @var{n} CPUs. On the PC target, up to 255
|
||||||
|
1
sysemu.h
1
sysemu.h
@ -121,6 +121,7 @@ extern int usb_enabled;
|
|||||||
extern int virtio_balloon;
|
extern int virtio_balloon;
|
||||||
extern const char *virtio_balloon_devaddr;
|
extern const char *virtio_balloon_devaddr;
|
||||||
extern int smp_cpus;
|
extern int smp_cpus;
|
||||||
|
extern int max_cpus;
|
||||||
extern int cursor_hide;
|
extern int cursor_hide;
|
||||||
extern int graphic_rotate;
|
extern int graphic_rotate;
|
||||||
extern int no_quit;
|
extern int no_quit;
|
||||||
|
27
vl.c
27
vl.c
@ -222,6 +222,7 @@ int rtc_td_hack = 0;
|
|||||||
int usb_enabled = 0;
|
int usb_enabled = 0;
|
||||||
int singlestep = 0;
|
int singlestep = 0;
|
||||||
int smp_cpus = 1;
|
int smp_cpus = 1;
|
||||||
|
int max_cpus = 0;
|
||||||
const char *vnc_display;
|
const char *vnc_display;
|
||||||
int acpi_enabled = 1;
|
int acpi_enabled = 1;
|
||||||
int no_hpet = 0;
|
int no_hpet = 0;
|
||||||
@ -5453,12 +5454,29 @@ int main(int argc, char **argv, char **envp)
|
|||||||
add_device_config(DEV_GENERIC, optarg);
|
add_device_config(DEV_GENERIC, optarg);
|
||||||
break;
|
break;
|
||||||
case QEMU_OPTION_smp:
|
case QEMU_OPTION_smp:
|
||||||
smp_cpus = atoi(optarg);
|
{
|
||||||
|
char *p;
|
||||||
|
char option[128];
|
||||||
|
smp_cpus = strtol(optarg, &p, 10);
|
||||||
if (smp_cpus < 1) {
|
if (smp_cpus < 1) {
|
||||||
fprintf(stderr, "Invalid number of CPUs\n");
|
fprintf(stderr, "Invalid number of CPUs\n");
|
||||||
exit(1);
|
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;
|
break;
|
||||||
|
}
|
||||||
case QEMU_OPTION_vnc:
|
case QEMU_OPTION_vnc:
|
||||||
display_type = DT_VNC;
|
display_type = DT_VNC;
|
||||||
vnc_display = optarg;
|
vnc_display = optarg;
|
||||||
@ -5639,6 +5657,13 @@ int main(int argc, char **argv, char **envp)
|
|||||||
}
|
}
|
||||||
#endif
|
#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 */
|
machine->max_cpus = machine->max_cpus ?: 1; /* Default to UP */
|
||||||
if (smp_cpus > machine->max_cpus) {
|
if (smp_cpus > machine->max_cpus) {
|
||||||
fprintf(stderr, "Number of SMP cpus requested (%d), exceeds max cpus "
|
fprintf(stderr, "Number of SMP cpus requested (%d), exceeds max cpus "
|
||||||
|
Loading…
x
Reference in New Issue
Block a user