Re: [PATCH v8 06/40] x86/sev: Check SEV-SNP features support

Brijesh Singh
2021-12-16T16:28:56Z

On 12/16/21 9:47 AM, Borislav Petkov wrote:

>>
>> - if (!boot_ghcb && !early_setup_sev_es())
>> + if (!boot_ghcb && !early_setup_ghcb())
>> sev_es_terminate(SEV_TERM_SET_GEN, GHCB_SEV_ES_GEN_REQ);
>
> Can you setup the GHCB in sev_enable() too, after the protocol version
> negotiation succeeds?

A good question; the GHCB page is needed only at the time of #VC. If
the second stage VC handler is not called after the sev_enable() during
the decompression stage, setting up the GHC page in sev_enable() is a
waste. But in practice, the second stage VC handler will be called
during decompression. It also brings a similar question for the kernel
proper, should we do the same over there?

Jorge did the initial ES support and may have other reasons he chose to
set up GHCB page in the handler. I was trying to avoid the flow change.
We can do this as a pre or post-SNP patch; let me know your thoughts?

>> + * SNP is supported in v2 of the GHCB spec which mandates support for HV
>> + * features. If SEV-SNP is enabled, then check if the hypervisor supports
>
> s/SEV-SNP/SNP/g
>
> And please do that everywhere in sev-specific files.
>
> This file is called sev.c and there's way too many acronyms flying
> around so the simpler the better.
>

Noted.

thanks