#include "crypto/init.h"
#include "sysemu/replay.h"
#include "qapi/qmp/qerror.h"
+#include "sysemu/iothread.h"
#define MAX_VIRTIO_CONSOLES 1
#define MAX_SCLP_CONSOLES 1
static void version(void)
{
- printf("QEMU emulator version " QEMU_VERSION QEMU_PKGVERSION ", Copyright (c) 2003-2008 Fabrice Bellard\n");
+ printf("QEMU emulator version " QEMU_VERSION QEMU_PKGVERSION ", "
+ QEMU_COPYRIGHT "\n");
}
static void help(int exitcode)
}
}
+void qemu_remove_machine_init_done_notifier(Notifier *notify)
+{
+ notifier_remove(notify);
+}
+
static void qemu_run_machine_init_done_notifiers(void)
{
notifier_list_notify(&machine_init_done_notifiers, NULL);
return false;
}
+ /* Memory allocation by backends needs to be done
+ * after configure_accelerator() (due to the tcg_enabled()
+ * checks at memory_region_init_*()).
+ *
+ * Also, allocation of large amounts of memory may delay
+ * chardev initialization for too long, and trigger timeouts
+ * on software that waits for a monitor socket to be created
+ * (e.g. libvirt).
+ */
+ if (g_str_has_prefix(type, "memory-backend-")) {
+ return false;
+ }
+
return true;
}
loc_pop(&loc);
}
+static int global_init_func(void *opaque, QemuOpts *opts, Error **errp)
+{
+ GlobalProperty *g;
+
+ g = g_malloc0(sizeof(*g));
+ g->driver = qemu_opt_get(opts, "driver");
+ g->property = qemu_opt_get(opts, "property");
+ g->value = qemu_opt_get(opts, "value");
+ g->user_provided = true;
+ g->errp = &error_fatal;
+ qdev_prop_register_global(g);
+ return 0;
+}
+
int main(int argc, char **argv, char **envp)
{
int i;
qemu_opts_del(icount_opts);
}
- /* clean up network at qemu process termination */
- atexit(&net_cleanup);
-
if (default_net) {
QemuOptsList *net = qemu_find_opts("net");
qemu_opts_set(net, NULL, "type", "nic", &error_abort);
exit (i == 1 ? 1 : 0);
}
- if (machine_class->compat_props) {
- GlobalProperty *p;
- for (i = 0; i < machine_class->compat_props->len; i++) {
- p = g_array_index(machine_class->compat_props, GlobalProperty *, i);
- qdev_prop_register_global(p);
- }
- }
- qemu_add_globals();
+ machine_register_compat_props(current_machine);
+
+ qemu_opts_foreach(qemu_find_opts("global"),
+ global_init_func, NULL, NULL);
/* This checkpoint is required by replay to separate prior clock
reading from the other reads, because timer polling functions query
os_setup_post();
+ trace_init_vcpu_events();
main_loop();
replay_disable_events();
+ iothread_stop_all();
bdrv_close_all();
pause_all_vcpus();
res_free();
-#ifdef CONFIG_TPM
- tpm_cleanup();
-#endif
+
+ /* vhost-user must be cleaned up before chardevs. */
+ net_cleanup();
+ audio_cleanup();
+ monitor_cleanup();
+ qemu_chr_cleanup();
return 0;
}