Re: [PATCH v8 36/40] x86/sev: Provide support for SNP guest request NAEs

Borislav Petkov
2022-01-29T12:02:28Z

On Sat, Jan 29, 2022 at 05:49:06AM -0600, Brijesh Singh wrote:
> The hypervisor must validate that the guest has supplied enough pages to
> hold the certificates that will be returned before performing the SNP
> guest request. If there are not enough guest pages to hold the
> certificate table and certificate data, the hypervisor will return the
> required number of pages needed to hold the certificate table and
> certificate data in the RBX register and set the SW_EXITINFO2 field to
> 0x0000000100000000.

Then you could call that one:

#define SNP_GUEST_REQ_ERR_NUM_PAGES BIT_ULL(32)

or so, to mean what exactly that error is. Because when you read the
code, it is more "self-descriptive" this way:

...
ghcb->save.sw_exit_info_2 == SNP_GUEST_REQ_ERR_NUM_PAGES)
input->data_npages = ghcb_get_rbx(ghcb);

> It does not spell it as invalid length. However, for *similar* failure,
> the SEV-SNP spec spells out it as INVALID_LENGTH, so, I choose macro
> name as INVALID_LENGTH.

You can simply define a separate one here called ...INVALID_LENGTH.

Thx.

--
Regards/Gruss,
Boris.