@samitouri / QOSamiQemu / commits / 542a9ffb1c

runstate: handle return code of EOPNOTSUPP properly from rebuild_guest()

If rebuild_guest() accelerator callback returns EOPNOTSUPP, this means that the accelerator does not support rebuilding the guest state. Handle this case properly and separately from other error return codes. Fixes: 4003e5e65fe0("hw/accel: add a per-accelerator callback to change VM accelerator handle") Reported-by: Harsh Prateek Bora <harshpb@linux.ibm.com> Signed-off-by: Ani Sinha <anisinha@redhat.com> Link: https://lore.kernel.org/r/20260310094450.35861-2-anisinha@redhat.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Ani Sinha committed Mar 10, 2026 at 15:14 UTC 542a9ffb1cb41d7ca344d15d4d39b1d0bebba681
1 file changed +3 -1
system/runstate.c
+3 -1
@@ -531,10 +531,12 @@ void qemu_system_reset(ShutdownCause reason)
531 (force_vmfd_change || !cpus_are_resettable())) {
532 if (ac->rebuild_guest) {
533 ret = ac->rebuild_guest(current_machine);
534 - if (ret < 0) {
534 + if (ret < 0 && ret != -EOPNOTSUPP) {
535 error_report("unable to rebuild guest: %s(%d)",
536 strerror(-ret), ret);
537 vm_stop(RUN_STATE_INTERNAL_ERROR);
538 + } else if (ret == -EOPNOTSUPP) {
539 + error_report("accelerator does not support reset!");
540 } else {
541 info_report("virtual machine state has been rebuilt with new "
542 "guest file handle.");