cpus: vm_was_suspended

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>
This commit is contained in:
Steve Sistare 2024-01-03 12:05:30 -08:00 committed by Peter Xu
parent 5d799717c2
commit f06f316d3e
2 changed files with 17 additions and 0 deletions

View 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 */

View 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;