From: Brian Gerst <brgerst@gmail.com>
To: linux-kernel@vger.kernel.org, x86@kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>,
Borislav Petkov <bp@alien8.de>, "H . Peter Anvin" <hpa@zytor.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>, Brian Gerst <brgerst@gmail.com>
Subject: [PATCH v2 3/6] x86/boot: Clean up get_cmd_line_ptr()
Date: Wed, 12 Apr 2023 14:44:59 -0400 [thread overview]
Message-ID: <20230412184502.145289-4-brgerst@gmail.com> (raw)
In-Reply-To: <20230412184502.145289-1-brgerst@gmail.com>
Pass in the boot_params pointer, and use the appropriate return type.
Signed-off-by: Brian Gerst <brgerst@gmail.com>
---
arch/x86/kernel/head64.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index 6e0f53a66678..08ea521041bf 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -434,19 +434,18 @@ void __init clear_bss(void)
(unsigned long) __brk_limit - (unsigned long) __brk_base);
}
-static unsigned long get_cmd_line_ptr(void)
+static char *get_cmd_line_ptr(struct boot_params *bp)
{
- unsigned long cmd_line_ptr = boot_params.hdr.cmd_line_ptr;
+ unsigned long cmd_line_ptr = bp->hdr.cmd_line_ptr;
- cmd_line_ptr |= (u64)boot_params.ext_cmd_line_ptr << 32;
+ cmd_line_ptr |= (u64)bp->ext_cmd_line_ptr << 32;
- return cmd_line_ptr;
+ return (char *)cmd_line_ptr;
}
static void __init copy_bootdata(char *real_mode_data)
{
- char * command_line;
- unsigned long cmd_line_ptr;
+ char *cmd_line_ptr;
/*
* If SME is active, this will create decrypted mappings of the
@@ -455,11 +454,9 @@ static void __init copy_bootdata(char *real_mode_data)
sme_map_bootdata(real_mode_data);
memcpy(&boot_params, real_mode_data, sizeof(boot_params));
- cmd_line_ptr = get_cmd_line_ptr();
- if (cmd_line_ptr) {
- command_line = __va(cmd_line_ptr);
- memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
- }
+ cmd_line_ptr = get_cmd_line_ptr(&boot_params);
+ if (cmd_line_ptr)
+ memcpy(boot_command_line, __va(cmd_line_ptr), COMMAND_LINE_SIZE);
/*
* The old boot data is no longer needed and won't be reserved,
--
2.39.2
next prev parent reply other threads:[~2023-04-12 18:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-12 18:44 [PATCH v2 0/6] x86/boot: Clean up handling of boot_params pointer Brian Gerst
2023-04-12 18:44 ` [PATCH v2 1/6] x86/boot: Move sanitize_boot_params() Brian Gerst
2023-04-12 18:44 ` [PATCH v2 2/6] x86/boot: Remove extra call to copy_bootdata() Brian Gerst
2023-04-12 18:44 ` Brian Gerst [this message]
2023-04-12 18:45 ` [PATCH v2 4/6] x86/boot: Move copy_bootdata() to very early boot Brian Gerst
2023-04-12 18:45 ` [PATCH v2 5/6] x86/boot: Use copied boot data in __startup_64() Brian Gerst
2023-04-12 18:45 ` [PATCH v2 6/6] x86/boot: Use copied boot data in sme_enable() Brian Gerst
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230412184502.145289-4-brgerst@gmail.com \
--to=brgerst@gmail.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox