summaryrefslogtreecommitdiffstats
path: root/vl.c
diff options
context:
space:
mode:
authorPeter Maydell2016-06-16 18:58:45 +0200
committerPeter Maydell2016-06-16 18:58:45 +0200
commit585fcd4b11070b3220685fc54ecca1991cdeb161 (patch)
treeeac78393a02a9a0cda3571ab7bce3000e095c978 /vl.c
parentMerge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (diff)
parentvl: smp_parse: cleanups (diff)
downloadqemu-585fcd4b11070b3220685fc54ecca1991cdeb161.tar.gz
qemu-585fcd4b11070b3220685fc54ecca1991cdeb161.tar.xz
qemu-585fcd4b11070b3220685fc54ecca1991cdeb161.zip
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
* KVM startup speedup (Chao Peng) * configure fixes and cleanups (David, Thomas) * ctags fix (Sergey) * NBD cleanups (Peter, Eric) * "-L help" command line option (Richard) * More esp.c bugfixes (me, Prasad) * KVM_CAP_MAX_VCPU_ID support (Greg) # gpg: Signature made Thu 16 Jun 2016 17:39:10 BST # gpg: using RSA key 0xBFFBD25F78C7AE83 # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * remotes/bonzini/tags/for-upstream: (29 commits) vl: smp_parse: cleanups scsi: esp: make cmdbuf big enough for maximum CDB size scsi: esp: clean up handle_ti/esp_do_dma if s->do_cmd scsi: esp: respect FIFO invariant after message phase scsi: esp: check buffer length before reading scsi command nbd: Avoid magic number for NBD max name size nbd: Detect servers that send unexpected error values nbd: Clean up ioctl handling of qemu-nbd -c nbd: Group all Linux-specific ioctl code in one place nbd: Reject unknown request flags nbd: Improve server handling of bogus commands nbd: Quit server after any write error nbd: More debug typo fixes, use correct formats nbd: Use BDRV_REQ_FUA for better FUA where supported vl.c: Add '-L help' which lists data dirs. KVM: use KVM_CAP_MAX_VCPU_ID scsi-disk: Use (unsigned long) typecasts when using "%lu" format string target-i386: kvm: cache KVM_GET_SUPPORTED_CPUID data nbd: simplify the nbd_request and nbd_reply structs nbd: Don't use cpu_to_*w() functions ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c47
1 files changed, 27 insertions, 20 deletions
diff --git a/vl.c b/vl.c
index 45eff5661b..0736d8430d 100644
--- a/vl.c
+++ b/vl.c
@@ -154,7 +154,7 @@ CharDriverState *sclp_hds[MAX_SCLP_CONSOLES];
int win2k_install_hack = 0;
int singlestep = 0;
int smp_cpus = 1;
-int max_cpus = 0;
+int max_cpus = 1;
int smp_cores = 1;
int smp_threads = 1;
int acpi_enabled = 1;
@@ -1218,7 +1218,6 @@ static QemuOptsList qemu_smp_opts = {
static void smp_parse(QemuOpts *opts)
{
if (opts) {
-
unsigned cpus = qemu_opt_get_number(opts, "cpus", 0);
unsigned sockets = qemu_opt_get_number(opts, "sockets", 0);
unsigned cores = qemu_opt_get_number(opts, "cores", 0);
@@ -1246,6 +1245,17 @@ static void smp_parse(QemuOpts *opts)
}
max_cpus = qemu_opt_get_number(opts, "maxcpus", cpus);
+
+ if (max_cpus > MAX_CPUMASK_BITS) {
+ error_report("unsupported number of maxcpus");
+ exit(1);
+ }
+
+ if (max_cpus < cpus) {
+ error_report("maxcpus must be equal to or greater than smp");
+ exit(1);
+ }
+
if (sockets * cores * threads > max_cpus) {
error_report("cpu topology: "
"sockets (%u) * cores (%u) * threads (%u) > "
@@ -1255,25 +1265,11 @@ static void smp_parse(QemuOpts *opts)
}
smp_cpus = cpus;
- smp_cores = cores > 0 ? cores : 1;
- smp_threads = threads > 0 ? threads : 1;
-
- }
-
- if (max_cpus == 0) {
- max_cpus = smp_cpus;
- }
-
- if (max_cpus > MAX_CPUMASK_BITS) {
- error_report("unsupported number of maxcpus");
- exit(1);
- }
- if (max_cpus < smp_cpus) {
- error_report("maxcpus must be equal to or greater than smp");
- exit(1);
+ smp_cores = cores;
+ smp_threads = threads;
}
- if (smp_cpus > 1 || smp_cores > 1 || smp_threads > 1) {
+ if (smp_cpus > 1) {
Error *blocker = NULL;
error_setg(&blocker, QERR_REPLAY_NOT_SUPPORTED, "smp");
replay_add_blocker(blocker);
@@ -2968,6 +2964,7 @@ int main(int argc, char **argv, char **envp)
FILE *vmstate_dump_file = NULL;
Error *main_loop_err = NULL;
Error *err = NULL;
+ bool list_data_dirs = false;
qemu_init_cpu_loop();
qemu_mutex_lock_iothread();
@@ -3354,7 +3351,9 @@ int main(int argc, char **argv, char **envp)
add_device_config(DEV_GDB, optarg);
break;
case QEMU_OPTION_L:
- if (data_dir_idx < ARRAY_SIZE(data_dir)) {
+ if (is_help_option(optarg)) {
+ list_data_dirs = true;
+ } else if (data_dir_idx < ARRAY_SIZE(data_dir)) {
data_dir[data_dir_idx++] = optarg;
}
break;
@@ -4086,6 +4085,14 @@ int main(int argc, char **argv, char **envp)
data_dir[data_dir_idx++] = CONFIG_QEMU_DATADIR;
}
+ /* -L help lists the data directories and exits. */
+ if (list_data_dirs) {
+ for (i = 0; i < data_dir_idx; i++) {
+ printf("%s\n", data_dir[i]);
+ }
+ exit(0);
+ }
+
smp_parse(qemu_opts_find(qemu_find_opts("smp-opts"), NULL));
machine_class->max_cpus = machine_class->max_cpus ?: 1; /* Default to UP */