[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH V6 02/14] cpus: vm_was_suspended
|
From: |
Steve Sistare |
|
Subject: |
[PATCH V6 02/14] cpus: vm_was_suspended |
|
Date: |
Thu, 30 Nov 2023 13:37:15 -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>
---
include/sysemu/runstate.h | 2 ++
system/cpus.c | 15 +++++++++++++++
2 files changed, 17 insertions(+)
diff --git a/include/sysemu/runstate.h b/include/sysemu/runstate.h
index 9e78c7f..f6a337b 100644
--- a/include/sysemu/runstate.h
+++ b/include/sysemu/runstate.h
@@ -53,6 +53,8 @@ int vm_prepare_start(bool step_pending, RunState state);
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 */
diff --git a/system/cpus.c b/system/cpus.c
index 0c60d7a..ef7a0d3 100644
--- a/system/cpus.c
+++ b/system/cpus.c
@@ -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;
--
1.8.3.1
- [PATCH V6 00/14] fix migration of suspended runstate, Steve Sistare, 2023/11/30
- [PATCH V6 02/14] cpus: vm_was_suspended,
Steve Sistare <=
- [PATCH V6 03/14] cpus: stop vm in suspended runstate, Steve Sistare, 2023/11/30
- [PATCH V6 01/14] cpus: pass runstate to vm_prepare_start, Steve Sistare, 2023/11/30
- [PATCH V6 06/14] migration: preserve suspended runstate, Steve Sistare, 2023/11/30
- [PATCH V6 05/14] migration: propagate suspended runstate, Steve Sistare, 2023/11/30
- [PATCH V6 04/14] cpus: vm_resume, Steve Sistare, 2023/11/30
- [PATCH V6 07/14] migration: preserve suspended for snapshot, Steve Sistare, 2023/11/30
- [PATCH V6 09/14] tests/qtest: migration events, Steve Sistare, 2023/11/30