Message ID | 1701380247-340457-3-git-send-email-steven.sistare@oracle.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | fix migration of suspended runstate | expand |
On Thu, Nov 30, 2023 at 01:37:15PM -0800, Steve Sistare wrote: > Add a state variable to remember if a vm previously transitioned into a > suspended state. > > Signed-off-by: Steve Sistare <steven.sistare@oracle.com> I'd even consider squashing this small patch into the next, the reasoning to have it resides there, but not a huge deal: Reviewed-by: Peter Xu <peterx@redhat.com> Thanks,
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;
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(+)