[RFC PATCH 2/2] Revert "x86/boot: Add xloadflags bits to check for 5-level paging support"

From: Borislav Petkov
Date: Fri Mar 01 2024 - 14:10:55 EST


From: "Borislav Petkov (AMD)" <bp@xxxxxxxxx>

This reverts commit f2d08c5d3bcf3f7ef788af122b57a919efa1e9d0.

This whole dynamic switching support is silly. I don't see a use case
where one would use an old kernel with CONFIG_X86_5LEVEL disabled to
kexec into. I.e., you use pretty much the same kernel.

But I'm open to corrections.

Commit message of

f2d08c5d3bcf ("x86/boot: Add xloadflags bits to check for 5-level paging support")

claims:

The flags will be used by the kernel kexec subsystem and the userspace
kexec tools.

but they're nowhere to be found in kexec tools:

[ ~/src/kexec-tools> git describe
v2.0.28-4-g6ee2ac1bf739
[ ~/src/kexec-tools> git grep XLF_5LEVEL
[ ~/src/kexec-tools>

Zap it all.

Signed-off-by: Borislav Petkov (AMD) <bp@xxxxxxxxx>
---
arch/x86/boot/header.S | 12 +-----------
arch/x86/include/uapi/asm/bootparam.h | 2 --
2 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S
index a1bbedd989e4..0f261224acef 100644
--- a/arch/x86/boot/header.S
+++ b/arch/x86/boot/header.S
@@ -364,17 +364,7 @@ xloadflags:
# define XLF4 0
#endif

-#ifdef CONFIG_X86_64
-#ifdef CONFIG_X86_5LEVEL
-#define XLF56 (XLF_5LEVEL|XLF_5LEVEL_ENABLED)
-#else
-#define XLF56 XLF_5LEVEL
-#endif
-#else
-#define XLF56 0
-#endif
-
- .word XLF0 | XLF1 | XLF23 | XLF4 | XLF56
+ .word XLF0 | XLF1 | XLF23 | XLF4

cmdline_size: .long COMMAND_LINE_SIZE-1 #length of the command line,
#added with boot protocol
diff --git a/arch/x86/include/uapi/asm/bootparam.h b/arch/x86/include/uapi/asm/bootparam.h
index 4a38e7917756..b53b524f6ed2 100644
--- a/arch/x86/include/uapi/asm/bootparam.h
+++ b/arch/x86/include/uapi/asm/bootparam.h
@@ -22,8 +22,6 @@
#define XLF_EFI_HANDOVER_32 (1<<2)
#define XLF_EFI_HANDOVER_64 (1<<3)
#define XLF_EFI_KEXEC (1<<4)
-#define XLF_5LEVEL (1<<5)
-#define XLF_5LEVEL_ENABLED (1<<6)

#ifndef __ASSEMBLY__

--
2.43.0