static bool list_data_dirs;
static const char *qtest_chrdev;
static const char *qtest_log;
-static bool opt_one_insn_per_tb;
static int has_defaults = 1;
static int default_audio = 1;
static int default_vga = 1;
static int default_net = 1;
-static struct {
+static const struct {
const char *driver;
int *flag;
} default_list[] = {
+ { .driver = "xen-console", .flag = &default_serial },
{ .driver = "isa-serial", .flag = &default_serial },
{ .driver = "isa-parallel", .flag = &default_parallel },
{ .driver = "isa-fdc", .flag = &default_floppy },
static void parse_display(const char *p)
{
- const char *opts;
-
if (is_help_option(p)) {
qemu_display_help();
exit(0);
}
+#ifdef CONFIG_VNC
+ const char *opts;
+
if (strstart(p, "vnc", &opts)) {
/*
* vnc isn't a (local) DisplayType but a protocol for remote
*/
if (*opts == '=') {
vnc_parse(opts + 1);
+ display_remote++;
} else {
error_report("VNC requires a display argument vnc=<display>");
exit(1);
}
- } else {
- parse_display_qapi(p);
+ return;
}
+#endif
+
+ parse_display_qapi(p);
}
static inline bool nonempty_str(const char *str)
}
}
+static void qemu_setup_display(void)
+{
+ if (dpy.type == DISPLAY_TYPE_DEFAULT && !display_remote) {
+ if (!qemu_display_find_default(&dpy)) {
+ dpy.type = DISPLAY_TYPE_NONE;
+#if defined(CONFIG_VNC)
+ vnc_parse("localhost:0,to=99,id=default");
+ display_remote++;
+#endif
+ }
+ }
+ if (dpy.type == DISPLAY_TYPE_DEFAULT) {
+ dpy.type = DISPLAY_TYPE_NONE;
+ }
+
+ qemu_display_early_init(&dpy);
+}
+
static void qemu_create_default_devices(void)
{
MachineClass *machine_class = MACHINE_GET_CLASS(current_machine);
+ const char *vc = qemu_display_get_vc(&dpy);
if (is_daemonized()) {
/* According to documentation and historically, -nographic redirects
}
if (nographic) {
- if (default_parallel)
+ if (default_parallel) {
add_device_config(DEV_PARALLEL, "null");
+ }
if (default_serial && default_monitor) {
add_device_config(DEV_SERIAL, "mon:stdio");
} else {
- if (default_serial)
+ if (default_serial) {
add_device_config(DEV_SERIAL, "stdio");
- if (default_monitor)
+ }
+ if (default_monitor) {
monitor_parse("stdio", "readline", false);
+ }
}
} else {
- if (default_serial)
- add_device_config(DEV_SERIAL, "vc:80Cx24C");
- if (default_parallel)
- add_device_config(DEV_PARALLEL, "vc:80Cx24C");
- if (default_monitor)
- monitor_parse("vc:80Cx24C", "readline", false);
+ if (default_serial) {
+ add_device_config(DEV_SERIAL, vc ?: "null");
+ }
+ if (default_parallel) {
+ add_device_config(DEV_PARALLEL, vc ?: "null");
+ }
+ if (default_monitor && vc) {
+ monitor_parse(vc, "readline", false);
+ }
}
if (default_net) {
#endif
}
-#if defined(CONFIG_VNC)
- if (!QTAILQ_EMPTY(&(qemu_find_opts("vnc")->head))) {
- display_remote++;
- }
-#endif
- if (dpy.type == DISPLAY_TYPE_DEFAULT && !display_remote) {
- if (!qemu_display_find_default(&dpy)) {
- dpy.type = DISPLAY_TYPE_NONE;
-#if defined(CONFIG_VNC)
- vnc_parse("localhost:0,to=99,id=default");
-#endif
- }
- }
- if (dpy.type == DISPLAY_TYPE_DEFAULT) {
- dpy.type = DISPLAY_TYPE_NONE;
- }
-
/* If no default VGA is requested, the default is "none". */
if (default_vga) {
vga_model = get_default_vga_model(machine_class);
static void machine_help_func(const QDict *qdict)
{
- GSList *machines, *el;
+ g_autoptr(GSList) machines = NULL;
+ GSList *el;
const char *type = qdict_get_try_str(qdict, "type");
machines = object_class_get_list(TYPE_MACHINE, false);
"ignoring option");
}
- qemu_display_early_init(&dpy);
qemu_console_early_init();
if (dpy.has_gl && dpy.gl != DISPLAYGL_MODE_OFF && display_opengl == 0) {
static int do_configure_icount(void *opaque, QemuOpts *opts, Error **errp)
{
- icount_configure(opts, errp);
- return 0;
+ return !icount_configure(opts, errp);
}
static int accelerator_set_property(void *opaque,
qemu_opt_foreach(opts, accelerator_set_property,
accel,
&error_fatal);
- /*
- * If legacy -singlestep option is set, honour it for TCG and
- * silently ignore for any other accelerator (which is how this
- * option has always behaved).
- */
- if (opt_one_insn_per_tb) {
- /*
- * This will always succeed for TCG, and we want to ignore
- * the error from trying to set a nonexistent property
- * on any other accelerator.
- */
- object_property_set_bool(OBJECT(accel), "one-insn-per-tb", true, NULL);
- }
+
ret = accel_init_machine(accel, current_machine);
if (ret < 0) {
if (!qtest_with_kvm || ret != -ENOENT) {
}
}
+ if (loadvm && incoming) {
+ error_report("'incoming' and 'loadvm' options are mutually exclusive");
+ exit(EXIT_FAILURE);
+ }
if (loadvm && preconfig_requested) {
error_report("'preconfig' and 'loadvm' options are "
"mutually exclusive");
qemu_machine_creation_done();
if (loadvm) {
+ RunState state = autostart ? RUN_STATE_RUNNING : runstate_get();
load_snapshot(loadvm, NULL, false, NULL, &error_fatal);
+ load_snapshot_resume(state);
}
if (replay_mode != REPLAY_MODE_NONE) {
replay_vmstate_init();
case QEMU_OPTION_bios:
qdict_put_str(machine_opts_dict, "firmware", optarg);
break;
- case QEMU_OPTION_singlestep:
- opt_one_insn_per_tb = true;
- break;
case QEMU_OPTION_S:
autostart = 0;
break;
machine_parse_property_opt(qemu_find_opts("smp-opts"),
"smp", optarg);
break;
+#ifdef CONFIG_VNC
case QEMU_OPTION_vnc:
vnc_parse(optarg);
+ display_remote++;
break;
- case QEMU_OPTION_no_acpi:
- warn_report("-no-acpi is deprecated, use '-machine acpi=off' instead");
- qdict_put_str(machine_opts_dict, "acpi", "off");
- break;
- case QEMU_OPTION_no_hpet:
- warn_report("-no-hpet is deprecated, use '-machine hpet=off' instead");
- qdict_put_str(machine_opts_dict, "hpet", "off");
- break;
+#endif
case QEMU_OPTION_no_reboot:
olist = qemu_find_opts("action");
qemu_opts_parse_noisily(olist, "reboot=shutdown", false);
exit(1);
}
break;
- case QEMU_OPTION_chroot:
- warn_report("option is deprecated,"
- " use '-run-with chroot=...' instead");
- os_set_chroot(optarg);
- break;
case QEMU_OPTION_daemonize:
os_set_daemonize(true);
break;
-#if defined(CONFIG_LINUX)
- /* deprecated */
- case QEMU_OPTION_asyncteardown:
- init_async_teardown();
- break;
-#endif
case QEMU_OPTION_run_with: {
const char *str;
opts = qemu_opts_parse_noisily(qemu_find_opts("run-with"),
suspend_mux_open();
qemu_disable_default_devices();
+ qemu_setup_display();
qemu_create_default_devices();
qemu_create_early_backends();
migration_object_init();
/* parse features once if machine provides default cpu_type */
- current_machine->cpu_type = machine_class->default_cpu_type;
+ current_machine->cpu_type = machine_class_default_cpu_type(machine_class);
if (cpu_option) {
current_machine->cpu_type = parse_cpu_option(cpu_option);
}