Skip to content

Commit 0a9567a

Browse files
committed
x86/mem_encrypt: Unbreak the AMD_MEM_ENCRYPT=n build
Moving mem_encrypt_init() broke the AMD_MEM_ENCRYPT=n because the declaration of that function was under #ifdef CONFIG_AMD_MEM_ENCRYPT and the obvious placement for the inline stub was the #else path. This is a leftover of commit 20f07a0 ("x86/sev: Move common memory encryption code to mem_encrypt.c") which made mem_encrypt_init() depend on X86_MEM_ENCRYPT without moving the prototype. That did not fail back then because there was no stub inline as the core init code had a weak function. Move both the declaration and the stub out of the CONFIG_AMD_MEM_ENCRYPT section and guard it with CONFIG_X86_MEM_ENCRYPT. Fixes: 439e175 ("init, x86: Move mem_encrypt_init() into arch_cpu_finalize_init()") Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Closes: https://lore.kernel.org/oe-kbuild-all/202306170247.eQtCJPE8-lkp@intel.com/
1 parent b81fac9 commit 0a9567a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

arch/x86/include/asm/mem_encrypt.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717

1818
#include <asm/bootparam.h>
1919

20+
#ifdef CONFIG_X86_MEM_ENCRYPT
21+
void __init mem_encrypt_init(void);
22+
#else
23+
static inline void mem_encrypt_init(void) { }
24+
#endif
25+
2026
#ifdef CONFIG_AMD_MEM_ENCRYPT
2127

2228
extern u64 sme_me_mask;
@@ -51,8 +57,6 @@ void __init mem_encrypt_free_decrypted_mem(void);
5157

5258
void __init sev_es_init_vc_handling(void);
5359

54-
void __init mem_encrypt_init(void);
55-
5660
#define __bss_decrypted __section(".bss..decrypted")
5761

5862
#else /* !CONFIG_AMD_MEM_ENCRYPT */
@@ -85,8 +89,6 @@ early_set_mem_enc_dec_hypercall(unsigned long vaddr, int npages, bool enc) {}
8589

8690
static inline void mem_encrypt_free_decrypted_mem(void) { }
8791

88-
static inline void mem_encrypt_init(void) { }
89-
9092
#define __bss_decrypted
9193

9294
#endif /* CONFIG_AMD_MEM_ENCRYPT */

0 commit comments

Comments
 (0)