]> git.proxmox.com Git - mirror_qemu.git/commitdiff
cpus: vm_was_suspended
authorSteve Sistare <steven.sistare@oracle.com>
Wed, 3 Jan 2024 20:05:30 +0000 (12:05 -0800)
committerPeter Xu <peterx@redhat.com>
Thu, 4 Jan 2024 01:52:42 +0000 (09:52 +0800)
Add a state variable to remember if a vm previously transitioned into a
suspended state.

Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Link: https://lore.kernel.org/r/1704312341-66640-2-git-send-email-steven.sistare@oracle.com
Signed-off-by: Peter Xu <peterx@redhat.com>
include/sysemu/runstate.h
system/cpus.c

index c8c2bd8a61b37000c8fdb266fc2191c50d3eb351..88a67e22b0c185bf2ecc1d05646a4d9f3026e36c 100644 (file)
@@ -51,6 +51,8 @@ int vm_prepare_start(bool step_pending);
 int vm_stop(RunState state);
 int vm_stop_force_state(RunState state);
 int vm_shutdown(void);
+void vm_set_suspended(bool suspended);
+bool vm_get_suspended(void);
 
 typedef enum WakeupReason {
     /* Always keep QEMU_WAKEUP_REASON_NONE = 0 */
index a444a747f0164ee9a998ef4b25b49a2efc4607a8..9f631ab734c743d15fca8607d46b2824d52b003a 100644 (file)
@@ -259,6 +259,21 @@ void cpu_interrupt(CPUState *cpu, int mask)
     }
 }
 
+/*
+ * True if the vm was previously suspended, and has not been woken or reset.
+ */
+static int vm_was_suspended;
+
+void vm_set_suspended(bool suspended)
+{
+    vm_was_suspended = suspended;
+}
+
+bool vm_get_suspended(void)
+{
+    return vm_was_suspended;
+}
+
 static int do_vm_stop(RunState state, bool send_stop)
 {
     int ret = 0;