Re: [PATCH 03/11] virt/coco/sev-guest: Simplify extended guest request handling

Dionna Amalie Glaze
2023-02-16T16:44:13Z

> if (ghcb->save.sw_exit_info_2) {
> /* Number of expected pages are returned in RBX */
> if (exit_code == SVM_VMGEXIT_EXT_GUEST_REQUEST &&
> - ghcb->save.sw_exit_info_2 == SNP_GUEST_REQ_INVALID_LEN)
> + ghcb->save.sw_exit_info_2 == SNP_GUEST_REQ_INVALID_LEN) {
> input->data_npages = ghcb_get_rbx(ghcb);
> + ret = -ENOSPC;
> + } else {
> + ret = -EIO;
> + }
>
> *fw_err = ghcb->save.sw_exit_info_2;
> -
> - ret = -EIO;
> }

I think *fw_err still needs to be hoisted out of this if block so that
a 0 fw_err gets written back to user space rather than the 0xff
placeholder. The 0 would more correctly indicate the lack of an error.

--
-Dionna Glaze, PhD (she/her)