[PATCH v3 5/8] x86/sev: Add a function to contain all SEV-specific setup operations

From: Melody Wang

Date: Sun Sep 20 2026 - 14:20:05 EST


To make the code clean in the boot phase, add a sev_prepare() wrapper
which contains early SEV-specific checks in order to have all that code
in a single place.

No functional changes.

Signed-off-by: Melody Wang <huibo.wang@xxxxxxx>
---
drivers/firmware/efi/libstub/x86-stub.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c
index cef32e2c82d8..49388524a61f 100644
--- a/drivers/firmware/efi/libstub/x86-stub.c
+++ b/drivers/firmware/efi/libstub/x86-stub.c
@@ -783,7 +783,7 @@ static efi_status_t exit_boot(struct boot_params *boot_params, void *handle)
return EFI_SUCCESS;
}

-static bool have_unsupported_snp_features(void)
+static bool sev_prepare(void)
{
u64 unsupported;

@@ -933,7 +933,7 @@ void __noreturn efi_stub_entry(efi_handle_t handle,

hdr = &boot_params->hdr;

- if (have_unsupported_snp_features())
+ if (sev_prepare())
efi_exit(handle, EFI_UNSUPPORTED);

if (IS_ENABLED(CONFIG_EFI_DXE_MEM_ATTRIBUTES)) {
--
2.43.0