[PATCH v2 1/6] x86/boot: Move sanitize_boot_params()

Brian Gerst
2023-04-12T18:45:22Z

sanitize_boot_params() contains a static table that would need to be
addressed in a PIC manner if it were executed early in the boot process
while using the identity-mapped page tables. Separate it from
copy_bootdata().

Signed-off-by: Brian Gerst <brgerst@gmail.com>
---
arch/x86/kernel/head64.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index 387e4b12e823..4a3b195c9002 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -455,7 +455,6 @@ static void __init copy_bootdata(char *real_mode_data)
sme_map_bootdata(real_mode_data);

memcpy(&boot_params, real_mode_data, sizeof(boot_params));
- sanitize_boot_params(&boot_params);
cmd_line_ptr = get_cmd_line_ptr();
if (cmd_line_ptr) {
command_line = __va(cmd_line_ptr);
@@ -543,6 +542,8 @@ void __init x86_64_start_reservations(char *real_mode_data)
if (!boot_params.hdr.version)
copy_bootdata(__va(real_mode_data));

+ sanitize_boot_params(&boot_params);
+
x86_early_init_platform_quirks();

switch (boot_params.hdr.hardware_subarch) {
--
2.39.2