From patchwork Fri Nov 10 01:38:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Daniel Walker (danielwa)" X-Patchwork-Id: 13451999 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4794AC4332F for ; Fri, 10 Nov 2023 01:39:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345787AbjKJBjz (ORCPT ); Thu, 9 Nov 2023 20:39:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345697AbjKJBjq (ORCPT ); Thu, 9 Nov 2023 20:39:46 -0500 Received: from rcdn-iport-5.cisco.com (rcdn-iport-5.cisco.com [173.37.86.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 899B146B4; Thu, 9 Nov 2023 17:39:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=5564; q=dns/txt; s=iport; t=1699580378; x=1700789978; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=G3mzXCo9zuU2hguTVdS6rnUvvYqWcYPaShxuD6OBkN0=; b=F2nUfxUCtcFveI3oyIjsm4cpIR/FGXOMK+WdV1NC63TpwUmtTPdnK4dn wyjbd+xUeI5JWaDcewY1of+WBqNftJKnbd2E8CqXZ5ZWTtvZ030SeeMe2 66D5s2XYrC2cpyj2STElo1d0exYw0SWDqJBNkMXHMSvHTD/TfECxO/m7M g=; X-CSE-ConnectionGUID: YdHHS5cKSjOdkXWDdGQbWA== X-CSE-MsgGUID: 3j2JtuLcRJaUnDnLONU/TA== X-IPAS-Result: A0ANA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Nt1deAlaN91n rd96Kb7KWWX03IXDzpPtQgMn0zkE5DKe/xPWk0yaGMztjcW9w== IronPort-HdrOrdr: A9a23:b/Ygcq9TQsiw84BTBQ9uk+DjI+orL9Y04lQ7vn2ZhyY4TiX+rb HLoB1173HJYVoqMk3I3OrwW5VoIkmskKKdn7NxAV7KZmCP01dAbrsSj7cKqAeOJ8SRzINgPI 5bAs9D4aXLbWSTSa3BkXCF+xFK+qjgzJyV X-Talos-CUID: 9a23:zo7SVGl8chH7+ZqbvLEe1TvEUczXOUzR7FfrfkSbMmRORL6ldnOc15purOM7zg== X-Talos-MUID: 9a23:1okezwpl1HEpOPbxGLsez2pgbuV0/oClMmIErJMqve2jExE3Bx7I2Q== X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="6.03,291,1694736000"; d="scan'208";a="135016454" Received: from rcdn-core-4.cisco.com ([173.37.93.155]) by rcdn-iport-5.cisco.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Nov 2023 01:38:35 +0000 Received: from goliath.lan ([10.25.128.169]) by rcdn-core-4.cisco.com (8.15.2/8.15.2) with ESMTP id 3AA1cHVO011466; Fri, 10 Nov 2023 01:38:34 GMT From: Daniel Walker To: Will Deacon , Christophe Leroy , Rob Herring , Daniel Gimpelevich , Andrew Morton , Pratyush Brahma , Tomas Mudrunka , Sean Anderson , x86@kernel.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Catalin Marinas Cc: xe-linux-external@cisco.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 8/8] CMDLINE: arm64: convert to generic builtin command line Date: Thu, 9 Nov 2023 17:38:12 -0800 Message-Id: <20231110013817.2378507-9-danielwa@cisco.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231110013817.2378507-1-danielwa@cisco.com> References: <20231110013817.2378507-1-danielwa@cisco.com> MIME-Version: 1.0 X-Auto-Response-Suppress: DR, OOF, AutoReply X-Outbound-SMTP-Client: 10.25.128.169, [10.25.128.169] X-Outbound-Node: rcdn-core-4.cisco.com Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org 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@cisco.com Signed-off-by: Daniel Walker --- 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 +#endif #include +#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 +#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 #include #include +#include #include #include @@ -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 #include #include +#include #include #include @@ -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)