[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 06/26] cpus: vm_resume
From: |
peterx |
Subject: |
[PULL 06/26] cpus: vm_resume |
Date: |
Thu, 4 Jan 2024 12:31:51 +0800 |
From: Steve Sistare <steven.sistare@oracle.com>
Define the vm_resume helper, for use in subsequent patches.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Link:
1704312341-66640-5-git-send-email-steven.sistare@oracle.com">https://lore.kernel.org/r/1704312341-66640-5-git-send-email-steven.sistare@oracle.com
Signed-off-by: Peter Xu <peterx@redhat.com>
---
include/sysemu/runstate.h | 9 +++++++++
system/cpus.c | 9 +++++++++
2 files changed, 18 insertions(+)
diff --git a/include/sysemu/runstate.h b/include/sysemu/runstate.h
index 618eb491af..0117d243c4 100644
--- a/include/sysemu/runstate.h
+++ b/include/sysemu/runstate.h
@@ -57,6 +57,15 @@ void vm_start(void);
* @step_pending: whether any of the CPUs is about to be single-stepped by gdb
*/
int vm_prepare_start(bool step_pending);
+
+/**
+ * vm_resume: If @state is a live state, start the vm and set the state,
+ * else just set the state.
+ *
+ * @state: the state to restore
+ */
+void vm_resume(RunState state);
+
int vm_stop(RunState state);
int vm_stop_force_state(RunState state);
int vm_shutdown(void);
diff --git a/system/cpus.c b/system/cpus.c
index f162435dd4..7d2c28b1d1 100644
--- a/system/cpus.c
+++ b/system/cpus.c
@@ -748,6 +748,15 @@ void vm_start(void)
}
}
+void vm_resume(RunState state)
+{
+ if (runstate_is_live(state)) {
+ vm_start();
+ } else {
+ runstate_set(state);
+ }
+}
+
/* does a state transition even if the VM is already stopped,
current state is forgotten forever */
int vm_stop_force_state(RunState state)
--
2.41.0
- [PULL 00/26] Migration 20240104 patches, peterx, 2024/01/03
- [PULL 01/26] MAINTAINERS: Leaving Migration, peterx, 2024/01/03
- [PULL 02/26] MAINTAINERS: Remove myself as reviewer from Live Migration, peterx, 2024/01/03
- [PULL 03/26] cpus: vm_was_suspended, peterx, 2024/01/03
- [PULL 04/26] cpus: stop vm in suspended runstate, peterx, 2024/01/03
- [PULL 05/26] cpus: check running not RUN_STATE_RUNNING, peterx, 2024/01/03
- [PULL 06/26] cpus: vm_resume,
peterx <=
- [PULL 07/26] migration: propagate suspended runstate, peterx, 2024/01/03
- [PULL 08/26] migration: preserve suspended runstate, peterx, 2024/01/03
- [PULL 09/26] migration: preserve suspended for snapshot, peterx, 2024/01/03
- [PULL 10/26] migration: preserve suspended for bg_migration, peterx, 2024/01/03
- [PULL 11/26] tests/qtest: migration events, peterx, 2024/01/03
- [PULL 12/26] tests/qtest: option to suspend during migration, peterx, 2024/01/03
- [PULL 13/26] tests/qtest: precopy migration with suspend, peterx, 2024/01/03
- [PULL 14/26] tests/qtest: postcopy migration with suspend, peterx, 2024/01/03
- [PULL 15/26] migration: Remove migrate_max_downtime() declaration, peterx, 2024/01/03
- [PULL 17/26] migration: Refactor migration_incoming_setup(), peterx, 2024/01/03