aboutsummaryrefslogtreecommitdiff
path: root/system/vl.c
diff options
context:
space:
mode:
Diffstat (limited to 'system/vl.c')
-rw-r--r--system/vl.c54
1 files changed, 31 insertions, 23 deletions
diff --git a/system/vl.c b/system/vl.c
index 520956f..5091fe5 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -27,6 +27,7 @@
#include "qemu/datadir.h"
#include "qemu/units.h"
#include "qemu/module.h"
+#include "qemu/target-info.h"
#include "exec/cpu-common.h"
#include "exec/page-vary.h"
#include "hw/qdev-properties.h"
@@ -52,6 +53,7 @@
#include "qemu/sockets.h"
#include "qemu/accel.h"
#include "qemu/async-teardown.h"
+#include "qemu/exit-with-parent.h"
#include "hw/usb.h"
#include "hw/isa/isa.h"
#include "hw/scsi/scsi.h"
@@ -85,8 +87,8 @@
#include "migration/snapshot.h"
#include "system/tpm.h"
#include "system/dma.h"
-#include "hw/audio/soundhw.h"
-#include "audio/audio.h"
+#include "hw/audio/model.h"
+#include "qemu/audio.h"
#include "system/cpus.h"
#include "system/cpu-timers.h"
#include "exec/icount.h"
@@ -767,7 +769,7 @@ static QemuOptsList qemu_smp_opts = {
},
};
-#if defined(CONFIG_POSIX)
+#if defined(CONFIG_POSIX) && !defined(EMSCRIPTEN)
static QemuOptsList qemu_run_with_opts = {
.name = "run-with",
.head = QTAILQ_HEAD_INITIALIZER(qemu_run_with_opts.head),
@@ -783,6 +785,10 @@ static QemuOptsList qemu_run_with_opts = {
.type = QEMU_OPT_STRING,
},
{
+ .name = "exit-with-parent",
+ .type = QEMU_OPT_BOOL,
+ },
+ {
.name = "user",
.type = QEMU_OPT_STRING,
},
@@ -1191,10 +1197,7 @@ static int parse_fw_cfg(void *opaque, QemuOpts *opts, Error **errp)
return -1;
}
}
- /* For legacy, keep user files in a specific global order. */
- fw_cfg_set_order_override(fw_cfg, FW_CFG_ORDER_OVERRIDE_USER);
fw_cfg_add_file(fw_cfg, name, buf, size);
- fw_cfg_reset_order_override(fw_cfg);
return 0;
}
@@ -1564,7 +1567,7 @@ static void machine_help_func(const QDict *qdict)
GSList *el;
const char *type = qdict_get_try_str(qdict, "type");
- machines = object_class_get_list(TYPE_MACHINE, false);
+ machines = object_class_get_list(target_machine_typename(), false);
if (type) {
ObjectClass *machine_class = OBJECT_CLASS(find_machine(type, machines));
if (machine_class) {
@@ -1674,7 +1677,8 @@ static MachineClass *select_machine(QDict *qdict, Error **errp)
{
ERRP_GUARD();
const char *machine_type = qdict_get_try_str(qdict, "type");
- g_autoptr(GSList) machines = object_class_get_list(TYPE_MACHINE, false);
+ g_autoptr(GSList) machines = object_class_get_list(target_machine_typename(),
+ false);
MachineClass *machine_class = NULL;
if (machine_type) {
@@ -2266,7 +2270,7 @@ static void qemu_record_config_group(const char *group, QDict *dict,
Audiodev *dev = NULL;
Visitor *v = qobject_input_visitor_new_keyval(QOBJECT(dict));
if (visit_type_Audiodev(v, NULL, &dev, errp)) {
- audio_define(dev);
+ audio_add_audiodev(dev);
}
visit_free(v);
@@ -2733,7 +2737,7 @@ static void qemu_create_cli_devices(void)
{
DeviceOption *opt;
- soundhw_init();
+ audio_model_init();
qemu_opts_foreach(qemu_find_opts("fw_cfg"),
parse_fw_cfg, fw_cfg_find(), &error_fatal);
@@ -2744,7 +2748,6 @@ static void qemu_create_cli_devices(void)
}
/* init generic devices */
- rom_set_order_override(FW_CFG_ORDER_OVERRIDE_DEVICE);
qemu_opts_foreach(qemu_find_opts("device"),
device_init_func, NULL, &error_fatal);
QTAILQ_FOREACH(opt, &device_opts, next) {
@@ -2755,7 +2758,6 @@ static void qemu_create_cli_devices(void)
assert(ret_data == NULL); /* error_fatal aborts */
loc_pop(&opt->loc);
}
- rom_reset_order_override();
}
static bool qemu_machine_creation_done(Error **errp)
@@ -3081,7 +3083,7 @@ void qemu_init(int argc, char **argv)
model = g_strdup(qdict_get_str(dict, "model"));
qdict_del(dict, "model");
if (is_help_option(model)) {
- show_valid_soundhw();
+ audio_print_available_models();
exit(0);
}
}
@@ -3090,11 +3092,11 @@ void qemu_init(int argc, char **argv)
visit_type_Audiodev(v, NULL, &dev, &error_fatal);
visit_free(v);
if (model) {
- audio_define(dev);
- select_soundhw(model, dev->id);
+ audio_add_audiodev(dev);
+ audio_set_model(model, dev->id);
g_free(model);
} else {
- audio_define_default(dev, &error_fatal);
+ audio_add_default_audiodev(dev, &error_fatal);
}
break;
}
@@ -3528,10 +3530,6 @@ void qemu_init(int argc, char **argv)
prom_envs[nb_prom_envs] = optarg;
nb_prom_envs++;
break;
- case QEMU_OPTION_old_param:
- warn_report("-old-param is deprecated");
- old_param = 1;
- break;
case QEMU_OPTION_rtc:
opts = qemu_opts_parse_noisily(qemu_find_opts("rtc"), optarg,
false);
@@ -3678,7 +3676,7 @@ void qemu_init(int argc, char **argv)
case QEMU_OPTION_nouserconfig:
/* Nothing to be parsed here. Especially, do not error out below. */
break;
-#if defined(CONFIG_POSIX)
+#if defined(CONFIG_POSIX) && !defined(EMSCRIPTEN)
case QEMU_OPTION_daemonize:
os_set_daemonize(true);
break;
@@ -3698,6 +3696,14 @@ void qemu_init(int argc, char **argv)
if (str) {
os_set_chroot(str);
}
+ if (qemu_opt_get_bool(opts, "exit-with-parent", false)) {
+ if (!can_exit_with_parent()) {
+ error_report("exit-with-parent is not available"
+ " on this platform");
+ exit(1);
+ }
+ set_exit_with_parent();
+ }
str = qemu_opt_get(opts, "user");
if (str) {
if (!os_set_runas(str)) {
@@ -3824,7 +3830,7 @@ void qemu_init(int argc, char **argv)
migration_object_init();
/* parse features once if machine provides default cpu_type */
- current_machine->cpu_type = machine_class_default_cpu_type(machine_class);
+ current_machine->cpu_type = machine_default_cpu_type(current_machine);
if (cpu_option) {
current_machine->cpu_type = parse_cpu_option(cpu_option);
}
@@ -3845,6 +3851,8 @@ void qemu_init(int argc, char **argv)
}
qemu_init_displays();
accel_setup_post(current_machine);
- os_setup_post();
+ if (migrate_mode() != MIG_MODE_CPR_EXEC) {
+ os_setup_post();
+ }
resume_mux_open();
}