On 10/7/25 01:16, Philippe Mathieu-Daudé wrote:
The same code is duplicated 3 times: factor a common method.
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
---
accel/kvm/kvm-all.c | 47 ++++++++++++++++++---------------------------
1 file changed, 19 insertions(+), 28 deletions(-)
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 9060599cd73..de79f4ca099 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -2935,22 +2935,32 @@ void kvm_cpu_synchronize_state(CPUState *cpu)
}
}
-static void do_kvm_cpu_synchronize_post_reset(CPUState *cpu, run_on_cpu_data arg)
+static bool kvm_cpu_synchronize_put(CPUState *cpu, KvmPutState state,
+ const char *desc)
{
Error *err = NULL;
- int ret = kvm_arch_put_registers(cpu, KVM_PUT_RESET_STATE, &err);
+ int ret = kvm_arch_put_registers(cpu, state, &err);
if (ret) {
if (err) {
- error_reportf_err(err, "Restoring resisters after reset: ");
+ error_reportf_err(err, "Restoring resisters %s: ", desc);
} else {
- error_report("Failed to put registers after reset: %s",
+ error_report("Failed to put registers %s: %s", desc,
strerror(-ret));
}
Reviewed-by: Richard Henderson <[email protected]>
For the to-do list: the arch routine really should be using error_setg_errno, not
deferring the test of errno to here. But it seems i386 is the only target that actually
sets errp.
r~