target/arm/machine: move cpu_post_load kvm bits to kvm_arm_cpu_post_load function

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20250512180502.2395029-37-pierrick.bouvier@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Pierrick Bouvier 2025-05-12 11:04:50 -07:00 committed by Peter Maydell
parent cb9f95996a
commit 1dfe5a0c2e
3 changed files with 16 additions and 9 deletions

View file

@ -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)

View file

@ -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:

View file

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