Patch "init, x86: Move mem_encrypt_init() into arch_cpu_finalize_init()" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    init, x86: Move mem_encrypt_init() into arch_cpu_finalize_init()

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     init-x86-move-mem_encrypt_init-into-arch_cpu_finalize_init.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From 555b9962472818fba44eb42f31cfd1e118d20478 Mon Sep 17 00:00:00 2001
From: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Date: Wed, 14 Jun 2023 01:39:41 +0200
Subject: init, x86: Move mem_encrypt_init() into arch_cpu_finalize_init()

From: Thomas Gleixner <tglx@xxxxxxxxxxxxx>

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@xxxxxxxxxxxxx>
Link: https://lore.kernel.org/r/20230613224545.670360645@xxxxxxxxxxxxx
Signed-off-by: Daniel Sneddon <daniel.sneddon@xxxxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 arch/x86/include/asm/mem_encrypt.h |    2 ++
 arch/x86/kernel/cpu/common.c       |   11 +++++++++++
 init/main.c                        |   11 -----------
 3 files changed, 13 insertions(+), 11 deletions(-)

--- a/arch/x86/include/asm/mem_encrypt.h
+++ b/arch/x86/include/asm/mem_encrypt.h
@@ -77,6 +77,8 @@ early_set_memory_decrypted(unsigned long
 static inline int __init
 early_set_memory_encrypted(unsigned long vaddr, unsigned long size) { return 0; }
 
+static inline void mem_encrypt_init(void) { }
+
 #define __bss_decrypted
 
 #endif	/* CONFIG_AMD_MEM_ENCRYPT */
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -17,6 +17,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>
@@ -2209,4 +2210,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();
 }
--- a/init/main.c
+++ b/init/main.c
@@ -93,7 +93,6 @@
 #include <linux/cache.h>
 #include <linux/rodata_test.h>
 #include <linux/jump_label.h>
-#include <linux/mem_encrypt.h>
 
 #include <asm/io.h>
 #include <asm/setup.h>
@@ -503,8 +502,6 @@ void __init __weak thread_stack_cache_in
 }
 #endif
 
-void __init __weak mem_encrypt_init(void) { }
-
 void __init __weak poking_init(void) { }
 
 void __init __weak pgtable_cache_init(void) { }
@@ -720,14 +717,6 @@ asmlinkage __visible void __init start_k
 	 */
 	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) {


Patches currently in stable-queue which might be from tglx@xxxxxxxxxxxxx are

queue-5.4/x86-cpu-switch-to-arch_cpu_finalize_init.patch
queue-5.4/arm-cpu-switch-to-arch_cpu_finalize_init.patch
queue-5.4/um-cpu-switch-to-arch_cpu_finalize_init.patch
queue-5.4/mips-cpu-switch-to-arch_cpu_finalize_init.patch
queue-5.4/init-x86-move-mem_encrypt_init-into-arch_cpu_finalize_init.patch
queue-5.4/sh-cpu-switch-to-arch_cpu_finalize_init.patch
queue-5.4/init-invoke-arch_cpu_finalize_init-earlier.patch
queue-5.4/x86-xen-fix-secondary-processors-fpu-initialization.patch
queue-5.4/x86-fpu-move-fpu-initialization-into-arch_cpu_finalize_init.patch
queue-5.4/init-remove-check_bugs-leftovers.patch
queue-5.4/init-provide-arch_cpu_finalize_init.patch
queue-5.4/m68k-cpu-switch-to-arch_cpu_finalize_init.patch
queue-5.4/sparc-cpu-switch-to-arch_cpu_finalize_init.patch
queue-5.4/x86-fpu-mark-init-functions-__init.patch
queue-5.4/ia64-cpu-switch-to-arch_cpu_finalize_init.patch
queue-5.4/x86-fpu-remove-cpuinfo-argument-from-init-functions.patch



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux