Re: [PATCH Part1 v5 33/38] x86/sev: Provide support for SNP guest request NAEs

From: Tom Lendacky
Date: Fri Aug 27 2021 - 16:32:04 EST


On 8/27/21 3:17 PM, Borislav Petkov wrote:
On Fri, Aug 27, 2021 at 02:57:11PM -0500, Tom Lendacky wrote:
The main thing about this is that it is an error code from the HV on
extended guest requests. The HV error code sits in the high-order 32-bits of
the SW_EXIT_INFO_2 field. So defining it either way seems a bit confusing.
To me, the value should just be 1ULL and then it should be shifted when
assigning it to the SW_EXIT_INFO_2.

Err, that's from the GHCB spec:

"The hypervisor must validate that the guest has supplied enough pages

...

certificate data in the RBX register and set the SW_EXITINFO2 field to
0x0000000100000000."

So if you wanna do the above, you need to fix the spec first. I'd say.

:-)

See the NAE Event table that documents "State from Hypervisor" where it says the upper 32-bits (63:32) will contain the return code from the hypervisor.

In the case you quoted, that specific situation is documented to return a hypervisor return code of 1 (since the hypervisor return code occupies bits 63:32). The hypervisor is free to return other values, that need not be documented in spec, if it encounters other types of unforeseeable errors.

Thanks,
Tom