x86/boot/sev: Support memory acceptance in the EFI stub under SVSM
authorArd Biesheuvel <ardb@kernel.org>
Mon, 28 Apr 2025 17:43:22 +0000 (19:43 +0200)
committerIngo Molnar <mingo@kernel.org>
Sun, 4 May 2025 06:20:27 +0000 (08:20 +0200)
commit8ed12ab1319b2d8e4a529504777aacacf71371e4
treec39f409bc983228556f1929c68348ec8e65ed5d2
parentb4432656b36e5cc1d50a1f2dc15357543add530e
x86/boot/sev: Support memory acceptance in the EFI stub under SVSM

Commit:

  d54d610243a4 ("x86/boot/sev: Avoid shared GHCB page for early memory acceptance")

provided a fix for SEV-SNP memory acceptance from the EFI stub when
running at VMPL #0. However, that fix was insufficient for SVSM SEV-SNP
guests running at VMPL >0, as those rely on a SVSM calling area, which
is a shared buffer whose address is programmed into a SEV-SNP MSR, and
the SEV init code that sets up this calling area executes much later
during the boot.

Given that booting via the EFI stub at VMPL >0 implies that the firmware
has configured this calling area already, reuse it for performing memory
acceptance in the EFI stub.

Fixes: fcd042e86422 ("x86/sev: Perform PVALIDATE using the SVSM when not at VMPL0")
Tested-by: Tom Lendacky <thomas.lendacky@amd.com>
Co-developed-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: <stable@vger.kernel.org>
Cc: Dionna Amalie Glaze <dionnaglaze@google.com>
Cc: Kevin Loughlin <kevinloughlin@google.com>
Cc: linux-efi@vger.kernel.org
Link: https://lore.kernel.org/r/20250428174322.2780170-2-ardb+git@google.com
arch/x86/boot/compressed/mem.c
arch/x86/boot/compressed/sev.c
arch/x86/boot/compressed/sev.h