#include "qemu/osdep.h"
#include "qemu-common.h"
#include "qemu/units.h"
+#include "hw/qdev-properties.h"
#include "qapi/error.h"
#include "qemu-version.h"
#include "qemu/cutils.h"
#include "qemu/help_option.h"
#include "qemu/uuid.h"
+#include "sysemu/reset.h"
+#include "sysemu/runstate.h"
#include "sysemu/seccomp.h"
#include "sysemu/tcg.h"
#include "qemu/error-report.h"
#include "qemu/sockets.h"
-#include "hw/hw.h"
#include "sysemu/accel.h"
#include "hw/usb.h"
#include "hw/isa/isa.h"
#include "hw/firmware/smbios.h"
#include "hw/acpi/acpi.h"
#include "hw/xen/xen.h"
-#include "hw/qdev.h"
#include "hw/loader.h"
#include "monitor/qdev.h"
#include "sysemu/bt.h"
return 1;
}
-struct vm_change_state_entry {
+struct VMChangeStateEntry {
VMChangeStateHandler *cb;
void *opaque;
- QTAILQ_ENTRY(vm_change_state_entry) entries;
+ QTAILQ_ENTRY(VMChangeStateEntry) entries;
int priority;
};
-static QTAILQ_HEAD(, vm_change_state_entry) vm_change_state_head;
+static QTAILQ_HEAD(, VMChangeStateEntry) vm_change_state_head;
/**
* qemu_add_vm_change_state_handler_prio:
} else {
qemu_devices_reset();
}
- if (reason != SHUTDOWN_CAUSE_SUBSYSTEM_RESET) {
+ if (reason && reason != SHUTDOWN_CAUSE_SUBSYSTEM_RESET) {
qapi_event_send_reset(shutdown_caused_by_guest(reason), reason);
}
cpu_synchronize_all_post_reset();
char *dir, **dirs;
BlockdevOptionsQueue bdo_queue = QSIMPLEQ_HEAD_INITIALIZER(bdo_queue);
+ os_set_line_buffering();
+
error_init(argv[0]);
module_call_init(MODULE_INIT_TRACE);
migration_object_init();
if (qtest_chrdev) {
- qtest_init(qtest_chrdev, qtest_log, &error_fatal);
+ qtest_server_init(qtest_chrdev, qtest_log, &error_fatal);
}
machine_opts = qemu_get_machine_opts();
semihosting_arg_fallback(kernel_filename, kernel_cmdline);
}
- os_set_line_buffering();
-
/* spice needs the timers to be initialized by this point */
qemu_spice_init();
*/
migration_shutdown();
+ /*
+ * We must cancel all block jobs while the block layer is drained,
+ * or cancelling will be affected by throttling and thus may block
+ * for an extended period of time.
+ * vm_shutdown() will bdrv_drain_all(), so we may as well include
+ * it in the drained section.
+ * We do not need to end this section, because we do not want any
+ * requests happening from here on anyway.
+ */
+ bdrv_drain_all_begin();
+
/* No more vcpu or device emulation activity beyond this point */
vm_shutdown();