x86/efistub: Perform SNP feature test while running in the firmware
authorArd Biesheuvel <ardb@kernel.org>
Mon, 7 Aug 2023 16:27:19 +0000 (18:27 +0200)
committerBorislav Petkov (AMD) <bp@alien8.de>
Mon, 7 Aug 2023 19:03:53 +0000 (21:03 +0200)
commit31c77a50992e8dd136feed7b67073bb5f1f978cc
tree17eb4e6a59cd635dba3fb6c74a0aa50d98ed7d03
parentbc5ddceff4c14494d83449ad45c985e6cd353fce
x86/efistub: Perform SNP feature test while running in the firmware

Before refactoring the EFI stub boot flow to avoid the legacy bare metal
decompressor, duplicate the SNP feature check in the EFI stub before
handing over to the kernel proper.

The SNP feature check can be performed while running under the EFI boot
services, which means it can force the boot to fail gracefully and
return an error to the bootloader if the loaded kernel does not
implement support for all the features that the hypervisor enabled.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20230807162720.545787-23-ardb@kernel.org
arch/x86/boot/compressed/sev.c
arch/x86/include/asm/sev.h
drivers/firmware/efi/libstub/x86-stub.c