[PATCH 8/8] CMDLINE: arm64: convert to generic builtin command line

From: Daniel Walker
Date: Fri Apr 16 2021 - 00:09:59 EST


This removes arm64 from the device tree handling of the
command line arguments.

The boot_command_line variable is populated inside the earliest
user of the command line, which is in idreg-override.c.

The device tree should not be needed to do any further handling
of the boot command line options.

Cc: xe-linux-external@xxxxxxxxx
Signed-off-by: Daniel Walker <danielwa@xxxxxxxxx>
---
arch/arm64/Kconfig | 33 +-----------------------------
arch/arm64/include/asm/setup.h | 2 ++
arch/arm64/kernel/idreg-override.c | 9 ++++----
3 files changed, 8 insertions(+), 36 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/include/asm/setup.h b/arch/arm64/include/asm/setup.h
index d3320618ed14..1f5b6d8f2433 100644
--- a/arch/arm64/include/asm/setup.h
+++ b/arch/arm64/include/asm/setup.h
@@ -5,7 +5,9 @@

#include <uapi/asm/setup.h>

+#ifndef __ASSEMBLY__
void *get_early_fdt_ptr(void);
void early_fdt_map(u64 dt_phys);
+#endif /* __ASSEMBLY__ */

#endif
diff --git a/arch/arm64/kernel/idreg-override.c b/arch/arm64/kernel/idreg-override.c
index 83f1c4b92095..0a3fcae13043 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>
@@ -188,11 +189,11 @@ static __init void parse_cmdline(void)
{
const u8 *prop = get_bootargs_cmdline();

- if (IS_ENABLED(CONFIG_CMDLINE_FORCE) || !prop)
- __parse_cmdline(CONFIG_CMDLINE, true);
+ strscpy(boot_command_line, prop, COMMAND_LINE_SIZE);
+ cmdline_add_builtin(boot_command_line);
+
+ __parse_cmdline(boot_command_line, true);

- if (!IS_ENABLED(CONFIG_CMDLINE_FORCE) && prop)
- __parse_cmdline(prop, true);
}

/* Keep checkers quiet */
--
2.25.1