Re: [PATCH v4 3/3] x86/efistub: Don't bother enabling SEV in the EFI stub

Ashish Kalra
2025-09-12T20:36:05Z

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().

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

If the EFI stub no longer boots the core kernel via the traditional
decompressor and jumps straight to it, there are some specific things
which i see are being setup by the decompressed kernel before passing
control to the uncompressed kernel such as calling sev_prep_identity_maps()
as part of setting up the identity map:

From sev_prep_identity_maps():

The Confidential Computing blob is used very early in uncompressed
kernel to find the in-memory CPUID table to handle CPUID
instructions. Make sure an identity-mapping exists so it can be
accessed after switchover.

Won't this setup in identity mapping be needed to find the
in-memory CPUID table as this won't exist if the EFI stub boots
directly boots the core kernel skipping the decompressor ?

Thanks,
Ashish