[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v8 36/48] target/arm/machine: move cpu_post_load kvm bits to kvm_
From: |
Pierrick Bouvier |
Subject: |
[PATCH v8 36/48] target/arm/machine: move cpu_post_load kvm bits to kvm_arm_cpu_post_load function |
Date: |
Mon, 12 May 2025 11:04:50 -0700 |
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
target/arm/kvm_arm.h | 4 +++-
target/arm/kvm.c | 13 ++++++++++++-
target/arm/machine.c | 8 +-------
3 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
index b638e09a687..c4178d1327c 100644
--- a/target/arm/kvm_arm.h
+++ b/target/arm/kvm_arm.h
@@ -83,8 +83,10 @@ void kvm_arm_cpu_pre_save(ARMCPU *cpu);
* @cpu: ARMCPU
*
* Called from cpu_post_load() to update KVM CPU state from the cpreg list.
+ *
+ * Returns: true on success, or false if write_list_to_kvmstate failed.
*/
-void kvm_arm_cpu_post_load(ARMCPU *cpu);
+bool kvm_arm_cpu_post_load(ARMCPU *cpu);
/**
* kvm_arm_reset_vcpu:
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index b6c39ca61fa..a08a269ad61 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -938,13 +938,24 @@ void kvm_arm_cpu_pre_save(ARMCPU *cpu)
}
}
-void kvm_arm_cpu_post_load(ARMCPU *cpu)
+bool kvm_arm_cpu_post_load(ARMCPU *cpu)
{
+ if (!write_list_to_kvmstate(cpu, KVM_PUT_FULL_STATE)) {
+ return false;
+ }
+ /* Note that it's OK for the TCG side not to know about
+ * every register in the list; KVM is authoritative if
+ * we're using it.
+ */
+ write_list_to_cpustate(cpu);
+
/* KVM virtual time adjustment */
if (cpu->kvm_adjvtime) {
cpu->kvm_vtime = *kvm_arm_get_cpreg_ptr(cpu, KVM_REG_ARM_TIMER_CNT);
cpu->kvm_vtime_dirty = true;
}
+
+ return true;
}
void kvm_arm_reset_vcpu(ARMCPU *cpu)
diff --git a/target/arm/machine.c b/target/arm/machine.c
index 868246a98c0..e442d485241 100644
--- a/target/arm/machine.c
+++ b/target/arm/machine.c
@@ -976,15 +976,9 @@ static int cpu_post_load(void *opaque, int version_id)
}
if (kvm_enabled()) {
- if (!write_list_to_kvmstate(cpu, KVM_PUT_FULL_STATE)) {
+ if (!kvm_arm_cpu_post_load(cpu)) {
return -1;
}
- /* Note that it's OK for the TCG side not to know about
- * every register in the list; KVM is authoritative if
- * we're using it.
- */
- write_list_to_cpustate(cpu);
- kvm_arm_cpu_post_load(cpu);
} else {
if (!write_list_to_cpustate(cpu)) {
return -1;
--
2.47.2
- Re: [PATCH v8 30/48] target/arm/ptw: replace TARGET_AARCH64 by CONFIG_ATOMIC64 from arm_casq_ptw, (continued)
[PATCH v8 28/48] target/arm/cortex-regs: compile file once (system), Pierrick Bouvier, 2025/05/12
[PATCH v8 32/48] target/arm/meson: accelerator files are not needed in user mode, Pierrick Bouvier, 2025/05/12
[PATCH v8 31/48] target/arm/ptw: compile file once (system), Pierrick Bouvier, 2025/05/12
[PATCH v8 33/48] target/arm/kvm-stub: compile file once (system), Pierrick Bouvier, 2025/05/12
[PATCH v8 23/48] target/arm/helper: compile file twice (user, system), Pierrick Bouvier, 2025/05/12
[PATCH v8 36/48] target/arm/machine: move cpu_post_load kvm bits to kvm_arm_cpu_post_load function,
Pierrick Bouvier <=
[PATCH v8 19/48] target/arm/helper: restrict include to common helpers, Pierrick Bouvier, 2025/05/12
[PATCH v8 26/48] target/arm/arch_dump: compile file once (system), Pierrick Bouvier, 2025/05/12
[PATCH v8 35/48] target/arm/machine: remove TARGET_AARCH64 from migration state, Pierrick Bouvier, 2025/05/12
[PATCH v8 29/48] target/arm/ptw: replace target_ulong with int64_t, Pierrick Bouvier, 2025/05/12
[PATCH v8 37/48] target/arm/kvm-stub: add missing stubs, Pierrick Bouvier, 2025/05/12
[PATCH v8 38/48] target/arm/machine: compile file once (system), Pierrick Bouvier, 2025/05/12