X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=softmmu%2Fvl.c;h=f669c06ede4a797cb1a3bf2e78f2ec9500cf2bb5;hb=e9a82986c27a1d721d983e4112f8b971374a4e21;hp=5549f4b619861f2e275537f26f52bad9bc0be04b;hpb=6db1857ec9960c63024f4ce6329d947f727bad39;p=mirror_qemu.git diff --git a/softmmu/vl.c b/softmmu/vl.c index 5549f4b619..f669c06ede 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -25,6 +25,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "qemu/units.h" +#include "hw/boards.h" #include "hw/qdev-properties.h" #include "qapi/error.h" #include "qemu-version.h" @@ -35,6 +36,7 @@ #include "sysemu/runstate.h" #include "sysemu/seccomp.h" #include "sysemu/tcg.h" +#include "sysemu/xen.h" #include "qemu/error-report.h" #include "qemu/sockets.h" @@ -143,7 +145,6 @@ static Chardev **serial_hds; Chardev *parallel_hds[MAX_PARALLEL_PORTS]; int win2k_install_hack = 0; int singlestep = 0; -int acpi_enabled = 1; int no_hpet = 0; int fd_bootchk = 1; static int no_reboot; @@ -178,7 +179,6 @@ static NotifierList exit_notifiers = static NotifierList machine_init_done_notifiers = NOTIFIER_LIST_INITIALIZER(machine_init_done_notifiers); -bool xen_allowed; uint32_t xen_domid; enum xen_mode xen_mode = XEN_EMULATE; bool xen_domid_restrict; @@ -1993,7 +1993,7 @@ char *qemu_find_file(int type, const char *name) return NULL; } -static void qemu_add_data_dir(const char *path) +void qemu_add_data_dir(const char *path) { int i; @@ -2600,6 +2600,9 @@ static bool set_memory_options(uint64_t *ram_slots, ram_addr_t *maxram_size, } sz = QEMU_ALIGN_UP(sz, 8192); + if (mc->fixup_ram_size) { + sz = mc->fixup_ram_size(sz); + } ram_size = sz; if (ram_size != sz) { error_report("ram size too large"); @@ -2799,7 +2802,10 @@ static void create_default_memdev(MachineState *ms, const char *path) } object_property_set_int(obj, ms->ram_size, "size", &error_fatal); object_property_add_child(object_get_objects_root(), mc->default_ram_id, - obj, &error_fatal); + obj); + /* Ensure backend's memory region name is equal to mc->default_ram_id */ + object_property_set_bool(obj, false, "x-use-canonical-path-for-ramblock-id", + &error_fatal); user_creatable_complete(USER_CREATABLE(obj), &error_fatal); object_unref(obj); object_property_set_str(OBJECT(ms), mc->default_ram_id, "memory-backend", @@ -3053,19 +3059,19 @@ void qemu_init(int argc, char **argv, char **envp) } break; case QEMU_OPTION_kernel: - qemu_opts_set(qemu_find_opts("machine"), 0, "kernel", optarg, + qemu_opts_set(qemu_find_opts("machine"), NULL, "kernel", optarg, &error_abort); break; case QEMU_OPTION_initrd: - qemu_opts_set(qemu_find_opts("machine"), 0, "initrd", optarg, + qemu_opts_set(qemu_find_opts("machine"), NULL, "initrd", optarg, &error_abort); break; case QEMU_OPTION_append: - qemu_opts_set(qemu_find_opts("machine"), 0, "append", optarg, + qemu_opts_set(qemu_find_opts("machine"), NULL, "append", optarg, &error_abort); break; case QEMU_OPTION_dtb: - qemu_opts_set(qemu_find_opts("machine"), 0, "dtb", optarg, + qemu_opts_set(qemu_find_opts("machine"), NULL, "dtb", optarg, &error_abort); break; case QEMU_OPTION_cdrom: @@ -3176,7 +3182,7 @@ void qemu_init(int argc, char **argv, char **envp) } break; case QEMU_OPTION_bios: - qemu_opts_set(qemu_find_opts("machine"), 0, "firmware", optarg, + qemu_opts_set(qemu_find_opts("machine"), NULL, "firmware", optarg, &error_abort); break; case QEMU_OPTION_singlestep: @@ -3512,7 +3518,8 @@ void qemu_init(int argc, char **argv, char **envp) vnc_parse(optarg, &error_fatal); break; case QEMU_OPTION_no_acpi: - acpi_enabled = 0; + olist = qemu_find_opts("machine"); + qemu_opts_parse_noisily(olist, "acpi=off", false); break; case QEMU_OPTION_no_hpet: no_hpet = 1; @@ -3524,8 +3531,10 @@ void qemu_init(int argc, char **argv, char **envp) no_shutdown = 1; break; case QEMU_OPTION_show_cursor: - warn_report("The -show-cursor option is deprecated, " - "use -display {sdl,gtk},show-cursor=on instead"); + warn_report("The -show-cursor option is deprecated. Please " + "add show-cursor=on to your -display options."); + warn_report("When using the default display you can use " + "-display default,show-cursor=on"); dpy.has_show_cursor = true; dpy.show_cursor = true; break; @@ -3788,6 +3797,22 @@ void qemu_init(int argc, char **argv, char **envp) */ loc_set_none(); + /* + * Check for -cpu help and -device help before we call select_machine(), + * which will return an error if the architecture has no default machine + * type and the user did not specify one, so that the user doesn't need + * to say '-cpu help -machine something'. + */ + if (cpu_option && is_help_option(cpu_option)) { + list_cpus(cpu_option); + exit(0); + } + + if (qemu_opts_foreach(qemu_find_opts("device"), + device_help_func, NULL, NULL)) { + exit(0); + } + user_register_global_props(); replay_configure(icount_opts); @@ -3855,11 +3880,10 @@ void qemu_init(int argc, char **argv, char **envp) exit(0); } object_property_add_child(object_get_root(), "machine", - OBJECT(current_machine), &error_abort); + OBJECT(current_machine)); object_property_add_child(container_get(OBJECT(current_machine), "/unattached"), - "sysbus", OBJECT(sysbus_get_default()), - NULL); + "sysbus", OBJECT(sysbus_get_default())); if (machine_class->minimum_page_bits) { if (!set_preferred_target_page_bits(machine_class->minimum_page_bits)) { @@ -3876,11 +3900,6 @@ void qemu_init(int argc, char **argv, char **envp) qemu_set_hw_version(machine_class->hw_version); } - if (cpu_option && is_help_option(cpu_option)) { - list_cpus(cpu_option); - exit(0); - } - if (!trace_init_backends()) { exit(1); } @@ -3934,6 +3953,7 @@ void qemu_init(int argc, char **argv, char **envp) current_machine->smp.max_cpus = machine_class->default_cpus; current_machine->smp.cores = 1; current_machine->smp.threads = 1; + current_machine->smp.sockets = 1; machine_class->smp_parse(current_machine, qemu_opts_find(qemu_find_opts("smp-opts"), NULL)); @@ -4111,11 +4131,6 @@ void qemu_init(int argc, char **argv, char **envp) fsdev_init_func, NULL, &error_fatal); #endif - if (qemu_opts_foreach(qemu_find_opts("device"), - device_help_func, NULL, NULL)) { - exit(0); - } - /* * Note: we need to create block backends before * machine_set_property(), so machine properties can refer to @@ -4126,6 +4141,9 @@ void qemu_init(int argc, char **argv, char **envp) machine_opts = qemu_get_machine_opts(); qemu_opt_foreach(machine_opts, machine_set_property, current_machine, &error_fatal); + current_machine->ram_size = ram_size; + current_machine->maxram_size = maxram_size; + current_machine->ram_slots = ram_slots; /* * Note: uses machine properties such as kernel-irqchip, must run @@ -4287,12 +4305,22 @@ void qemu_init(int argc, char **argv, char **envp) backend = object_resolve_path_type(current_machine->ram_memdev_id, TYPE_MEMORY_BACKEND, NULL); + if (!backend) { + error_report("Memory backend '%s' not found", + current_machine->ram_memdev_id); + exit(EXIT_FAILURE); + } backend_size = object_property_get_uint(backend, "size", &error_abort); if (have_custom_ram_size && backend_size != ram_size) { error_report("Size specified by -m option must match size of " "explicitly specified 'memory-backend' property"); exit(EXIT_FAILURE); } + if (mem_path) { + error_report("'-mem-path' can't be used together with" + "'-machine memory-backend'"); + exit(EXIT_FAILURE); + } ram_size = backend_size; } @@ -4304,18 +4332,15 @@ void qemu_init(int argc, char **argv, char **envp) } } - current_machine->ram_size = ram_size; - current_machine->maxram_size = maxram_size; - current_machine->ram_slots = ram_slots; - parse_numa_opts(current_machine); + /* do monitor/qmp handling at preconfig state if requested */ + qemu_main_loop(); + if (machine_class->default_ram_id && current_machine->ram_size && numa_uses_legacy_mem() && !current_machine->ram_memdev_id) { create_default_memdev(current_machine, mem_path); } - /* do monitor/qmp handling at preconfig state if requested */ - qemu_main_loop(); audio_init_audiodevs();