[PATCH v4 4/7] x86/sev: Add a function to contain all SEV-specific setup operations
From: Melody Wang
Date: Tue Oct 13 2026 - 15:39:46 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 | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c
index cef32e2c82d8..2a1fa773d241 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;
@@ -791,9 +791,9 @@ static bool have_unsupported_snp_features(void)
if (unsupported) {
efi_err("Unsupported SEV-SNP features detected: 0x%llx\n",
unsupported);
- return true;
+ return false;
}
- return false;
+ return true;
}
static void efi_get_seed(void *seed, int size)
@@ -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