diff options
Diffstat (limited to 'vl.c')
-rw-r--r-- | vl.c | 75 |
1 files changed, 38 insertions, 37 deletions
@@ -28,6 +28,7 @@ #include <errno.h> #include <sys/time.h> #include <zlib.h> +#include "bitmap.h" /* Needed early for CONFIG_BSD etc. */ #include "config-host.h" @@ -130,8 +131,8 @@ int main(int argc, char **argv) #include "qemu-timer.h" #include "qemu-char.h" #include "cache-utils.h" -#include "block.h" #include "blockdev.h" +#include "hw/block-common.h" #include "block-migration.h" #include "dma.h" #include "audio/audio.h" @@ -159,6 +160,7 @@ int main(int argc, char **argv) #include "qemu-queue.h" #include "cpus.h" #include "arch_init.h" +#include "osdep.h" #include "ui/qemu-spice.h" @@ -240,7 +242,7 @@ QTAILQ_HEAD(, FWBootEntry) fw_boot_order = QTAILQ_HEAD_INITIALIZER(fw_boot_order int nb_numa_nodes; uint64_t node_mem[MAX_NODES]; -uint64_t node_cpumask[MAX_NODES]; +unsigned long *node_cpumask[MAX_NODES]; uint8_t qemu_uuid[16]; @@ -951,6 +953,8 @@ static void numa_add(const char *optarg) unsigned long long value, endvalue; int nodenr; + value = endvalue = 0ULL; + optarg = get_opt_name(option, 128, optarg, ',') + 1; if (!strcmp(option, "node")) { if (get_param_value(option, 128, "nodeid", optarg) == 0) { @@ -970,27 +974,22 @@ static void numa_add(const char *optarg) } node_mem[nodenr] = sval; } - if (get_param_value(option, 128, "cpus", optarg) == 0) { - node_cpumask[nodenr] = 0; - } else { + if (get_param_value(option, 128, "cpus", optarg) != 0) { value = strtoull(option, &endptr, 10); - if (value >= 64) { - value = 63; - fprintf(stderr, "only 64 CPUs in NUMA mode supported.\n"); + if (*endptr == '-') { + endvalue = strtoull(endptr+1, &endptr, 10); } else { - if (*endptr == '-') { - endvalue = strtoull(endptr+1, &endptr, 10); - if (endvalue >= 63) { - endvalue = 62; - fprintf(stderr, - "only 63 CPUs in NUMA mode supported.\n"); - } - value = (2ULL << endvalue) - (1ULL << value); - } else { - value = 1ULL << value; - } + endvalue = value; } - node_cpumask[nodenr] = value; + + if (!(endvalue < MAX_CPUMASK_BITS)) { + endvalue = MAX_CPUMASK_BITS - 1; + fprintf(stderr, + "A max of %d CPUs are supported in a guest\n", + MAX_CPUMASK_BITS); + } + + bitmap_set(node_cpumask[nodenr], value, endvalue-value+1); } nb_numa_nodes++; } @@ -1795,9 +1794,8 @@ char *qemu_find_file(int type, const char *name) const char *subdir; char *buf; - /* If name contains path separators then try it as a straight path. */ - if ((strchr(name, '/') || strchr(name, '\\')) - && access(name, R_OK) == 0) { + /* Try the name as a straight path first */ + if (access(name, R_OK) == 0) { return g_strdup(name); } switch (type) { @@ -1985,8 +1983,8 @@ static int serial_parse(const char *devname) snprintf(label, sizeof(label), "serial%d", index); serial_hds[index] = qemu_chr_new(label, devname, NULL); if (!serial_hds[index]) { - fprintf(stderr, "qemu: could not open serial device '%s': %s\n", - devname, strerror(errno)); + fprintf(stderr, "qemu: could not connect serial device" + " to character backend '%s'\n", devname); return -1; } index++; @@ -2007,8 +2005,8 @@ static int parallel_parse(const char *devname) snprintf(label, sizeof(label), "parallel%d", index); parallel_hds[index] = qemu_chr_new(label, devname, NULL); if (!parallel_hds[index]) { - fprintf(stderr, "qemu: could not open parallel device '%s': %s\n", - devname, strerror(errno)); + fprintf(stderr, "qemu: could not connect parallel device" + " to character backend '%s'\n", devname); return -1; } index++; @@ -2042,8 +2040,8 @@ static int virtcon_parse(const char *devname) snprintf(label, sizeof(label), "virtcon%d", index); virtcon_hds[index] = qemu_chr_new(label, devname, NULL); if (!virtcon_hds[index]) { - fprintf(stderr, "qemu: could not open virtio console '%s': %s\n", - devname, strerror(errno)); + fprintf(stderr, "qemu: could not connect virtio console" + " to character backend '%s'\n", devname); return -1; } qemu_opt_set(dev_opts, "chardev", label); @@ -2087,7 +2085,7 @@ static QEMUMachine *machine_parse(const char *name) printf("%-20s %s%s\n", m->name, m->desc, m->is_default ? " (default)" : ""); } - exit(!name || *name != '?'); + exit(!name || !is_help_option(name)); } static int tcg_init(void) @@ -2331,7 +2329,7 @@ int main(int argc, char **argv, char **envp) for (i = 0; i < MAX_NODES; i++) { node_mem[i] = 0; - node_cpumask[i] = 0; + node_cpumask[i] = bitmap_new(MAX_CPUMASK_BITS); } nb_numa_nodes = 0; @@ -3217,7 +3215,7 @@ int main(int argc, char **argv, char **envp) */ cpudef_init(); - if (cpu_model && *cpu_model == '?') { + if (cpu_model && is_help_option(cpu_model)) { list_cpus(stdout, &fprintf, cpu_model); exit(0); } @@ -3438,8 +3436,7 @@ int main(int argc, char **argv, char **envp) default_drive(default_sdcard, snapshot, machine->use_scsi, IF_SD, 0, SD_OPTS); - register_savevm_live(NULL, "ram", 0, 4, NULL, ram_save_live, NULL, - ram_load, NULL); + register_savevm_live(NULL, "ram", 0, 4, &savevm_ram_handlers, NULL); if (nb_numa_nodes > 0) { int i; @@ -3469,8 +3466,9 @@ int main(int argc, char **argv, char **envp) } for (i = 0; i < nb_numa_nodes; i++) { - if (node_cpumask[i] != 0) + if (!bitmap_empty(node_cpumask[i], MAX_CPUMASK_BITS)) { break; + } } /* assigning the VCPUs round-robin is easier to implement, guest OSes * must cope with this anyway, because there are BIOSes out there in @@ -3478,7 +3476,7 @@ int main(int argc, char **argv, char **envp) */ if (i == nb_numa_nodes) { for (i = 0; i < max_cpus; i++) { - node_cpumask[i % nb_numa_nodes] |= 1 << i; + set_bit(i, node_cpumask[i % nb_numa_nodes]); } } } @@ -3585,8 +3583,11 @@ int main(int argc, char **argv, char **envp) /* init remote displays */ if (vnc_display) { vnc_display_init(ds); - if (vnc_display_open(ds, vnc_display) < 0) + if (vnc_display_open(ds, vnc_display) < 0) { + fprintf(stderr, "Failed to start VNC server on `%s'\n", + vnc_display); exit(1); + } if (show_vnc_port) { printf("VNC server running on `%s'\n", vnc_display_local_addr(ds)); |