[PATCH v4 1/3] x86/boot: Drop unused sev_enable() fallback

Ard Biesheuvel posted 3 patches 3 weeks, 2 days ago
[PATCH v4 1/3] x86/boot: Drop unused sev_enable() fallback
Posted by Ard Biesheuvel 3 weeks, 2 days ago
From: Ard Biesheuvel <ardb@kernel.org>

The misc.h header is not included by the EFI stub, which is the only C
caller of sev_enable(). This means the fallback for cases where
CONFIG_AMD_MEM_ENCRYPT is not set is never used, so it can be dropped.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 arch/x86/boot/compressed/misc.h | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/arch/x86/boot/compressed/misc.h b/arch/x86/boot/compressed/misc.h
index db1048621ea2..fd855e32c9b9 100644
--- a/arch/x86/boot/compressed/misc.h
+++ b/arch/x86/boot/compressed/misc.h
@@ -152,17 +152,6 @@ bool insn_has_rep_prefix(struct insn *insn);
 void sev_insn_decode_init(void);
 bool early_setup_ghcb(void);
 #else
-static inline void sev_enable(struct boot_params *bp)
-{
-	/*
-	 * bp->cc_blob_address should only be set by boot/compressed kernel.
-	 * Initialize it to 0 unconditionally (thus here in this stub too) to
-	 * ensure that uninitialized values from buggy bootloaders aren't
-	 * propagated.
-	 */
-	if (bp)
-		bp->cc_blob_address = 0;
-}
 static inline void snp_check_features(void) { }
 static inline void sev_es_shutdown_ghcb(void) { }
 static inline bool sev_es_check_ghcb_fault(unsigned long address)
-- 
2.51.0.384.g4c02a37b29-goog
Re: [PATCH v4 1/3] x86/boot: Drop unused sev_enable() fallback
Posted by Tom Lendacky 3 weeks ago
On 9/9/25 03:06, Ard Biesheuvel wrote:
> From: Ard Biesheuvel <ardb@kernel.org>
> 
> The misc.h header is not included by the EFI stub, which is the only C
> caller of sev_enable(). This means the fallback for cases where
> CONFIG_AMD_MEM_ENCRYPT is not set is never used, so it can be dropped.
> 
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>

Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>

> ---
>  arch/x86/boot/compressed/misc.h | 11 -----------
>  1 file changed, 11 deletions(-)
> 
> diff --git a/arch/x86/boot/compressed/misc.h b/arch/x86/boot/compressed/misc.h
> index db1048621ea2..fd855e32c9b9 100644
> --- a/arch/x86/boot/compressed/misc.h
> +++ b/arch/x86/boot/compressed/misc.h
> @@ -152,17 +152,6 @@ bool insn_has_rep_prefix(struct insn *insn);
>  void sev_insn_decode_init(void);
>  bool early_setup_ghcb(void);
>  #else
> -static inline void sev_enable(struct boot_params *bp)
> -{
> -	/*
> -	 * bp->cc_blob_address should only be set by boot/compressed kernel.
> -	 * Initialize it to 0 unconditionally (thus here in this stub too) to
> -	 * ensure that uninitialized values from buggy bootloaders aren't
> -	 * propagated.
> -	 */
> -	if (bp)
> -		bp->cc_blob_address = 0;
> -}
>  static inline void snp_check_features(void) { }
>  static inline void sev_es_shutdown_ghcb(void) { }
>  static inline bool sev_es_check_ghcb_fault(unsigned long address)