Allow silent system resets
This allows qemu_system_reset to be issued silently for internal
purposes, ie. without sending out a monitor event. Convert the system
reset after startup to the silent mode.
Signed-off-by: Jan Kiszka <[email protected]>
Signed-off-by: Luiz Capitulino <[email protected]>
diff --git a/sysemu.h b/sysemu.h
index 7e70daa..d3013f5 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -34,6 +34,9 @@
#define VMSTOP_LOADVM 7
#define VMSTOP_MIGRATE 8
+#define VMRESET_SILENT false
+#define VMRESET_REPORT true
+
void vm_start(void);
void vm_stop(int reason);
@@ -50,7 +53,7 @@
void qemu_system_killed(int signal, pid_t pid);
void qemu_kill_report(void);
extern qemu_irq qemu_system_powerdown;
-void qemu_system_reset(void);
+void qemu_system_reset(bool report);
void qemu_add_exit_notifier(Notifier *notify);
void qemu_remove_exit_notifier(Notifier *notify);
diff --git a/vl.c b/vl.c
index dbdec71..52402a2 100644
--- a/vl.c
+++ b/vl.c
@@ -1253,7 +1253,7 @@
}
}
-void qemu_system_reset(void)
+void qemu_system_reset(bool report)
{
QEMUResetEntry *re, *nre;
@@ -1261,7 +1261,9 @@
QTAILQ_FOREACH_SAFE(re, &reset_handlers, entry, nre) {
re->func(re->opaque);
}
- monitor_protocol_event(QEVENT_RESET, NULL);
+ if (report) {
+ monitor_protocol_event(QEVENT_RESET, NULL);
+ }
cpu_synchronize_all_post_reset();
}
@@ -1403,7 +1405,7 @@
if (qemu_reset_requested()) {
pause_all_vcpus();
cpu_synchronize_all_states();
- qemu_system_reset();
+ qemu_system_reset(VMRESET_REPORT);
resume_all_vcpus();
}
if (qemu_powerdown_requested()) {
@@ -3293,7 +3295,7 @@
qemu_register_reset(qbus_reset_all_fn, sysbus_get_default());
qemu_run_machine_init_done_notifiers();
- qemu_system_reset();
+ qemu_system_reset(VMRESET_SILENT);
if (loadvm) {
if (load_vmstate(loadvm) < 0) {
autostart = 0;
diff --git a/xen-all.c b/xen-all.c
index 0eac202..41fd98a 100644
--- a/xen-all.c
+++ b/xen-all.c
@@ -452,7 +452,7 @@
destroy_hvm_domain();
}
if (qemu_reset_requested_get()) {
- qemu_system_reset();
+ qemu_system_reset(VMRESET_REPORT);
}
}