aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorLuiz Capitulino <lcapitulino@redhat.com>2012-08-08 17:29:17 -0300
committerLuiz Capitulino <lcapitulino@redhat.com>2012-08-13 16:10:18 -0300
commit1405819637f53ed8021067eb3ea52e32bef2870b (patch)
tree6df885c8b79fe3aa75fdb26b4f6e9751e7029485 /vl.c
parent08b76b9fc3f0c25f062216955411aefaefabff89 (diff)
qmp: don't emit the RESET event on wakeup from S3
QEMU is basically using reset logic when waking up from S3. This causes the QMP RESET event to be emitted, which is wrong. Also, the runstate checks done in reset are not necessary for S3 wakeup. Fix this by untangling wakeup from reset logic and passing VMRESET_SILENT to qemu_system_reset() to avoid emitting the RESET event. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/vl.c b/vl.c
index 91076f0e7c..68fa0a060f 100644
--- a/vl.c
+++ b/vl.c
@@ -1298,6 +1298,7 @@ static pid_t shutdown_pid;
static int powerdown_requested;
static int debug_requested;
static int suspend_requested;
+static int wakeup_requested;
static NotifierList suspend_notifiers =
NOTIFIER_LIST_INITIALIZER(suspend_notifiers);
static NotifierList wakeup_notifiers =
@@ -1352,6 +1353,13 @@ static int qemu_suspend_requested(void)
return r;
}
+static int qemu_wakeup_requested(void)
+{
+ int r = wakeup_requested;
+ wakeup_requested = 0;
+ return r;
+}
+
int qemu_powerdown_requested(void)
{
int r = powerdown_requested;
@@ -1459,7 +1467,7 @@ void qemu_system_wakeup_request(WakeupReason reason)
runstate_set(RUN_STATE_RUNNING);
monitor_protocol_event(QEVENT_WAKEUP, NULL);
notifier_list_notify(&wakeup_notifiers, &reason);
- reset_requested = 1;
+ wakeup_requested = 1;
qemu_notify_event();
}
@@ -1539,6 +1547,12 @@ static bool main_loop_should_exit(void)
runstate_set(RUN_STATE_PAUSED);
}
}
+ if (qemu_wakeup_requested()) {
+ pause_all_vcpus();
+ cpu_synchronize_all_states();
+ qemu_system_reset(VMRESET_SILENT);
+ resume_all_vcpus();
+ }
if (qemu_powerdown_requested()) {
monitor_protocol_event(QEVENT_POWERDOWN, NULL);
qemu_irq_raise(qemu_system_powerdown);