[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231110013817.2378507-9-danielwa@cisco.com>
Date: Thu, 9 Nov 2023 17:38:12 -0800
From: Daniel Walker <danielwa@...co.com>
To: Will Deacon <will@...nel.org>,
Christophe Leroy <christophe.leroy@...roup.eu>,
Rob Herring <robh@...nel.org>,
Daniel Gimpelevich <daniel@...pelevich.san-francisco.ca.us>,
Andrew Morton <akpm@...ux-foundation.org>,
Pratyush Brahma <quic_pbrahma@...cinc.com>,
Tomas Mudrunka <tomas.mudrunka@...il.com>,
Sean Anderson <sean.anderson@...o.com>, x86@...nel.org,
linux-mips@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
Catalin Marinas <catalin.marinas@....com>
Cc: xe-linux-external@...co.com, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 8/8] CMDLINE: arm64: convert to generic builtin command line
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@...co.com
Signed-off-by: Daniel Walker <danielwa@...co.com>
---
arch/arm64/Kconfig | 33 +----------------------------
arch/arm64/include/asm/setup.h | 4 ++++
arch/arm64/include/uapi/asm/setup.h | 2 ++
arch/arm64/kernel/idreg-override.c | 9 ++++----
arch/arm64/kernel/pi/kaslr_early.c | 14 ++++++------
5 files changed, 19 insertions(+), 43 deletions(-)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 78f20e632712..d3b7fd1080d0 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -131,6 +131,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
@@ -2217,38 +2218,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 f4af547ef54c..5a8037262cbb 100644
--- a/arch/arm64/include/asm/setup.h
+++ b/arch/arm64/include/asm/setup.h
@@ -3,10 +3,13 @@
#ifndef __ARM64_ASM_SETUP_H
#define __ARM64_ASM_SETUP_H
+#ifndef __ASSEMBLY__
#include <linux/string.h>
+#endif
#include <uapi/asm/setup.h>
+#ifndef __ASSEMBLY__
void *get_early_fdt_ptr(void);
void early_fdt_map(u64 dt_phys);
@@ -30,5 +33,6 @@ static inline bool arch_parse_debug_rodata(char *arg)
return false;
}
#define arch_parse_debug_rodata arch_parse_debug_rodata
+#endif /* __ASSEMBLY__ */
#endif
diff --git a/arch/arm64/include/uapi/asm/setup.h b/arch/arm64/include/uapi/asm/setup.h
index 5d703888f351..f5fc5b806369 100644
--- a/arch/arm64/include/uapi/asm/setup.h
+++ b/arch/arm64/include/uapi/asm/setup.h
@@ -20,7 +20,9 @@
#ifndef __ASM_SETUP_H
#define __ASM_SETUP_H
+#ifndef __ASSEMBLY__
#include <linux/types.h>
+#endif
#define COMMAND_LINE_SIZE 2048
diff --git a/arch/arm64/kernel/idreg-override.c b/arch/arm64/kernel/idreg-override.c
index 3addc09f8746..6334a9228909 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>
@@ -304,11 +305,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 */
diff --git a/arch/arm64/kernel/pi/kaslr_early.c b/arch/arm64/kernel/pi/kaslr_early.c
index 17bff6e399e4..1e00bc01fa7a 100644
--- a/arch/arm64/kernel/pi/kaslr_early.c
+++ b/arch/arm64/kernel/pi/kaslr_early.c
@@ -11,6 +11,7 @@
#include <linux/types.h>
#include <linux/sizes.h>
#include <linux/string.h>
+#include <linux/cmdline.h>
#include <asm/archrandom.h>
#include <asm/memory.h>
@@ -42,7 +43,7 @@ static bool cmdline_contains_nokaslr(const u8 *cmdline)
static bool is_kaslr_disabled_cmdline(void *fdt)
{
- if (!IS_ENABLED(CONFIG_CMDLINE_FORCE)) {
+ if (!IS_ENABLED(CONFIG_CMDLINE_OVERRIDE)) {
int node;
const u8 *prop;
@@ -54,16 +55,15 @@ static bool is_kaslr_disabled_cmdline(void *fdt)
if (!prop)
goto out;
+ if (cmdline_contains_nokaslr(CMDLINE_STATIC_APPEND))
+ return true;
if (cmdline_contains_nokaslr(prop))
return true;
-
- if (IS_ENABLED(CONFIG_CMDLINE_EXTEND))
- goto out;
-
- return false;
+ if (cmdline_contains_nokaslr(CMDLINE_STATIC_PREPEND))
+ return true;
}
out:
- return cmdline_contains_nokaslr(CONFIG_CMDLINE);
+ return cmdline_contains_nokaslr(cmdline_get_static_builtin());
}
static u64 get_kaslr_seed(void *fdt)
--
2.39.2
Powered by blists - more mailing lists