LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 09/20] arm64: Convert to GENERIC_CMDLINE
From: Christophe Leroy @ 2021-04-02 15:18 UTC (permalink / raw)
  To: will, danielwa, robh, daniel, arnd, akpm
  Cc: linux-arch, devicetree, microblaze, linux-xtensa, linux-sh,
	linux-hexagon, x86, linux-kernel, nios2, linux-mips, linux-mm,
	openrisc, sparclinux, linux-riscv, linuxppc-dev, linux-arm-kernel
In-Reply-To: <cover.1617375802.git.christophe.leroy@csgroup.eu>

This converts the architecture to GENERIC_CMDLINE.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/arm64/Kconfig                 | 33 +-----------------------------
 arch/arm64/kernel/idreg-override.c |  9 ++++----
 2 files changed, 5 insertions(+), 37 deletions(-)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index e4e1b6550115..9781ba3758b1 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -105,6 +105,7 @@ config ARM64
 	select GENERIC_ALLOCATOR
 	select GENERIC_ARCH_TOPOLOGY
 	select GENERIC_CLOCKEVENTS_BROADCAST
+	select GENERIC_CMDLINE
 	select GENERIC_CPU_AUTOPROBE
 	select GENERIC_CPU_VULNERABILITIES
 	select GENERIC_EARLY_IOREMAP
@@ -1841,38 +1842,6 @@ config ARM64_ACPI_PARKING_PROTOCOL
 	  protocol even if the corresponding data is present in the ACPI
 	  MADT table.
 
-config CMDLINE
-	string "Default kernel command string"
-	default ""
-	help
-	  Provide a set of default command-line options at build time by
-	  entering them here. As a minimum, you should specify the the
-	  root device (e.g. root=/dev/nfs).
-
-choice
-	prompt "Kernel command line type" if CMDLINE != ""
-	default CMDLINE_FROM_BOOTLOADER
-	help
-	  Choose how the kernel will handle the provided default kernel
-	  command line string.
-
-config CMDLINE_FROM_BOOTLOADER
-	bool "Use bootloader kernel arguments if available"
-	help
-	  Uses the command-line options passed by the boot loader. If
-	  the boot loader doesn't provide any, the default kernel command
-	  string provided in CMDLINE will be used.
-
-config CMDLINE_FORCE
-	bool "Always use the default kernel command string"
-	help
-	  Always use the default kernel command string, even if the boot
-	  loader passes other arguments to the kernel.
-	  This is useful if you cannot or don't want to change the
-	  command-line options your boot loader passes to the kernel.
-
-endchoice
-
 config EFI_STUB
 	bool
 
diff --git a/arch/arm64/kernel/idreg-override.c b/arch/arm64/kernel/idreg-override.c
index 83f1c4b92095..96a4e96a80a2 100644
--- a/arch/arm64/kernel/idreg-override.c
+++ b/arch/arm64/kernel/idreg-override.c
@@ -9,6 +9,7 @@
 #include <linux/ctype.h>
 #include <linux/kernel.h>
 #include <linux/libfdt.h>
+#include <linux/cmdline.h>
 
 #include <asm/cacheflush.h>
 #include <asm/cpufeature.h>
@@ -187,12 +188,10 @@ static __init const u8 *get_bootargs_cmdline(void)
 static __init void parse_cmdline(void)
 {
 	const u8 *prop = get_bootargs_cmdline();
+	static char __initdata cmdline[COMMAND_LINE_SIZE];
 
-	if (IS_ENABLED(CONFIG_CMDLINE_FORCE) || !prop)
-		__parse_cmdline(CONFIG_CMDLINE, true);
-
-	if (!IS_ENABLED(CONFIG_CMDLINE_FORCE) && prop)
-		__parse_cmdline(prop, true);
+	cmdline_build(cmdline, prop);
+	__parse_cmdline(cmdline, true);
 }
 
 /* Keep checkers quiet */
-- 
2.25.0


^ permalink raw reply related

* [PATCH v4 10/20] hexagon: Convert to GENERIC_CMDLINE
From: Christophe Leroy @ 2021-04-02 15:18 UTC (permalink / raw)
  To: will, danielwa, robh, daniel, arnd, akpm
  Cc: linux-arch, devicetree, microblaze, linux-xtensa, linux-sh,
	linux-hexagon, x86, linux-kernel, nios2, linux-mips, linux-mm,
	openrisc, sparclinux, linux-riscv, linuxppc-dev, linux-arm-kernel
In-Reply-To: <cover.1617375802.git.christophe.leroy@csgroup.eu>

This converts the architecture to GENERIC_CMDLINE.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/hexagon/Kconfig        | 11 +----------
 arch/hexagon/kernel/setup.c | 10 ++--------
 2 files changed, 3 insertions(+), 18 deletions(-)

diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig
index 44a409967af1..1e69c99bae6b 100644
--- a/arch/hexagon/Kconfig
+++ b/arch/hexagon/Kconfig
@@ -18,6 +18,7 @@ config HEXAGON
 	select HAVE_PERF_EVENTS
 	# GENERIC_ALLOCATOR is used by dma_alloc_coherent()
 	select GENERIC_ALLOCATOR
+	select GENERIC_CMDLINE
 	select GENERIC_IRQ_SHOW
 	select HAVE_ARCH_KGDB
 	select HAVE_ARCH_TRACEHOOK
@@ -91,16 +92,6 @@ config HEXAGON_ARCH_VERSION
 	int "Architecture version"
 	default 2
 
-config CMDLINE
-	string "Default kernel command string"
-	default ""
-	help
-	  On some platforms, there is currently no way for the boot loader
-	  to pass arguments to the kernel. For these, you should supply some
-	  command-line options at build time by entering them here.  At a
-	  minimum, you should specify the memory size and the root device
-	  (e.g., mem=64M root=/dev/nfs).
-
 config SMP
 	bool "Multi-Processing support"
 	help
diff --git a/arch/hexagon/kernel/setup.c b/arch/hexagon/kernel/setup.c
index 1880d9beaf2b..78641ce219e2 100644
--- a/arch/hexagon/kernel/setup.c
+++ b/arch/hexagon/kernel/setup.c
@@ -13,6 +13,7 @@
 #include <linux/seq_file.h>
 #include <linux/console.h>
 #include <linux/of_fdt.h>
+#include <linux/cmdline.h>
 #include <asm/io.h>
 #include <asm/sections.h>
 #include <asm/setup.h>
@@ -22,7 +23,6 @@
 #include <asm/time.h>
 
 char cmd_line[COMMAND_LINE_SIZE];
-static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
 
 int on_simulator;
 
@@ -38,8 +38,6 @@ void calibrate_delay(void)
 
 void __init setup_arch(char **cmdline_p)
 {
-	char *p = &external_cmdline_buffer;
-
 	/*
 	 * These will eventually be pulled in via either some hypervisor
 	 * or devicetree description.  Hardwiring for now.
@@ -65,11 +63,7 @@ void __init setup_arch(char **cmdline_p)
 	else
 		on_simulator = 0;
 
-	if (p[0] != '\0')
-		strlcpy(boot_command_line, p, COMMAND_LINE_SIZE);
-	else
-		strlcpy(boot_command_line, default_command_line,
-			COMMAND_LINE_SIZE);
+	cmdline_build(boot_command_line, external_cmdline_buffer);
 
 	/*
 	 * boot_command_line and the value set up by setup_arch
-- 
2.25.0


^ permalink raw reply related

* [PATCH v4 11/20] microblaze: Convert to GENERIC_CMDLINE
From: Christophe Leroy @ 2021-04-02 15:18 UTC (permalink / raw)
  To: will, danielwa, robh, daniel, arnd, akpm
  Cc: linux-arch, devicetree, microblaze, linux-xtensa, linux-sh,
	linux-hexagon, x86, linux-kernel, nios2, linux-mips, linux-mm,
	openrisc, sparclinux, linux-riscv, linuxppc-dev, linux-arm-kernel
In-Reply-To: <cover.1617375802.git.christophe.leroy@csgroup.eu>

This converts the architecture to GENERIC_CMDLINE.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/microblaze/Kconfig               | 24 +-----------------------
 arch/microblaze/configs/mmu_defconfig |  2 +-
 arch/microblaze/kernel/head.S         |  4 ++--
 3 files changed, 4 insertions(+), 26 deletions(-)

diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index 0660f47012bc..1242f34bc2a2 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -15,6 +15,7 @@ config MICROBLAZE
 	select COMMON_CLK
 	select DMA_DIRECT_REMAP
 	select GENERIC_ATOMIC64
+	select GENERIC_CMDLINE
 	select GENERIC_CPU_DEVICES
 	select GENERIC_IDLE_POLL_SETUP
 	select GENERIC_IRQ_PROBE
@@ -93,29 +94,6 @@ source "kernel/Kconfig.hz"
 config MMU
 	def_bool y
 
-comment "Boot options"
-
-config CMDLINE_BOOL
-	bool "Default bootloader kernel arguments"
-
-config CMDLINE
-	string "Default kernel command string"
-	depends on CMDLINE_BOOL
-	default "console=ttyUL0,115200"
-	help
-	  On some architectures there is currently no way for the boot loader
-	  to pass arguments to the kernel. For these architectures, you should
-	  supply some command-line options at build time by entering them
-	  here.
-
-config CMDLINE_FORCE
-	bool "Force default kernel command string"
-	depends on CMDLINE_BOOL
-	default n
-	help
-	  Set this to have arguments from the default kernel command string
-	  override those passed by the boot loader.
-
 endmenu
 
 menu "Kernel features"
diff --git a/arch/microblaze/configs/mmu_defconfig b/arch/microblaze/configs/mmu_defconfig
index 51337fffb947..b4d2219d0a8f 100644
--- a/arch/microblaze/configs/mmu_defconfig
+++ b/arch/microblaze/configs/mmu_defconfig
@@ -16,7 +16,7 @@ CONFIG_XILINX_MICROBLAZE0_USE_DIV=1
 CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL=2
 CONFIG_XILINX_MICROBLAZE0_USE_FPU=2
 CONFIG_HZ_100=y
-CONFIG_CMDLINE_BOOL=y
+CONFIG_CMDLINE="console=ttyUL0,115200"
 CONFIG_CMDLINE_FORCE=y
 CONFIG_HIGHMEM=y
 CONFIG_PCI_XILINX=y
diff --git a/arch/microblaze/kernel/head.S b/arch/microblaze/kernel/head.S
index ec2fcb545e64..605b18c86ac8 100644
--- a/arch/microblaze/kernel/head.S
+++ b/arch/microblaze/kernel/head.S
@@ -105,7 +105,7 @@ _copy_fdt:
 	addik	r3, r3, -4 /* descrement loop */
 no_fdt_arg:
 
-#ifndef CONFIG_CMDLINE_BOOL
+#if CONFIG_CMDLINE == ""
 /*
  * handling command line
  * copy command line directly to cmd_line placed in data section.
@@ -126,7 +126,7 @@ _copy_command_line:
 	addik	r5, r4, 0		/* add new space for command line */
 	tovirt(r5,r5)
 skip:
-#endif /* CONFIG_CMDLINE_BOOL */
+#endif /* CONFIG_CMDLINE */
 
 #ifdef NOT_COMPILE
 /* save bram context */
-- 
2.25.0


^ permalink raw reply related

* [PATCH v4 12/20] nios2: Convert to GENERIC_CMDLINE
From: Christophe Leroy @ 2021-04-02 15:18 UTC (permalink / raw)
  To: will, danielwa, robh, daniel, arnd, akpm
  Cc: linux-arch, devicetree, microblaze, linux-xtensa, linux-sh,
	linux-hexagon, x86, linux-kernel, nios2, linux-mips, linux-mm,
	openrisc, sparclinux, linux-riscv, linuxppc-dev, linux-arm-kernel
In-Reply-To: <cover.1617375802.git.christophe.leroy@csgroup.eu>

This converts the architecture to GENERIC_CMDLINE.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
v4: Added missing selection of CONFIG_GENERIC_CMDLINE in Kconfig
---
 arch/nios2/Kconfig        | 25 ++-----------------------
 arch/nios2/kernel/setup.c | 13 ++++---------
 2 files changed, 6 insertions(+), 32 deletions(-)

diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig
index c24955c81c92..6018f3d626f8 100644
--- a/arch/nios2/Kconfig
+++ b/arch/nios2/Kconfig
@@ -10,6 +10,7 @@ config NIOS2
 	select COMMON_CLK
 	select TIMER_OF
 	select GENERIC_ATOMIC64
+	select GENERIC_CMDLINE
 	select GENERIC_CPU_DEVICES
 	select GENERIC_IRQ_PROBE
 	select GENERIC_IRQ_SHOW
@@ -90,31 +91,9 @@ config NIOS2_ALIGNMENT_TRAP
 
 comment "Boot options"
 
-config CMDLINE_BOOL
-	bool "Default bootloader kernel arguments"
-	default y
-
-config CMDLINE
-	string "Default kernel command string"
-	default ""
-	depends on CMDLINE_BOOL
-	help
-	  On some platforms, there is currently no way for the boot loader to
-	  pass arguments to the kernel. For these platforms, you can supply
-	  some command-line options at build time by entering them here.  In
-	  other cases you can specify kernel args so that you don't have
-	  to set them up in board prom initialization routines.
-
-config CMDLINE_FORCE
-	bool "Force default kernel command string"
-	depends on CMDLINE_BOOL
-	help
-	  Set this to have arguments from the default kernel command string
-	  override those passed by the boot loader.
-
 config NIOS2_CMDLINE_IGNORE_DTB
 	bool "Ignore kernel command string from DTB"
-	depends on CMDLINE_BOOL
+	depends on CMDLINE != ""
 	depends on !CMDLINE_FORCE
 	default y
 	help
diff --git a/arch/nios2/kernel/setup.c b/arch/nios2/kernel/setup.c
index d2f21957e99c..5b38d3d0ad64 100644
--- a/arch/nios2/kernel/setup.c
+++ b/arch/nios2/kernel/setup.c
@@ -20,6 +20,7 @@
 #include <linux/initrd.h>
 #include <linux/of_fdt.h>
 #include <linux/screen_info.h>
+#include <linux/cmdline.h>
 
 #include <asm/mmu_context.h>
 #include <asm/sections.h>
@@ -108,7 +109,7 @@ asmlinkage void __init nios2_boot_init(unsigned r4, unsigned r5, unsigned r6,
 				       unsigned r7)
 {
 	unsigned dtb_passed = 0;
-	char cmdline_passed[COMMAND_LINE_SIZE] __maybe_unused = { 0, };
+	char cmdline_passed[COMMAND_LINE_SIZE] = { 0, };
 
 #if defined(CONFIG_NIOS2_PASS_CMDLINE)
 	if (r4 == 0x534f494e) { /* r4 is magic NIOS */
@@ -127,14 +128,8 @@ asmlinkage void __init nios2_boot_init(unsigned r4, unsigned r5, unsigned r6,
 
 	early_init_devtree((void *)dtb_passed);
 
-#ifndef CONFIG_CMDLINE_FORCE
-	if (cmdline_passed[0])
-		strlcpy(boot_command_line, cmdline_passed, COMMAND_LINE_SIZE);
-#ifdef CONFIG_NIOS2_CMDLINE_IGNORE_DTB
-	else
-		strlcpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
-#endif
-#endif
+	if (cmdline_passed[0] || IS_ENABLED(CONFIG_NIOS2_CMDLINE_IGNORE_DTB))
+		cmdline_build(boot_command_line, cmdline_passed);
 
 	parse_early_param();
 }
-- 
2.25.0


^ permalink raw reply related

* [PATCH v4 13/20] openrisc: Convert to GENERIC_CMDLINE
From: Christophe Leroy @ 2021-04-02 15:18 UTC (permalink / raw)
  To: will, danielwa, robh, daniel, arnd, akpm
  Cc: linux-arch, devicetree, microblaze, linux-xtensa, linux-sh,
	linux-hexagon, x86, linux-kernel, nios2, linux-mips, linux-mm,
	openrisc, sparclinux, linux-riscv, linuxppc-dev, linux-arm-kernel
In-Reply-To: <cover.1617375802.git.christophe.leroy@csgroup.eu>

This converts the architecture to GENERIC_CMDLINE.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/openrisc/Kconfig | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index 591acc5990dc..ca1d0f18fe16 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -25,6 +25,7 @@ config OPENRISC
 	select HAVE_UID16
 	select GENERIC_ATOMIC64
 	select GENERIC_CLOCKEVENTS_BROADCAST
+	select GENERIC_CMDLINE
 	select GENERIC_STRNCPY_FROM_USER
 	select GENERIC_STRNLEN_USER
 	select GENERIC_SMP_IDLE_THREAD
@@ -162,15 +163,6 @@ config OPENRISC_HAVE_SHADOW_GPRS
 	  On SMP systems, this feature is mandatory.
 	  On a unicore system it's safe to say N here if you are unsure.
 
-config CMDLINE
-	string "Default kernel command string"
-	default ""
-	help
-	  On some architectures there is currently no way for the boot loader
-	  to pass arguments to the kernel. For these architectures, you should
-	  supply some command-line options at build time by entering them
-	  here.
-
 menu "Debugging options"
 
 config JUMP_UPON_UNHANDLED_EXCEPTION
-- 
2.25.0


^ permalink raw reply related

* [PATCH v4 14/20] riscv: Convert to GENERIC_CMDLINE
From: Christophe Leroy @ 2021-04-02 15:18 UTC (permalink / raw)
  To: will, danielwa, robh, daniel, arnd, akpm
  Cc: linux-arch, devicetree, microblaze, linux-xtensa, linux-sh,
	linux-hexagon, x86, linux-kernel, nios2, linux-mips, linux-mm,
	openrisc, sparclinux, linux-riscv, linuxppc-dev, linux-arm-kernel
In-Reply-To: <cover.1617375802.git.christophe.leroy@csgroup.eu>

This converts the architecture to GENERIC_CMDLINE.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
v4: Remove the message when forcing
---
 arch/riscv/Kconfig        | 44 +--------------------------------------
 arch/riscv/kernel/setup.c |  7 +++----
 2 files changed, 4 insertions(+), 47 deletions(-)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 87d7b52f278f..3dbd50bed037 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -39,6 +39,7 @@ config RISCV
 	select EDAC_SUPPORT
 	select GENERIC_ARCH_TOPOLOGY if SMP
 	select GENERIC_ATOMIC64 if !64BIT
+	select GENERIC_CMDLINE
 	select GENERIC_EARLY_IOREMAP
 	select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO
 	select GENERIC_IOREMAP
@@ -390,49 +391,6 @@ endmenu
 
 menu "Boot options"
 
-config CMDLINE
-	string "Built-in kernel command line"
-	help
-	  For most platforms, the arguments for the kernel's command line
-	  are provided at run-time, during boot. However, there are cases
-	  where either no arguments are being provided or the provided
-	  arguments are insufficient or even invalid.
-
-	  When that occurs, it is possible to define a built-in command
-	  line here and choose how the kernel should use it later on.
-
-choice
-	prompt "Built-in command line usage" if CMDLINE != ""
-	default CMDLINE_FALLBACK
-	help
-	  Choose how the kernel will handle the provided built-in command
-	  line.
-
-config CMDLINE_FALLBACK
-	bool "Use bootloader kernel arguments if available"
-	help
-	  Use the built-in command line as fallback in case we get nothing
-	  during boot. This is the default behaviour.
-
-config CMDLINE_EXTEND
-	bool "Extend bootloader kernel arguments"
-	help
-	  The command-line arguments provided during boot will be
-	  appended to the built-in command line. This is useful in
-	  cases where the provided arguments are insufficient and
-	  you don't want to or cannot modify them.
-
-
-config CMDLINE_FORCE
-	bool "Always use the default kernel command string"
-	help
-	  Always use the built-in command line, even if we get one during
-	  boot. This is useful in case you need to override the provided
-	  command line on systems where you don't have or want control
-	  over it.
-
-endchoice
-
 config EFI_STUB
 	bool
 
diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
index f8f15332caa2..d4f16a9c1762 100644
--- a/arch/riscv/kernel/setup.c
+++ b/arch/riscv/kernel/setup.c
@@ -20,6 +20,7 @@
 #include <linux/swiotlb.h>
 #include <linux/smp.h>
 #include <linux/efi.h>
+#include <linux/cmdline.h>
 
 #include <asm/cpu_ops.h>
 #include <asm/early_ioremap.h>
@@ -228,10 +229,8 @@ static void __init parse_dtb(void)
 	}
 
 	pr_err("No DTB passed to the kernel\n");
-#ifdef CONFIG_CMDLINE_FORCE
-	strlcpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
-	pr_info("Forcing kernel command line to: %s\n", boot_command_line);
-#endif
+
+	cmdline_build(boot_command_line, NULL);
 }
 
 void __init setup_arch(char **cmdline_p)
-- 
2.25.0


^ permalink raw reply related

* [PATCH v4 15/20] sh: Convert to GENERIC_CMDLINE
From: Christophe Leroy @ 2021-04-02 15:18 UTC (permalink / raw)
  To: will, danielwa, robh, daniel, arnd, akpm
  Cc: linux-arch, devicetree, microblaze, linux-xtensa, linux-sh,
	linux-hexagon, x86, linux-kernel, nios2, linux-mips, linux-mm,
	openrisc, sparclinux, linux-riscv, linuxppc-dev, linux-arm-kernel
In-Reply-To: <cover.1617375802.git.christophe.leroy@csgroup.eu>

This converts the architecture to GENERIC_CMDLINE.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
v4: Restore the removed 'endmenu' in Kconfig
---
 arch/sh/Kconfig                             | 28 +--------------------
 arch/sh/configs/ap325rxa_defconfig          |  2 +-
 arch/sh/configs/dreamcast_defconfig         |  2 +-
 arch/sh/configs/ecovec24-romimage_defconfig |  2 +-
 arch/sh/configs/ecovec24_defconfig          |  2 +-
 arch/sh/configs/edosk7760_defconfig         |  2 +-
 arch/sh/configs/espt_defconfig              |  2 +-
 arch/sh/configs/j2_defconfig                |  2 +-
 arch/sh/configs/kfr2r09-romimage_defconfig  |  2 +-
 arch/sh/configs/kfr2r09_defconfig           |  2 +-
 arch/sh/configs/lboxre2_defconfig           |  2 +-
 arch/sh/configs/microdev_defconfig          |  2 +-
 arch/sh/configs/migor_defconfig             |  2 +-
 arch/sh/configs/polaris_defconfig           |  2 +-
 arch/sh/configs/r7780mp_defconfig           |  2 +-
 arch/sh/configs/r7785rp_defconfig           |  2 +-
 arch/sh/configs/rsk7201_defconfig           |  2 +-
 arch/sh/configs/rsk7203_defconfig           |  2 +-
 arch/sh/configs/rts7751r2d1_defconfig       |  2 +-
 arch/sh/configs/rts7751r2dplus_defconfig    |  2 +-
 arch/sh/configs/sdk7780_defconfig           |  2 +-
 arch/sh/configs/sdk7786_defconfig           |  2 +-
 arch/sh/configs/se7206_defconfig            |  2 +-
 arch/sh/configs/se7343_defconfig            |  2 +-
 arch/sh/configs/se7712_defconfig            |  2 +-
 arch/sh/configs/se7721_defconfig            |  2 +-
 arch/sh/configs/se7724_defconfig            |  2 +-
 arch/sh/configs/se7751_defconfig            |  2 +-
 arch/sh/configs/se7780_defconfig            |  2 +-
 arch/sh/configs/sh03_defconfig              |  2 +-
 arch/sh/configs/sh2007_defconfig            |  2 +-
 arch/sh/configs/sh7757lcr_defconfig         |  2 +-
 arch/sh/configs/sh7763rdp_defconfig         |  2 +-
 arch/sh/configs/shmin_defconfig             |  2 +-
 arch/sh/configs/shx3_defconfig              |  2 +-
 arch/sh/configs/titan_defconfig             |  2 +-
 arch/sh/configs/ul2_defconfig               |  2 +-
 arch/sh/kernel/setup.c                      | 11 ++------
 38 files changed, 39 insertions(+), 72 deletions(-)

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index e798e55915c2..92d6a4443166 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -16,6 +16,7 @@ config SUPERH
 	select CPU_NO_EFFICIENT_FFS
 	select DMA_DECLARE_COHERENT
 	select GENERIC_ATOMIC64
+	select GENERIC_CMDLINE
 	select GENERIC_CMOS_UPDATE if SH_SH03 || SH_DREAMCAST
 	select GENERIC_IDLE_POLL_SETUP
 	select GENERIC_IRQ_SHOW
@@ -742,33 +743,6 @@ config ROMIMAGE_MMCIF
 	  first part of the romImage which in turn loads the rest the kernel
 	  image to RAM using the MMCIF hardware block.
 
-choice
-	prompt "Kernel command line"
-	optional
-	default CMDLINE_OVERWRITE
-	help
-	  Setting this option allows the kernel command line arguments
-	  to be set.
-
-config CMDLINE_OVERWRITE
-	bool "Overwrite bootloader kernel arguments"
-	help
-	  Given string will overwrite any arguments passed in by
-	  a bootloader.
-
-config CMDLINE_EXTEND
-	bool "Extend bootloader kernel arguments"
-	help
-	  Given string will be concatenated with arguments passed in
-	  by a bootloader.
-
-endchoice
-
-config CMDLINE
-	string "Kernel command line arguments string"
-	depends on CMDLINE_OVERWRITE || CMDLINE_EXTEND
-	default "console=ttySC1,115200"
-
 endmenu
 
 menu "Bus options"
diff --git a/arch/sh/configs/ap325rxa_defconfig b/arch/sh/configs/ap325rxa_defconfig
index 5193b3e099b9..3997aa49c75b 100644
--- a/arch/sh/configs/ap325rxa_defconfig
+++ b/arch/sh/configs/ap325rxa_defconfig
@@ -15,7 +15,7 @@ CONFIG_SH_AP325RXA=y
 CONFIG_HIGH_RES_TIMERS=y
 CONFIG_SECCOMP=y
 CONFIG_PREEMPT=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=tty1 console=ttySC5,38400 root=/dev/nfs ip=dhcp"
 CONFIG_NET=y
 CONFIG_PACKET=y
diff --git a/arch/sh/configs/dreamcast_defconfig b/arch/sh/configs/dreamcast_defconfig
index 6a82c7b8ff32..ac030c1a351e 100644
--- a/arch/sh/configs/dreamcast_defconfig
+++ b/arch/sh/configs/dreamcast_defconfig
@@ -22,7 +22,7 @@ CONFIG_NR_DMA_CHANNELS_BOOL=y
 CONFIG_NR_DMA_CHANNELS=9
 CONFIG_SECCOMP=y
 CONFIG_PREEMPT=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=ttySC1,115200 panic=3"
 CONFIG_MAPLE=y
 CONFIG_PCI=y
diff --git a/arch/sh/configs/ecovec24-romimage_defconfig b/arch/sh/configs/ecovec24-romimage_defconfig
index 5c60e71d839e..db78857ae30f 100644
--- a/arch/sh/configs/ecovec24-romimage_defconfig
+++ b/arch/sh/configs/ecovec24-romimage_defconfig
@@ -14,7 +14,7 @@ CONFIG_FLATMEM_MANUAL=y
 CONFIG_SH_ECOVEC=y
 # CONFIG_SH_TIMER_TMU is not set
 CONFIG_KEXEC=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=ttySC0,115200"
 # CONFIG_SUSPEND is not set
 CONFIG_NET=y
diff --git a/arch/sh/configs/ecovec24_defconfig b/arch/sh/configs/ecovec24_defconfig
index 03cb916819fa..f6f7d2e1840d 100644
--- a/arch/sh/configs/ecovec24_defconfig
+++ b/arch/sh/configs/ecovec24_defconfig
@@ -16,7 +16,7 @@ CONFIG_SH_ECOVEC=y
 CONFIG_HEARTBEAT=y
 CONFIG_SECCOMP=y
 CONFIG_PREEMPT=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=tty0, console=ttySC0,115200 root=/dev/nfs ip=dhcp mem=248M memchunk.vpu=8m memchunk.veu0=4m"
 CONFIG_NET=y
 CONFIG_PACKET=y
diff --git a/arch/sh/configs/edosk7760_defconfig b/arch/sh/configs/edosk7760_defconfig
index d77f54e906fd..1ac8eb89c550 100644
--- a/arch/sh/configs/edosk7760_defconfig
+++ b/arch/sh/configs/edosk7760_defconfig
@@ -19,7 +19,7 @@ CONFIG_HIGH_RES_TIMERS=y
 CONFIG_SH_DMA=y
 CONFIG_SH_DMA_API=y
 CONFIG_PREEMPT=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="mem=64M console=ttySC2,115200 root=/dev/nfs rw nfsroot=192.168.0.3:/scripts/filesys ip=192.168.0.4"
 CONFIG_NET=y
 CONFIG_PACKET=y
diff --git a/arch/sh/configs/espt_defconfig b/arch/sh/configs/espt_defconfig
index 2804cb760a76..1bffacbaba3d 100644
--- a/arch/sh/configs/espt_defconfig
+++ b/arch/sh/configs/espt_defconfig
@@ -14,7 +14,7 @@ CONFIG_MEMORY_START=0x0c000000
 CONFIG_SH_ESPT=y
 CONFIG_SH_PCLK_FREQ=66666666
 CONFIG_SECCOMP=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/nfs ip=bootp"
 CONFIG_NET=y
 CONFIG_PACKET=y
diff --git a/arch/sh/configs/j2_defconfig b/arch/sh/configs/j2_defconfig
index 2eb81ebe3888..983c62e936eb 100644
--- a/arch/sh/configs/j2_defconfig
+++ b/arch/sh/configs/j2_defconfig
@@ -10,7 +10,7 @@ CONFIG_CPU_BIG_ENDIAN=y
 CONFIG_SH_DEVICE_TREE=y
 CONFIG_SH_JCORE_SOC=y
 CONFIG_HZ_100=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=ttyUL0 earlycon"
 CONFIG_BINFMT_ELF_FDPIC=y
 CONFIG_BINFMT_FLAT=y
diff --git a/arch/sh/configs/kfr2r09-romimage_defconfig b/arch/sh/configs/kfr2r09-romimage_defconfig
index 04436b4fbd76..8418c1f0c1ce 100644
--- a/arch/sh/configs/kfr2r09-romimage_defconfig
+++ b/arch/sh/configs/kfr2r09-romimage_defconfig
@@ -15,7 +15,7 @@ CONFIG_SH_KFR2R09=y
 # CONFIG_SH_TIMER_TMU is not set
 CONFIG_HZ_100=y
 CONFIG_KEXEC=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=ttySC1,115200 quiet"
 # CONFIG_SUSPEND is not set
 CONFIG_NET=y
diff --git a/arch/sh/configs/kfr2r09_defconfig b/arch/sh/configs/kfr2r09_defconfig
index 833404490cfe..0b04d179ebba 100644
--- a/arch/sh/configs/kfr2r09_defconfig
+++ b/arch/sh/configs/kfr2r09_defconfig
@@ -19,7 +19,7 @@ CONFIG_NO_HZ=y
 CONFIG_HZ_1000=y
 CONFIG_KEXEC=y
 CONFIG_PREEMPT=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=tty0 console=ttySC1,115200"
 # CONFIG_SUSPEND is not set
 CONFIG_CPU_IDLE=y
diff --git a/arch/sh/configs/lboxre2_defconfig b/arch/sh/configs/lboxre2_defconfig
index 05e4ac6fed5f..498c88953d2a 100644
--- a/arch/sh/configs/lboxre2_defconfig
+++ b/arch/sh/configs/lboxre2_defconfig
@@ -12,7 +12,7 @@ CONFIG_FLATMEM_MANUAL=y
 CONFIG_SH_LBOX_RE2=y
 CONFIG_SH_PCLK_FREQ=40000000
 CONFIG_KEXEC=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=ttySC1,115200 root=/dev/sda1"
 CONFIG_PCI=y
 CONFIG_PCCARD=y
diff --git a/arch/sh/configs/microdev_defconfig b/arch/sh/configs/microdev_defconfig
index e9825196dd66..8467de1d3092 100644
--- a/arch/sh/configs/microdev_defconfig
+++ b/arch/sh/configs/microdev_defconfig
@@ -11,7 +11,7 @@ CONFIG_SH_DMA=y
 CONFIG_SH_DMA_API=y
 CONFIG_HEARTBEAT=y
 CONFIG_PREEMPT=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/hda1"
 CONFIG_SUPERHYWAY=y
 CONFIG_NET=y
diff --git a/arch/sh/configs/migor_defconfig b/arch/sh/configs/migor_defconfig
index 4859cd30cfc4..e43fb2a63f1f 100644
--- a/arch/sh/configs/migor_defconfig
+++ b/arch/sh/configs/migor_defconfig
@@ -15,7 +15,7 @@ CONFIG_NUMA=y
 CONFIG_SH_MIGOR=y
 # CONFIG_SH_TIMER_CMT is not set
 CONFIG_SECCOMP=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=tty0 console=ttySC0,115200 earlyprintk=serial ip=on root=/dev/nfs ip=dhcp"
 CONFIG_NET=y
 CONFIG_PACKET=y
diff --git a/arch/sh/configs/polaris_defconfig b/arch/sh/configs/polaris_defconfig
index 246408ec7462..2fc2bdc0e002 100644
--- a/arch/sh/configs/polaris_defconfig
+++ b/arch/sh/configs/polaris_defconfig
@@ -25,7 +25,7 @@ CONFIG_SH_DMA_API=y
 CONFIG_HEARTBEAT=y
 CONFIG_HZ_100=y
 CONFIG_PREEMPT=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=ttySC1,115200 root=/dev/mtdblock2 rootfstype=jffs2 mem=63M mtdparts=physmap-flash.0:0x00100000(bootloader)ro,0x00500000(Kernel)ro,0x00A00000(Filesystem)"
 CONFIG_NET=y
 CONFIG_PACKET=y
diff --git a/arch/sh/configs/r7780mp_defconfig b/arch/sh/configs/r7780mp_defconfig
index f823cc6b18f9..9e2438114890 100644
--- a/arch/sh/configs/r7780mp_defconfig
+++ b/arch/sh/configs/r7780mp_defconfig
@@ -20,7 +20,7 @@ CONFIG_SH_PCLK_FREQ=33333333
 CONFIG_PUSH_SWITCH=y
 CONFIG_KEXEC=y
 CONFIG_PREEMPT=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/sda1"
 CONFIG_PCI=y
 CONFIG_NET=y
diff --git a/arch/sh/configs/r7785rp_defconfig b/arch/sh/configs/r7785rp_defconfig
index f96bc20d4b1a..c1c92f154694 100644
--- a/arch/sh/configs/r7785rp_defconfig
+++ b/arch/sh/configs/r7785rp_defconfig
@@ -26,7 +26,7 @@ CONFIG_HEARTBEAT=y
 CONFIG_PUSH_SWITCH=y
 CONFIG_KEXEC=y
 CONFIG_PREEMPT=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/sda1"
 CONFIG_PCI=y
 CONFIG_BINFMT_MISC=m
diff --git a/arch/sh/configs/rsk7201_defconfig b/arch/sh/configs/rsk7201_defconfig
index e41526120be1..65f3d695bc78 100644
--- a/arch/sh/configs/rsk7201_defconfig
+++ b/arch/sh/configs/rsk7201_defconfig
@@ -21,7 +21,7 @@ CONFIG_CPU_BIG_ENDIAN=y
 CONFIG_SH_RSK=y
 CONFIG_SH_PCLK_FREQ=40000000
 CONFIG_HZ_1000=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=ttySC0,115200 earlyprintk=serial ignore_loglevel"
 CONFIG_BINFMT_FLAT=y
 CONFIG_BINFMT_ZFLAT=y
diff --git a/arch/sh/configs/rsk7203_defconfig b/arch/sh/configs/rsk7203_defconfig
index 6af08fa1ddf8..33f608c54b85 100644
--- a/arch/sh/configs/rsk7203_defconfig
+++ b/arch/sh/configs/rsk7203_defconfig
@@ -26,7 +26,7 @@ CONFIG_CPU_FREQ=y
 CONFIG_SH_CPU_FREQ=y
 CONFIG_HEARTBEAT=y
 CONFIG_HZ_1000=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=ttySC0,115200 earlyprintk=serial ignore_loglevel"
 CONFIG_BINFMT_FLAT=y
 CONFIG_BINFMT_ZFLAT=y
diff --git a/arch/sh/configs/rts7751r2d1_defconfig b/arch/sh/configs/rts7751r2d1_defconfig
index 96263a4912b7..131699a6daa7 100644
--- a/arch/sh/configs/rts7751r2d1_defconfig
+++ b/arch/sh/configs/rts7751r2d1_defconfig
@@ -11,7 +11,7 @@ CONFIG_FLATMEM_MANUAL=y
 CONFIG_SH_RTS7751R2D=y
 CONFIG_RTS7751R2D_1=y
 CONFIG_HEARTBEAT=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=tty0 console=ttySC1,115200 root=/dev/sda1"
 CONFIG_PCI=y
 CONFIG_HOTPLUG_PCI=y
diff --git a/arch/sh/configs/rts7751r2dplus_defconfig b/arch/sh/configs/rts7751r2dplus_defconfig
index 92e586e6c974..ffa76ad8efaa 100644
--- a/arch/sh/configs/rts7751r2dplus_defconfig
+++ b/arch/sh/configs/rts7751r2dplus_defconfig
@@ -11,7 +11,7 @@ CONFIG_FLATMEM_MANUAL=y
 CONFIG_SH_RTS7751R2D=y
 CONFIG_RTS7751R2D_PLUS=y
 CONFIG_HEARTBEAT=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=tty0 console=ttySC1,115200 root=/dev/sda1"
 CONFIG_PCI=y
 CONFIG_HOTPLUG_PCI=y
diff --git a/arch/sh/configs/sdk7780_defconfig b/arch/sh/configs/sdk7780_defconfig
index 6c719ab4332a..a33f81c41a13 100644
--- a/arch/sh/configs/sdk7780_defconfig
+++ b/arch/sh/configs/sdk7780_defconfig
@@ -22,7 +22,7 @@ CONFIG_SH_DMA=y
 CONFIG_SH_DMA_API=y
 CONFIG_HEARTBEAT=y
 CONFIG_PREEMPT=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="mem=128M console=tty0 console=ttySC0,115200 ip=bootp root=/dev/nfs nfsroot=192.168.0.1:/home/rootfs"
 CONFIG_PCI=y
 CONFIG_PCI_DEBUG=y
diff --git a/arch/sh/configs/sdk7786_defconfig b/arch/sh/configs/sdk7786_defconfig
index f776a1d0d277..1daf3dbffc16 100644
--- a/arch/sh/configs/sdk7786_defconfig
+++ b/arch/sh/configs/sdk7786_defconfig
@@ -70,7 +70,7 @@ CONFIG_HOTPLUG_CPU=y
 CONFIG_PREEMPT=y
 CONFIG_INTC_USERIMASK=y
 CONFIG_INTC_BALANCING=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=ttySC1,115200 earlyprintk=sh-sci.1,115200 root=/dev/sda1 nmi_debug=state,debounce rootdelay=5 pmb=iomap ignore_loglevel"
 CONFIG_PCI=y
 CONFIG_PCIEPORTBUS=y
diff --git a/arch/sh/configs/se7206_defconfig b/arch/sh/configs/se7206_defconfig
index 315b04a8dd2f..c729ddb5d2c8 100644
--- a/arch/sh/configs/se7206_defconfig
+++ b/arch/sh/configs/se7206_defconfig
@@ -36,7 +36,7 @@ CONFIG_SH_CPU_FREQ=y
 CONFIG_HEARTBEAT=y
 CONFIG_HZ_1000=y
 CONFIG_PREEMPT=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=ttySC3,115200 ignore_loglevel earlyprintk=serial"
 CONFIG_BINFMT_FLAT=y
 CONFIG_BINFMT_ZFLAT=y
diff --git a/arch/sh/configs/se7343_defconfig b/arch/sh/configs/se7343_defconfig
index 5d6c19338ebf..32fedfd8ae81 100644
--- a/arch/sh/configs/se7343_defconfig
+++ b/arch/sh/configs/se7343_defconfig
@@ -17,7 +17,7 @@ CONFIG_FLATMEM_MANUAL=y
 CONFIG_SH_7343_SOLUTION_ENGINE=y
 # CONFIG_SH_TIMER_CMT is not set
 CONFIG_HEARTBEAT=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=ttySC0,115200"
 CONFIG_NET=y
 CONFIG_PACKET=y
diff --git a/arch/sh/configs/se7712_defconfig b/arch/sh/configs/se7712_defconfig
index ee6d28ae08de..02a8dcb898db 100644
--- a/arch/sh/configs/se7712_defconfig
+++ b/arch/sh/configs/se7712_defconfig
@@ -22,7 +22,7 @@ CONFIG_SH_SOLUTION_ENGINE=y
 CONFIG_SH_PCLK_FREQ=66666666
 CONFIG_HEARTBEAT=y
 CONFIG_PREEMPT_VOLUNTARY=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/sda1"
 CONFIG_NET=y
 CONFIG_PACKET=y
diff --git a/arch/sh/configs/se7721_defconfig b/arch/sh/configs/se7721_defconfig
index bad921bc10f8..a0ce6eca3bf5 100644
--- a/arch/sh/configs/se7721_defconfig
+++ b/arch/sh/configs/se7721_defconfig
@@ -22,7 +22,7 @@ CONFIG_SH_7721_SOLUTION_ENGINE=y
 CONFIG_SH_PCLK_FREQ=33333333
 CONFIG_HEARTBEAT=y
 CONFIG_PREEMPT_VOLUNTARY=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/sda2"
 CONFIG_NET=y
 CONFIG_PACKET=y
diff --git a/arch/sh/configs/se7724_defconfig b/arch/sh/configs/se7724_defconfig
index a26f7f1841c7..9cd50acd959d 100644
--- a/arch/sh/configs/se7724_defconfig
+++ b/arch/sh/configs/se7724_defconfig
@@ -17,7 +17,7 @@ CONFIG_SH_DMA_API=y
 CONFIG_HEARTBEAT=y
 CONFIG_SECCOMP=y
 CONFIG_PREEMPT=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=tty1 console=ttySC3,115200 root=/dev/nfs ip=dhcp memchunk.vpu=4m"
 CONFIG_NET=y
 CONFIG_PACKET=y
diff --git a/arch/sh/configs/se7751_defconfig b/arch/sh/configs/se7751_defconfig
index 4a024065bb75..8c2beb3677e2 100644
--- a/arch/sh/configs/se7751_defconfig
+++ b/arch/sh/configs/se7751_defconfig
@@ -12,7 +12,7 @@ CONFIG_MEMORY_START=0x0c000000
 CONFIG_FLATMEM_MANUAL=y
 CONFIG_SH_7751_SOLUTION_ENGINE=y
 CONFIG_HEARTBEAT=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=ttySC1,38400"
 CONFIG_NET=y
 CONFIG_PACKET=y
diff --git a/arch/sh/configs/se7780_defconfig b/arch/sh/configs/se7780_defconfig
index dcd85b858ac8..3be23f65c38e 100644
--- a/arch/sh/configs/se7780_defconfig
+++ b/arch/sh/configs/se7780_defconfig
@@ -14,7 +14,7 @@ CONFIG_MEMORY_SIZE=0x08000000
 CONFIG_SH_7780_SOLUTION_ENGINE=y
 CONFIG_SH_PCLK_FREQ=33333333
 CONFIG_HEARTBEAT=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/sda1"
 CONFIG_PCI=y
 CONFIG_NET=y
diff --git a/arch/sh/configs/sh03_defconfig b/arch/sh/configs/sh03_defconfig
index ff502683132e..87e9805b76d0 100644
--- a/arch/sh/configs/sh03_defconfig
+++ b/arch/sh/configs/sh03_defconfig
@@ -16,7 +16,7 @@ CONFIG_FLATMEM_MANUAL=y
 CONFIG_SH_SH03=y
 CONFIG_HEARTBEAT=y
 CONFIG_PREEMPT=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=ttySC1,115200 mem=64M root=/dev/nfs"
 CONFIG_PCI=y
 CONFIG_HOTPLUG_PCI=y
diff --git a/arch/sh/configs/sh2007_defconfig b/arch/sh/configs/sh2007_defconfig
index 99975db461d8..8e92c58316db 100644
--- a/arch/sh/configs/sh2007_defconfig
+++ b/arch/sh/configs/sh2007_defconfig
@@ -20,7 +20,7 @@ CONFIG_SH_DMA=y
 CONFIG_SH_DMA_API=y
 CONFIG_NR_DMA_CHANNELS_BOOL=y
 CONFIG_HZ_100=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=ttySC1,115200 ip=dhcp root=/dev/nfs rw nfsroot=/nfs/rootfs,rsize=1024,wsize=1024 earlyprintk=sh-sci.1"
 CONFIG_PCCARD=y
 CONFIG_BINFMT_MISC=y
diff --git a/arch/sh/configs/sh7757lcr_defconfig b/arch/sh/configs/sh7757lcr_defconfig
index a2700ab165af..a15877daff16 100644
--- a/arch/sh/configs/sh7757lcr_defconfig
+++ b/arch/sh/configs/sh7757lcr_defconfig
@@ -21,7 +21,7 @@ CONFIG_FLATMEM_MANUAL=y
 CONFIG_SH_SH7757LCR=y
 CONFIG_HEARTBEAT=y
 CONFIG_SECCOMP=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=ttySC2,115200 root=/dev/nfs ip=dhcp"
 CONFIG_NET=y
 CONFIG_PACKET=y
diff --git a/arch/sh/configs/sh7763rdp_defconfig b/arch/sh/configs/sh7763rdp_defconfig
index 8a6a446f9eb8..351ccabac8a6 100644
--- a/arch/sh/configs/sh7763rdp_defconfig
+++ b/arch/sh/configs/sh7763rdp_defconfig
@@ -14,7 +14,7 @@ CONFIG_MEMORY_START=0x0c000000
 CONFIG_SH_SH7763RDP=y
 CONFIG_SH_PCLK_FREQ=66666666
 CONFIG_SECCOMP=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=ttySC2,115200 root=/dev/sda1 rootdelay=10"
 CONFIG_NET=y
 CONFIG_PACKET=y
diff --git a/arch/sh/configs/shmin_defconfig b/arch/sh/configs/shmin_defconfig
index c0b6f40d01cc..7cc8725951f5 100644
--- a/arch/sh/configs/shmin_defconfig
+++ b/arch/sh/configs/shmin_defconfig
@@ -18,7 +18,7 @@ CONFIG_FLATMEM_MANUAL=y
 # CONFIG_SH_ADC is not set
 CONFIG_SH_SHMIN=y
 CONFIG_SH_PCLK_FREQ=32000000
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=ttySC1,115200 root=1f01 mtdparts=phys_mapped_flash:64k(firm)ro,-(sys) netdev=34,0x300,eth0 "
 CONFIG_NET=y
 CONFIG_UNIX=y
diff --git a/arch/sh/configs/shx3_defconfig b/arch/sh/configs/shx3_defconfig
index 32ec6eb1eabc..36cac3067cef 100644
--- a/arch/sh/configs/shx3_defconfig
+++ b/arch/sh/configs/shx3_defconfig
@@ -47,7 +47,7 @@ CONFIG_KEXEC=y
 CONFIG_SECCOMP=y
 CONFIG_SMP=y
 CONFIG_PREEMPT=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=ttySC0,115200 earlyprintk=bios ignore_loglevel"
 CONFIG_BINFMT_MISC=y
 CONFIG_NET=y
diff --git a/arch/sh/configs/titan_defconfig b/arch/sh/configs/titan_defconfig
index ba887f1351be..5aa513d54df0 100644
--- a/arch/sh/configs/titan_defconfig
+++ b/arch/sh/configs/titan_defconfig
@@ -20,7 +20,7 @@ CONFIG_SH_PCLK_FREQ=30000000
 CONFIG_SH_DMA=y
 CONFIG_SH_DMA_API=y
 CONFIG_PREEMPT_VOLUNTARY=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=ttySC1,38400N81 root=/dev/nfs ip=:::::eth1:autoconf rw"
 CONFIG_PCI=y
 CONFIG_HOTPLUG_PCI=y
diff --git a/arch/sh/configs/ul2_defconfig b/arch/sh/configs/ul2_defconfig
index 103b81ec1ffb..8d8b6787302f 100644
--- a/arch/sh/configs/ul2_defconfig
+++ b/arch/sh/configs/ul2_defconfig
@@ -18,7 +18,7 @@ CONFIG_HIGH_RES_TIMERS=y
 CONFIG_HZ_100=y
 CONFIG_KEXEC=y
 CONFIG_PREEMPT=y
-CONFIG_CMDLINE_OVERWRITE=y
+CONFIG_CMDLINE_FORCE=y
 CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/nfs ip=dhcp"
 CONFIG_NET=y
 CONFIG_PACKET=y
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index 4144be650d41..464ccbbd8205 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -32,6 +32,7 @@
 #include <linux/of.h>
 #include <linux/of_fdt.h>
 #include <linux/uaccess.h>
+#include <linux/cmdline.h>
 #include <uapi/linux/mount.h>
 #include <asm/io.h>
 #include <asm/page.h>
@@ -306,15 +307,7 @@ void __init setup_arch(char **cmdline_p)
 	bss_resource.start = virt_to_phys(__bss_start);
 	bss_resource.end = virt_to_phys(__bss_stop)-1;
 
-#ifdef CONFIG_CMDLINE_OVERWRITE
-	strlcpy(command_line, CONFIG_CMDLINE, sizeof(command_line));
-#else
-	strlcpy(command_line, COMMAND_LINE, sizeof(command_line));
-#ifdef CONFIG_CMDLINE_EXTEND
-	strlcat(command_line, " ", sizeof(command_line));
-	strlcat(command_line, CONFIG_CMDLINE, sizeof(command_line));
-#endif
-#endif
+	cmdline_build(command_line, COMMAND_LINE);
 
 	/* Save unparsed command line copy for /proc/cmdline */
 	memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
-- 
2.25.0


^ permalink raw reply related

* [PATCH v4 16/20] sparc: Convert to GENERIC_CMDLINE
From: Christophe Leroy @ 2021-04-02 15:18 UTC (permalink / raw)
  To: will, danielwa, robh, daniel, arnd, akpm
  Cc: linux-arch, devicetree, microblaze, linux-xtensa, linux-sh,
	linux-hexagon, x86, linux-kernel, nios2, linux-mips, linux-mm,
	openrisc, sparclinux, linux-riscv, linuxppc-dev, linux-arm-kernel
In-Reply-To: <cover.1617375802.git.christophe.leroy@csgroup.eu>

This converts the architecture to GENERIC_CMDLINE.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/sparc/Kconfig           | 18 +-----------------
 arch/sparc/prom/bootstr_64.c |  2 +-
 2 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 164a5254c91c..2a197f3a2549 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -50,6 +50,7 @@ config SPARC
 	select NEED_DMA_MAP_STATE
 	select NEED_SG_DMA_LENGTH
 	select SET_FS
+	select GENERIC_CMDLINE if SPARC64
 
 config SPARC32
 	def_bool !64BIT
@@ -313,23 +314,6 @@ config SCHED_MC
 	  making when dealing with multi-core CPU chips at a cost of slightly
 	  increased overhead in some places. If unsure say N here.
 
-config CMDLINE_BOOL
-	bool "Default bootloader kernel arguments"
-	depends on SPARC64
-
-config CMDLINE
-	string "Initial kernel command string"
-	depends on CMDLINE_BOOL
-	default "console=ttyS0,9600 root=/dev/sda1"
-	help
-	  Say Y here if you want to be able to pass default arguments to
-	  the kernel. This will be overridden by the bootloader, if you
-	  use one (such as SILO). This is most useful if you want to boot
-	  a kernel from TFTP, and want default options to be available
-	  with having them passed on the command line.
-
-	  NOTE: This option WILL override the PROM bootargs setting!
-
 config SUN_PM
 	bool
 	default y if SPARC32
diff --git a/arch/sparc/prom/bootstr_64.c b/arch/sparc/prom/bootstr_64.c
index f1cc34d99eec..4853a45b3de9 100644
--- a/arch/sparc/prom/bootstr_64.c
+++ b/arch/sparc/prom/bootstr_64.c
@@ -25,7 +25,7 @@ struct {
 	char bootstr_buf[BARG_LEN];
 } bootstr_info = {
 	.bootstr_len = BARG_LEN,
-#ifdef CONFIG_CMDLINE
+#if CONFIG_CMDLINE != ""
 	.bootstr_valid = 1,
 	.bootstr_buf = CONFIG_CMDLINE,
 #endif
-- 
2.25.0


^ permalink raw reply related

* [PATCH v4 17/20] xtensa: Convert to GENERIC_CMDLINE
From: Christophe Leroy @ 2021-04-02 15:18 UTC (permalink / raw)
  To: will, danielwa, robh, daniel, arnd, akpm
  Cc: linux-arch, devicetree, microblaze, linux-xtensa, linux-sh,
	linux-hexagon, x86, linux-kernel, nios2, linux-mips, linux-mm,
	openrisc, sparclinux, linux-riscv, linuxppc-dev, linux-arm-kernel
In-Reply-To: <cover.1617375802.git.christophe.leroy@csgroup.eu>

This converts the architecture to GENERIC_CMDLINE.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/xtensa/Kconfig                         | 15 +--------------
 arch/xtensa/configs/audio_kc705_defconfig   |  1 -
 arch/xtensa/configs/common_defconfig        |  1 -
 arch/xtensa/configs/generic_kc705_defconfig |  1 -
 arch/xtensa/configs/iss_defconfig           |  1 -
 arch/xtensa/configs/nommu_kc705_defconfig   |  1 -
 arch/xtensa/configs/smp_lx200_defconfig     |  1 -
 arch/xtensa/configs/virt_defconfig          |  1 -
 arch/xtensa/configs/xip_kc705_defconfig     |  1 -
 arch/xtensa/kernel/setup.c                  | 10 ++--------
 10 files changed, 3 insertions(+), 30 deletions(-)

diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 9ad6b7b82707..42309f5e9cda 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -16,6 +16,7 @@ config XTENSA
 	select COMMON_CLK
 	select DMA_REMAP if MMU
 	select GENERIC_ATOMIC64
+	select GENERIC_CMDLINE
 	select GENERIC_IRQ_SHOW
 	select GENERIC_PCI_IOMAP
 	select GENERIC_SCHED_CLOCK
@@ -353,20 +354,6 @@ config GENERIC_CALIBRATE_DELAY
 	help
 	  The BogoMIPS value can easily be derived from the CPU frequency.
 
-config CMDLINE_BOOL
-	bool "Default bootloader kernel arguments"
-
-config CMDLINE
-	string "Initial kernel command string"
-	depends on CMDLINE_BOOL
-	default "console=ttyS0,38400 root=/dev/ram"
-	help
-	  On some architectures (EBSA110 and CATS), there is currently no way
-	  for the boot loader to pass arguments to the kernel. For these
-	  architectures, you should supply some command-line options at build
-	  time by entering them here. As a minimum, you should specify the
-	  memory size and the root device (e.g., mem=64M root=/dev/nfs).
-
 config USE_OF
 	bool "Flattened Device Tree support"
 	select OF
diff --git a/arch/xtensa/configs/audio_kc705_defconfig b/arch/xtensa/configs/audio_kc705_defconfig
index 3be62da8089b..5f8661a33ab4 100644
--- a/arch/xtensa/configs/audio_kc705_defconfig
+++ b/arch/xtensa/configs/audio_kc705_defconfig
@@ -27,7 +27,6 @@ CONFIG_PREEMPT=y
 CONFIG_HIGHMEM=y
 # CONFIG_PCI is not set
 CONFIG_XTENSA_PLATFORM_XTFPGA=y
-CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=0x38000000@0"
 CONFIG_USE_OF=y
 CONFIG_BUILTIN_DTB_SOURCE="kc705"
diff --git a/arch/xtensa/configs/common_defconfig b/arch/xtensa/configs/common_defconfig
index fa9389869154..6467ebcbb080 100644
--- a/arch/xtensa/configs/common_defconfig
+++ b/arch/xtensa/configs/common_defconfig
@@ -6,7 +6,6 @@ CONFIG_MODULES=y
 CONFIG_MODVERSIONS=y
 CONFIG_XTENSA_PLATFORM_XT2000=y
 CONFIG_GENERIC_CALIBRATE_DELAY=y
-CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="console=ttyS0,38400 ip=bootp root=nfs nfsroot=/opt/montavista/pro/devkit/xtensa/linux_be/target memmap=128M@0"
 CONFIG_BINFMT_MISC=y
 CONFIG_NET=y
diff --git a/arch/xtensa/configs/generic_kc705_defconfig b/arch/xtensa/configs/generic_kc705_defconfig
index e9d6b6f6eca1..8984c4e68a42 100644
--- a/arch/xtensa/configs/generic_kc705_defconfig
+++ b/arch/xtensa/configs/generic_kc705_defconfig
@@ -26,7 +26,6 @@ CONFIG_PREEMPT=y
 CONFIG_HIGHMEM=y
 # CONFIG_PCI is not set
 CONFIG_XTENSA_PLATFORM_XTFPGA=y
-CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=0x38000000@0"
 CONFIG_USE_OF=y
 CONFIG_BUILTIN_DTB_SOURCE="kc705"
diff --git a/arch/xtensa/configs/iss_defconfig b/arch/xtensa/configs/iss_defconfig
index 32ce8fb068f0..996ad115264d 100644
--- a/arch/xtensa/configs/iss_defconfig
+++ b/arch/xtensa/configs/iss_defconfig
@@ -2,7 +2,6 @@ CONFIG_SYSVIPC=y
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_EXPERT=y
 # CONFIG_PCI is not set
-CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="console=ttyS0,38400 eth0=tuntap,,tap0 ip=192.168.168.5:192.168.168.1 root=nfs nfsroot=192.168.168.1:/opt/montavista/pro/devkit/xtensa/linux_be/target memmap=128M@0"
 # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
 CONFIG_NET=y
diff --git a/arch/xtensa/configs/nommu_kc705_defconfig b/arch/xtensa/configs/nommu_kc705_defconfig
index 88b2e222d4bf..54250bc74885 100644
--- a/arch/xtensa/configs/nommu_kc705_defconfig
+++ b/arch/xtensa/configs/nommu_kc705_defconfig
@@ -33,7 +33,6 @@ CONFIG_PREEMPT=y
 CONFIG_MEMMAP_CACHEATTR=0xfff2442f
 # CONFIG_PCI is not set
 CONFIG_XTENSA_PLATFORM_XTFPGA=y
-CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0x9d050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=256M@0x60000000"
 CONFIG_USE_OF=y
 CONFIG_BUILTIN_DTB_SOURCE="kc705_nommu"
diff --git a/arch/xtensa/configs/smp_lx200_defconfig b/arch/xtensa/configs/smp_lx200_defconfig
index a47c85638ec1..58b284fd627f 100644
--- a/arch/xtensa/configs/smp_lx200_defconfig
+++ b/arch/xtensa/configs/smp_lx200_defconfig
@@ -30,7 +30,6 @@ CONFIG_HOTPLUG_CPU=y
 # CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX is not set
 # CONFIG_PCI is not set
 CONFIG_XTENSA_PLATFORM_XTFPGA=y
-CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=96M@0"
 CONFIG_USE_OF=y
 CONFIG_BUILTIN_DTB_SOURCE="lx200mx"
diff --git a/arch/xtensa/configs/virt_defconfig b/arch/xtensa/configs/virt_defconfig
index 6d1387dfa96f..fb4dce2c70a3 100644
--- a/arch/xtensa/configs/virt_defconfig
+++ b/arch/xtensa/configs/virt_defconfig
@@ -21,7 +21,6 @@ CONFIG_XTENSA_VARIANT_DC233C=y
 CONFIG_XTENSA_UNALIGNED_USER=y
 CONFIG_XTENSA_KSEG_512M=y
 CONFIG_HIGHMEM=y
-CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=0x80000000@0"
 CONFIG_USE_OF=y
 CONFIG_BUILTIN_DTB_SOURCE="virt"
diff --git a/arch/xtensa/configs/xip_kc705_defconfig b/arch/xtensa/configs/xip_kc705_defconfig
index 4f1ff9531f6a..ae4427773af2 100644
--- a/arch/xtensa/configs/xip_kc705_defconfig
+++ b/arch/xtensa/configs/xip_kc705_defconfig
@@ -26,7 +26,6 @@ CONFIG_KERNEL_LOAD_ADDRESS=0xf6000000
 CONFIG_XTENSA_KSEG_512M=y
 CONFIG_HIGHMEM=y
 CONFIG_XTENSA_PLATFORM_XTFPGA=y
-CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=0x38000000@0"
 CONFIG_USE_OF=y
 CONFIG_BUILTIN_DTB_SOURCE="kc705"
diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c
index ed184106e4cf..ebb009f112a5 100644
--- a/arch/xtensa/kernel/setup.c
+++ b/arch/xtensa/kernel/setup.c
@@ -25,6 +25,7 @@
 #include <linux/cpu.h>
 #include <linux/of.h>
 #include <linux/of_fdt.h>
+#include <linux/cmdline.h>
 
 #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
 # include <linux/console.h>
@@ -73,10 +74,6 @@ extern unsigned long loops_per_jiffy;
 
 static char __initdata command_line[COMMAND_LINE_SIZE];
 
-#ifdef CONFIG_CMDLINE_BOOL
-static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
-#endif
-
 #ifdef CONFIG_PARSE_BOOTPARAM
 /*
  * Boot parameter parsing.
@@ -257,10 +254,7 @@ void __init init_arch(bp_tag_t *bp_start)
 	early_init_devtree(dtb_start);
 #endif
 
-#ifdef CONFIG_CMDLINE_BOOL
-	if (!command_line[0])
-		strlcpy(command_line, default_command_line, COMMAND_LINE_SIZE);
-#endif
+	cmdline_build(command_line, command_line);
 
 	/* Early hook for platforms */
 
-- 
2.25.0


^ permalink raw reply related

* [PATCH v4 18/20] x86: Convert to GENERIC_CMDLINE
From: Christophe Leroy @ 2021-04-02 15:18 UTC (permalink / raw)
  To: will, danielwa, robh, daniel, arnd, akpm
  Cc: linux-arch, devicetree, microblaze, linux-xtensa, linux-sh,
	linux-hexagon, x86, linux-kernel, nios2, linux-mips, linux-mm,
	openrisc, sparclinux, linux-riscv, linuxppc-dev, linux-arm-kernel
In-Reply-To: <cover.1617375802.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 ++--------------
 2 files changed, 4 insertions(+), 58 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index a20684d56b4b..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_FORCE 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_FORCE
-	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 6f2de58eeb54..3f274b02e51c 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_FORCE
-	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);
 
 	strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
 	*cmdline_p = command_line;
-- 
2.25.0


^ permalink raw reply related

* [PATCH v4 19/20] mips: Convert to GENERIC_CMDLINE
From: Christophe Leroy @ 2021-04-02 15:18 UTC (permalink / raw)
  To: will, danielwa, robh, daniel, arnd, akpm
  Cc: linux-arch, devicetree, microblaze, linux-xtensa, linux-sh,
	linux-hexagon, x86, linux-kernel, nios2, linux-mips, linux-mm,
	openrisc, sparclinux, linux-riscv, linuxppc-dev, linux-arm-kernel
In-Reply-To: <cover.1617375802.git.christophe.leroy@csgroup.eu>

This converts the architecture to GENERIC_CMDLINE.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/mips/Kconfig                         |  1 +
 arch/mips/Kconfig.debug                   | 44 -----------------------
 arch/mips/configs/ar7_defconfig           |  1 -
 arch/mips/configs/bcm47xx_defconfig       |  1 -
 arch/mips/configs/bcm63xx_defconfig       |  1 -
 arch/mips/configs/bmips_be_defconfig      |  1 -
 arch/mips/configs/bmips_stb_defconfig     |  1 -
 arch/mips/configs/capcella_defconfig      |  1 -
 arch/mips/configs/ci20_defconfig          |  1 -
 arch/mips/configs/cu1000-neo_defconfig    |  1 -
 arch/mips/configs/cu1830-neo_defconfig    |  1 -
 arch/mips/configs/e55_defconfig           |  1 -
 arch/mips/configs/generic_defconfig       |  1 -
 arch/mips/configs/gpr_defconfig           |  1 -
 arch/mips/configs/loongson3_defconfig     |  1 -
 arch/mips/configs/mpc30x_defconfig        |  1 -
 arch/mips/configs/rt305x_defconfig        |  1 -
 arch/mips/configs/tb0219_defconfig        |  1 -
 arch/mips/configs/tb0226_defconfig        |  1 -
 arch/mips/configs/tb0287_defconfig        |  1 -
 arch/mips/configs/workpad_defconfig       |  1 -
 arch/mips/configs/xway_defconfig          |  1 -
 arch/mips/kernel/relocate.c               |  4 +--
 arch/mips/kernel/setup.c                  | 40 ++-------------------
 arch/mips/pic32/pic32mzda/early_console.c |  2 +-
 arch/mips/pic32/pic32mzda/init.c          |  2 --
 26 files changed, 5 insertions(+), 108 deletions(-)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index d89efba3d8a4..a65ce9ddbfce 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -24,6 +24,7 @@ config MIPS
 	select CPU_NO_EFFICIENT_FFS if (TARGET_ISA_REV < 1)
 	select CPU_PM if CPU_IDLE
 	select GENERIC_ATOMIC64 if !64BIT
+	select GENERIC_CMDLINE
 	select GENERIC_CMOS_UPDATE
 	select GENERIC_CPU_AUTOPROBE
 	select GENERIC_GETTIMEOFDAY
diff --git a/arch/mips/Kconfig.debug b/arch/mips/Kconfig.debug
index 7a8d94cdd493..b5a099c74eb6 100644
--- a/arch/mips/Kconfig.debug
+++ b/arch/mips/Kconfig.debug
@@ -30,50 +30,6 @@ config EARLY_PRINTK_8250
 config USE_GENERIC_EARLY_PRINTK_8250
 	bool
 
-config CMDLINE_BOOL
-	bool "Built-in kernel command line"
-	help
-	  For most systems, it is firmware or second stage bootloader that
-	  by default specifies the kernel command line options.  However,
-	  it might be necessary or advantageous to either override the
-	  default kernel command line or add a few extra options to it.
-	  For such cases, this option allows you to hardcode your own
-	  command line options directly into the kernel.  For that, you
-	  should choose 'Y' here, and fill in the extra boot arguments
-	  in CONFIG_CMDLINE.
-
-	  The built-in options will be concatenated to the default command
-	  line if CMDLINE_OVERRIDE is set to 'N'. Otherwise, the default
-	  command line will be ignored and replaced by the built-in string.
-
-	  Most MIPS systems will normally expect 'N' here and rely upon
-	  the command line from the firmware or the second-stage bootloader.
-
-config CMDLINE
-	string "Default kernel command string"
-	depends on CMDLINE_BOOL
-	help
-	  On some platforms, there is currently no way for the boot loader to
-	  pass arguments to the kernel.  For these platforms, and for the cases
-	  when you want to add some extra options to the command line or ignore
-	  the default command line, you can supply some command-line options at
-	  build time by entering them here.  In other cases you can specify
-	  kernel args so that you don't have to set them up in board prom
-	  initialization routines.
-
-	  For more information, see the CMDLINE_BOOL and CMDLINE_OVERRIDE
-	  options.
-
-config CMDLINE_OVERRIDE
-	bool "Built-in command line overrides firmware arguments"
-	depends on CMDLINE_BOOL
-	help
-	  By setting this option to 'Y' you will have your kernel ignore
-	  command line arguments from firmware or second stage bootloader.
-	  Instead, the built-in command line will be used exclusively.
-
-	  Normally, you will choose 'N' here.
-
 config SB1XXX_CORELIS
 	bool "Corelis Debugger"
 	depends on SIBYTE_SB1xxx_SOC
diff --git a/arch/mips/configs/ar7_defconfig b/arch/mips/configs/ar7_defconfig
index cf9c6329b807..5e8adcd799d0 100644
--- a/arch/mips/configs/ar7_defconfig
+++ b/arch/mips/configs/ar7_defconfig
@@ -120,5 +120,4 @@ CONFIG_SQUASHFS=y
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_STRIP_ASM_SYMS=y
 CONFIG_DEBUG_FS=y
-CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="rootfstype=squashfs,jffs2"
diff --git a/arch/mips/configs/bcm47xx_defconfig b/arch/mips/configs/bcm47xx_defconfig
index 91ce75edbfb4..690f423509f0 100644
--- a/arch/mips/configs/bcm47xx_defconfig
+++ b/arch/mips/configs/bcm47xx_defconfig
@@ -77,5 +77,4 @@ CONFIG_DEBUG_INFO_REDUCED=y
 CONFIG_STRIP_ASM_SYMS=y
 CONFIG_DEBUG_FS=y
 CONFIG_MAGIC_SYSRQ=y
-CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="console=ttyS0,115200"
diff --git a/arch/mips/configs/bcm63xx_defconfig b/arch/mips/configs/bcm63xx_defconfig
index 861f680184b9..19b15424f669 100644
--- a/arch/mips/configs/bcm63xx_defconfig
+++ b/arch/mips/configs/bcm63xx_defconfig
@@ -65,5 +65,4 @@ CONFIG_PROC_KCORE=y
 # CONFIG_NETWORK_FILESYSTEMS is not set
 # CONFIG_CRYPTO_HW is not set
 CONFIG_MAGIC_SYSRQ=y
-CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="console=ttyS0,115200"
diff --git a/arch/mips/configs/bmips_be_defconfig b/arch/mips/configs/bmips_be_defconfig
index 032bb51defe8..2db7712acc5d 100644
--- a/arch/mips/configs/bmips_be_defconfig
+++ b/arch/mips/configs/bmips_be_defconfig
@@ -75,5 +75,4 @@ CONFIG_NLS_ISO8859_1=y
 CONFIG_PRINTK_TIME=y
 CONFIG_DEBUG_FS=y
 CONFIG_MAGIC_SYSRQ=y
-CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="earlycon"
diff --git a/arch/mips/configs/bmips_stb_defconfig b/arch/mips/configs/bmips_stb_defconfig
index 625bd2d7e685..bc1659d43ca7 100644
--- a/arch/mips/configs/bmips_stb_defconfig
+++ b/arch/mips/configs/bmips_stb_defconfig
@@ -86,5 +86,4 @@ CONFIG_NLS_ISO8859_1=y
 CONFIG_PRINTK_TIME=y
 CONFIG_DEBUG_FS=y
 CONFIG_MAGIC_SYSRQ=y
-CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="earlycon"
diff --git a/arch/mips/configs/capcella_defconfig b/arch/mips/configs/capcella_defconfig
index 7bf8971af53b..300032a5caa0 100644
--- a/arch/mips/configs/capcella_defconfig
+++ b/arch/mips/configs/capcella_defconfig
@@ -87,5 +87,4 @@ CONFIG_CRYPTO_TEA=m
 CONFIG_CRYPTO_TWOFISH=m
 CONFIG_CRYPTO_DEFLATE=m
 # CONFIG_CRYPTO_HW is not set
-CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="mem=32M console=ttyVR0,38400"
diff --git a/arch/mips/configs/ci20_defconfig b/arch/mips/configs/ci20_defconfig
index ab7ebb066834..f874e421b54f 100644
--- a/arch/mips/configs/ci20_defconfig
+++ b/arch/mips/configs/ci20_defconfig
@@ -203,5 +203,4 @@ CONFIG_PANIC_TIMEOUT=10
 # CONFIG_DEBUG_PREEMPT is not set
 CONFIG_STACKTRACE=y
 # CONFIG_FTRACE is not set
-CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="earlycon console=ttyS4,115200 clk_ignore_unused"
diff --git a/arch/mips/configs/cu1000-neo_defconfig b/arch/mips/configs/cu1000-neo_defconfig
index 9d75f5b77d5d..03cb524967e7 100644
--- a/arch/mips/configs/cu1000-neo_defconfig
+++ b/arch/mips/configs/cu1000-neo_defconfig
@@ -123,5 +123,4 @@ CONFIG_PANIC_TIMEOUT=10
 # CONFIG_DEBUG_PREEMPT is not set
 CONFIG_STACKTRACE=y
 # CONFIG_FTRACE is not set
-CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="earlycon clk_ignore_unused"
diff --git a/arch/mips/configs/cu1830-neo_defconfig b/arch/mips/configs/cu1830-neo_defconfig
index 29decd0003c6..d733ccab494e 100644
--- a/arch/mips/configs/cu1830-neo_defconfig
+++ b/arch/mips/configs/cu1830-neo_defconfig
@@ -126,5 +126,4 @@ CONFIG_PANIC_TIMEOUT=10
 # CONFIG_DEBUG_PREEMPT is not set
 CONFIG_STACKTRACE=y
 # CONFIG_FTRACE is not set
-CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="earlycon clk_ignore_unused"
diff --git a/arch/mips/configs/e55_defconfig b/arch/mips/configs/e55_defconfig
index fd82b858a8f0..ffc964d1bae7 100644
--- a/arch/mips/configs/e55_defconfig
+++ b/arch/mips/configs/e55_defconfig
@@ -33,5 +33,4 @@ CONFIG_AUTOFS4_FS=y
 CONFIG_PROC_KCORE=y
 CONFIG_TMPFS=y
 CONFIG_TMPFS_POSIX_ACL=y
-CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="console=ttyVR0,19200 ide0=0x1f0,0x3f6,40 mem=8M"
diff --git a/arch/mips/configs/generic_defconfig b/arch/mips/configs/generic_defconfig
index 714169e411cf..6003f6c7aa09 100644
--- a/arch/mips/configs/generic_defconfig
+++ b/arch/mips/configs/generic_defconfig
@@ -88,5 +88,4 @@ CONFIG_DEBUG_INFO_REDUCED=y
 CONFIG_DEBUG_FS=y
 # CONFIG_SCHED_DEBUG is not set
 # CONFIG_FTRACE is not set
-CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="earlycon"
diff --git a/arch/mips/configs/gpr_defconfig b/arch/mips/configs/gpr_defconfig
index 5cb91509bb7c..8998d28b94c8 100644
--- a/arch/mips/configs/gpr_defconfig
+++ b/arch/mips/configs/gpr_defconfig
@@ -306,5 +306,4 @@ CONFIG_CRYPTO_TWOFISH=m
 CONFIG_CRYPTO_DEFLATE=m
 # CONFIG_ENABLE_MUST_CHECK is not set
 CONFIG_MAGIC_SYSRQ=y
-CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs rw ip=auto"
diff --git a/arch/mips/configs/loongson3_defconfig b/arch/mips/configs/loongson3_defconfig
index 0e79f81217bc..c4f9a236bd1f 100644
--- a/arch/mips/configs/loongson3_defconfig
+++ b/arch/mips/configs/loongson3_defconfig
@@ -408,5 +408,4 @@ CONFIG_MAGIC_SYSRQ=y
 # CONFIG_SCHED_DEBUG is not set
 # CONFIG_DEBUG_PREEMPT is not set
 # CONFIG_FTRACE is not set
-CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="ieee754=relaxed"
diff --git a/arch/mips/configs/mpc30x_defconfig b/arch/mips/configs/mpc30x_defconfig
index d4e038802510..6ecef2a666fc 100644
--- a/arch/mips/configs/mpc30x_defconfig
+++ b/arch/mips/configs/mpc30x_defconfig
@@ -49,5 +49,4 @@ CONFIG_AUTOFS4_FS=y
 CONFIG_PROC_KCORE=y
 CONFIG_CONFIGFS_FS=m
 CONFIG_NFS_FS=y
-CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="mem=32M console=ttyVR0,19200 ide0=0x170,0x376,73"
diff --git a/arch/mips/configs/rt305x_defconfig b/arch/mips/configs/rt305x_defconfig
index fec5851c164b..c34441ce6621 100644
--- a/arch/mips/configs/rt305x_defconfig
+++ b/arch/mips/configs/rt305x_defconfig
@@ -147,4 +147,3 @@ CONFIG_DEBUG_FS=y
 CONFIG_MAGIC_SYSRQ=y
 # CONFIG_SCHED_DEBUG is not set
 # CONFIG_FTRACE is not set
-CONFIG_CMDLINE_BOOL=y
diff --git a/arch/mips/configs/tb0219_defconfig b/arch/mips/configs/tb0219_defconfig
index 6547f84750b5..ccf20bd156a1 100644
--- a/arch/mips/configs/tb0219_defconfig
+++ b/arch/mips/configs/tb0219_defconfig
@@ -73,5 +73,4 @@ CONFIG_NFS_FS=y
 CONFIG_ROOT_NFS=y
 CONFIG_NFSD=y
 CONFIG_NFSD_V3=y
-CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="cca=3 mem=64M console=ttyVR0,115200 ip=any root=/dev/nfs"
diff --git a/arch/mips/configs/tb0226_defconfig b/arch/mips/configs/tb0226_defconfig
index 7e099f7c2286..9f78fd00a4f6 100644
--- a/arch/mips/configs/tb0226_defconfig
+++ b/arch/mips/configs/tb0226_defconfig
@@ -68,5 +68,4 @@ CONFIG_NFS_FS=y
 CONFIG_ROOT_NFS=y
 CONFIG_NFSD=m
 CONFIG_NFSD_V3=y
-CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="cca=3 mem=32M console=ttyVR0,115200"
diff --git a/arch/mips/configs/tb0287_defconfig b/arch/mips/configs/tb0287_defconfig
index 0d881dd862c0..5529d0dacf94 100644
--- a/arch/mips/configs/tb0287_defconfig
+++ b/arch/mips/configs/tb0287_defconfig
@@ -81,5 +81,4 @@ CONFIG_NFSD_V3=y
 CONFIG_FONTS=y
 CONFIG_FONT_8x8=y
 CONFIG_FONT_8x16=y
-CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="cca=3 mem=64M console=ttyVR0,115200 ip=any root=/dev/nfs"
diff --git a/arch/mips/configs/workpad_defconfig b/arch/mips/configs/workpad_defconfig
index 891a5f77305d..ee712f7b5575 100644
--- a/arch/mips/configs/workpad_defconfig
+++ b/arch/mips/configs/workpad_defconfig
@@ -61,5 +61,4 @@ CONFIG_TMPFS_POSIX_ACL=y
 CONFIG_NFS_FS=m
 CONFIG_NFSD=m
 CONFIG_NFSD_V3=y
-CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="console=ttyVR0,19200 ide0=0x170,0x376,49 mem=16M"
diff --git a/arch/mips/configs/xway_defconfig b/arch/mips/configs/xway_defconfig
index 9abbc0debc2a..ebd8dbdb0695 100644
--- a/arch/mips/configs/xway_defconfig
+++ b/arch/mips/configs/xway_defconfig
@@ -153,4 +153,3 @@ CONFIG_DEBUG_FS=y
 CONFIG_MAGIC_SYSRQ=y
 # CONFIG_SCHED_DEBUG is not set
 # CONFIG_FTRACE is not set
-CONFIG_CMDLINE_BOOL=y
diff --git a/arch/mips/kernel/relocate.c b/arch/mips/kernel/relocate.c
index 499a5357c09f..13c955027696 100644
--- a/arch/mips/kernel/relocate.c
+++ b/arch/mips/kernel/relocate.c
@@ -244,15 +244,13 @@ static inline __init unsigned long get_random_boot(void)
 static inline __init bool kaslr_disabled(void)
 {
 	char *str;
-
-#if defined(CONFIG_CMDLINE_BOOL)
 	const char *builtin_cmdline = CONFIG_CMDLINE;
 
 	str = strstr(builtin_cmdline, "nokaslr");
 	if (str == builtin_cmdline ||
 	    (str > builtin_cmdline && *(str - 1) == ' '))
 		return true;
-#endif
+
 	str = strstr(arcs_cmdline, "nokaslr");
 	if (str == arcs_cmdline || (str > arcs_cmdline && *(str - 1) == ' '))
 		return true;
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 279be0153f8b..f2270528011b 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -29,6 +29,7 @@
 #include <linux/of_fdt.h>
 #include <linux/dmi.h>
 #include <linux/crash_dump.h>
+#include <linux/cmdline.h>
 
 #include <asm/addrspace.h>
 #include <asm/bootinfo.h>
@@ -66,12 +67,6 @@ EXPORT_SYMBOL(mips_machtype);
 static char __initdata command_line[COMMAND_LINE_SIZE];
 char __initdata arcs_cmdline[COMMAND_LINE_SIZE];
 
-#ifdef CONFIG_CMDLINE_BOOL
-static const char builtin_cmdline[] __initconst = CONFIG_CMDLINE;
-#else
-static const char builtin_cmdline[] __initconst = "";
-#endif
-
 /*
  * mips_io_port_base is the begin of the address space to which x86 style
  * I/O ports are mapped.
@@ -546,28 +541,6 @@ static void __init bootcmdline_init(void)
 {
 	bool dt_bootargs = false;
 
-	/*
-	 * If CMDLINE_OVERRIDE is enabled then initializing the command line is
-	 * trivial - we simply use the built-in command line unconditionally &
-	 * unmodified.
-	 */
-	if (IS_ENABLED(CONFIG_CMDLINE_OVERRIDE)) {
-		strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
-		return;
-	}
-
-	/*
-	 * If the user specified a built-in command line &
-	 * MIPS_CMDLINE_BUILTIN_EXTEND, then the built-in command line is
-	 * prepended to arguments from the bootloader or DT so we'll copy them
-	 * to the start of boot_command_line here. Otherwise, empty
-	 * boot_command_line to undo anything early_init_dt_scan_chosen() did.
-	 */
-	if (IS_ENABLED(CONFIG_MIPS_CMDLINE_BUILTIN_EXTEND))
-		strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
-	else
-		boot_command_line[0] = 0;
-
 #ifdef CONFIG_OF_EARLY_FLATTREE
 	/*
 	 * If we're configured to take boot arguments from DT, look for those
@@ -585,16 +558,7 @@ static void __init bootcmdline_init(void)
 	 * plat_mem_setup() should have filled arcs_cmdline with arguments from
 	 * the bootloader.
 	 */
-	if (IS_ENABLED(CONFIG_MIPS_CMDLINE_DTB_EXTEND) || !dt_bootargs)
-		bootcmdline_append(arcs_cmdline, COMMAND_LINE_SIZE);
-
-	/*
-	 * If the user specified a built-in command line & we didn't already
-	 * prepend it, we append it to boot_command_line here.
-	 */
-	if (IS_ENABLED(CONFIG_CMDLINE_BOOL) &&
-	    !IS_ENABLED(CONFIG_MIPS_CMDLINE_BUILTIN_EXTEND))
-		bootcmdline_append(builtin_cmdline, COMMAND_LINE_SIZE);
+	cmdline_build(boot_command_line, arcs_cmdline);
 }
 
 /*
diff --git a/arch/mips/pic32/pic32mzda/early_console.c b/arch/mips/pic32/pic32mzda/early_console.c
index 25372e62783b..94d3a5ba5e10 100644
--- a/arch/mips/pic32/pic32mzda/early_console.c
+++ b/arch/mips/pic32/pic32mzda/early_console.c
@@ -75,7 +75,7 @@ static char * __init pic32_getcmdline(void)
 	 * arch_mem_init() has not been called yet, so we don't have a real
 	 * command line setup if using CONFIG_CMDLINE_BOOL.
 	 */
-#ifdef CONFIG_CMDLINE_OVERRIDE
+#ifdef CONFIG_CMDLINE_FORCE
 	return CONFIG_CMDLINE;
 #else
 	return fw_getcmdline();
diff --git a/arch/mips/pic32/pic32mzda/init.c b/arch/mips/pic32/pic32mzda/init.c
index 764f2d022fae..39fdacbbac56 100644
--- a/arch/mips/pic32/pic32mzda/init.c
+++ b/arch/mips/pic32/pic32mzda/init.c
@@ -40,9 +40,7 @@ void __init plat_mem_setup(void)
 	pr_info("Found following command lines\n");
 	pr_info(" boot_command_line: %s\n", boot_command_line);
 	pr_info(" arcs_cmdline     : %s\n", arcs_cmdline);
-#ifdef CONFIG_CMDLINE_BOOL
 	pr_info(" builtin_cmdline  : %s\n", CONFIG_CMDLINE);
-#endif
 	if (dtb != __dtb_start)
 		strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE);
 
-- 
2.25.0


^ permalink raw reply related

* [PATCH v4 20/20] cmdline: Remove CONFIG_CMDLINE_EXTEND
From: Christophe Leroy @ 2021-04-02 15:18 UTC (permalink / raw)
  To: will, danielwa, robh, daniel, arnd, akpm
  Cc: linux-arch, devicetree, microblaze, linux-xtensa, linux-sh,
	linux-hexagon, x86, linux-kernel, nios2, linux-mips, linux-mm,
	openrisc, sparclinux, linux-riscv, linuxppc-dev, linux-arm-kernel
In-Reply-To: <cover.1617375802.git.christophe.leroy@csgroup.eu>

All architectures providing CONFIG_CMDLINE_EXTEND
are now converted to GENERIC_CMDLINE.

This configuration item is not used anymore, drop it.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 include/linux/cmdline.h | 2 +-
 init/Kconfig            | 6 ------
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/include/linux/cmdline.h b/include/linux/cmdline.h
index a0773dc365c7..020028e2bdf0 100644
--- a/include/linux/cmdline.h
+++ b/include/linux/cmdline.h
@@ -36,7 +36,7 @@ static __always_inline bool __cmdline_build(char *dst, const char *src)
 
 	len = cmdline_strlcat(dst, src, COMMAND_LINE_SIZE);
 
-	if (IS_ENABLED(CONFIG_CMDLINE_EXTEND))
+	if (IS_ENABLED(CONFIG_CMDLINE_APPEND))
 		len = cmdline_strlcat(dst, " " CONFIG_CMDLINE, COMMAND_LINE_SIZE);
 
 	if (len < COMMAND_LINE_SIZE - 1)
diff --git a/init/Kconfig b/init/Kconfig
index af0d84662cc2..fa002e3765ab 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -163,12 +163,6 @@ config CMDLINE_FORCE
 	  arguments provided by the bootloader.
 endchoice
 
-config CMDLINE_EXTEND
-	bool
-	default CMDLINE_APPEND
-	help
-	  To be removed once all architectures are converted to generic CMDLINE
-
 config COMPILE_TEST
 	bool "Compile also drivers which will not load"
 	depends on HAS_IOMEM
-- 
2.25.0


^ permalink raw reply related

* Re: [PATCH v3 05/17] arm: Convert to GENERIC_CMDLINE
From: Christophe Leroy @ 2021-04-02 15:19 UTC (permalink / raw)
  To: Rob Herring
  Cc: open list:GENERIC INCLUDE/ASM HEADER FILES, devicetree,
	microblaze, Daniel Gimpelevich, linux-xtensa, SH-Linux,
	Will Deacon, X86 ML, linux-kernel@vger.kernel.org, nios2,
	open list:MIPS, Openrisc, linux-hexagon, sparclinux, linux-riscv,
	linuxppc-dev, linux-arm-kernel, Daniel Walker
In-Reply-To: <CAL_Jsq+LF-s5K4Jwd5jCHrU8271L5WCiGb0tR7aTUa8ddHF1YQ@mail.gmail.com>



Le 26/03/2021 à 16:47, Rob Herring a écrit :
> On Fri, Mar 26, 2021 at 7:44 AM Christophe Leroy
> <christophe.leroy@csgroup.eu> wrote:
>>
>> This converts the architecture to GENERIC_CMDLINE.
>>
>> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
>> ---
>>   arch/arm/Kconfig              | 38 +----------------------------------
>>   arch/arm/kernel/atags_parse.c | 15 +++++---------
>>   2 files changed, 6 insertions(+), 47 deletions(-)
>>
>> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
>> index 5da96f5df48f..67bc75f2da81 100644
>> --- a/arch/arm/Kconfig
>> +++ b/arch/arm/Kconfig
>> @@ -50,6 +50,7 @@ config ARM
>>          select GENERIC_ARCH_TOPOLOGY if ARM_CPU_TOPOLOGY
>>          select GENERIC_ATOMIC64 if CPU_V7M || CPU_V6 || !CPU_32v6K || !AEABI
>>          select GENERIC_CLOCKEVENTS_BROADCAST if SMP
>> +       select GENERIC_CMDLINE if ATAGS
> 
> Don't we need this enabled for !ATAGS (i.e. DT boot)?
> 
> Can we always enable GENERIC_CMDLINE for OF_EARLY_FLATTREE?
> 

Done in v4

^ permalink raw reply

* Re: [PATCH v3 00/17] Implement GENERIC_CMDLINE
From: Christophe Leroy @ 2021-04-02 15:20 UTC (permalink / raw)
  To: Rob Herring
  Cc: open list:GENERIC INCLUDE/ASM HEADER FILES, devicetree,
	microblaze, Daniel Gimpelevich, linux-xtensa, SH-Linux,
	Will Deacon, X86 ML, linux-kernel@vger.kernel.org, nios2,
	open list:MIPS, Openrisc, linux-hexagon, sparclinux, linux-riscv,
	linuxppc-dev, linux-arm-kernel, Daniel Walker
In-Reply-To: <CAL_JsqLQTM0Xw_skFeysJyYAyW3B=0u0xgePgoUYSpKaWw9SjQ@mail.gmail.com>



Le 26/03/2021 à 16:04, Rob Herring a écrit :
> On Fri, Mar 26, 2021 at 7:44 AM Christophe Leroy
> <christophe.leroy@csgroup.eu> wrote:
>>
>> The purpose of this series is to improve and enhance the
>> handling of kernel boot arguments.
>>
>> It is first focussed on powerpc but also extends the capability
>> for other arches.
>>
>> This is based on suggestion from Daniel Walker <danielwa@cisco.com>
>>
>> Main changes in V3:
>> - Also accept destination equal to source in cmdline_build() by setting a tmp buffer in __initdata. Powerpc provides different source and destination and call __cmdline_build() directly.
>> - Taken comments received from Will and Rob
>> - Converted all architectures (Only tested on powerpc)
>>
>> Christophe Leroy (17):
>>    cmdline: Add generic function to build command line.
>>    drivers: of: use cmdline building function
>>    cmdline: Gives architectures opportunity to use generically defined
>>      boot cmdline manipulation
>>    powerpc: Convert to GENERIC_CMDLINE
>>    arm: Convert to GENERIC_CMDLINE
>>    arm64: Convert to GENERIC_CMDLINE
>>    hexagon: Convert to GENERIC_CMDLINE
>>    microblaze: Convert to GENERIC_CMDLINE
>>    nios2: Convert to GENERIC_CMDLINE
>>    openrisc: Convert to GENERIC_CMDLINE
>>    riscv: Convert to GENERIC_CMDLINE
>>    sh: Convert to GENERIC_CMDLINE
>>    sparc: Convert to GENERIC_CMDLINE
>>    xtensa: Convert to GENERIC_CMDLINE
>>    x86: Convert to GENERIC_CMDLINE
>>    mips: Convert to GENERIC_CMDLINE
>>    cmdline: Remove CONFIG_CMDLINE_EXTEND
>>
>>   arch/arm/Kconfig                            | 38 +-------------
>>   arch/arm/kernel/atags_parse.c               | 15 ++----
>>   arch/arm64/Kconfig                          | 33 +-----------
>>   arch/arm64/kernel/idreg-override.c          |  9 ++--
>>   arch/hexagon/Kconfig                        | 11 +---
>>   arch/hexagon/kernel/setup.c                 | 10 +---
>>   arch/microblaze/Kconfig                     | 24 +--------
>>   arch/microblaze/configs/mmu_defconfig       |  2 +-
>>   arch/microblaze/kernel/head.S               |  4 +-
>>   arch/mips/Kconfig                           |  1 +
>>   arch/mips/Kconfig.debug                     | 44 ----------------
>>   arch/mips/configs/ar7_defconfig             |  1 -
>>   arch/mips/configs/bcm47xx_defconfig         |  1 -
>>   arch/mips/configs/bcm63xx_defconfig         |  1 -
>>   arch/mips/configs/bmips_be_defconfig        |  1 -
>>   arch/mips/configs/bmips_stb_defconfig       |  1 -
>>   arch/mips/configs/capcella_defconfig        |  1 -
>>   arch/mips/configs/ci20_defconfig            |  1 -
>>   arch/mips/configs/cu1000-neo_defconfig      |  1 -
>>   arch/mips/configs/cu1830-neo_defconfig      |  1 -
>>   arch/mips/configs/e55_defconfig             |  1 -
>>   arch/mips/configs/generic_defconfig         |  1 -
>>   arch/mips/configs/gpr_defconfig             |  1 -
>>   arch/mips/configs/loongson3_defconfig       |  1 -
>>   arch/mips/configs/mpc30x_defconfig          |  1 -
>>   arch/mips/configs/rt305x_defconfig          |  1 -
>>   arch/mips/configs/tb0219_defconfig          |  1 -
>>   arch/mips/configs/tb0226_defconfig          |  1 -
>>   arch/mips/configs/tb0287_defconfig          |  1 -
>>   arch/mips/configs/workpad_defconfig         |  1 -
>>   arch/mips/configs/xway_defconfig            |  1 -
>>   arch/mips/kernel/relocate.c                 |  4 +-
>>   arch/mips/kernel/setup.c                    | 40 +--------------
>>   arch/mips/pic32/pic32mzda/early_console.c   |  2 +-
>>   arch/mips/pic32/pic32mzda/init.c            |  2 -
>>   arch/nios2/Kconfig                          | 24 +--------
>>   arch/nios2/kernel/setup.c                   | 13 ++---
>>   arch/openrisc/Kconfig                       | 10 +---
>>   arch/powerpc/Kconfig                        | 37 +------------
>>   arch/powerpc/kernel/prom_init.c             | 17 +++---
>>   arch/riscv/Kconfig                          | 44 +---------------
>>   arch/riscv/kernel/setup.c                   |  5 +-
>>   arch/sh/Kconfig                             | 30 +----------
>>   arch/sh/configs/ap325rxa_defconfig          |  2 +-
>>   arch/sh/configs/dreamcast_defconfig         |  2 +-
>>   arch/sh/configs/ecovec24-romimage_defconfig |  2 +-
>>   arch/sh/configs/ecovec24_defconfig          |  2 +-
>>   arch/sh/configs/edosk7760_defconfig         |  2 +-
>>   arch/sh/configs/espt_defconfig              |  2 +-
>>   arch/sh/configs/j2_defconfig                |  2 +-
>>   arch/sh/configs/kfr2r09-romimage_defconfig  |  2 +-
>>   arch/sh/configs/kfr2r09_defconfig           |  2 +-
>>   arch/sh/configs/lboxre2_defconfig           |  2 +-
>>   arch/sh/configs/microdev_defconfig          |  2 +-
>>   arch/sh/configs/migor_defconfig             |  2 +-
>>   arch/sh/configs/polaris_defconfig           |  2 +-
>>   arch/sh/configs/r7780mp_defconfig           |  2 +-
>>   arch/sh/configs/r7785rp_defconfig           |  2 +-
>>   arch/sh/configs/rsk7201_defconfig           |  2 +-
>>   arch/sh/configs/rsk7203_defconfig           |  2 +-
>>   arch/sh/configs/rts7751r2d1_defconfig       |  2 +-
>>   arch/sh/configs/rts7751r2dplus_defconfig    |  2 +-
>>   arch/sh/configs/sdk7780_defconfig           |  2 +-
>>   arch/sh/configs/sdk7786_defconfig           |  2 +-
>>   arch/sh/configs/se7206_defconfig            |  2 +-
>>   arch/sh/configs/se7343_defconfig            |  2 +-
>>   arch/sh/configs/se7712_defconfig            |  2 +-
>>   arch/sh/configs/se7721_defconfig            |  2 +-
>>   arch/sh/configs/se7724_defconfig            |  2 +-
>>   arch/sh/configs/se7751_defconfig            |  2 +-
>>   arch/sh/configs/se7780_defconfig            |  2 +-
>>   arch/sh/configs/sh03_defconfig              |  2 +-
>>   arch/sh/configs/sh2007_defconfig            |  2 +-
>>   arch/sh/configs/sh7757lcr_defconfig         |  2 +-
>>   arch/sh/configs/sh7763rdp_defconfig         |  2 +-
>>   arch/sh/configs/shmin_defconfig             |  2 +-
>>   arch/sh/configs/shx3_defconfig              |  2 +-
>>   arch/sh/configs/titan_defconfig             |  2 +-
>>   arch/sh/configs/ul2_defconfig               |  2 +-
>>   arch/sh/kernel/setup.c                      | 11 +---
>>   arch/sparc/Kconfig                          | 18 +------
>>   arch/sparc/prom/bootstr_64.c                |  2 +-
>>   arch/x86/Kconfig                            | 45 +---------------
>>   arch/x86/kernel/setup.c                     | 17 +-----
>>   arch/xtensa/Kconfig                         | 15 +-----
>>   arch/xtensa/configs/audio_kc705_defconfig   |  1 -
>>   arch/xtensa/configs/common_defconfig        |  1 -
>>   arch/xtensa/configs/generic_kc705_defconfig |  1 -
>>   arch/xtensa/configs/iss_defconfig           |  1 -
>>   arch/xtensa/configs/nommu_kc705_defconfig   |  1 -
>>   arch/xtensa/configs/smp_lx200_defconfig     |  1 -
>>   arch/xtensa/configs/virt_defconfig          |  1 -
>>   arch/xtensa/configs/xip_kc705_defconfig     |  1 -
>>   arch/xtensa/kernel/setup.c                  | 10 +---
>>   drivers/firmware/efi/libstub/x86-stub.c     | 26 +++++-----
> 
> You missed efi-stub.c which has CMDLINE_EXTEND.
> 

I think I completely missed EFI.

Reworked in V4.


^ permalink raw reply

* Re: [PATCH v3 11/17] riscv: Convert to GENERIC_CMDLINE
From: Christophe Leroy @ 2021-04-02 15:21 UTC (permalink / raw)
  To: Rob Herring
  Cc: open list:GENERIC INCLUDE/ASM HEADER FILES, devicetree,
	microblaze, Daniel Gimpelevich, linux-xtensa, SH-Linux,
	linuxppc-dev, X86 ML, linux-kernel@vger.kernel.org, nios2,
	open list:MIPS, Openrisc, Andreas Schwab, linux-hexagon,
	sparclinux, linux-riscv, Will Deacon, linux-arm-kernel,
	Daniel Walker
In-Reply-To: <CAL_JsqK2TT=j1QjiRgTYQvwHqivE-3HgYo2JzxTJSWO2wvK69Q@mail.gmail.com>



Le 26/03/2021 à 16:26, Rob Herring a écrit :
> On Fri, Mar 26, 2021 at 8:20 AM Christophe Leroy
> <christophe.leroy@csgroup.eu> wrote:
>>
>>
>>
>> Le 26/03/2021 à 15:08, Andreas Schwab a écrit :
>>> On Mär 26 2021, Christophe Leroy wrote:
>>>
>>>> diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
>>>> index f8f15332caa2..e7c91ee478d1 100644
>>>> --- a/arch/riscv/kernel/setup.c
>>>> +++ b/arch/riscv/kernel/setup.c
>>>> @@ -20,6 +20,7 @@
>>>>    #include <linux/swiotlb.h>
>>>>    #include <linux/smp.h>
>>>>    #include <linux/efi.h>
>>>> +#include <linux/cmdline.h>
>>>>
>>>>    #include <asm/cpu_ops.h>
>>>>    #include <asm/early_ioremap.h>
>>>> @@ -228,10 +229,8 @@ static void __init parse_dtb(void)
>>>>       }
>>>>
>>>>       pr_err("No DTB passed to the kernel\n");
>>>> -#ifdef CONFIG_CMDLINE_FORCE
>>>> -    strlcpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
>>>> +    cmdline_build(boot_command_line, NULL, COMMAND_LINE_SIZE);
>>>>       pr_info("Forcing kernel command line to: %s\n", boot_command_line);
>>>
>>> Shouldn't that message become conditional in some way?
>>>
>>
>> You are right, I did something similar on ARM but looks like I missed it on RISCV.
> 
> How is this hunk even useful? Under what conditions can you boot
> without a DTB? Even with a built-in DTB, the DT cmdline handling would
> be called.
> 

Don't know, I wanted to keep as is today.

Do you think the hunk should be completely removed ?


^ permalink raw reply

* Re: [PATCH v3 01/17] cmdline: Add generic function to build command line.
From: Christophe Leroy @ 2021-04-02 15:23 UTC (permalink / raw)
  To: Rob Herring
  Cc: open list:GENERIC INCLUDE/ASM HEADER FILES, devicetree,
	microblaze, Daniel Gimpelevich, linux-xtensa, SH-Linux,
	Will Deacon, X86 ML, linux-kernel@vger.kernel.org, nios2,
	open list:MIPS, Openrisc, linux-hexagon, sparclinux, linux-riscv,
	linuxppc-dev, linux-arm-kernel, Daniel Walker
In-Reply-To: <CAL_JsqKr3xekKSo3DtQvOOw_VoGC=FUTagZGY5g=CGGGdUZSMQ@mail.gmail.com>



Le 26/03/2021 à 16:42, Rob Herring a écrit :
> On Fri, Mar 26, 2021 at 7:44 AM Christophe Leroy
> <christophe.leroy@csgroup.eu> wrote:
>>
>> This code provides architectures with a way to build command line
>> based on what is built in the kernel and what is handed over by the
>> bootloader, based on selected compile-time options.
> 
> Note that I have this patch pending:
> 
> https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20210316193820.3137-1-alex@ghiti.fr/
> 
> It's going to need to be adapted for this. I've held off applying to
> see if this gets settled.

When reworking EFI, I found out that they are a similar handling, which in addition takes care of 
space inside quotes.

I added something similar now in cmdline_build() function.


> 
>>
>> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
>> ---
>> v3:
>> - Addressed comments from Will
>> - Added capability to have src == dst
>> ---
>>   include/linux/cmdline.h | 57 +++++++++++++++++++++++++++++++++++++++++
>>   1 file changed, 57 insertions(+)
>>   create mode 100644 include/linux/cmdline.h
>>
>> diff --git a/include/linux/cmdline.h b/include/linux/cmdline.h
>> new file mode 100644
>> index 000000000000..dea87edd41be
>> --- /dev/null
>> +++ b/include/linux/cmdline.h
>> @@ -0,0 +1,57 @@
>> +/* SPDX-License-Identifier: GPL-2.0 */
>> +#ifndef _LINUX_CMDLINE_H
>> +#define _LINUX_CMDLINE_H
>> +
>> +#include <linux/string.h>
>> +
>> +/* Allow architectures to override strlcat, powerpc can't use strings so early */
>> +#ifndef cmdline_strlcat
>> +#define cmdline_strlcat strlcat
>> +#endif
>> +
>> +/*
>> + * This function will append or prepend a builtin command line to the command
>> + * line provided by the bootloader. Kconfig options can be used to alter
>> + * the behavior of this builtin command line.
>> + * @dst: The destination of the final appended/prepended string.
>> + * @src: The starting string or NULL if there isn't one.
>> + * @len: the length of dest buffer.
>> + */
>> +static __always_inline void __cmdline_build(char *dst, const char *src, size_t len)
>> +{
>> +       if (!len || src == dst)
>> +               return;
>> +
>> +       if (IS_ENABLED(CONFIG_CMDLINE_FORCE) || !src) {
>> +               dst[0] = 0;
>> +               cmdline_strlcat(dst, CONFIG_CMDLINE, len);
>> +               return;
>> +       }
>> +
>> +       if (dst != src)
>> +               dst[0] = 0;
>> +
>> +       if (IS_ENABLED(CONFIG_CMDLINE_PREPEND))
>> +               cmdline_strlcat(dst, CONFIG_CMDLINE " ", len);
>> +
>> +       cmdline_strlcat(dst, src, len);
>> +
>> +       if (IS_ENABLED(CONFIG_CMDLINE_EXTEND))
> 
> Should be APPEND.
> 
>> +               cmdline_strlcat(dst, " " CONFIG_CMDLINE, len);
>> +}
>> +
>> +#define cmdline_build(dst, src, len) do {                              \
> 
> Perhaps a comment why we need this to be a define.
> 
>> +       char *__c_dst = (dst);                                          \
>> +       const char *__c_src = (src);                                    \
>> +                                                                       \
>> +       if (__c_src == __c_dst) {                                       \
>> +               static char __c_tmp[COMMAND_LINE_SIZE] __initdata = ""; \
>> +                                                                       \
>> +               cmdline_strlcat(__c_tmp, __c_src, COMMAND_LINE_SIZE);   \
>> +               __cmdline_build(__c_dst, __c_tmp, (len));               \
>> +       } else {                                                        \
>> +               __cmdline_build(__c_dst, __c_src, (len));               \
>> +       }                                                               \
>> +} while (0)
>> +
>> +#endif /* _LINUX_CMDLINE_H */
>> --
>> 2.25.0
>>

^ permalink raw reply

* Re: [PATCH v3 05/17] arm: Convert to GENERIC_CMDLINE
From: Christophe Leroy @ 2021-04-02 15:24 UTC (permalink / raw)
  To: Rob Herring
  Cc: open list:GENERIC INCLUDE/ASM HEADER FILES, devicetree,
	microblaze, Daniel Gimpelevich, linux-xtensa, SH-Linux,
	Will Deacon, X86 ML, linux-kernel@vger.kernel.org, nios2,
	open list:MIPS, Openrisc, linux-hexagon, sparclinux, linux-riscv,
	linuxppc-dev, linux-arm-kernel, Daniel Walker
In-Reply-To: <CAL_Jsq+LF-s5K4Jwd5jCHrU8271L5WCiGb0tR7aTUa8ddHF1YQ@mail.gmail.com>



Le 26/03/2021 à 16:47, Rob Herring a écrit :
> On Fri, Mar 26, 2021 at 7:44 AM Christophe Leroy
> <christophe.leroy@csgroup.eu> wrote:
>>
>> This converts the architecture to GENERIC_CMDLINE.
>>
>> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
>> ---
>>   arch/arm/Kconfig              | 38 +----------------------------------
>>   arch/arm/kernel/atags_parse.c | 15 +++++---------
>>   2 files changed, 6 insertions(+), 47 deletions(-)
>>
>> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
>> index 5da96f5df48f..67bc75f2da81 100644
>> --- a/arch/arm/Kconfig
>> +++ b/arch/arm/Kconfig
>> @@ -50,6 +50,7 @@ config ARM
>>          select GENERIC_ARCH_TOPOLOGY if ARM_CPU_TOPOLOGY
>>          select GENERIC_ATOMIC64 if CPU_V7M || CPU_V6 || !CPU_32v6K || !AEABI
>>          select GENERIC_CLOCKEVENTS_BROADCAST if SMP
>> +       select GENERIC_CMDLINE if ATAGS
> 
> Don't we need this enabled for !ATAGS (i.e. DT boot)?
> 
> Can we always enable GENERIC_CMDLINE for OF_EARLY_FLATTREE?
> 

Yes missed it in v3 after your comment on v2. Done in v4.

^ permalink raw reply

* Re: [PATCH v5 41/48] KVM: PPC: Book3S HV: Remove unused nested HV tests in XICS emulation
From: kernel test robot @ 2021-04-02 15:28 UTC (permalink / raw)
  To: Nicholas Piggin, kvm-ppc
  Cc: linuxppc-dev, kbuild-all, Cédric Le Goater, Nicholas Piggin
In-Reply-To: <20210401150325.442125-42-npiggin@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 13229 bytes --]

Hi Nicholas,

I love your patch! Perhaps something to improve:

[auto build test WARNING on powerpc/next]
[also build test WARNING on v5.12-rc5 next-20210401]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Nicholas-Piggin/KVM-PPC-Book3S-C-ify-the-P9-entry-exit-code/20210401-232743
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc64-randconfig-s032-20210402 (attached as .config)
compiler: powerpc64le-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.3-279-g6d5d9b42-dirty
        # https://github.com/0day-ci/linux/commit/53519e6ae0f84e2742b886a08598648b424e6f08
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Nicholas-Piggin/KVM-PPC-Book3S-C-ify-the-P9-entry-exit-code/20210401-232743
        git checkout 53519e6ae0f84e2742b886a08598648b424e6f08
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=powerpc64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
   arch/powerpc/kvm/book3s_hv_builtin.c:417:41: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned int [usertype] *out_xirr @@     got restricted __be32 * @@
   arch/powerpc/kvm/book3s_hv_builtin.c:417:41: sparse:     expected unsigned int [usertype] *out_xirr
   arch/powerpc/kvm/book3s_hv_builtin.c:417:41: sparse:     got restricted __be32 *
>> arch/powerpc/kvm/book3s_hv_builtin.c:419:22: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __be32 [addressable] [usertype] xirr @@     got unsigned int @@
   arch/powerpc/kvm/book3s_hv_builtin.c:419:22: sparse:     expected restricted __be32 [addressable] [usertype] xirr
   arch/powerpc/kvm/book3s_hv_builtin.c:419:22: sparse:     got unsigned int
>> arch/powerpc/kvm/book3s_hv_builtin.c:450:41: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned int [usertype] val @@     got restricted __be32 [addressable] [usertype] xirr @@
   arch/powerpc/kvm/book3s_hv_builtin.c:450:41: sparse:     expected unsigned int [usertype] val
   arch/powerpc/kvm/book3s_hv_builtin.c:450:41: sparse:     got restricted __be32 [addressable] [usertype] xirr
   arch/powerpc/kvm/book3s_hv_builtin.c: note: in included file:
   arch/powerpc/include/asm/kvm_ppc.h:967:1: sparse: sparse: cast to restricted __be64
   arch/powerpc/include/asm/kvm_ppc.h:967:1: sparse: sparse: cast to restricted __be64
   arch/powerpc/include/asm/kvm_ppc.h:967:1: sparse: sparse: cast to restricted __be64
   arch/powerpc/include/asm/kvm_ppc.h:967:1: sparse: sparse: cast to restricted __be64
   arch/powerpc/include/asm/kvm_ppc.h:967:1: sparse: sparse: cast to restricted __be64
   arch/powerpc/include/asm/kvm_ppc.h:967:1: sparse: sparse: cast to restricted __be64
   arch/powerpc/include/asm/kvm_ppc.h:967:1: sparse: sparse: cast to restricted __be64
   arch/powerpc/include/asm/kvm_ppc.h:967:1: sparse: sparse: cast to restricted __be64
   arch/powerpc/include/asm/kvm_ppc.h:967:1: sparse: sparse: cast to restricted __be64
   arch/powerpc/include/asm/kvm_ppc.h:967:1: sparse: sparse: cast to restricted __be64
   arch/powerpc/include/asm/kvm_ppc.h:967:1: sparse: sparse: cast to restricted __le64
   arch/powerpc/include/asm/kvm_ppc.h:963:1: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned long long [usertype] srr0 @@     got restricted __be64 [usertype] @@
   arch/powerpc/include/asm/kvm_ppc.h:963:1: sparse:     expected unsigned long long [usertype] srr0
   arch/powerpc/include/asm/kvm_ppc.h:963:1: sparse:     got restricted __be64 [usertype]
   arch/powerpc/include/asm/kvm_ppc.h:963:1: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned long long [usertype] srr0 @@     got restricted __le64 [usertype] @@
   arch/powerpc/include/asm/kvm_ppc.h:963:1: sparse:     expected unsigned long long [usertype] srr0
   arch/powerpc/include/asm/kvm_ppc.h:963:1: sparse:     got restricted __le64 [usertype]
   arch/powerpc/include/asm/kvm_ppc.h:964:1: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned long long [usertype] srr1 @@     got restricted __be64 [usertype] @@
   arch/powerpc/include/asm/kvm_ppc.h:964:1: sparse:     expected unsigned long long [usertype] srr1
   arch/powerpc/include/asm/kvm_ppc.h:964:1: sparse:     got restricted __be64 [usertype]
   arch/powerpc/include/asm/kvm_ppc.h:964:1: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned long long [usertype] srr1 @@     got restricted __le64 [usertype] @@
   arch/powerpc/include/asm/kvm_ppc.h:964:1: sparse:     expected unsigned long long [usertype] srr1
   arch/powerpc/include/asm/kvm_ppc.h:964:1: sparse:     got restricted __le64 [usertype]

vim +419 arch/powerpc/kvm/book3s_hv_builtin.c

f725758b899f11 Paul Mackerras         2016-11-18  395  
f725758b899f11 Paul Mackerras         2016-11-18  396  static long kvmppc_read_one_intr(bool *again)
37f55d30df2eef Suresh Warrier         2016-08-19  397  {
d381d7caf812f7 Benjamin Herrenschmidt 2017-04-05  398  	void __iomem *xics_phys;
37f55d30df2eef Suresh Warrier         2016-08-19  399  	u32 h_xirr;
37f55d30df2eef Suresh Warrier         2016-08-19  400  	__be32 xirr;
37f55d30df2eef Suresh Warrier         2016-08-19  401  	u32 xisr;
37f55d30df2eef Suresh Warrier         2016-08-19  402  	u8 host_ipi;
f725758b899f11 Paul Mackerras         2016-11-18  403  	int64_t rc;
37f55d30df2eef Suresh Warrier         2016-08-19  404  
5af50993850a48 Benjamin Herrenschmidt 2017-04-05  405  	if (xive_enabled())
5af50993850a48 Benjamin Herrenschmidt 2017-04-05  406  		return 1;
5af50993850a48 Benjamin Herrenschmidt 2017-04-05  407  
37f55d30df2eef Suresh Warrier         2016-08-19  408  	/* see if a host IPI is pending */
37f55d30df2eef Suresh Warrier         2016-08-19  409  	host_ipi = local_paca->kvm_hstate.host_ipi;
37f55d30df2eef Suresh Warrier         2016-08-19  410  	if (host_ipi)
37f55d30df2eef Suresh Warrier         2016-08-19  411  		return 1;
37f55d30df2eef Suresh Warrier         2016-08-19  412  
37f55d30df2eef Suresh Warrier         2016-08-19  413  	/* Now read the interrupt from the ICP */
37f55d30df2eef Suresh Warrier         2016-08-19  414  	xics_phys = local_paca->kvm_hstate.xics_phys;
53af3ba2e8195f Paul Mackerras         2017-01-30  415  	rc = 0;
ab9bad0ead9ab1 Benjamin Herrenschmidt 2017-02-07  416  	if (!xics_phys)
53af3ba2e8195f Paul Mackerras         2017-01-30  417  		rc = opal_int_get_xirr(&xirr, false);
53af3ba2e8195f Paul Mackerras         2017-01-30  418  	else
d381d7caf812f7 Benjamin Herrenschmidt 2017-04-05 @419  		xirr = __raw_rm_readl(xics_phys + XICS_XIRR);
f725758b899f11 Paul Mackerras         2016-11-18  420  	if (rc < 0)
37f55d30df2eef Suresh Warrier         2016-08-19  421  		return 1;
37f55d30df2eef Suresh Warrier         2016-08-19  422  
37f55d30df2eef Suresh Warrier         2016-08-19  423  	/*
37f55d30df2eef Suresh Warrier         2016-08-19  424  	 * Save XIRR for later. Since we get control in reverse endian
37f55d30df2eef Suresh Warrier         2016-08-19  425  	 * on LE systems, save it byte reversed and fetch it back in
37f55d30df2eef Suresh Warrier         2016-08-19  426  	 * host endian. Note that xirr is the value read from the
37f55d30df2eef Suresh Warrier         2016-08-19  427  	 * XIRR register, while h_xirr is the host endian version.
37f55d30df2eef Suresh Warrier         2016-08-19  428  	 */
37f55d30df2eef Suresh Warrier         2016-08-19  429  	h_xirr = be32_to_cpu(xirr);
37f55d30df2eef Suresh Warrier         2016-08-19  430  	local_paca->kvm_hstate.saved_xirr = h_xirr;
37f55d30df2eef Suresh Warrier         2016-08-19  431  	xisr = h_xirr & 0xffffff;
37f55d30df2eef Suresh Warrier         2016-08-19  432  	/*
37f55d30df2eef Suresh Warrier         2016-08-19  433  	 * Ensure that the store/load complete to guarantee all side
37f55d30df2eef Suresh Warrier         2016-08-19  434  	 * effects of loading from XIRR has completed
37f55d30df2eef Suresh Warrier         2016-08-19  435  	 */
37f55d30df2eef Suresh Warrier         2016-08-19  436  	smp_mb();
37f55d30df2eef Suresh Warrier         2016-08-19  437  
37f55d30df2eef Suresh Warrier         2016-08-19  438  	/* if nothing pending in the ICP */
37f55d30df2eef Suresh Warrier         2016-08-19  439  	if (!xisr)
37f55d30df2eef Suresh Warrier         2016-08-19  440  		return 0;
37f55d30df2eef Suresh Warrier         2016-08-19  441  
37f55d30df2eef Suresh Warrier         2016-08-19  442  	/* We found something in the ICP...
37f55d30df2eef Suresh Warrier         2016-08-19  443  	 *
37f55d30df2eef Suresh Warrier         2016-08-19  444  	 * If it is an IPI, clear the MFRR and EOI it.
37f55d30df2eef Suresh Warrier         2016-08-19  445  	 */
37f55d30df2eef Suresh Warrier         2016-08-19  446  	if (xisr == XICS_IPI) {
53af3ba2e8195f Paul Mackerras         2017-01-30  447  		rc = 0;
53519e6ae0f84e Nicholas Piggin        2021-04-02  448  		if (xics_phys) {
d381d7caf812f7 Benjamin Herrenschmidt 2017-04-05  449  			__raw_rm_writeb(0xff, xics_phys + XICS_MFRR);
d381d7caf812f7 Benjamin Herrenschmidt 2017-04-05 @450  			__raw_rm_writel(xirr, xics_phys + XICS_XIRR);
f725758b899f11 Paul Mackerras         2016-11-18  451  		} else {
ab9bad0ead9ab1 Benjamin Herrenschmidt 2017-02-07  452  			opal_int_set_mfrr(hard_smp_processor_id(), 0xff);
ab9bad0ead9ab1 Benjamin Herrenschmidt 2017-02-07  453  			rc = opal_int_eoi(h_xirr);
53af3ba2e8195f Paul Mackerras         2017-01-30  454  		}
f725758b899f11 Paul Mackerras         2016-11-18  455  		/* If rc > 0, there is another interrupt pending */
f725758b899f11 Paul Mackerras         2016-11-18  456  		*again = rc > 0;
f725758b899f11 Paul Mackerras         2016-11-18  457  
37f55d30df2eef Suresh Warrier         2016-08-19  458  		/*
37f55d30df2eef Suresh Warrier         2016-08-19  459  		 * Need to ensure side effects of above stores
37f55d30df2eef Suresh Warrier         2016-08-19  460  		 * complete before proceeding.
37f55d30df2eef Suresh Warrier         2016-08-19  461  		 */
37f55d30df2eef Suresh Warrier         2016-08-19  462  		smp_mb();
37f55d30df2eef Suresh Warrier         2016-08-19  463  
37f55d30df2eef Suresh Warrier         2016-08-19  464  		/*
37f55d30df2eef Suresh Warrier         2016-08-19  465  		 * We need to re-check host IPI now in case it got set in the
37f55d30df2eef Suresh Warrier         2016-08-19  466  		 * meantime. If it's clear, we bounce the interrupt to the
37f55d30df2eef Suresh Warrier         2016-08-19  467  		 * guest
37f55d30df2eef Suresh Warrier         2016-08-19  468  		 */
37f55d30df2eef Suresh Warrier         2016-08-19  469  		host_ipi = local_paca->kvm_hstate.host_ipi;
37f55d30df2eef Suresh Warrier         2016-08-19  470  		if (unlikely(host_ipi != 0)) {
37f55d30df2eef Suresh Warrier         2016-08-19  471  			/* We raced with the host,
37f55d30df2eef Suresh Warrier         2016-08-19  472  			 * we need to resend that IPI, bummer
37f55d30df2eef Suresh Warrier         2016-08-19  473  			 */
53519e6ae0f84e Nicholas Piggin        2021-04-02  474  			if (xics_phys)
d381d7caf812f7 Benjamin Herrenschmidt 2017-04-05  475  				__raw_rm_writeb(IPI_PRIORITY,
d381d7caf812f7 Benjamin Herrenschmidt 2017-04-05  476  						xics_phys + XICS_MFRR);
f725758b899f11 Paul Mackerras         2016-11-18  477  			else
ab9bad0ead9ab1 Benjamin Herrenschmidt 2017-02-07  478  				opal_int_set_mfrr(hard_smp_processor_id(),
f725758b899f11 Paul Mackerras         2016-11-18  479  						  IPI_PRIORITY);
37f55d30df2eef Suresh Warrier         2016-08-19  480  			/* Let side effects complete */
37f55d30df2eef Suresh Warrier         2016-08-19  481  			smp_mb();
37f55d30df2eef Suresh Warrier         2016-08-19  482  			return 1;
37f55d30df2eef Suresh Warrier         2016-08-19  483  		}
37f55d30df2eef Suresh Warrier         2016-08-19  484  
37f55d30df2eef Suresh Warrier         2016-08-19  485  		/* OK, it's an IPI for us */
37f55d30df2eef Suresh Warrier         2016-08-19  486  		local_paca->kvm_hstate.saved_xirr = 0;
37f55d30df2eef Suresh Warrier         2016-08-19  487  		return -1;
37f55d30df2eef Suresh Warrier         2016-08-19  488  	}
37f55d30df2eef Suresh Warrier         2016-08-19  489  
f725758b899f11 Paul Mackerras         2016-11-18  490  	return kvmppc_check_passthru(xisr, xirr, again);
37f55d30df2eef Suresh Warrier         2016-08-19  491  }
5af50993850a48 Benjamin Herrenschmidt 2017-04-05  492  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 42686 bytes --]

^ permalink raw reply

* Re: [PATCH v3 01/17] cmdline: Add generic function to build command line.
From: Christophe Leroy @ 2021-04-02 15:33 UTC (permalink / raw)
  To: Daniel Walker
  Cc: linux-arch, robh, microblaze, daniel, devicetree, linux-sh, will,
	linux-xtensa, x86, linux-kernel, nios2, linux-mips, openrisc,
	linux-hexagon, sparclinux, linux-riscv, linuxppc-dev,
	Andrew Morton, linux-arm-kernel
In-Reply-To: <20210330172714.GR109100@zorba>



Le 30/03/2021 à 19:27, Daniel Walker a écrit :
> On Fri, Mar 26, 2021 at 01:44:48PM +0000, Christophe Leroy wrote:
>> This code provides architectures with a way to build command line
>> based on what is built in the kernel and what is handed over by the
>> bootloader, based on selected compile-time options.
>>
>> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
>> ---
>> v3:
>> - Addressed comments from Will
>> - Added capability to have src == dst
>> ---
>>   include/linux/cmdline.h | 57 +++++++++++++++++++++++++++++++++++++++++
>>   1 file changed, 57 insertions(+)
>>   create mode 100644 include/linux/cmdline.h
>>
>> diff --git a/include/linux/cmdline.h b/include/linux/cmdline.h
>> new file mode 100644
>> index 000000000000..dea87edd41be
>> --- /dev/null
>> +++ b/include/linux/cmdline.h
>> @@ -0,0 +1,57 @@
>> +/* SPDX-License-Identifier: GPL-2.0 */
>> +#ifndef _LINUX_CMDLINE_H
>> +#define _LINUX_CMDLINE_H
>> +
>> +#include <linux/string.h>
>> +
>> +/* Allow architectures to override strlcat, powerpc can't use strings so early */
>> +#ifndef cmdline_strlcat
>> +#define cmdline_strlcat strlcat
>> +#endif
>> +
>> +/*
>> + * This function will append or prepend a builtin command line to the command
>> + * line provided by the bootloader. Kconfig options can be used to alter
>> + * the behavior of this builtin command line.
>> + * @dst: The destination of the final appended/prepended string.
>> + * @src: The starting string or NULL if there isn't one.
>> + * @len: the length of dest buffer.
>> + */
> 
> Append or prepend ? Cisco requires both at the same time. This is why my
> implementation provides both. I can't use this with both at once.
> 

I think it can be added as a second step if dimmed necessary. The feeling I have from all the 
discussion is that it's not what people from the community are looking for at the moment.

Anyway, once all architectures are moved to generic handling, I believe it is then easier to split 
CONFIG_CMDLINE in two configuration items in order to provide both appending and prepending at the 
same time.

I see some concerns about risk of double changes, but I have focussed in changing as little as 
possible the existing configuration items, in order to minimise that.

^ permalink raw reply

* Re: [PATCH v3 09/17] nios2: Convert to GENERIC_CMDLINE
From: Christophe Leroy @ 2021-04-02 15:33 UTC (permalink / raw)
  To: Tan, Ley Foon, 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,
	microblaze, linux-xtensa@linux-xtensa.org,
	linux-sh@vger.kernel.org, linux-hexagon@vger.kernel.org,
	x86@kernel.org, linux-kernel@vger.kernel.org,
	linux-mips@vger.kernel.org, openrisc@lists.librecores.org,
	sparclinux@vger.kernel.org, linux-riscv@lists.infradead.org,
	linuxppc-dev@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org
In-Reply-To: <BY5PR11MB38934E74AF74D40379E46AB9CC7E9@BY5PR11MB3893.namprd11.prod.outlook.com>



Le 29/03/2021 à 03:35, Tan, Ley Foon a écrit :
> 
> 
>> -----Original Message-----
>> From: Christophe Leroy <christophe.leroy@csgroup.eu>
>> Sent: Friday, March 26, 2021 9:45 PM
>> 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; Tan, Ley Foon
>> <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 09/17] nios2: Convert to GENERIC_CMDLINE
>>
>> This converts the architecture to GENERIC_CMDLINE.
>>
>> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
>> ---
>>   arch/nios2/Kconfig        | 24 +-----------------------
>>   arch/nios2/kernel/setup.c | 13 ++++---------
>>   2 files changed, 5 insertions(+), 32 deletions(-)
>>
>> diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig index
>> c24955c81c92..f66c97b15813 100644
>> --- a/arch/nios2/Kconfig
>> +++ b/arch/nios2/Kconfig
>> @@ -90,31 +90,9 @@ config NIOS2_ALIGNMENT_TRAP
>>
>>   comment "Boot options"
>>
>> -config CMDLINE_BOOL
>> -	bool "Default bootloader kernel arguments"
>> -	default y
>> -
>> -config CMDLINE
>> -	string "Default kernel command string"
>> -	default ""
>> -	depends on CMDLINE_BOOL
>> -	help
>> -	  On some platforms, there is currently no way for the boot loader to
>> -	  pass arguments to the kernel. For these platforms, you can supply
>> -	  some command-line options at build time by entering them here.  In
>> -	  other cases you can specify kernel args so that you don't have
>> -	  to set them up in board prom initialization routines.
>> -
>> -config CMDLINE_FORCE
>> -	bool "Force default kernel command string"
>> -	depends on CMDLINE_BOOL
>> -	help
>> -	  Set this to have arguments from the default kernel command string
>> -	  override those passed by the boot loader.
>> -
>>   config NIOS2_CMDLINE_IGNORE_DTB
>>   	bool "Ignore kernel command string from DTB"
>> -	depends on CMDLINE_BOOL
>> +	depends on CMDLINE != ""
>>   	depends on !CMDLINE_FORCE
>>   	default y
>>   	help
> 
> Missing " select GENERIC_CMDLINE" ?

Added in v4

Thanks
Christophe

^ permalink raw reply

* Re: [PATCH v3 12/17] sh: Convert to GENERIC_CMDLINE
From: Christophe Leroy @ 2021-04-02 15:36 UTC (permalink / raw)
  To: will, danielwa, robh, daniel
  Cc: linux-arch, devicetree, microblaze, linux-sh, linux-hexagon,
	linux-xtensa, x86, linux-kernel, nios2, linux-mips, openrisc,
	sparclinux, linux-riscv, linuxppc-dev, linux-arm-kernel
In-Reply-To: <6b76649009943f2893fdfded22becd41db2fe1f7.1616765870.git.christophe.leroy@csgroup.eu>



Le 26/03/2021 à 14:44, Christophe Leroy a écrit :
> This converts the architecture to GENERIC_CMDLINE.
> 
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---

> diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
> index e798e55915c2..fab84f62448c 100644
> --- a/arch/sh/Kconfig
> +++ b/arch/sh/Kconfig
> @@ -16,6 +16,7 @@ config SUPERH
>   	select CPU_NO_EFFICIENT_FFS
>   	select DMA_DECLARE_COHERENT
>   	select GENERIC_ATOMIC64
> +	select GENERIC_CMDLINE
>   	select GENERIC_CMOS_UPDATE if SH_SH03 || SH_DREAMCAST
>   	select GENERIC_IDLE_POLL_SETUP
>   	select GENERIC_IRQ_SHOW
> @@ -742,35 +743,6 @@ config ROMIMAGE_MMCIF
>   	  first part of the romImage which in turn loads the rest the kernel
>   	  image to RAM using the MMCIF hardware block.
>   
> -choice
> -	prompt "Kernel command line"
> -	optional
> -	default CMDLINE_OVERWRITE
> -	help
> -	  Setting this option allows the kernel command line arguments
> -	  to be set.
> -
> -config CMDLINE_OVERWRITE
> -	bool "Overwrite bootloader kernel arguments"
> -	help
> -	  Given string will overwrite any arguments passed in by
> -	  a bootloader.
> -
> -config CMDLINE_EXTEND
> -	bool "Extend bootloader kernel arguments"
> -	help
> -	  Given string will be concatenated with arguments passed in
> -	  by a bootloader.
> -
> -endchoice
> -
> -config CMDLINE
> -	string "Kernel command line arguments string"
> -	depends on CMDLINE_OVERWRITE || CMDLINE_EXTEND
> -	default "console=ttySC1,115200"
> -
> -endmenu
> -

That "endmenu" shall not be removed.

Fixed in v4,

Thanks to Rob L. for the report.
Christophe

>   menu "Bus options"
>   
>   config SUPERHYWAY

^ permalink raw reply

* Re: [PATCH v5 41/48] KVM: PPC: Book3S HV: Remove unused nested HV tests in XICS emulation
From: Cédric Le Goater @ 2021-04-02 16:32 UTC (permalink / raw)
  To: Nicholas Piggin, kvm-ppc; +Cc: linuxppc-dev
In-Reply-To: <20210401150325.442125-42-npiggin@gmail.com>

On 4/1/21 5:03 PM, Nicholas Piggin wrote:
> Commit f3c18e9342a44 ("KVM: PPC: Book3S HV: Use XICS hypercalls when
> running as a nested hypervisor") added nested HV tests in XICS
> hypercalls, but not all are required.
> 
> * icp_eoi is only called by kvmppc_deliver_irq_passthru which is only
>   called by kvmppc_check_passthru which is only caled by
>   kvmppc_read_one_intr.
> 
> * kvmppc_read_one_intr is only called by kvmppc_read_intr which is only
>   called by the L0 HV rmhandlers code.
> 
> * kvmhv_rm_send_ipi is called by:
>   - kvmhv_interrupt_vcore which is only called by kvmhv_commence_exit
>     which is only called by the L0 HV rmhandlers code.
>   - icp_send_hcore_msg which is only called by icp_rm_set_vcpu_irq.
>   - icp_rm_set_vcpu_irq which is only called by icp_rm_try_update
>   - icp_rm_set_vcpu_irq is not nested HV safe because it writes to
>     LPCR directly without a kvmhv_on_pseries test. Nested handlers
>     should not in general be using the rm handlers.
> 
> The important test seems to be in kvmppc_ipi_thread, which sends the
> virt-mode H_IPI handler kick to use smp_call_function rather than
> msgsnd.
> 
> Cc: Cédric Le Goater <clg@kaod.org>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
>  arch/powerpc/kvm/book3s_hv_builtin.c | 44 +++++-----------------------
>  arch/powerpc/kvm/book3s_hv_rm_xics.c | 15 ----------
>  2 files changed, 8 insertions(+), 51 deletions(-)

So, now, the L1 is not limited to XICS anymore and we can use the XIVE 
native interrupt mode with an L2 using XICS in KVM or XIVE in QEMU.
Is that correct ?   

It seems you removed all the XICS hcalls under kvmhv_on_pseries().

C.

 
> diff --git a/arch/powerpc/kvm/book3s_hv_builtin.c b/arch/powerpc/kvm/book3s_hv_builtin.c
> index 8d669a0e15f8..259492bb4153 100644
> --- a/arch/powerpc/kvm/book3s_hv_builtin.c
> +++ b/arch/powerpc/kvm/book3s_hv_builtin.c
> @@ -199,15 +199,6 @@ void kvmhv_rm_send_ipi(int cpu)
>  	void __iomem *xics_phys;
>  	unsigned long msg = PPC_DBELL_TYPE(PPC_DBELL_SERVER);
>  
> -	/* For a nested hypervisor, use the XICS via hcall */
> -	if (kvmhv_on_pseries()) {
> -		unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
> -
> -		plpar_hcall_raw(H_IPI, retbuf, get_hard_smp_processor_id(cpu),
> -				IPI_PRIORITY);
> -		return;
> -	}
> -
>  	/* On POWER9 we can use msgsnd for any destination cpu. */
>  	if (cpu_has_feature(CPU_FTR_ARCH_300)) {
>  		msg |= get_hard_smp_processor_id(cpu);
> @@ -420,19 +411,12 @@ static long kvmppc_read_one_intr(bool *again)
>  		return 1;
>  
>  	/* Now read the interrupt from the ICP */
> -	if (kvmhv_on_pseries()) {
> -		unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
> -
> -		rc = plpar_hcall_raw(H_XIRR, retbuf, 0xFF);
> -		xirr = cpu_to_be32(retbuf[0]);
> -	} else {
> -		xics_phys = local_paca->kvm_hstate.xics_phys;
> -		rc = 0;
> -		if (!xics_phys)
> -			rc = opal_int_get_xirr(&xirr, false);
> -		else
> -			xirr = __raw_rm_readl(xics_phys + XICS_XIRR);
> -	}
> +	xics_phys = local_paca->kvm_hstate.xics_phys;
> +	rc = 0;
> +	if (!xics_phys)
> +		rc = opal_int_get_xirr(&xirr, false);
> +	else
> +		xirr = __raw_rm_readl(xics_phys + XICS_XIRR);
>  	if (rc < 0)
>  		return 1;
>  
> @@ -461,13 +445,7 @@ static long kvmppc_read_one_intr(bool *again)
>  	 */
>  	if (xisr == XICS_IPI) {
>  		rc = 0;
> -		if (kvmhv_on_pseries()) {
> -			unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
> -
> -			plpar_hcall_raw(H_IPI, retbuf,
> -					hard_smp_processor_id(), 0xff);
> -			plpar_hcall_raw(H_EOI, retbuf, h_xirr);
> -		} else if (xics_phys) {
> +		if (xics_phys) {
>  			__raw_rm_writeb(0xff, xics_phys + XICS_MFRR);
>  			__raw_rm_writel(xirr, xics_phys + XICS_XIRR);
>  		} else {
> @@ -493,13 +471,7 @@ static long kvmppc_read_one_intr(bool *again)
>  			/* We raced with the host,
>  			 * we need to resend that IPI, bummer
>  			 */
> -			if (kvmhv_on_pseries()) {
> -				unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
> -
> -				plpar_hcall_raw(H_IPI, retbuf,
> -						hard_smp_processor_id(),
> -						IPI_PRIORITY);
> -			} else if (xics_phys)
> +			if (xics_phys)
>  				__raw_rm_writeb(IPI_PRIORITY,
>  						xics_phys + XICS_MFRR);
>  			else
> diff --git a/arch/powerpc/kvm/book3s_hv_rm_xics.c b/arch/powerpc/kvm/book3s_hv_rm_xics.c
> index c2c9c733f359..0a11ec88a0ae 100644
> --- a/arch/powerpc/kvm/book3s_hv_rm_xics.c
> +++ b/arch/powerpc/kvm/book3s_hv_rm_xics.c
> @@ -141,13 +141,6 @@ static void icp_rm_set_vcpu_irq(struct kvm_vcpu *vcpu,
>  		return;
>  	}
>  
> -	if (xive_enabled() && kvmhv_on_pseries()) {
> -		/* No XICS access or hypercalls available, too hard */
> -		this_icp->rm_action |= XICS_RM_KICK_VCPU;
> -		this_icp->rm_kick_target = vcpu;
> -		return;
> -	}
> -
>  	/*
>  	 * Check if the core is loaded,
>  	 * if not, find an available host core to post to wake the VCPU,
> @@ -771,14 +764,6 @@ static void icp_eoi(struct irq_chip *c, u32 hwirq, __be32 xirr, bool *again)
>  	void __iomem *xics_phys;
>  	int64_t rc;
>  
> -	if (kvmhv_on_pseries()) {
> -		unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
> -
> -		iosync();
> -		plpar_hcall_raw(H_EOI, retbuf, hwirq);
> -		return;
> -	}
> -
>  	rc = pnv_opal_pci_msi_eoi(c, hwirq);
>  
>  	if (rc)
> 


^ permalink raw reply

* Re: [PATCH v2] pseries: prevent free CPU ids to be reused on another node
From: Nathan Lynch @ 2021-04-02 16:44 UTC (permalink / raw)
  To: Laurent Dufour
  Cc: Srikar Dronamraju, cheloha, linux-kernel, paulus, linuxppc-dev
In-Reply-To: <d06106d3-76e6-f5da-e3b4-db13c6bfee96@linux.ibm.com>

Laurent Dufour <ldufour@linux.ibm.com> writes:
> Le 02/04/2021 à 15:34, Nathan Lynch a écrit :
>> Laurent Dufour <ldufour@linux.ibm.com> writes:
>>> When a CPU is hot added, the CPU ids are taken from the available mask from
>>> the lower possible set. If that set of values was previously used for CPU
>>> attached to a different node, this seems to application like if these CPUs
>>> have migrated from a node to another one which is not expected in real
>>> life.
>> 
>> This seems like a problem that could affect other architectures or
>> platforms? I guess as long as arch code is responsible for placing new
>> CPUs in cpu_present_mask, that code will have the responsibility of
>> ensuring CPU IDs' NUMA assignments remain stable.
>
> Actually, x86 is already handling this issue in the arch code specific
> code, see 8f54969dc8d6 ("x86/acpi: Introduce persistent storage for
> cpuid <-> apicid mapping"). I didn't check for other architectures but
> as CPU id allocation is in the arch part, I believe this is up to each
> arch to deal with this issue.
>
> Making the CPU id allocation common to all arch is outside the scope
> of this patch.

Well... we'd better avoid a situation where architectures impose
different policies in this area. (I guess we're already in this
situation, which is the problem.) A more maintainable way to achieve
that would be to put the higher-level policy in arch-independent code,
as much as possible.

I don't insist, though.


>> I don't know, should we not fail the request instead of doing the
>> ABI-breaking thing the code in this change is trying to prevent? I
>> don't think a warning in the kernel log is going to help any
>> application that would be affected by this.
>
> That's a really good question. One should argue that the most
> important is to satisfy the CPU add operation, assuming that only few
> are interested in the CPU numbering, while others would prefer the CPU
> adding to fail (which may prevent adding CPUs on another nodes if the
> whole operation is aborted as soon as a CPU add is failing).
>
> I was conservative here, but if failing the operation is the best
> option, then this will make that code simpler, removing the backward
> jump.
>
> Who is deciding?

I favor failing the request. Apart from the implications for user space,
it's not clear to me that allowing the cpu-node relationship to change
once initialized is benign in terms of internal kernel assumptions
(e.g. sched domains, workqueues?). And as you say, it would make for
more straightforward code.

^ permalink raw reply

* Re: [PATCH 1/8] CMDLINE: add generic builtin command line
From: Christophe Leroy @ 2021-04-02 17:28 UTC (permalink / raw)
  To: Daniel Walker, Will Deacon, ob Herring, Daniel Gimpelevich,
	Andrew Morton, x86, linux-mips, linuxppc-dev
  Cc: Ruslan Bilovol, linux-kernel, xe-linux-external
In-Reply-To: <41021d66db2ab427c14255d2a24bb4517c8b58fd.1617126961.git.danielwa@cisco.com>



Le 30/03/2021 à 19:56, Daniel Walker a écrit :
> This code allows architectures to use a generic builtin command line.
> The state of the builtin command line options across architecture is
> diverse. MIPS and X86 once has similar systems, then mips added some
> options to allow extending the command line. Powerpc did something
> simiar in adding the ability to extend. Even with mips and powerpc
> enhancement the needs of Cisco are not met on these platforms.

Can you explain in the commit what is the need ? Nobody mind "who" needs it I think, but "what" is 
needed would be valuable to know.

> 
> The code in this commit unifies the code into a generic
> header file under the CONFIG_GENERIC_CMDLINE option. When this
> option is enabled the architecture can call the cmdline_add_builtin()
> to add the builtin command line.
> 
> This unified implementation offers the same functionality needed by
> Cisco on all platform which use it.

Cisco cisco cisco ... Can we avoid mentionning companies like this ? I can't see patches mentioning 
google or IBM or other companies to that extend.

> 
> Cc: xe-linux-external@cisco.com
> Signed-off-by: Ruslan Bilovol <rbilovol@cisco.com>
> Signed-off-by: Daniel Walker <danielwa@cisco.com>
> ---
>   include/linux/cmdline.h | 98 +++++++++++++++++++++++++++++++++++++++++
>   init/Kconfig            | 72 ++++++++++++++++++++++++++++++
>   2 files changed, 170 insertions(+)
>   create mode 100644 include/linux/cmdline.h
> 
> diff --git a/include/linux/cmdline.h b/include/linux/cmdline.h
> new file mode 100644
> index 000000000000..439c4585feba
> --- /dev/null
> +++ b/include/linux/cmdline.h
> @@ -0,0 +1,98 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef _LINUX_CMDLINE_H
> +#define _LINUX_CMDLINE_H
> +
> +/*
> + *
> + * Copyright (C) 2006,2021. Cisco Systems, Inc.
> + *
> + * Generic Append/Prepend cmdline support.
> + */
> +
> +#if defined(CONFIG_GENERIC_CMDLINE) && defined(CONFIG_CMDLINE_BOOL)
> +
> +#ifndef CONFIG_CMDLINE_OVERRIDE
> +#define GENERIC_CMDLINE_NEED_STRLCAT

Does it matter ?

Only powerpc needs that really. And prom_strlcat() is there anyway, so why not just use it when 
needed and rely on GCC to optimise it out when possible ?


> +#define CMDLINE_PREPEND CONFIG_CMDLINE_PREPEND
> +#define CMDLINE_APPEND CONFIG_CMDLINE_APPEND

What are those defines used for ?

> +
> +/*
> + * This function will append or prepend a builtin command line to the command
> + * line provided by the bootloader. Kconfig options can be used to alter
> + * the behavior of this builtin command line.
> + * @dest: The destination of the final appended/prepended string
> + * @src: The starting string or NULL if there isn't one.
> + * @tmp: temporary space used for prepending
> + * @length: the maximum length of the strings above.
> + * @cmdline_strlcpy: point to a compatible strlcpy
> + * @cmdline_strlcat: point to a compatible strlcat
> + */
> +static inline void
> +__cmdline_add_builtin(char *dest, const char *src, char *tmp, unsigned long length,
> +		size_t (*cmdline_strlcpy)(char *dest, const char *src, size_t size),
> +		size_t (*cmdline_strlcat)(char *dest, const char *src, size_t count))

I still can see the advantage of passing strlcpy and strlcat as functions to the function.

Can we instead use macros defined by default that can be overriden by powerpc ?

Something like

#ifndef cmdline_strlcat
#define cmdline_strlcat strlcat
#define cmdline_strlcpy strlcpy
#endif

> +{
> +	if (src != dest && src != NULL) {
> +		cmdline_strlcpy(dest, " ", length);
> +		cmdline_strlcat(dest, src, length);
> +	}
> +
> +	if (sizeof(CONFIG_CMDLINE_APPEND) > 1)
> +		cmdline_strlcat(dest, " " CONFIG_CMDLINE_APPEND, length);
> +
> +	if (sizeof(CONFIG_CMDLINE_PREPEND) > 1) {
> +		cmdline_strlcpy(tmp, CONFIG_CMDLINE_PREPEND " ", length);
> +		cmdline_strlcat(tmp, dest, length);
> +		cmdline_strlcpy(dest, tmp, length);
> +	}
> +}
> +
> +#define cmdline_add_builtin_custom(dest, src, length, label, cmdline_strlcpy, cmdline_strlcat)			\
> +{														\
> +	if (sizeof(CONFIG_CMDLINE_PREPEND) > 1) {								\
> +		static label char cmdline_tmp_space[length];							\
> +		__cmdline_add_builtin(dest, src, cmdline_tmp_space, length, cmdline_strlcpy, cmdline_strlcat);	\
> +	} else if (sizeof(CONFIG_CMDLINE_APPEND) > 1) {								\
> +		__cmdline_add_builtin(dest, src, NULL, length, cmdline_strlcpy, cmdline_strlcat);		\
> +	}													\
> +}

I still don't like passing section names to a macro that way, just for powerpc.
That tmp space is only needed when source and destination are identical, and it is easy to ensure 
powerpc doesn't need that. For others, just use __initdata section.

Also the variable length is not really necessary, only COMMAND_LINE_SIZE is used everywhere.

> +#define cmdline_add_builtin(dest, src, length)	\
> +	cmdline_add_builtin_custom(dest, src, length, __initdata, strlcpy, strlcat)
> +
> +#else /* CONFIG_CMDLINE_OVERRIDE */
> +
> +#define CMDLINE_PREPEND CONFIG_CMDLINE_PREPEND
> +#define CMDLINE_APPEND CONFIG_CMDLINE_APPEND
> +
> +static inline void
> +__cmdline_add_builtin_custom(char *dest, const char *src, unsigned long length,
> +		size_t (*cmdline_strlcpy)(char *dest, const char *src, size_t size))
> +{
> +	cmdline_strlcpy(dest, CONFIG_CMDLINE_PREPEND " " CONFIG_CMDLINE_APPEND, length);
> +}
> +#define cmdline_add_builtin_custom(dest, src, length, label, cmdline_strlcpy, cmdline_strlcat)	\
> +	__cmdline_add_builtin_custom(dest, src, length, cmdline_strlcpy)
> +#define cmdline_add_builtin(dest, src, length)	\
> +	__cmdline_add_builtin_custom(dest, src, length, strlcpy)
> +#endif /* !CONFIG_CMDLINE_OVERRIDE */
> +
> +#else /* !CONFIG_GENERIC_CMDLINE || !CONFIG_CMDLINE_BOOL */
> +
> +#define CMDLINE_PREPEND ""
> +#define CMDLINE_APPEND ""
> +
> +static inline void
> +__cmdline_add_builtin_custom(char *dest, const char *src, unsigned long length,
> +		size_t (*cmdline_strlcpy)(char *dest, const char *src, size_t size))
> +{
> +	if (src != NULL)
> +		cmdline_strlcpy(dest, src, length);
> +}
> +#define cmdline_add_builtin_custom(dest, src, length, label, cmdline_strlcpy, cmdline_strlcat)	\
> +	__cmdline_add_builtin_custom(dest, src, length, cmdline_strlcpy)
> +#define cmdline_add_builtin(dest, src, length)	\
> +	__cmdline_add_builtin_custom(dest, src, length, strlcpy)	\
> +
> +#endif /* CONFIG_GENERIC_CMDLINE */

There are too many alternatives, they could be easily refactored to a single instance reducing the 
number of #ifdefs.

> +
> +#endif /* _LINUX_CMDLINE_H */
> diff --git a/init/Kconfig b/init/Kconfig
> index 5f5c776ef192..84f06f62550a 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -2034,6 +2034,78 @@ config PROFILING
>   config TRACEPOINTS
>   	bool
>   
> +config GENERIC_CMDLINE
> +	bool
> +
> +config GENERIC_CMDLINE_OF
> +	bool

Oh ? A new one ? What do we need something special for OF ?

> +
> +
> +if GENERIC_CMDLINE
> +
> +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
> +	  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_APPEND
> +	string "Built-in kernel command string append"
> +	depends on CMDLINE_BOOL
> +	default ""

By doing the following instead of using depends

	string "Built-in kernel command string append" if CMDLINE_BOOL
	default ""

you could have CMDLINE_APPEND defined all the time and avoid related #ifdefs.

> +	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, this string is appended to it 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_PREPEND
> +	string "Built-in kernel command string prepend"
> +	depends on CMDLINE_BOOL
> +	default ""

Same


> +	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, this string is prepended to it 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

Most platforms use CMDLINE_FORCE. Why change the majority to minority ?

> +	bool "Built-in command line overrides boot loader arguments"
> +	depends on CMDLINE_BOOL
> +	help
> +	  Set this option to 'Y' to have the kernel ignore the boot loader
> +	  command line, and use ONLY the built-in command line. In this case
> +	  append and prepend strings are concatenated to form the full
> +	  command line.
> +
> +	  This is used to work around broken boot loaders.  This should
> +	  be set to 'N' under normal conditions.
> +endif
> +

Looks like we are still missing the one used at least by powerpc today: CMDLINE_DEFAULT_BOOTLOADER, 
which uses bootloader arguments if provided, builtin arguments otherwise.

>   endmenu		# General setup
>   
>   source "arch/Kconfig"
> 

^ permalink raw reply

* Re: [PATCH 2/8] CMDLINE: drivers: of: ifdef out cmdline section
From: Christophe Leroy @ 2021-04-02 17:32 UTC (permalink / raw)
  To: Daniel Walker, Will Deacon, ob Herring, Daniel Gimpelevich,
	Andrew Morton, x86, linux-mips, linuxppc-dev, Rob Herring,
	Frank Rowand
  Cc: devicetree, Ruslan Ruslichenko, linux-kernel, xe-linux-external
In-Reply-To: <0c4b839f023f87c451c8aa3c4f7a8d92729c2f02.1617126961.git.danielwa@cisco.com>



Le 30/03/2021 à 19:56, Daniel Walker a écrit :
> It looks like there's some seepage of cmdline stuff into
> the generic device tree code. This conflicts with the
> generic cmdline implementation so I remove it in the case
> when that's enabled.
> 
> Cc: xe-linux-external@cisco.com
> Signed-off-by: Ruslan Ruslichenko <rruslich@cisco.com>
> Signed-off-by: Daniel Walker <danielwa@cisco.com>
> ---
>   drivers/of/fdt.c | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index dcc1dd96911a..d8805cd9717a 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -25,6 +25,7 @@
>   #include <linux/serial_core.h>
>   #include <linux/sysfs.h>
>   #include <linux/random.h>
> +#include <linux/cmdline.h>
>   
>   #include <asm/setup.h>  /* for COMMAND_LINE_SIZE */
>   #include <asm/page.h>
> @@ -1050,6 +1051,18 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
>   
>   	/* Retrieve command line */
>   	p = of_get_flat_dt_prop(node, "bootargs", &l);
> +
> +#if defined(CONFIG_GENERIC_CMDLINE) && defined(CONFIG_GENERIC_CMDLINE_OF)
> +	/*
> +	 * The builtin command line will be added here, or it can override
> +	 * with the DT bootargs.
> +	 */
> +	cmdline_add_builtin(data,
> +			    (l > 0 ? p : NULL), /* This is sanity checking */
> +			    COMMAND_LINE_SIZE);
> +#elif defined(CONFIG_GENERIC_CMDLINE)
> +	strlcpy(data, p, COMMAND_LINE_SIZE);
> +#else

Ugly.

Linux codying style recommend to limit the use of #ifdefs to headers as much as possible.

Why do we need so many alternatives ? Allthough they are temporary, can we order the changes in 
another way to reduce that ?

>   	if (p != NULL && l > 0)
>   		strlcpy(data, p, min(l, COMMAND_LINE_SIZE));
>   
> @@ -1070,6 +1083,7 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
>   		strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
>   #endif
>   #endif /* CONFIG_CMDLINE */
> +#endif /* CONFIG_GENERIC_CMDLINE */
>   
>   	pr_debug("Command line is: %s\n", (char *)data);
>   
> 

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox