init, x86: Move mem_encrypt_init() into arch_cpu_finalize_init()
commit 439e17576eb47f26b78c5bbc72e344d4206d2327 upstream Invoke the X86ism mem_encrypt_init() from X86 arch_cpu_finalize_init() and remove the weak fallback from the core code. No functional change. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20230613224545.670360645@linutronix.de Signed-off-by: Daniel Sneddon <daniel.sneddon@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
theshaenix
parent
b7a6ed1c1c
commit
35eb54594d
@@ -64,6 +64,8 @@ static inline void __init sme_early_init(void) { }
|
||||
static inline void __init sme_encrypt_kernel(struct boot_params *bp) { }
|
||||
static inline void __init sme_enable(struct boot_params *bp) { }
|
||||
|
||||
static inline void mem_encrypt_init(void) { }
|
||||
|
||||
#endif /* CONFIG_AMD_MEM_ENCRYPT */
|
||||
|
||||
/*
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/kprobes.h>
|
||||
#include <linux/kgdb.h>
|
||||
#include <linux/mem_encrypt.h>
|
||||
#include <linux/smp.h>
|
||||
#include <linux/cpu.h>
|
||||
#include <linux/io.h>
|
||||
@@ -2049,4 +2050,14 @@ void __init arch_cpu_finalize_init(void)
|
||||
} else {
|
||||
fpu__init_check_bugs();
|
||||
}
|
||||
|
||||
/*
|
||||
* This needs to be called before any devices perform DMA
|
||||
* operations that might use the SWIOTLB bounce buffers. It will
|
||||
* mark the bounce buffers as decrypted so that their usage will
|
||||
* not cause "plain-text" data to be decrypted when accessed. It
|
||||
* must be called after late_time_init() so that Hyper-V x86/x64
|
||||
* hypercalls work when the SWIOTLB bounce buffers are decrypted.
|
||||
*/
|
||||
mem_encrypt_init();
|
||||
}
|
||||
|
||||
33
init/main.c
33
init/main.c
@@ -493,31 +493,6 @@ void __init __weak thread_stack_cache_init(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
void __init __weak mem_encrypt_init(void) { }
|
||||
|
||||
/* Report memory auto-initialization states for this boot. */
|
||||
static void __init report_meminit(void)
|
||||
{
|
||||
const char *stack;
|
||||
|
||||
if (IS_ENABLED(CONFIG_INIT_STACK_ALL))
|
||||
stack = "all";
|
||||
else if (IS_ENABLED(CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL))
|
||||
stack = "byref_all";
|
||||
else if (IS_ENABLED(CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF))
|
||||
stack = "byref";
|
||||
else if (IS_ENABLED(CONFIG_GCC_PLUGIN_STRUCTLEAK_USER))
|
||||
stack = "__user";
|
||||
else
|
||||
stack = "off";
|
||||
|
||||
pr_info("mem auto-init: stack:%s, heap alloc:%s, heap free:%s\n",
|
||||
stack, want_init_on_alloc(GFP_KERNEL) ? "on" : "off",
|
||||
want_init_on_free() ? "on" : "off");
|
||||
if (want_init_on_free())
|
||||
pr_info("mem auto-init: clearing system memory may take some time...\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Set up kernel memory allocators
|
||||
*/
|
||||
@@ -691,14 +666,6 @@ asmlinkage __visible void __init start_kernel(void)
|
||||
*/
|
||||
locking_selftest();
|
||||
|
||||
/*
|
||||
* This needs to be called before any devices perform DMA
|
||||
* operations that might use the SWIOTLB bounce buffers. It will
|
||||
* mark the bounce buffers as decrypted so that their usage will
|
||||
* not cause "plain-text" data to be decrypted when accessed.
|
||||
*/
|
||||
mem_encrypt_init();
|
||||
|
||||
#ifdef CONFIG_BLK_DEV_INITRD
|
||||
if (initrd_start && !initrd_below_start_ok &&
|
||||
page_to_pfn(virt_to_page((void *)initrd_start)) < min_low_pfn) {
|
||||
|
||||
Reference in New Issue
Block a user