Linux EFI development
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb+git@google.com>
To: 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: [PATCH v2 3/3] x86/efistub: Don't bother enabling SEV in the EFI stub
Date: Fri,  4 Dec 2026 16:48:46 +0100	[thread overview]
Message-ID: <20261204154842.414894-8-ardb+git@google.com> (raw)
In-Reply-To: <20261204154842.414894-5-ardb+git@google.com>

From: Ard Biesheuvel <ardb@kernel.org>

One of the last things the EFI stub does before handing over to the core
kernel when booting as a SEV guest is enabling SEV, even though this is
mostly redundant: one of the first things the core kernel does is
calling sme_enable(), after setting up the early GDT and IDT but before
even setting up the kernel page tables. sme_enable() performs the same
SEV-SNP initialization that the decompressor performs in sev_enable().

The only check performed by sev_enable() that was not covered by the
core kernel, i.e., whether the hypervisor supports the SVSM GHCB events
when not running at VMPL0, has been moved into svsm_setup_ca() in the
previous patch.

Note that the identity mapping of the CC blob and the secrets page that
the decompressor creates in sev_prep_identity_maps() is not needed
either, given that EFI maps all of system memory 1:1.

So let's just drop this call to sev_enable(), and rely on the core
kernel to initialize SEV correctly.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 arch/x86/include/asm/sev.h              | 2 --
 drivers/firmware/efi/libstub/x86-stub.c | 6 ------
 2 files changed, 8 deletions(-)

diff --git a/arch/x86/include/asm/sev.h b/arch/x86/include/asm/sev.h
index c7ea9845351e..3682e39ed295 100644
--- a/arch/x86/include/asm/sev.h
+++ b/arch/x86/include/asm/sev.h
@@ -462,7 +462,6 @@ static __always_inline void sev_es_nmi_complete(void)
 		__sev_es_nmi_complete();
 }
 extern int __init sev_es_efi_map_ghcbs_cas(pgd_t *pgd);
-extern void sev_enable(struct boot_params *bp);
 
 /*
  * RMPADJUST modifies the RMP permissions of a page of a lesser-
@@ -606,7 +605,6 @@ static inline void sev_es_ist_exit(void) { }
 static inline int sev_es_setup_ap_jump_table(struct real_mode_header *rmh) { return 0; }
 static inline void sev_es_nmi_complete(void) { }
 static inline int sev_es_efi_map_ghcbs_cas(pgd_t *pgd) { return 0; }
-static inline void sev_enable(struct boot_params *bp) { }
 static inline int pvalidate(unsigned long vaddr, bool rmp_psize, bool validate) { return 0; }
 static inline int rmpadjust(unsigned long vaddr, bool rmp_psize, unsigned long attrs) { return 0; }
 static inline void setup_ghcb(void) { }
diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c
index 1cceab57a738..66b98c6c0e2a 100644
--- a/drivers/firmware/efi/libstub/x86-stub.c
+++ b/drivers/firmware/efi/libstub/x86-stub.c
@@ -1052,12 +1052,6 @@ void __noreturn efi_stub_entry(efi_handle_t handle,
 		goto fail;
 	}
 
-	/*
-	 * Call the SEV init code while still running with the firmware's
-	 * GDT/IDT, so #VC exceptions will be handled by EFI.
-	 */
-	sev_enable(boot_params);
-
 	efi_5level_switch();
 
 	enter_kernel(kernel_entry, boot_params);
-- 
2.56.1.915.g69d5ec7298-goog


  parent reply	other threads:[~2026-12-04 15:48 UTC|newest]

Thread overview: 6+ 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
2026-12-04 15:48 ` Ard Biesheuvel [this message]
2026-12-04 17:11   ` [PATCH v2 3/3] x86/efistub: Don't bother enabling SEV in the EFI stub sashiko-bot

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=20261204154842.414894-8-ardb+git@google.com \
    --to=ardb+git@google.com \
    --cc=Ashish.Kalra@amd.com \
    --cc=ardb@kernel.org \
    --cc=bp@alien8.de \
    --cc=linux-efi@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox