From 95b363b5c643d8ad81c5377726e753b84c909037 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Thu, 23 Feb 2012 13:45:19 +0100 Subject: suspend: add infrastructure This patch adds some infrastructure to handle suspend and resume to qemu. First there are two functions to switch state and second there is a suspend notifier: * qemu_system_suspend_request is supposed to be called when the guest asks for being be suspended, for example via ACPI. * qemu_system_wakeup_request is supposed to be called on events which should wake up the guest. * qemu_register_suspend_notifier can be used to register a notifier which will be called when the guest is suspended. Machine types and device models can hook in there to modify state if needed. * qemu_register_wakeup_notifier can be used to register a notifier which will be called when the guest is woken up. Machine types and device models can hook in there to modify state if needed. * qemu_system_wakeup_enable can be used to enable/disable wakeup events. Signed-off-by: Gerd Hoffmann Signed-off-by: Anthony Liguori --- sysemu.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'sysemu.h') diff --git a/sysemu.h b/sysemu.h index 9d5ce33..af73813 100644 --- a/sysemu.h +++ b/sysemu.h @@ -38,7 +38,16 @@ void vm_start(void); void vm_stop(RunState state); void vm_stop_force_state(RunState state); +typedef enum WakeupReason { + QEMU_WAKEUP_REASON_OTHER = 0, +} WakeupReason; + void qemu_system_reset_request(void); +void qemu_system_suspend_request(void); +void qemu_register_suspend_notifier(Notifier *notifier); +void qemu_system_wakeup_request(WakeupReason reason); +void qemu_system_wakeup_enable(WakeupReason reason, bool enabled); +void qemu_register_wakeup_notifier(Notifier *notifier); void qemu_system_shutdown_request(void); void qemu_system_powerdown_request(void); void qemu_system_debug_request(void); -- cgit v1.1