diff options
author | Luiz Capitulino <lcapitulino@redhat.com> | 2012-04-27 13:33:36 -0300 |
---|---|---|
committer | Luiz Capitulino <lcapitulino@redhat.com> | 2012-05-08 14:30:09 -0300 |
commit | ad02b96ad86baf6dd72a43b04876b2d6ea957112 (patch) | |
tree | 3f069ea707475c64c7aa8e306b9bfbe2c27f2395 /vl.c | |
parent | 0a24c7b18eefcd1138a5c60fc77bc9b653c64082 (diff) | |
download | qemu-ad02b96ad86baf6dd72a43b04876b2d6ea957112.zip qemu-ad02b96ad86baf6dd72a43b04876b2d6ea957112.tar.gz qemu-ad02b96ad86baf6dd72a43b04876b2d6ea957112.tar.bz2 |
runstate: introduce suspended state
QEMU enters in this state when the guest suspends to ram (S3).
This is important so that HMP users and QMP clients can know that
the guest is suspended. QMP also has an event for this, but events
are not reliable and are limited (ie. a client can connect to QEMU
after the event has been emitted).
Having a different state for S3 brings a new issue, though. Every
device that doesn't run when the VM is stopped but wants to run
when the VM is suspended has to check for RUN_STATE_SUSPENDED
explicitly. This is the case for the keyboard and mouse devices,
for example.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'vl.c')
-rw-r--r-- | vl.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -366,6 +366,11 @@ static const RunStateTransition runstate_transitions_def[] = { { RUN_STATE_SHUTDOWN, RUN_STATE_PAUSED }, { RUN_STATE_SHUTDOWN, RUN_STATE_FINISH_MIGRATE }, + { RUN_STATE_DEBUG, RUN_STATE_SUSPENDED }, + { RUN_STATE_RUNNING, RUN_STATE_SUSPENDED }, + { RUN_STATE_SUSPENDED, RUN_STATE_RUNNING }, + { RUN_STATE_SUSPENDED, RUN_STATE_FINISH_MIGRATE }, + { RUN_STATE_WATCHDOG, RUN_STATE_RUNNING }, { RUN_STATE_WATCHDOG, RUN_STATE_FINISH_MIGRATE }, @@ -1420,6 +1425,7 @@ static void qemu_system_suspend(void) { pause_all_vcpus(); notifier_list_notify(&suspend_notifiers, NULL); + runstate_set(RUN_STATE_SUSPENDED); monitor_protocol_event(QEVENT_SUSPEND, NULL); is_suspended = true; } @@ -1447,6 +1453,7 @@ void qemu_system_wakeup_request(WakeupReason reason) if (!(wakeup_reason_mask & (1 << reason))) { return; } + runstate_set(RUN_STATE_RUNNING); monitor_protocol_event(QEVENT_WAKEUP, NULL); notifier_list_notify(&wakeup_notifiers, &reason); reset_requested = 1; |