}
}
+void qemu_system_guest_crashloaded(GuestPanicInformation *info)
+{
+ qemu_log_mask(LOG_GUEST_ERROR, "Guest crash loaded");
+
+ qapi_event_send_guest_crashloaded(GUEST_PANIC_ACTION_RUN,
+ !!info, info);
+
+ if (info) {
+ qapi_free_GuestPanicInformation(info);
+ }
+}
+
void qemu_system_reset_request(ShutdownCause reason)
{
if (no_reboot && reason != SHUTDOWN_CAUSE_SUBSYSTEM_RESET) {
RunState r;
ShutdownCause request;
- if (runstate_check(RUN_STATE_FINISH_MIGRATE)) {
- return false;
- }
if (preconfig_exit_requested) {
if (runstate_check(RUN_STATE_PRECONFIG)) {
runstate_set(RUN_STATE_PRELAUNCH);
pause_all_vcpus();
qemu_system_reset(request);
resume_all_vcpus();
+ /*
+ * runstate can change in pause_all_vcpus()
+ * as iothread mutex is unlocked
+ */
if (!runstate_check(RUN_STATE_RUNNING) &&
- !runstate_check(RUN_STATE_INMIGRATE)) {
+ !runstate_check(RUN_STATE_INMIGRATE) &&
+ !runstate_check(RUN_STATE_FINISH_MIGRATE)) {
runstate_set(RUN_STATE_PRELAUNCH);
}
}
{
const char *opts;
+ if (is_help_option(p)) {
+ qemu_display_help();
+ exit(0);
+ }
+
if (strstart(p, "sdl", &opts)) {
/*
* sdl DisplayType needs hand-crafted parser instead of
static void configure_accelerators(const char *progname)
{
const char *accel;
- char **accel_list, **tmp;
- bool accel_initialised = false;
bool init_failed = false;
qemu_opts_foreach(qemu_find_opts("icount"),
accel = qemu_opt_get(qemu_get_machine_opts(), "accel");
if (QTAILQ_EMPTY(&qemu_accel_opts.head)) {
+ char **accel_list, **tmp;
+
if (accel == NULL) {
/* Select the default accelerator */
- if (!accel_find("tcg") && !accel_find("kvm")) {
- error_report("No accelerator selected and"
- " no default accelerator available");
- exit(1);
- } else {
- int pnlen = strlen(progname);
- if (pnlen >= 3 && g_str_equal(&progname[pnlen - 3], "kvm")) {
+ bool have_tcg = accel_find("tcg");
+ bool have_kvm = accel_find("kvm");
+
+ if (have_tcg && have_kvm) {
+ if (g_str_has_suffix(progname, "kvm")) {
/* If the program name ends with "kvm", we prefer KVM */
accel = "kvm:tcg";
} else {
accel = "tcg:kvm";
}
+ } else if (have_kvm) {
+ accel = "kvm";
+ } else if (have_tcg) {
+ accel = "tcg";
+ } else {
+ error_report("No accelerator selected and"
+ " no default accelerator available");
+ exit(1);
}
}
-
accel_list = g_strsplit(accel, ":", 0);
- for (tmp = accel_list; !accel_initialised && tmp && *tmp; tmp++) {
+ for (tmp = accel_list; *tmp; tmp++) {
/*
* Filter invalid accelerators here, to prevent obscenities
* such as "-machine accel=tcg,,thread=single".
error_report("invalid accelerator %s", *tmp);
}
}
+ g_strfreev(accel_list);
} else {
if (accel != NULL) {
error_report("The -accel and \"-machine accel=\" options are incompatible");
}
if (init_failed) {
- AccelClass *ac = ACCEL_GET_CLASS(current_machine->accelerator);
+ AccelClass *ac = ACCEL_GET_CLASS(current_accel());
error_report("falling back to %s", ac->name);
}
/* Open the logfile at this point and set the log mask if necessary.
*/
- if (log_file) {
- qemu_set_log_filename(log_file, &error_fatal);
- }
-
+ qemu_set_log_filename(log_file, &error_fatal);
if (log_mask) {
int mask;
mask = qemu_str_to_log_mask(log_mask);
qemu_opts_foreach(qemu_find_opts("mon"),
mon_init_func, NULL, &error_fatal);
+ /* connect semihosting console input if requested */
+ qemu_semihosting_console_init();
+
if (foreach_device_config(DEV_SERIAL, serial_parse) < 0)
exit(1);
if (foreach_device_config(DEV_PARALLEL, parallel_parse) < 0)
/* TODO: once all bus devices are qdevified, this should be done
* when bus is created by qdev.c */
- qemu_register_reset(qbus_reset_all_fn, sysbus_get_default());
+ /*
+ * TODO: If we had a main 'reset container' that the whole system
+ * lived in, we could reset that using the multi-phase reset
+ * APIs. For the moment, we just reset the sysbus, which will cause
+ * all devices hanging off it (and all their child buses, recursively)
+ * to be reset. Note that this will *not* reset any Device objects
+ * which are not attached to some part of the qbus tree!
+ */
+ qemu_register_reset(resettable_cold_reset_fn, sysbus_get_default());
qemu_run_machine_init_done_notifiers();
if (rom_check_and_register_reset() != 0) {