On 2021-12-10 09:42:58 -0600, Brijesh Singh wrote: > Version 2 of the GHCB specification added the advertisement of features > that are supported by the hypervisor. If hypervisor supports the SEV-SNP > then it must set the SEV-SNP features bit to indicate that the base > SEV-SNP is supported. > > Check the SEV-SNP feature while establishing the GHCB, if failed, > terminate the guest. > > Version 2 of GHCB specification adds several new NAEs, most of them are > optional except the hypervisor feature. Now that hypervisor feature NAE > is implemented, so bump the GHCB maximum support protocol version. > > While at it, move the GHCB protocol negotitation check from VC exception > handler to sev_enable() so that all feature detection happens before > the first VC exception. > > Signed-off-by: Brijesh Singh <brijesh.singh@xxxxxxx> > --- > arch/x86/boot/compressed/sev.c | 21 ++++++++++++++++----- > arch/x86/include/asm/sev-common.h | 6 ++++++ > arch/x86/include/asm/sev.h | 2 +- > arch/x86/include/uapi/asm/svm.h | 2 ++ > arch/x86/kernel/sev-shared.c | 20 ++++++++++++++++++++ > arch/x86/kernel/sev.c | 16 ++++++++++++++++ > 6 files changed, 61 insertions(+), 6 deletions(-) > > diff --git a/arch/x86/boot/compressed/sev.c b/arch/x86/boot/compressed/sev.c > index 0b6cc6402ac1..a0708f359a46 100644 > --- a/arch/x86/boot/compressed/sev.c > +++ b/arch/x86/boot/compressed/sev.c > @@ -119,11 +119,8 @@ static enum es_result vc_read_mem(struct es_em_ctxt *ctxt, > /* Include code for early handlers */ > #include "../../kernel/sev-shared.c" > > -static bool early_setup_sev_es(void) > +static bool early_setup_ghcb(void) > { > - if (!sev_es_negotiate_protocol()) > - sev_es_terminate(SEV_TERM_SET_GEN, GHCB_SEV_ES_PROT_UNSUPPORTED); Should the name sev_es_terminate() be changed to a more generic name, as we are simply terminating the guest, not SEV or ES as the name implies? Other than that... Reviewed-by: Venu Busireddy <venu.busireddy@xxxxxxxxxx>