{"id":1460187,"url":"http://patchwork.ozlabs.org/api/patches/1460187/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/e5d98d566c38d6f8516b8d9d1fd603ec1f131037.1617126961.git.danielwa@cisco.com/","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":"<e5d98d566c38d6f8516b8d9d1fd603ec1f131037.1617126961.git.danielwa@cisco.com>","list_archive_url":"https://lore.kernel.org/linuxppc-dev/e5d98d566c38d6f8516b8d9d1fd603ec1f131037.1617126961.git.danielwa@cisco.com/","date":"2021-03-30T17:57:01","name":"[6/8] drivers: firmware: efi: libstub: enable generic commandline","commit_ref":null,"pull_url":null,"state":"not-applicable","archived":false,"hash":"2770708e9c231ee4b4448048928cc67218f0cd4e","submitter":{"id":67374,"url":"http://patchwork.ozlabs.org/api/people/67374/?format=json","name":"Daniel Walker (danielwa)","email":"danielwa@cisco.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/e5d98d566c38d6f8516b8d9d1fd603ec1f131037.1617126961.git.danielwa@cisco.com/mbox/","series":[{"id":236583,"url":"http://patchwork.ozlabs.org/api/series/236583/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=236583","date":"2021-03-30T17:56:56","name":"[1/8] CMDLINE: add generic builtin command line","version":1,"mbox":"http://patchwork.ozlabs.org/series/236583/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/1460187/comments/","check":"success","checks":"http://patchwork.ozlabs.org/api/patches/1460187/checks/","tags":{},"related":[{"id":1466840,"url":"http://patchwork.ozlabs.org/api/patches/1466840/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20210416040924.2882771-6-danielwa@cisco.com/","msgid":"<20210416040924.2882771-6-danielwa@cisco.com>","list_archive_url":"https://lore.kernel.org/linuxppc-dev/20210416040924.2882771-6-danielwa@cisco.com/","date":"2021-04-16T04:09:16","name":"[5/8] drivers: firmware: efi: libstub: enable generic commandline","mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20210416040924.2882771-6-danielwa@cisco.com/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>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=cisco.com header.i=@cisco.com header.a=rsa-sha256\n header.s=iport header.b=b5JWU8kx;\n\tdkim-atps=neutral","lists.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=cisco.com header.i=@cisco.com header.a=rsa-sha256\n header.s=iport header.b=b5JWU8kx;\n\tdkim-atps=neutral","lists.ozlabs.org; spf=pass (sender SPF authorized)\n smtp.mailfrom=cisco.com (client-ip=173.37.86.74; helo=rcdn-iport-3.cisco.com;\n envelope-from=danielwa@cisco.com; receiver=<UNKNOWN>)","lists.ozlabs.org; dkim=pass (1024-bit key;\n unprotected) header.d=cisco.com header.i=@cisco.com header.a=rsa-sha256\n header.s=iport header.b=b5JWU8kx; dkim-atps=neutral"],"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 4F8xzy2PMyz9sVm\n\tfor <patchwork-incoming@ozlabs.org>; Wed, 31 Mar 2021 04:59:58 +1100 (AEDT)","from boromir.ozlabs.org (localhost [IPv6:::1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4F8xzy19GDz3dGw\n\tfor <patchwork-incoming@ozlabs.org>; Wed, 31 Mar 2021 04:59:58 +1100 (AEDT)","from rcdn-iport-3.cisco.com (rcdn-iport-3.cisco.com [173.37.86.74])\n (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n bits)) (No client certificate requested)\n by lists.ozlabs.org (Postfix) with ESMTPS id 4F8xwz29XHz3bsv\n for <linuxppc-dev@lists.ozlabs.org>; Wed, 31 Mar 2021 04:57:22 +1100 (AEDT)","from rcdn-core-2.cisco.com ([173.37.93.153])\n by rcdn-iport-3.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA;\n 30 Mar 2021 17:57:19 +0000","from zorba.cisco.com ([10.24.8.123])\n by rcdn-core-2.cisco.com (8.15.2/8.15.2) with ESMTP id 12UHv6CJ024502;\n Tue, 30 Mar 2021 17:57:18 GMT"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple;\n d=cisco.com; i=@cisco.com; l=5244; q=dns/txt; s=iport;\n t=1617127043; x=1618336643;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=z8anDruZfbCd8nxE9KL6/A2E5PwrXLs8pPpA/zlWF6w=;\n b=b5JWU8kxBw965qCsO+//WLVStchbXeA+1dsbsAb5uxb9KDyQm8ZLexOd\n nCSMFufxT4FBPw1VsniUeypIx3Xiypu/o6AUOGdCdcsVRKyvxxZ1QyRDE\n Y7CZXlchbTCLhTdmQk8n1GxnTr70e+ZhPvCVHkMdxAy1MLhrG3M8uQUb3 s=;","IronPort-HdrOrdr":"\n A9a23:m/H1YKFBatQSpq7EpLqFtZHXdLJzesId70hD6mlaQ3VuHvCwvcaogfgdyFvIkz4XQn4tgpStP6OHTHPa+/dOkO0sFJqrQQWOggWVBa5464+K+VfdMg34stVQzKJxN5V5YeeAbmRSqebfzE2GH807wN+BmZrY4Nv263t2VwllZ+VB4m5CazqzKUF9SAlYCZdRLvP1jfZvnDaudW8aac62HBA+Lor+jufWn5HrawNuPXEawTSJ5AnE1JfKVzCFwxFbaD9U2LEk62SAqRDh/76uqevT8G6660bjq7BfmN7s0bJ4ZPCku4wyNijmjBquacBHXbCP1QpF2d2H2RINjMTGpQsmMoBIz07pOkuxoRfrxmDboVAT10M=","X-IronPort-Anti-Spam-Filtered":"true","X-IronPort-Anti-Spam-Result":"\n A0ANAAAXZmNg/5ldJa1aGwEBAQEBAQEBBQEBARIBAQEDAwEBAYF8BgEBAQsBgiqBTAE5MYxlpBKBfAsBAQEPNAQBAYRQAoF6AiU0CQ4CAwEBDAEBBQEBAQIBBgRxhW6GRQYnCwFGEFFXBgEShXirNIF2M4kLgUQUgSUBiGN0g3ImHIFJQoFFgyeKNgSCR4EPk2AGjUKBIJlugRSDEYEjm0UipFKVB58MhCiBVDqBWTMaCBsVgyRQGQ2OKxaNagFbIQMvOAIGCgEBAwmJHwEB","X-IronPort-AV":"E=Sophos;i=\"5.81,291,1610409600\"; d=\"scan'208\";a=\"853727117\"","From":"Daniel Walker <danielwa@cisco.com>","To":"Will Deacon <will@kernel.org>,\n Christophe Leroy <christophe.leroy@csgroup.eu>,\n ob Herring <robh@kernel.org>,\n Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>,\n Andrew Morton <akpm@linux-foundation.org>, x86@kernel.org,\n linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org","Subject":"[PATCH 6/8] drivers: firmware: efi: libstub: enable generic\n commandline","Date":"Tue, 30 Mar 2021 10:57:01 -0700","Message-Id":"\n <e5d98d566c38d6f8516b8d9d1fd603ec1f131037.1617126961.git.danielwa@cisco.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"\n <41021d66db2ab427c14255d2a24bb4517c8b58fd.1617126961.git.danielwa@cisco.com>","References":"\n <41021d66db2ab427c14255d2a24bb4517c8b58fd.1617126961.git.danielwa@cisco.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-Auto-Response-Suppress":"DR, OOF, AutoReply","X-Outbound-SMTP-Client":"10.24.8.123, [10.24.8.123]","X-Outbound-Node":"rcdn-core-2.cisco.com","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-kernel@vger.kernel.org, linux-efi@vger.kernel.org,\n Ard Biesheuvel <ardb@kernel.org>, xe-linux-external@cisco.com","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 adds code to handle the generic command line changes.\nThe efi code appears that it doesn't benefit as much from this design\nas it could.\n\nFor example, if you had a prepend command line with \"nokaslr\" then\nyou might be helpful to re-enable it in the boot loader or dts,\nbut there appears to be no way to re-enable kaslr or some of the\nother options.\n\nCc: xe-linux-external@cisco.com\nSigned-off-by: Daniel Walker <danielwa@cisco.com>\n---\n .../firmware/efi/libstub/efi-stub-helper.c    | 35 +++++++++++++++++++\n drivers/firmware/efi/libstub/efi-stub.c       |  7 ++++\n drivers/firmware/efi/libstub/efistub.h        |  1 +\n drivers/firmware/efi/libstub/x86-stub.c       | 13 +++++--\n 4 files changed, 54 insertions(+), 2 deletions(-)","diff":"diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c\nindex aa8da0a49829..c155837cedc9 100644\n--- a/drivers/firmware/efi/libstub/efi-stub-helper.c\n+++ b/drivers/firmware/efi/libstub/efi-stub-helper.c\n@@ -13,6 +13,7 @@\n #include <linux/efi.h>\n #include <linux/kernel.h>\n #include <linux/printk.h> /* For CONSOLE_LOGLEVEL_* */\n+#include <linux/cmdline.h>\n #include <asm/efi.h>\n #include <asm/setup.h>\n \n@@ -172,6 +173,40 @@ int efi_printk(const char *fmt, ...)\n \treturn printed;\n }\n \n+/**\n+ * efi_handle_cmdline() - handle adding in building parts of the command line\n+ * @cmdline:\tkernel command line\n+ *\n+ * Add in the generic parts of the commandline and start the parsing of the\n+ * command line.\n+ *\n+ * Return:\tstatus code\n+ */\n+efi_status_t efi_handle_cmdline(char const *cmdline)\n+{\n+\tefi_status_t status;\n+\n+\tstatus = efi_parse_options(CMDLINE_PREPEND);\n+\tif (status != EFI_SUCCESS) {\n+\t\tefi_err(\"Failed to parse options\\n\");\n+\t\treturn status;\n+\t}\n+\n+\tstatus = efi_parse_options(IS_ENABLED(CONFIG_CMDLINE_OVERRIDE) ? \"\" : cmdline);\n+\tif (status != EFI_SUCCESS) {\n+\t\tefi_err(\"Failed to parse options\\n\");\n+\t\treturn status;\n+\t}\n+\n+\tstatus = efi_parse_options(CMDLINE_APPEND);\n+\tif (status != EFI_SUCCESS) {\n+\t\tefi_err(\"Failed to parse options\\n\");\n+\t\treturn status;\n+\t}\n+\n+\treturn EFI_SUCCESS;\n+}\n+\n /**\n  * efi_parse_options() - Parse EFI command line options\n  * @cmdline:\tkernel command line\ndiff --git a/drivers/firmware/efi/libstub/efi-stub.c b/drivers/firmware/efi/libstub/efi-stub.c\nindex 26e69788f27a..760480248adf 100644\n--- a/drivers/firmware/efi/libstub/efi-stub.c\n+++ b/drivers/firmware/efi/libstub/efi-stub.c\n@@ -172,6 +172,12 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle,\n \t\tgoto fail;\n \t}\n \n+#ifdef CONFIG_GENERIC_CMDLINE\n+\tstatus = efi_handle_cmdline(cmdline_ptr);\n+\tif (status != EFI_SUCCESS) {\n+\t\tgoto fail_free_cmdline;\n+\t}\n+#else\n \tif (IS_ENABLED(CONFIG_CMDLINE_EXTEND) ||\n \t    IS_ENABLED(CONFIG_CMDLINE_FORCE) ||\n \t    cmdline_size == 0) {\n@@ -189,6 +195,7 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle,\n \t\t\tgoto fail_free_cmdline;\n \t\t}\n \t}\n+#endif\n \n \tefi_info(\"Booting Linux Kernel...\\n\");\n \ndiff --git a/drivers/firmware/efi/libstub/efistub.h b/drivers/firmware/efi/libstub/efistub.h\nindex cde0a2ef507d..07c7f9fdfffc 100644\n--- a/drivers/firmware/efi/libstub/efistub.h\n+++ b/drivers/firmware/efi/libstub/efistub.h\n@@ -800,6 +800,7 @@ efi_status_t efi_relocate_kernel(unsigned long *image_addr,\n \t\t\t\t unsigned long alignment,\n \t\t\t\t unsigned long min_addr);\n \n+efi_status_t efi_handle_cmdline(char const *cmdline);\n efi_status_t efi_parse_options(char const *cmdline);\n \n void efi_parse_option_graphics(char *option);\ndiff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c\nindex f14c4ff5839f..30ad8fb7122d 100644\n--- a/drivers/firmware/efi/libstub/x86-stub.c\n+++ b/drivers/firmware/efi/libstub/x86-stub.c\n@@ -673,6 +673,8 @@ unsigned long efi_main(efi_handle_t handle,\n \tunsigned long bzimage_addr = (unsigned long)startup_32;\n \tunsigned long buffer_start, buffer_end;\n \tstruct setup_header *hdr = &boot_params->hdr;\n+\tunsigned long cmdline_paddr = ((u64)hdr->cmd_line_ptr |\n+\t\t\t\t       ((u64)boot_params->ext_cmd_line_ptr << 32));\n \tefi_status_t status;\n \n \tefi_system_table = sys_table_arg;\n@@ -735,6 +737,14 @@ unsigned long efi_main(efi_handle_t handle,\n \t\timage_offset = 0;\n \t}\n \n+#ifdef CONFIG_GENERIC_CMDLINE\n+\tstatus = efi_handle_cmdline((char *)cmdline_paddr);\n+\tif (status != EFI_SUCCESS) {\n+\t\tefi_err(\"Failed to parse options\\n\");\n+\t\tgoto fail;\n+\t}\n+#else /* CONFIG_GENERIC_CMDLINE */\n+\n #ifdef CONFIG_CMDLINE_BOOL\n \tstatus = efi_parse_options(CONFIG_CMDLINE);\n \tif (status != EFI_SUCCESS) {\n@@ -743,8 +753,6 @@ unsigned long efi_main(efi_handle_t handle,\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@@ -752,6 +760,7 @@ unsigned long efi_main(efi_handle_t handle,\n \t\t}\n \t}\n \n+#endif\n \t/*\n \t * At this point, an initrd may already have been loaded by the\n \t * bootloader and passed via bootparams. We permit an initrd loaded\n","prefixes":["6/8"]}