All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ard Biesheuvel" <ardb+git@google.com>, linux-efi@vger.kernel.org
Cc: "Ard Biesheuvel" <ardb@kernel.org>,
	"Borislav Petkov" <bp@alien8.de>,
	"Tom Lendacky" <thomas.lendacky@amd.com>,
	"Ashish Kalra" <Ashish.Kalra@amd.com>
Subject: Re: [PATCH v2 2/3] x86/sev: Check for SVSM GHCB event support in svsm_setup_ca()
Date: Fri, 04 Dec 2026 16:41:11 +0000	[thread overview]
Message-ID: <sashiko-outbox-250209@kernel.org> (raw)
In-Reply-To: <20261204154842.414894-7-ardb+git@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] x86/sev: wrong termination reason in svsm_setup_ca() on protocol
  failure
--

commit 639cfa984764f41b3b4fc2ff75b221d418a19a04
Author: Ard Biesheuvel <ardb@kernel.org>

x86/sev: Check for SVSM GHCB event support in svsm_setup_ca()

This commit moves the GHCB_HV_FT_SNP_MULTI_VMPL hypervisor feature check
from the decompressor's sev_enable() into the shared svsm_setup_ca()
helper, and moves sev_es_negotiate_protocol() into the shared startup
code so it can be called beforehand.

> diff --git a/arch/x86/boot/startup/sev-shared.c b/arch/x86/boot/startup/sev-shared.c
> index d9ac3a929d335..c6648501433e7 100644
> --- a/arch/x86/boot/startup/sev-shared.c
> +++ b/arch/x86/boot/startup/sev-shared.c

[ ... ]

> @@ -722,6 +743,17 @@ static bool __init svsm_setup_ca(const struct cc_blob_sev_info *cc_info,
>  	if (!rmpadjust((unsigned long)page, RMP_PG_SIZE_4K, 1))
>  		return false;
>  
> +	/*
> +	 * Running at VMPL0 is required unless an SVSM is present and the
> +	 * hypervisor supports the required SVSM GHCB events. The hypervisor
> +	 * features are only available from GHCB version 2 onward, and this
> +	 * code may run before the GHCB protocol version has been negotiated,
> +	 * so take care of that first.
> +	 */
> +	if (!sev_es_negotiate_protocol() ||
> +	    !(get_hv_features() & GHCB_HV_FT_SNP_MULTI_VMPL))
> +		sev_es_terminate(SEV_TERM_SET_LINUX, GHCB_TERM_NOT_VMPL0);

[Severity: Low]
Should a sev_es_negotiate_protocol() failure terminate with
SEV_TERM_SET_GEN / GHCB_SEV_ES_PROT_UNSUPPORTED instead of
GHCB_TERM_NOT_VMPL0?

svsm_setup_ca() runs before sev_enable() negotiates the protocol, so a
failed negotiation on a non-VMPL0 guest now reports the Linux-specific
GHCB_TERM_NOT_VMPL0 reason instead of the standard GHCB code, misleading
host diagnostics.

Checking !sev_es_negotiate_protocol() separately would preserve the
previous termination reason.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204154842.414894-5-ardb+git@google.com?part=2

  reply	other threads:[~2026-12-04 16:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 15:48 [PATCH v2 0/3] x86/efistub: Omit SEV-SNP init from the stub Ard Biesheuvel
2026-12-04 15:48 ` [PATCH v2 1/3] x86/efistub: Obtain SEV CC blob address " Ard Biesheuvel
2026-12-04 15:48 ` [PATCH v2 2/3] x86/sev: Check for SVSM GHCB event support in svsm_setup_ca() Ard Biesheuvel
2026-12-04 16:41   ` sashiko-bot [this message]
2026-12-04 15:48 ` [PATCH v2 3/3] x86/efistub: Don't bother enabling SEV in the EFI stub Ard Biesheuvel
2026-12-04 17:11   ` sashiko-bot
2026-12-05  8:53     ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-250209@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Ashish.Kalra@amd.com \
    --cc=ardb+git@google.com \
    --cc=ardb@kernel.org \
    --cc=bp@alien8.de \
    --cc=linux-efi@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=thomas.lendacky@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.