{"id":1458813,"url":"http://patchwork.ozlabs.org/api/patches/1458813/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/db9de18cca2fb0cbc0ffd75082d2d110fe8034d2.1616765870.git.christophe.leroy@csgroup.eu/","project":{"id":2,"url":"http://patchwork.ozlabs.org/api/projects/2/?format=json","name":"Linux PPC development","link_name":"linuxppc-dev","list_id":"linuxppc-dev.lists.ozlabs.org","list_email":"linuxppc-dev@lists.ozlabs.org","web_url":"https://github.com/linuxppc/wiki/wiki","scm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git","webscm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/","list_archive_url":"https://lore.kernel.org/linuxppc-dev/","list_archive_url_format":"https://lore.kernel.org/linuxppc-dev/{}/","commit_url_format":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}"},"msgid":"<db9de18cca2fb0cbc0ffd75082d2d110fe8034d2.1616765870.git.christophe.leroy@csgroup.eu>","list_archive_url":"https://lore.kernel.org/linuxppc-dev/db9de18cca2fb0cbc0ffd75082d2d110fe8034d2.1616765870.git.christophe.leroy@csgroup.eu/","date":"2021-03-26T13:45:02","name":"[v3,15/17] x86: Convert to GENERIC_CMDLINE","commit_ref":null,"pull_url":null,"state":"not-applicable","archived":false,"hash":"9c0e54d9634621ce2848b94571d8b7c97f143028","submitter":{"id":79086,"url":"http://patchwork.ozlabs.org/api/people/79086/?format=json","name":"Christophe Leroy","email":"christophe.leroy@csgroup.eu"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/db9de18cca2fb0cbc0ffd75082d2d110fe8034d2.1616765870.git.christophe.leroy@csgroup.eu/mbox/","series":[{"id":236020,"url":"http://patchwork.ozlabs.org/api/series/236020/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=236020","date":"2021-03-26T13:44:49","name":"Implement GENERIC_CMDLINE","version":3,"mbox":"http://patchwork.ozlabs.org/series/236020/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/1458813/comments/","check":"success","checks":"http://patchwork.ozlabs.org/api/patches/1458813/checks/","tags":{},"related":[{"id":1461772,"url":"http://patchwork.ozlabs.org/api/patches/1461772/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/ab0fd4477964cdbf99e3dd2965a455aa3e738e4b.1617375802.git.christophe.leroy@csgroup.eu/","msgid":"<ab0fd4477964cdbf99e3dd2965a455aa3e738e4b.1617375802.git.christophe.leroy@csgroup.eu>","list_archive_url":"https://lore.kernel.org/linuxppc-dev/ab0fd4477964cdbf99e3dd2965a455aa3e738e4b.1617375802.git.christophe.leroy@csgroup.eu/","date":"2021-04-02T15:18:20","name":"[v4,18/20] x86: Convert to GENERIC_CMDLINE","mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/ab0fd4477964cdbf99e3dd2965a455aa3e738e4b.1617375802.git.christophe.leroy@csgroup.eu/mbox/"}],"headers":{"Return-Path":"\n <linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Authentication-Results":["ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org\n (client-ip=112.213.38.117; helo=lists.ozlabs.org;\n envelope-from=linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org;\n receiver=<UNKNOWN>)","lists.ozlabs.org; spf=pass (sender SPF authorized)\n smtp.mailfrom=csgroup.eu (client-ip=93.17.236.30; helo=pegase1.c-s.fr;\n envelope-from=christophe.leroy@csgroup.eu; receiver=<UNKNOWN>)"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (4096 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 4F6NdV0ByMz9sVm\n\tfor <patchwork-incoming@ozlabs.org>; Sat, 27 Mar 2021 00:50:05 +1100 (AEDT)","from boromir.ozlabs.org (localhost [IPv6:::1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4F6NdT3Bd4z3fHd\n\tfor <patchwork-incoming@ozlabs.org>; Sat, 27 Mar 2021 00:50:05 +1100 (AEDT)","from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30])\n (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n (No client certificate requested)\n by lists.ozlabs.org (Postfix) with ESMTPS id 4F6NWm0lj0z3c1T\n for <linuxppc-dev@lists.ozlabs.org>; Sat, 27 Mar 2021 00:45:08 +1100 (AEDT)","from localhost (mailhub1-int [192.168.12.234])\n by localhost (Postfix) with ESMTP id 4F6NWg6MzGz9v03T;\n Fri, 26 Mar 2021 14:45:03 +0100 (CET)","from pegase1.c-s.fr ([192.168.12.234])\n by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024)\n with ESMTP id 0qyljEPHuFJn; Fri, 26 Mar 2021 14:45:03 +0100 (CET)","from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192])\n by pegase1.c-s.fr (Postfix) with ESMTP id 4F6NWf6MZ6z9v03P;\n Fri, 26 Mar 2021 14:45:02 +0100 (CET)","from localhost (localhost [127.0.0.1])\n by messagerie.si.c-s.fr (Postfix) with ESMTP id AFA6E8B8D1;\n Fri, 26 Mar 2021 14:45:03 +0100 (CET)","from messagerie.si.c-s.fr ([127.0.0.1])\n by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023)\n with ESMTP id c6KWcbGdcZc0; Fri, 26 Mar 2021 14:45:03 +0100 (CET)","from po16121vm.idsi0.si.c-s.fr (unknown [192.168.4.90])\n by messagerie.si.c-s.fr (Postfix) with ESMTP id D72458B8C7;\n Fri, 26 Mar 2021 14:45:02 +0100 (CET)","by po16121vm.idsi0.si.c-s.fr (Postfix, from userid 0)\n id 3BC2C67611; Fri, 26 Mar 2021 13:45:02 +0000 (UTC)"],"X-Virus-Scanned":["Debian amavisd-new at c-s.fr","amavisd-new at c-s.fr"],"Message-Id":"\n <db9de18cca2fb0cbc0ffd75082d2d110fe8034d2.1616765870.git.christophe.leroy@csgroup.eu>","In-Reply-To":"<cover.1616765869.git.christophe.leroy@csgroup.eu>","References":"<cover.1616765869.git.christophe.leroy@csgroup.eu>","From":"Christophe Leroy <christophe.leroy@csgroup.eu>","Subject":"[PATCH v3 15/17] x86: Convert to GENERIC_CMDLINE","To":"will@kernel.org, danielwa@cisco.com, robh@kernel.org,\n daniel@gimpelevich.san-francisco.ca.us","Date":"Fri, 26 Mar 2021 13:45:02 +0000 (UTC)","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List <linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n <mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n <mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Cc":"linux-arch@vger.kernel.org, devicetree@vger.kernel.org,\n microblaze <monstr@monstr.eu>, linux-xtensa@linux-xtensa.org,\n linux-sh@vger.kernel.org, linux-hexagon@vger.kernel.org, x86@kernel.org,\n linux-kernel@vger.kernel.org, nios2 <ley.foon.tan@intel.com>,\n linux-mips@vger.kernel.org, openrisc@lists.librecores.org,\n sparclinux@vger.kernel.org, linux-riscv@lists.infradead.org,\n linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n <linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"},"content":"This converts the architecture to GENERIC_CMDLINE.\n\nSigned-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>\n---\n arch/x86/Kconfig                        | 45 ++-----------------------\n arch/x86/kernel/setup.c                 | 17 ++--------\n drivers/firmware/efi/libstub/x86-stub.c | 26 +++++++-------\n 3 files changed, 18 insertions(+), 70 deletions(-)","diff":"diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig\nindex 2792879d398e..66b384228ca3 100644\n--- a/arch/x86/Kconfig\n+++ b/arch/x86/Kconfig\n@@ -104,6 +104,7 @@ config X86\n \tselect ARCH_USE_QUEUED_SPINLOCKS\n \tselect ARCH_USE_SYM_ANNOTATIONS\n \tselect ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH\n+\tselect ARCH_WANT_CMDLINE_PREPEND_BY_DEFAULT\n \tselect ARCH_WANT_DEFAULT_BPF_JIT\tif X86_64\n \tselect ARCH_WANTS_DYNAMIC_TASK_STRUCT\n \tselect ARCH_WANT_HUGE_PMD_SHARE\n@@ -118,6 +119,7 @@ config X86\n \tselect EDAC_SUPPORT\n \tselect GENERIC_CLOCKEVENTS_BROADCAST\tif X86_64 || (X86_32 && X86_LOCAL_APIC)\n \tselect GENERIC_CLOCKEVENTS_MIN_ADJUST\n+\tselect GENERIC_CMDLINE\n \tselect GENERIC_CMOS_UPDATE\n \tselect GENERIC_CPU_AUTOPROBE\n \tselect GENERIC_CPU_VULNERABILITIES\n@@ -2358,49 +2360,6 @@ choice\n \n endchoice\n \n-config CMDLINE_BOOL\n-\tbool \"Built-in kernel command line\"\n-\thelp\n-\t  Allow for specifying boot arguments to the kernel at\n-\t  build time.  On some systems (e.g. embedded ones), it is\n-\t  necessary or convenient to provide some or all of the\n-\t  kernel boot arguments with the kernel itself (that is,\n-\t  to not rely on the boot loader to provide them.)\n-\n-\t  To compile command line arguments into the kernel,\n-\t  set this option to 'Y', then fill in the\n-\t  boot arguments in CONFIG_CMDLINE.\n-\n-\t  Systems with fully functional boot loaders (i.e. non-embedded)\n-\t  should leave this option set to 'N'.\n-\n-config CMDLINE\n-\tstring \"Built-in kernel command string\"\n-\tdepends on CMDLINE_BOOL\n-\tdefault \"\"\n-\thelp\n-\t  Enter arguments here that should be compiled into the kernel\n-\t  image and used at boot time.  If the boot loader provides a\n-\t  command line at boot time, it is appended to this string to\n-\t  form the full kernel command line, when the system boots.\n-\n-\t  However, you can use the CONFIG_CMDLINE_OVERRIDE option to\n-\t  change this behavior.\n-\n-\t  In most cases, the command line (whether built-in or provided\n-\t  by the boot loader) should specify the device for the root\n-\t  file system.\n-\n-config CMDLINE_OVERRIDE\n-\tbool \"Built-in command line overrides boot loader arguments\"\n-\tdepends on CMDLINE_BOOL && CMDLINE != \"\"\n-\thelp\n-\t  Set this option to 'Y' to have the kernel ignore the boot loader\n-\t  command line, and use ONLY the built-in command line.\n-\n-\t  This is used to work around broken boot loaders.  This should\n-\t  be set to 'N' under normal conditions.\n-\n config MODIFY_LDT_SYSCALL\n \tbool \"Enable the LDT (local descriptor table)\" if EXPERT\n \tdefault y\ndiff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c\nindex d883176ef2ce..93ac57ea3e64 100644\n--- a/arch/x86/kernel/setup.c\n+++ b/arch/x86/kernel/setup.c\n@@ -5,6 +5,7 @@\n  * This file contains the setup_arch() code, which handles the architecture-dependent\n  * parts of early kernel initialization.\n  */\n+#include <linux/cmdline.h>\n #include <linux/console.h>\n #include <linux/crash_dump.h>\n #include <linux/dma-map-ops.h>\n@@ -161,9 +162,6 @@ unsigned long saved_video_mode;\n #define RAMDISK_LOAD_FLAG\t\t0x4000\n \n static char __initdata command_line[COMMAND_LINE_SIZE];\n-#ifdef CONFIG_CMDLINE_BOOL\n-static char __initdata builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE;\n-#endif\n \n #if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)\n struct edd edd;\n@@ -883,18 +881,7 @@ void __init setup_arch(char **cmdline_p)\n \tbss_resource.start = __pa_symbol(__bss_start);\n \tbss_resource.end = __pa_symbol(__bss_stop)-1;\n \n-#ifdef CONFIG_CMDLINE_BOOL\n-#ifdef CONFIG_CMDLINE_OVERRIDE\n-\tstrlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);\n-#else\n-\tif (builtin_cmdline[0]) {\n-\t\t/* append boot loader cmdline to builtin */\n-\t\tstrlcat(builtin_cmdline, \" \", COMMAND_LINE_SIZE);\n-\t\tstrlcat(builtin_cmdline, boot_command_line, COMMAND_LINE_SIZE);\n-\t\tstrlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);\n-\t}\n-#endif\n-#endif\n+\tcmdline_build(boot_command_line, boot_command_line, COMMAND_LINE_SIZE);\n \n \tstrlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);\n \t*cmdline_p = command_line;\ndiff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c\nindex f14c4ff5839f..5413aff010ec 100644\n--- a/drivers/firmware/efi/libstub/x86-stub.c\n+++ b/drivers/firmware/efi/libstub/x86-stub.c\n@@ -6,6 +6,7 @@\n  *\n  * ----------------------------------------------------------------------- */\n \n+#include <linux/cmdline.h>\n #include <linux/efi.h>\n #include <linux/pci.h>\n #include <linux/stddef.h>\n@@ -674,6 +675,7 @@ unsigned long efi_main(efi_handle_t handle,\n \tunsigned long buffer_start, buffer_end;\n \tstruct setup_header *hdr = &boot_params->hdr;\n \tefi_status_t status;\n+\tchar *cmdline;\n \n \tefi_system_table = sys_table_arg;\n \n@@ -735,22 +737,22 @@ unsigned long efi_main(efi_handle_t handle,\n \t\timage_offset = 0;\n \t}\n \n-#ifdef CONFIG_CMDLINE_BOOL\n-\tstatus = efi_parse_options(CONFIG_CMDLINE);\n+\tcmdline = kzalloc(COMMAND_LINE_SIZE, GFP_KERNEL);\n+\tif (cmdline) {\n+\t\tunsigned long cmdline_paddr = ((u64)hdr->cmd_line_ptr |\n+\t\t\t\t\t       ((u64)boot_params->ext_cmd_line_ptr << 32));\n+\n+\t\tcmdline_build(cmdline, (char *)cmdline_paddr, COMMAND_LINE_SIZE);\n+\t\tstatus = efi_parse_options(cmdline);\n+\t\tkfree(cmdline);\n+\t} else {\n+\t\tefi_err(\"Failed to allocate memory\\n\");\n+\t\tgoto fail;\n+\t}\n \tif (status != EFI_SUCCESS) {\n \t\tefi_err(\"Failed to parse options\\n\");\n \t\tgoto fail;\n \t}\n-#endif\n-\tif (!IS_ENABLED(CONFIG_CMDLINE_OVERRIDE)) {\n-\t\tunsigned long cmdline_paddr = ((u64)hdr->cmd_line_ptr |\n-\t\t\t\t\t       ((u64)boot_params->ext_cmd_line_ptr << 32));\n-\t\tstatus = efi_parse_options((char *)cmdline_paddr);\n-\t\tif (status != EFI_SUCCESS) {\n-\t\t\tefi_err(\"Failed to parse options\\n\");\n-\t\t\tgoto fail;\n-\t\t}\n-\t}\n \n \t/*\n \t * At this point, an initrd may already have been loaded by the\n","prefixes":["v3","15/17"]}