From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: will@kernel.org, danielwa@cisco.com, robh@kernel.org,
daniel@gimpelevich.san-francisco.ca.us
Cc: linux-arch@vger.kernel.org, devicetree@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org,
linux-arm-kernel@lists.infradead.org,
microblaze <monstr@monstr.eu>,
linux-mips@vger.kernel.org, nios2 <ley.foon.tan@intel.com>,
openrisc@lists.librecores.org, linux-hexagon@vger.kernel.org,
linux-riscv@lists.infradead.org, x86@kernel.org,
linux-xtensa@linux-xtensa.org, linux-sh@vger.kernel.org,
sparclinux@vger.kernel.org
Subject: [PATCH v3 15/17] x86: Convert to GENERIC_CMDLINE
Date: Fri, 26 Mar 2021 13:45:02 +0000 (UTC) [thread overview]
Message-ID: <db9de18cca2fb0cbc0ffd75082d2d110fe8034d2.1616765870.git.christophe.leroy@csgroup.eu> (raw)
In-Reply-To: <cover.1616765869.git.christophe.leroy@csgroup.eu>
This converts the architecture to GENERIC_CMDLINE.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
arch/x86/Kconfig | 45 ++-----------------------
arch/x86/kernel/setup.c | 17 ++--------
drivers/firmware/efi/libstub/x86-stub.c | 26 +++++++-------
3 files changed, 18 insertions(+), 70 deletions(-)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 2792879d398e..66b384228ca3 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -104,6 +104,7 @@ config X86
select ARCH_USE_QUEUED_SPINLOCKS
select ARCH_USE_SYM_ANNOTATIONS
select ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH
+ select ARCH_WANT_CMDLINE_PREPEND_BY_DEFAULT
select ARCH_WANT_DEFAULT_BPF_JIT if X86_64
select ARCH_WANTS_DYNAMIC_TASK_STRUCT
select ARCH_WANT_HUGE_PMD_SHARE
@@ -118,6 +119,7 @@ config X86
select EDAC_SUPPORT
select GENERIC_CLOCKEVENTS_BROADCAST if X86_64 || (X86_32 && X86_LOCAL_APIC)
select GENERIC_CLOCKEVENTS_MIN_ADJUST
+ select GENERIC_CMDLINE
select GENERIC_CMOS_UPDATE
select GENERIC_CPU_AUTOPROBE
select GENERIC_CPU_VULNERABILITIES
@@ -2358,49 +2360,6 @@ choice
endchoice
-config CMDLINE_BOOL
- bool "Built-in kernel command line"
- help
- Allow for specifying boot arguments to the kernel at
- build time. On some systems (e.g. embedded ones), it is
- necessary or convenient to provide some or all of the
- kernel boot arguments with the kernel itself (that is,
- to not rely on the boot loader to provide them.)
-
- To compile command line arguments into the kernel,
- set this option to 'Y', then fill in the
- boot arguments in CONFIG_CMDLINE.
-
- Systems with fully functional boot loaders (i.e. non-embedded)
- should leave this option set to 'N'.
-
-config CMDLINE
- string "Built-in kernel command string"
- depends on CMDLINE_BOOL
- default ""
- help
- Enter arguments here that should be compiled into the kernel
- image and used at boot time. If the boot loader provides a
- command line at boot time, it is appended to this string to
- form the full kernel command line, when the system boots.
-
- However, you can use the CONFIG_CMDLINE_OVERRIDE option to
- change this behavior.
-
- In most cases, the command line (whether built-in or provided
- by the boot loader) should specify the device for the root
- file system.
-
-config CMDLINE_OVERRIDE
- bool "Built-in command line overrides boot loader arguments"
- depends on CMDLINE_BOOL && CMDLINE != ""
- help
- Set this option to 'Y' to have the kernel ignore the boot loader
- command line, and use ONLY the built-in command line.
-
- This is used to work around broken boot loaders. This should
- be set to 'N' under normal conditions.
-
config MODIFY_LDT_SYSCALL
bool "Enable the LDT (local descriptor table)" if EXPERT
default y
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index d883176ef2ce..93ac57ea3e64 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -5,6 +5,7 @@
* This file contains the setup_arch() code, which handles the architecture-dependent
* parts of early kernel initialization.
*/
+#include <linux/cmdline.h>
#include <linux/console.h>
#include <linux/crash_dump.h>
#include <linux/dma-map-ops.h>
@@ -161,9 +162,6 @@ unsigned long saved_video_mode;
#define RAMDISK_LOAD_FLAG 0x4000
static char __initdata command_line[COMMAND_LINE_SIZE];
-#ifdef CONFIG_CMDLINE_BOOL
-static char __initdata builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE;
-#endif
#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
struct edd edd;
@@ -883,18 +881,7 @@ void __init setup_arch(char **cmdline_p)
bss_resource.start = __pa_symbol(__bss_start);
bss_resource.end = __pa_symbol(__bss_stop)-1;
-#ifdef CONFIG_CMDLINE_BOOL
-#ifdef CONFIG_CMDLINE_OVERRIDE
- strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
-#else
- if (builtin_cmdline[0]) {
- /* append boot loader cmdline to builtin */
- strlcat(builtin_cmdline, " ", COMMAND_LINE_SIZE);
- strlcat(builtin_cmdline, boot_command_line, COMMAND_LINE_SIZE);
- strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
- }
-#endif
-#endif
+ cmdline_build(boot_command_line, boot_command_line, COMMAND_LINE_SIZE);
strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
*cmdline_p = command_line;
diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c
index f14c4ff5839f..5413aff010ec 100644
--- a/drivers/firmware/efi/libstub/x86-stub.c
+++ b/drivers/firmware/efi/libstub/x86-stub.c
@@ -6,6 +6,7 @@
*
* ----------------------------------------------------------------------- */
+#include <linux/cmdline.h>
#include <linux/efi.h>
#include <linux/pci.h>
#include <linux/stddef.h>
@@ -674,6 +675,7 @@ unsigned long efi_main(efi_handle_t handle,
unsigned long buffer_start, buffer_end;
struct setup_header *hdr = &boot_params->hdr;
efi_status_t status;
+ char *cmdline;
efi_system_table = sys_table_arg;
@@ -735,22 +737,22 @@ unsigned long efi_main(efi_handle_t handle,
image_offset = 0;
}
-#ifdef CONFIG_CMDLINE_BOOL
- status = efi_parse_options(CONFIG_CMDLINE);
+ cmdline = kzalloc(COMMAND_LINE_SIZE, GFP_KERNEL);
+ if (cmdline) {
+ unsigned long cmdline_paddr = ((u64)hdr->cmd_line_ptr |
+ ((u64)boot_params->ext_cmd_line_ptr << 32));
+
+ cmdline_build(cmdline, (char *)cmdline_paddr, COMMAND_LINE_SIZE);
+ status = efi_parse_options(cmdline);
+ kfree(cmdline);
+ } else {
+ efi_err("Failed to allocate memory\n");
+ goto fail;
+ }
if (status != EFI_SUCCESS) {
efi_err("Failed to parse options\n");
goto fail;
}
-#endif
- if (!IS_ENABLED(CONFIG_CMDLINE_OVERRIDE)) {
- unsigned long cmdline_paddr = ((u64)hdr->cmd_line_ptr |
- ((u64)boot_params->ext_cmd_line_ptr << 32));
- status = efi_parse_options((char *)cmdline_paddr);
- if (status != EFI_SUCCESS) {
- efi_err("Failed to parse options\n");
- goto fail;
- }
- }
/*
* At this point, an initrd may already have been loaded by the
--
2.25.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2021-03-26 13:51 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-26 13:44 [PATCH v3 00/17] Implement GENERIC_CMDLINE Christophe Leroy
2021-03-26 13:44 ` [PATCH v3 01/17] cmdline: Add generic function to build command line Christophe Leroy
2021-03-26 15:42 ` Rob Herring
2021-03-26 15:55 ` Christophe Leroy
2021-04-02 15:23 ` Christophe Leroy
2021-03-30 17:27 ` Daniel Walker
2021-03-30 18:07 ` H. Nikolaus Schaller
2021-03-30 18:23 ` Daniel Walker
2021-04-02 15:33 ` Christophe Leroy
2021-03-26 13:44 ` [PATCH v3 02/17] drivers: of: use cmdline building function Christophe Leroy
2021-03-26 13:44 ` [PATCH v3 03/17] cmdline: Gives architectures opportunity to use generically defined boot cmdline manipulation Christophe Leroy
2021-03-26 13:44 ` [PATCH v3 04/17] powerpc: Convert to GENERIC_CMDLINE Christophe Leroy
2021-03-26 13:44 ` [PATCH v3 05/17] arm: " Christophe Leroy
2021-03-26 15:47 ` Rob Herring
2021-03-26 15:49 ` Christophe Leroy
2021-03-26 18:22 ` Rob Herring
2021-04-02 15:19 ` Christophe Leroy
2021-04-02 15:24 ` Christophe Leroy
2021-03-26 13:44 ` [PATCH v3 06/17] arm64: " Christophe Leroy
2021-03-26 13:44 ` [PATCH v3 07/17] hexagon: " Christophe Leroy
2021-03-26 13:44 ` [PATCH v3 08/17] microblaze: " Christophe Leroy
2021-03-26 13:44 ` [PATCH v3 09/17] nios2: " Christophe Leroy
2021-03-29 1:35 ` Tan, Ley Foon
2021-04-02 15:33 ` Christophe Leroy
2021-03-26 13:44 ` [PATCH v3 10/17] openrisc: " Christophe Leroy
2021-03-26 13:44 ` [PATCH v3 11/17] riscv: " Christophe Leroy
2021-03-26 14:08 ` Andreas Schwab
2021-03-26 14:20 ` Christophe Leroy
2021-03-26 15:26 ` Rob Herring
2021-03-30 0:52 ` Nick Kossifidis
2021-04-02 15:21 ` Christophe Leroy
2021-03-26 13:44 ` [PATCH v3 12/17] sh: " Christophe Leroy
2021-04-02 15:36 ` Christophe Leroy
2021-03-26 13:45 ` [PATCH v3 13/17] sparc: " Christophe Leroy
2021-03-26 13:45 ` [PATCH v3 14/17] xtensa: " Christophe Leroy
2021-03-26 13:45 ` Christophe Leroy [this message]
2021-03-26 13:45 ` [PATCH v3 16/17] mips: " Christophe Leroy
2021-03-26 13:45 ` [PATCH v3 17/17] cmdline: Remove CONFIG_CMDLINE_EXTEND Christophe Leroy
2021-03-26 15:04 ` [PATCH v3 00/17] Implement GENERIC_CMDLINE Rob Herring
2021-04-02 15:20 ` Christophe Leroy
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=db9de18cca2fb0cbc0ffd75082d2d110fe8034d2.1616765870.git.christophe.leroy@csgroup.eu \
--to=christophe.leroy@csgroup.eu \
--cc=daniel@gimpelevich.san-francisco.ca.us \
--cc=danielwa@cisco.com \
--cc=devicetree@vger.kernel.org \
--cc=ley.foon.tan@intel.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-hexagon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-sh@vger.kernel.org \
--cc=linux-xtensa@linux-xtensa.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=monstr@monstr.eu \
--cc=openrisc@lists.librecores.org \
--cc=robh@kernel.org \
--cc=sparclinux@vger.kernel.org \
--cc=will@kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).