All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: will@kernel.org, danielwa@cisco.com, robh@kernel.org,
	daniel@gimpelevich.san-francisco.ca.us
Cc: linux-arch@vger.kernel.org, devicetree@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org,
	microblaze <monstr@monstr.eu>,
	linux-mips@vger.kernel.org, nios2 <ley.foon.tan@intel.com>,
	openrisc@lists.librecores.org, linux-hexagon@vger.kernel.org,
	linux-riscv@lists.infradead.org, x86@kernel.org,
	linux-xtensa@linux-xtensa.org, linux-sh@vger.kernel.org,
	sparclinux@vger.kernel.org
Subject: [PATCH v3 04/17] powerpc: Convert to GENERIC_CMDLINE
Date: Fri, 26 Mar 2021 13:44:51 +0000 (UTC)	[thread overview]
Message-ID: <3d5d4281f264ec634f17252b6fef558ca4334243.1616765870.git.christophe.leroy@csgroup.eu> (raw)
In-Reply-To: <cover.1616765869.git.christophe.leroy@csgroup.eu>

This updates the powerpc code to use the new cmdline building function.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/powerpc/Kconfig            | 37 +--------------------------------
 arch/powerpc/kernel/prom_init.c | 17 +++++++--------
 2 files changed, 8 insertions(+), 46 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 386ae12d8523..5181efd7757e 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -167,6 +167,7 @@ config PPC
 	select EDAC_SUPPORT
 	select GENERIC_ATOMIC64			if PPC32
 	select GENERIC_CLOCKEVENTS_BROADCAST	if SMP
+	select GENERIC_CMDLINE
 	select GENERIC_CMOS_UPDATE
 	select GENERIC_CPU_AUTOPROBE
 	select GENERIC_CPU_VULNERABILITIES	if PPC_BARRIER_NOSPEC
@@ -886,42 +887,6 @@ config PPC_DENORMALISATION
 	  Add support for handling denormalisation of single precision
 	  values.  Useful for bare metal only.  If unsure say Y here.
 
-config CMDLINE
-	string "Initial 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 platforms, you can supply
-	  some command-line options at build time by entering them here.  In
-	  most cases you will need to specify the root device here.
-
-choice
-	prompt "Kernel command line type" if CMDLINE != ""
-	default CMDLINE_FROM_BOOTLOADER
-
-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_EXTEND
-	bool "Extend bootloader kernel arguments"
-	help
-	  The command-line arguments provided by the boot loader will be
-	  appended to the default kernel command string.
-
-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 EXTRA_TARGETS
 	string "Additional default image types"
 	help
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index ccf77b985c8f..157d508e9fe9 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -152,7 +152,7 @@ static struct prom_t __prombss prom;
 static unsigned long __prombss prom_entry;
 
 static char __prombss of_stdout_device[256];
-static char __prombss prom_scratch[256];
+static char __prombss prom_scratch[COMMAND_LINE_SIZE];
 
 static unsigned long __prombss dt_header_start;
 static unsigned long __prombss dt_struct_start, dt_struct_end;
@@ -765,22 +765,19 @@ static unsigned long prom_memparse(const char *ptr, const char **retptr)
  * Early parsing of the command line passed to the kernel, used for
  * "mem=x" and the options that affect the iommu
  */
+#define cmdline_strlcat prom_strlcat
+#include <linux/cmdline.h>
+
 static void __init early_cmdline_parse(void)
 {
 	const char *opt;
-
-	char *p;
 	int l = 0;
 
-	prom_cmd_line[0] = 0;
-	p = prom_cmd_line;
-
 	if (!IS_ENABLED(CONFIG_CMDLINE_FORCE) && (long)prom.chosen > 0)
-		l = prom_getprop(prom.chosen, "bootargs", p, COMMAND_LINE_SIZE-1);
+		l = prom_getprop(prom.chosen, "bootargs", prom_scratch,
+				 COMMAND_LINE_SIZE - 1);
 
-	if (IS_ENABLED(CONFIG_CMDLINE_EXTEND) || l <= 0 || p[0] == '\0')
-		prom_strlcat(prom_cmd_line, " " CONFIG_CMDLINE,
-			     sizeof(prom_cmd_line));
+	__cmdline_build(prom_cmd_line, l > 0 ? prom_scratch : NULL, sizeof(prom_scratch));
 
 	prom_printf("command line: %s\n", prom_cmd_line);
 
-- 
2.25.0


WARNING: multiple messages have this Message-ID (diff)
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: will@kernel.org, danielwa@cisco.com, robh@kernel.org,
	daniel@gimpelevich.san-francisco.ca.us
Cc: linux-arch@vger.kernel.org, devicetree@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org,
	microblaze <monstr@monstr.eu>,
	linux-mips@vger.kernel.org, nios2 <ley.foon.tan@intel.com>,
	openrisc@lists.librecores.org, linux-hexagon@vger.kernel.org,
	linux-riscv@lists.infradead.org, x86@kernel.org,
	linux-xtensa@linux-xtensa.org, linux-sh@vger.kernel.org,
	sparclinux@vger.kernel.org
Subject: [PATCH v3 04/17] powerpc: Convert to GENERIC_CMDLINE
Date: Fri, 26 Mar 2021 13:44:51 +0000 (UTC)	[thread overview]
Message-ID: <3d5d4281f264ec634f17252b6fef558ca4334243.1616765870.git.christophe.leroy@csgroup.eu> (raw)
In-Reply-To: <cover.1616765869.git.christophe.leroy@csgroup.eu>

This updates the powerpc code to use the new cmdline building function.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/powerpc/Kconfig            | 37 +--------------------------------
 arch/powerpc/kernel/prom_init.c | 17 +++++++--------
 2 files changed, 8 insertions(+), 46 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 386ae12d8523..5181efd7757e 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -167,6 +167,7 @@ config PPC
 	select EDAC_SUPPORT
 	select GENERIC_ATOMIC64			if PPC32
 	select GENERIC_CLOCKEVENTS_BROADCAST	if SMP
+	select GENERIC_CMDLINE
 	select GENERIC_CMOS_UPDATE
 	select GENERIC_CPU_AUTOPROBE
 	select GENERIC_CPU_VULNERABILITIES	if PPC_BARRIER_NOSPEC
@@ -886,42 +887,6 @@ config PPC_DENORMALISATION
 	  Add support for handling denormalisation of single precision
 	  values.  Useful for bare metal only.  If unsure say Y here.
 
-config CMDLINE
-	string "Initial 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 platforms, you can supply
-	  some command-line options at build time by entering them here.  In
-	  most cases you will need to specify the root device here.
-
-choice
-	prompt "Kernel command line type" if CMDLINE != ""
-	default CMDLINE_FROM_BOOTLOADER
-
-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_EXTEND
-	bool "Extend bootloader kernel arguments"
-	help
-	  The command-line arguments provided by the boot loader will be
-	  appended to the default kernel command string.
-
-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 EXTRA_TARGETS
 	string "Additional default image types"
 	help
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index ccf77b985c8f..157d508e9fe9 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -152,7 +152,7 @@ static struct prom_t __prombss prom;
 static unsigned long __prombss prom_entry;
 
 static char __prombss of_stdout_device[256];
-static char __prombss prom_scratch[256];
+static char __prombss prom_scratch[COMMAND_LINE_SIZE];
 
 static unsigned long __prombss dt_header_start;
 static unsigned long __prombss dt_struct_start, dt_struct_end;
@@ -765,22 +765,19 @@ static unsigned long prom_memparse(const char *ptr, const char **retptr)
  * Early parsing of the command line passed to the kernel, used for
  * "mem=x" and the options that affect the iommu
  */
+#define cmdline_strlcat prom_strlcat
+#include <linux/cmdline.h>
+
 static void __init early_cmdline_parse(void)
 {
 	const char *opt;
-
-	char *p;
 	int l = 0;
 
-	prom_cmd_line[0] = 0;
-	p = prom_cmd_line;
-
 	if (!IS_ENABLED(CONFIG_CMDLINE_FORCE) && (long)prom.chosen > 0)
-		l = prom_getprop(prom.chosen, "bootargs", p, COMMAND_LINE_SIZE-1);
+		l = prom_getprop(prom.chosen, "bootargs", prom_scratch,
+				 COMMAND_LINE_SIZE - 1);
 
-	if (IS_ENABLED(CONFIG_CMDLINE_EXTEND) || l <= 0 || p[0] == '\0')
-		prom_strlcat(prom_cmd_line, " " CONFIG_CMDLINE,
-			     sizeof(prom_cmd_line));
+	__cmdline_build(prom_cmd_line, l > 0 ? prom_scratch : NULL, sizeof(prom_scratch));
 
 	prom_printf("command line: %s\n", prom_cmd_line);
 
-- 
2.25.0


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

WARNING: multiple messages have this Message-ID (diff)
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: will@kernel.org, danielwa@cisco.com, robh@kernel.org,
	daniel@gimpelevich.san-francisco.ca.us
Cc: linux-arch@vger.kernel.org, devicetree@vger.kernel.org,
	microblaze <monstr@monstr.eu>,
	linux-xtensa@linux-xtensa.org, linux-sh@vger.kernel.org,
	linux-hexagon@vger.kernel.org, x86@kernel.org,
	linux-kernel@vger.kernel.org, nios2 <ley.foon.tan@intel.com>,
	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
Subject: [PATCH v3 04/17] powerpc: Convert to GENERIC_CMDLINE
Date: Fri, 26 Mar 2021 13:44:51 +0000 (UTC)	[thread overview]
Message-ID: <3d5d4281f264ec634f17252b6fef558ca4334243.1616765870.git.christophe.leroy@csgroup.eu> (raw)
In-Reply-To: <cover.1616765869.git.christophe.leroy@csgroup.eu>

This updates the powerpc code to use the new cmdline building function.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/powerpc/Kconfig            | 37 +--------------------------------
 arch/powerpc/kernel/prom_init.c | 17 +++++++--------
 2 files changed, 8 insertions(+), 46 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 386ae12d8523..5181efd7757e 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -167,6 +167,7 @@ config PPC
 	select EDAC_SUPPORT
 	select GENERIC_ATOMIC64			if PPC32
 	select GENERIC_CLOCKEVENTS_BROADCAST	if SMP
+	select GENERIC_CMDLINE
 	select GENERIC_CMOS_UPDATE
 	select GENERIC_CPU_AUTOPROBE
 	select GENERIC_CPU_VULNERABILITIES	if PPC_BARRIER_NOSPEC
@@ -886,42 +887,6 @@ config PPC_DENORMALISATION
 	  Add support for handling denormalisation of single precision
 	  values.  Useful for bare metal only.  If unsure say Y here.
 
-config CMDLINE
-	string "Initial 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 platforms, you can supply
-	  some command-line options at build time by entering them here.  In
-	  most cases you will need to specify the root device here.
-
-choice
-	prompt "Kernel command line type" if CMDLINE != ""
-	default CMDLINE_FROM_BOOTLOADER
-
-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_EXTEND
-	bool "Extend bootloader kernel arguments"
-	help
-	  The command-line arguments provided by the boot loader will be
-	  appended to the default kernel command string.
-
-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 EXTRA_TARGETS
 	string "Additional default image types"
 	help
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index ccf77b985c8f..157d508e9fe9 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -152,7 +152,7 @@ static struct prom_t __prombss prom;
 static unsigned long __prombss prom_entry;
 
 static char __prombss of_stdout_device[256];
-static char __prombss prom_scratch[256];
+static char __prombss prom_scratch[COMMAND_LINE_SIZE];
 
 static unsigned long __prombss dt_header_start;
 static unsigned long __prombss dt_struct_start, dt_struct_end;
@@ -765,22 +765,19 @@ static unsigned long prom_memparse(const char *ptr, const char **retptr)
  * Early parsing of the command line passed to the kernel, used for
  * "mem=x" and the options that affect the iommu
  */
+#define cmdline_strlcat prom_strlcat
+#include <linux/cmdline.h>
+
 static void __init early_cmdline_parse(void)
 {
 	const char *opt;
-
-	char *p;
 	int l = 0;
 
-	prom_cmd_line[0] = 0;
-	p = prom_cmd_line;
-
 	if (!IS_ENABLED(CONFIG_CMDLINE_FORCE) && (long)prom.chosen > 0)
-		l = prom_getprop(prom.chosen, "bootargs", p, COMMAND_LINE_SIZE-1);
+		l = prom_getprop(prom.chosen, "bootargs", prom_scratch,
+				 COMMAND_LINE_SIZE - 1);
 
-	if (IS_ENABLED(CONFIG_CMDLINE_EXTEND) || l <= 0 || p[0] == '\0')
-		prom_strlcat(prom_cmd_line, " " CONFIG_CMDLINE,
-			     sizeof(prom_cmd_line));
+	__cmdline_build(prom_cmd_line, l > 0 ? prom_scratch : NULL, sizeof(prom_scratch));
 
 	prom_printf("command line: %s\n", prom_cmd_line);
 
-- 
2.25.0


WARNING: multiple messages have this Message-ID (diff)
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: will@kernel.org, danielwa@cisco.com, robh@kernel.org,
	daniel@gimpelevich.san-francisco.ca.us
Cc: linux-arch@vger.kernel.org, devicetree@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org,
	microblaze <monstr@monstr.eu>,
	linux-mips@vger.kernel.org, nios2 <ley.foon.tan@intel.com>,
	openrisc@lists.librecores.org, linux-hexagon@vger.kernel.org,
	linux-riscv@lists.infradead.org, x86@kernel.org,
	linux-xtensa@linux-xtensa.org, linux-sh@vger.kernel.org,
	sparclinux@vger.kernel.org
Subject: [PATCH v3 04/17] powerpc: Convert to GENERIC_CMDLINE
Date: Fri, 26 Mar 2021 13:44:51 +0000 (UTC)	[thread overview]
Message-ID: <3d5d4281f264ec634f17252b6fef558ca4334243.1616765870.git.christophe.leroy@csgroup.eu> (raw)
In-Reply-To: <cover.1616765869.git.christophe.leroy@csgroup.eu>

This updates the powerpc code to use the new cmdline building function.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/powerpc/Kconfig            | 37 +--------------------------------
 arch/powerpc/kernel/prom_init.c | 17 +++++++--------
 2 files changed, 8 insertions(+), 46 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 386ae12d8523..5181efd7757e 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -167,6 +167,7 @@ config PPC
 	select EDAC_SUPPORT
 	select GENERIC_ATOMIC64			if PPC32
 	select GENERIC_CLOCKEVENTS_BROADCAST	if SMP
+	select GENERIC_CMDLINE
 	select GENERIC_CMOS_UPDATE
 	select GENERIC_CPU_AUTOPROBE
 	select GENERIC_CPU_VULNERABILITIES	if PPC_BARRIER_NOSPEC
@@ -886,42 +887,6 @@ config PPC_DENORMALISATION
 	  Add support for handling denormalisation of single precision
 	  values.  Useful for bare metal only.  If unsure say Y here.
 
-config CMDLINE
-	string "Initial 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 platforms, you can supply
-	  some command-line options at build time by entering them here.  In
-	  most cases you will need to specify the root device here.
-
-choice
-	prompt "Kernel command line type" if CMDLINE != ""
-	default CMDLINE_FROM_BOOTLOADER
-
-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_EXTEND
-	bool "Extend bootloader kernel arguments"
-	help
-	  The command-line arguments provided by the boot loader will be
-	  appended to the default kernel command string.
-
-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 EXTRA_TARGETS
 	string "Additional default image types"
 	help
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index ccf77b985c8f..157d508e9fe9 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -152,7 +152,7 @@ static struct prom_t __prombss prom;
 static unsigned long __prombss prom_entry;
 
 static char __prombss of_stdout_device[256];
-static char __prombss prom_scratch[256];
+static char __prombss prom_scratch[COMMAND_LINE_SIZE];
 
 static unsigned long __prombss dt_header_start;
 static unsigned long __prombss dt_struct_start, dt_struct_end;
@@ -765,22 +765,19 @@ static unsigned long prom_memparse(const char *ptr, const char **retptr)
  * Early parsing of the command line passed to the kernel, used for
  * "mem=x" and the options that affect the iommu
  */
+#define cmdline_strlcat prom_strlcat
+#include <linux/cmdline.h>
+
 static void __init early_cmdline_parse(void)
 {
 	const char *opt;
-
-	char *p;
 	int l = 0;
 
-	prom_cmd_line[0] = 0;
-	p = prom_cmd_line;
-
 	if (!IS_ENABLED(CONFIG_CMDLINE_FORCE) && (long)prom.chosen > 0)
-		l = prom_getprop(prom.chosen, "bootargs", p, COMMAND_LINE_SIZE-1);
+		l = prom_getprop(prom.chosen, "bootargs", prom_scratch,
+				 COMMAND_LINE_SIZE - 1);
 
-	if (IS_ENABLED(CONFIG_CMDLINE_EXTEND) || l <= 0 || p[0] == '\0')
-		prom_strlcat(prom_cmd_line, " " CONFIG_CMDLINE,
-			     sizeof(prom_cmd_line));
+	__cmdline_build(prom_cmd_line, l > 0 ? prom_scratch : NULL, sizeof(prom_scratch));
 
 	prom_printf("command line: %s\n", prom_cmd_line);
 
-- 
2.25.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: openrisc@lists.librecores.org
Subject: [OpenRISC] [PATCH v3 04/17] powerpc: Convert to GENERIC_CMDLINE
Date: Fri, 26 Mar 2021 13:44:51 +0000 (UTC)	[thread overview]
Message-ID: <3d5d4281f264ec634f17252b6fef558ca4334243.1616765870.git.christophe.leroy@csgroup.eu> (raw)
In-Reply-To: <cover.1616765869.git.christophe.leroy@csgroup.eu>

This updates the powerpc code to use the new cmdline building function.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/powerpc/Kconfig            | 37 +--------------------------------
 arch/powerpc/kernel/prom_init.c | 17 +++++++--------
 2 files changed, 8 insertions(+), 46 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 386ae12d8523..5181efd7757e 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -167,6 +167,7 @@ config PPC
 	select EDAC_SUPPORT
 	select GENERIC_ATOMIC64			if PPC32
 	select GENERIC_CLOCKEVENTS_BROADCAST	if SMP
+	select GENERIC_CMDLINE
 	select GENERIC_CMOS_UPDATE
 	select GENERIC_CPU_AUTOPROBE
 	select GENERIC_CPU_VULNERABILITIES	if PPC_BARRIER_NOSPEC
@@ -886,42 +887,6 @@ config PPC_DENORMALISATION
 	  Add support for handling denormalisation of single precision
 	  values.  Useful for bare metal only.  If unsure say Y here.
 
-config CMDLINE
-	string "Initial 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 platforms, you can supply
-	  some command-line options at build time by entering them here.  In
-	  most cases you will need to specify the root device here.
-
-choice
-	prompt "Kernel command line type" if CMDLINE != ""
-	default CMDLINE_FROM_BOOTLOADER
-
-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_EXTEND
-	bool "Extend bootloader kernel arguments"
-	help
-	  The command-line arguments provided by the boot loader will be
-	  appended to the default kernel command string.
-
-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 EXTRA_TARGETS
 	string "Additional default image types"
 	help
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index ccf77b985c8f..157d508e9fe9 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -152,7 +152,7 @@ static struct prom_t __prombss prom;
 static unsigned long __prombss prom_entry;
 
 static char __prombss of_stdout_device[256];
-static char __prombss prom_scratch[256];
+static char __prombss prom_scratch[COMMAND_LINE_SIZE];
 
 static unsigned long __prombss dt_header_start;
 static unsigned long __prombss dt_struct_start, dt_struct_end;
@@ -765,22 +765,19 @@ static unsigned long prom_memparse(const char *ptr, const char **retptr)
  * Early parsing of the command line passed to the kernel, used for
  * "mem=x" and the options that affect the iommu
  */
+#define cmdline_strlcat prom_strlcat
+#include <linux/cmdline.h>
+
 static void __init early_cmdline_parse(void)
 {
 	const char *opt;
-
-	char *p;
 	int l = 0;
 
-	prom_cmd_line[0] = 0;
-	p = prom_cmd_line;
-
 	if (!IS_ENABLED(CONFIG_CMDLINE_FORCE) && (long)prom.chosen > 0)
-		l = prom_getprop(prom.chosen, "bootargs", p, COMMAND_LINE_SIZE-1);
+		l = prom_getprop(prom.chosen, "bootargs", prom_scratch,
+				 COMMAND_LINE_SIZE - 1);
 
-	if (IS_ENABLED(CONFIG_CMDLINE_EXTEND) || l <= 0 || p[0] == '\0')
-		prom_strlcat(prom_cmd_line, " " CONFIG_CMDLINE,
-			     sizeof(prom_cmd_line));
+	__cmdline_build(prom_cmd_line, l > 0 ? prom_scratch : NULL, sizeof(prom_scratch));
 
 	prom_printf("command line: %s\n", prom_cmd_line);
 
-- 
2.25.0


  parent reply	other threads:[~2021-03-26 13:46 UTC|newest]

Thread overview: 206+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-26 13:44 [PATCH v3 00/17] Implement GENERIC_CMDLINE Christophe Leroy
2021-03-26 13:44 ` [OpenRISC] " Christophe Leroy
2021-03-26 13:44 ` Christophe Leroy
2021-03-26 13:44 ` Christophe Leroy
2021-03-26 13:44 ` Christophe Leroy
2021-03-26 13:44 ` [PATCH v3 01/17] cmdline: Add generic function to build command line Christophe Leroy
2021-03-26 13:44   ` [OpenRISC] " Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 15:42   ` Rob Herring
2021-03-26 15:42     ` [OpenRISC] " Rob Herring
2021-03-26 15:42     ` Rob Herring
2021-03-26 15:42     ` Rob Herring
2021-03-26 15:42     ` Rob Herring
2021-03-26 15:55     ` Christophe Leroy
2021-03-26 15:55       ` [OpenRISC] " Christophe Leroy
2021-03-26 15:55       ` Christophe Leroy
2021-03-26 15:55       ` Christophe Leroy
2021-03-26 15:55       ` Christophe Leroy
2021-04-02 15:23     ` Christophe Leroy
2021-04-02 15:23       ` [OpenRISC] " Christophe Leroy
2021-04-02 15:23       ` Christophe Leroy
2021-04-02 15:23       ` Christophe Leroy
2021-04-02 15:23       ` Christophe Leroy
2021-03-30 17:27   ` Daniel Walker
2021-03-30 17:27     ` [OpenRISC] " Daniel Walker
2021-03-30 17:27     ` Daniel Walker
2021-03-30 17:27     ` Daniel Walker
2021-03-30 17:27     ` Daniel Walker
2021-03-30 18:07     ` H. Nikolaus Schaller
2021-03-30 18:07       ` [OpenRISC] " H. Nikolaus Schaller
2021-03-30 18:07       ` H. Nikolaus Schaller
2021-03-30 18:07       ` H. Nikolaus Schaller
2021-03-30 18:07       ` H. Nikolaus Schaller
2021-03-30 18:23       ` Daniel Walker
2021-03-30 18:23         ` [OpenRISC] " Daniel Walker
2021-03-30 18:23         ` Daniel Walker
2021-03-30 18:23         ` Daniel Walker
2021-03-30 18:23         ` Daniel Walker
2021-04-02 15:33     ` Christophe Leroy
2021-04-02 15:33       ` [OpenRISC] " Christophe Leroy
2021-04-02 15:33       ` Christophe Leroy
2021-04-02 15:33       ` Christophe Leroy
2021-04-02 15:33       ` Christophe Leroy
2021-03-26 13:44 ` [PATCH v3 02/17] drivers: of: use cmdline building function Christophe Leroy
2021-03-26 13:44   ` [OpenRISC] " Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 13:44 ` [PATCH v3 03/17] cmdline: Gives architectures opportunity to use generically defined boot cmdline manipulation Christophe Leroy
2021-03-26 13:44   ` [OpenRISC] " Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 13:44 ` Christophe Leroy [this message]
2021-03-26 13:44   ` [OpenRISC] [PATCH v3 04/17] powerpc: Convert to GENERIC_CMDLINE Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 13:44 ` [PATCH v3 05/17] arm: " Christophe Leroy
2021-03-26 13:44   ` [OpenRISC] " Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 15:47   ` Rob Herring
2021-03-26 15:47     ` [OpenRISC] " Rob Herring
2021-03-26 15:47     ` Rob Herring
2021-03-26 15:47     ` Rob Herring
2021-03-26 15:47     ` Rob Herring
2021-03-26 15:49     ` Christophe Leroy
2021-03-26 15:49       ` [OpenRISC] " Christophe Leroy
2021-03-26 15:49       ` Christophe Leroy
2021-03-26 15:49       ` Christophe Leroy
2021-03-26 15:49       ` Christophe Leroy
2021-03-26 18:22       ` Rob Herring
2021-03-26 18:22         ` [OpenRISC] " Rob Herring
2021-03-26 18:22         ` Rob Herring
2021-03-26 18:22         ` Rob Herring
2021-03-26 18:22         ` Rob Herring
2021-04-02 15:19     ` Christophe Leroy
2021-04-02 15:19       ` [OpenRISC] " Christophe Leroy
2021-04-02 15:19       ` Christophe Leroy
2021-04-02 15:19       ` Christophe Leroy
2021-04-02 15:19       ` Christophe Leroy
2021-04-02 15:24     ` Christophe Leroy
2021-04-02 15:24       ` [OpenRISC] " Christophe Leroy
2021-04-02 15:24       ` Christophe Leroy
2021-04-02 15:24       ` Christophe Leroy
2021-04-02 15:24       ` Christophe Leroy
2021-03-26 13:44 ` [PATCH v3 06/17] arm64: " Christophe Leroy
2021-03-26 13:44   ` [OpenRISC] " Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 13:44 ` [PATCH v3 07/17] hexagon: " Christophe Leroy
2021-03-26 13:44   ` [OpenRISC] " Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 13:44 ` [PATCH v3 08/17] microblaze: " Christophe Leroy
2021-03-26 13:44   ` [OpenRISC] " Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 13:44 ` [PATCH v3 09/17] nios2: " Christophe Leroy
2021-03-26 13:44   ` [OpenRISC] " Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-29  1:35   ` Tan, Ley Foon
2021-03-29  1:35     ` Tan, Ley Foon
2021-03-29  1:35     ` [OpenRISC] " Tan, Ley Foon
2021-03-29  1:35     ` Tan, Ley Foon
2021-03-29  1:35     ` Tan, Ley Foon
2021-03-29  1:35     ` Tan, Ley Foon
2021-04-02 15:33     ` Christophe Leroy
2021-04-02 15:33       ` Christophe Leroy
2021-04-02 15:33       ` [OpenRISC] " Christophe Leroy
2021-04-02 15:33       ` Christophe Leroy
2021-04-02 15:33       ` Christophe Leroy
2021-04-02 15:33       ` Christophe Leroy
2021-03-26 13:44 ` [PATCH v3 10/17] openrisc: " Christophe Leroy
2021-03-26 13:44   ` [OpenRISC] " Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 13:44 ` [PATCH v3 11/17] riscv: " Christophe Leroy
2021-03-26 13:44   ` [OpenRISC] " Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 14:08   ` Andreas Schwab
2021-03-26 14:08     ` Andreas Schwab
2021-03-26 14:08     ` [OpenRISC] " Andreas Schwab
2021-03-26 14:08     ` Andreas Schwab
2021-03-26 14:08     ` Andreas Schwab
2021-03-26 14:08     ` Andreas Schwab
2021-03-26 14:20     ` Christophe Leroy
2021-03-26 14:20       ` [OpenRISC] " Christophe Leroy
2021-03-26 14:20       ` Christophe Leroy
2021-03-26 14:20       ` Christophe Leroy
2021-03-26 14:20       ` Christophe Leroy
2021-03-26 15:26       ` Rob Herring
2021-03-26 15:26         ` [OpenRISC] " Rob Herring
2021-03-26 15:26         ` Rob Herring
2021-03-26 15:26         ` Rob Herring
2021-03-26 15:26         ` Rob Herring
2021-03-30  0:52         ` Nick Kossifidis
2021-03-30  0:52           ` Nick Kossifidis
2021-03-30  0:52           ` [OpenRISC] " Nick Kossifidis
2021-03-30  0:52           ` Nick Kossifidis
2021-03-30  0:52           ` Nick Kossifidis
2021-03-30  0:52           ` Nick Kossifidis
2021-04-02 15:21         ` Christophe Leroy
2021-04-02 15:21           ` Christophe Leroy
2021-04-02 15:21           ` [OpenRISC] " Christophe Leroy
2021-04-02 15:21           ` Christophe Leroy
2021-04-02 15:21           ` Christophe Leroy
2021-04-02 15:21           ` Christophe Leroy
2021-03-26 13:44 ` [PATCH v3 12/17] sh: " Christophe Leroy
2021-03-26 13:44   ` [OpenRISC] " Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-03-26 13:44   ` Christophe Leroy
2021-04-02 15:36   ` Christophe Leroy
2021-04-02 15:36     ` [OpenRISC] " Christophe Leroy
2021-04-02 15:36     ` Christophe Leroy
2021-04-02 15:36     ` Christophe Leroy
2021-04-02 15:36     ` Christophe Leroy
2021-03-26 13:45 ` [PATCH v3 13/17] sparc: " Christophe Leroy
2021-03-26 13:45   ` Christophe Leroy
2021-03-26 13:45   ` [OpenRISC] " Christophe Leroy
2021-03-26 13:45   ` Christophe Leroy
2021-03-26 13:45   ` Christophe Leroy
2021-03-26 13:45   ` Christophe Leroy
2021-03-26 13:45 ` [PATCH v3 14/17] xtensa: " Christophe Leroy
2021-03-26 13:45   ` [OpenRISC] " Christophe Leroy
2021-03-26 13:45   ` Christophe Leroy
2021-03-26 13:45   ` Christophe Leroy
2021-03-26 13:45   ` Christophe Leroy
2021-03-26 13:45 ` [PATCH v3 15/17] x86: " Christophe Leroy
2021-03-26 13:45   ` [OpenRISC] " Christophe Leroy
2021-03-26 13:45   ` Christophe Leroy
2021-03-26 13:45   ` Christophe Leroy
2021-03-26 13:45   ` Christophe Leroy
2021-03-26 13:45 ` [PATCH v3 16/17] mips: " Christophe Leroy
2021-03-26 13:45   ` [OpenRISC] " Christophe Leroy
2021-03-26 13:45   ` Christophe Leroy
2021-03-26 13:45   ` Christophe Leroy
2021-03-26 13:45   ` Christophe Leroy
2021-03-26 13:45 ` [PATCH v3 17/17] cmdline: Remove CONFIG_CMDLINE_EXTEND Christophe Leroy
2021-03-26 13:45   ` [OpenRISC] " Christophe Leroy
2021-03-26 13:45   ` Christophe Leroy
2021-03-26 13:45   ` Christophe Leroy
2021-03-26 13:45   ` Christophe Leroy
2021-03-26 15:04 ` [PATCH v3 00/17] Implement GENERIC_CMDLINE Rob Herring
2021-03-26 15:04   ` [OpenRISC] " Rob Herring
2021-03-26 15:04   ` Rob Herring
2021-03-26 15:04   ` Rob Herring
2021-03-26 15:04   ` Rob Herring
2021-04-02 15:20   ` Christophe Leroy
2021-04-02 15:20     ` [OpenRISC] " Christophe Leroy
2021-04-02 15:20     ` Christophe Leroy
2021-04-02 15:20     ` Christophe Leroy
2021-04-02 15:20     ` Christophe Leroy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3d5d4281f264ec634f17252b6fef558ca4334243.1616765870.git.christophe.leroy@csgroup.eu \
    --to=christophe.leroy@csgroup.eu \
    --cc=daniel@gimpelevich.san-francisco.ca.us \
    --cc=danielwa@cisco.com \
    --cc=devicetree@vger.kernel.org \
    --cc=ley.foon.tan@intel.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-hexagon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=linux-xtensa@linux-xtensa.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=monstr@monstr.eu \
    --cc=openrisc@lists.librecores.org \
    --cc=robh@kernel.org \
    --cc=sparclinux@vger.kernel.org \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.