On Mon, Jan 12, 2026 at 2:23 PM Ani Sinha <[email protected]> wrote:
> +    if (current_machine->cgs && reason == SHUTDOWN_CAUSE_GUEST_RESET) {

This should check (I think) !cpus_are_resettable(), instead of
current_machine->cgs.

> +        if (ac->reset_vmfd) {
> +            ret = ac->reset_vmfd(current_machine);
> +            if (ret < 0) {
> +                error_report("unable to reset vmfd: %d", ret);
> +                abort();

This should not be an abort, but it should change the runstate to
RUN_STATE_INTERNAL_ERROR.

Also, I would move the introduction of
confidential_guest_can_rebuild_state() callback even before this patch
(see upcoming review of patch 24).

At the end of the series, this should look something like:

    if (reason == SHUTDOWN_CAUSE_GUEST_RESET
        && (current_machine->new_accel_vmfd_on_reset
            || !cpus_are_resettable()) {
        if (ac->reset_vmfd) {
            ret = ac->reset_vmfd(current_machine);
            if (ret < 0) {
                 error_report(..., strerror(-ret));
                 vm_stop(RUN_STATE_INTERNAL_ERROR);
            }
        } else if (!cpus_are_resettable()) {
            error_report("accelerator does not support reset");
        } else {
            error_report("accelerator does not support
x-change-vmfd-on-reset=...,"
                        " proceeding with normal reset");
        }
    }

Paolo

> +            }
> +        }
> +    }
> +
>      if (mc && mc->reset) {
>          mc->reset(current_machine, type);
>      } else {
> --
> 2.42.0
>


Reply via email to