[{"id":2659215,"web_url":"http://patchwork.ozlabs.org/comment/2659215/","msgid":"<CAMj1kXG_rRLU2Hp_GaZyayxx6J+HaWyPHPmE-hEZawuxzZ4JXw@mail.gmail.com>","date":"2021-03-31T16:10:08","subject":"Re: [PATCH 6/8] drivers: firmware: efi: libstub: enable generic\n commandline","submitter":{"id":77831,"url":"http://patchwork.ozlabs.org/api/people/77831/","name":"Ard Biesheuvel","email":"ardb@kernel.org"},"content":"(+ Arvind)\n\nOn Tue, 30 Mar 2021 at 19:57, Daniel Walker <danielwa@cisco.com> wrote:\n>\n> This adds code to handle the generic command line changes.\n> The efi code appears that it doesn't benefit as much from this design\n> as it could.\n>\n> For example, if you had a prepend command line with \"nokaslr\" then\n> you might be helpful to re-enable it in the boot loader or dts,\n> but there appears to be no way to re-enable kaslr or some of the\n> other options.\n>\n> Cc: xe-linux-external@cisco.com\n> Signed-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(-)\n>\n> diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c\n> index 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>         return printed;\n>  }\n>\n> +/**\n> + * efi_handle_cmdline() - handle adding in building parts of the command line\n> + * @cmdline:   kernel command line\n> + *\n> + * Add in the generic parts of the commandline and start the parsing of the\n> + * command line.\n> + *\n> + * Return:     status code\n> + */\n> +efi_status_t efi_handle_cmdline(char const *cmdline)\n> +{\n> +       efi_status_t status;\n> +\n> +       status = efi_parse_options(CMDLINE_PREPEND);\n> +       if (status != EFI_SUCCESS) {\n> +               efi_err(\"Failed to parse options\\n\");\n> +               return status;\n> +       }\n\nEven though I am not a fan of the 'success handling' pattern,\nduplicating the exact same error handling three times is not great\neither. Could we reuse more of the code here?\n\n> +\n> +       status = efi_parse_options(IS_ENABLED(CONFIG_CMDLINE_OVERRIDE) ? \"\" : cmdline);\n\nWhat is the point of calling efi_parse_options() with an empty string?\n\n\n\n> +       if (status != EFI_SUCCESS) {\n> +               efi_err(\"Failed to parse options\\n\");\n> +               return status;\n> +       }\n> +\n> +       status = efi_parse_options(CMDLINE_APPEND);\n> +       if (status != EFI_SUCCESS) {\n> +               efi_err(\"Failed to parse options\\n\");\n> +               return status;\n> +       }\n> +\n> +       return EFI_SUCCESS;\n> +}\n> +\n>  /**\n>   * efi_parse_options() - Parse EFI command line options\n>   * @cmdline:   kernel command line\n> diff --git a/drivers/firmware/efi/libstub/efi-stub.c b/drivers/firmware/efi/libstub/efi-stub.c\n> index 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>                 goto fail;\n>         }\n>\n> +#ifdef CONFIG_GENERIC_CMDLINE\n> +       status = efi_handle_cmdline(cmdline_ptr);\n> +       if (status != EFI_SUCCESS) {\n> +               goto fail_free_cmdline;\n> +       }\n> +#else\n>         if (IS_ENABLED(CONFIG_CMDLINE_EXTEND) ||\n>             IS_ENABLED(CONFIG_CMDLINE_FORCE) ||\n\nDoes this mean CONFIG_GENERIC_CMDLINE does not replace CMDLINE_EXTEND\n/ CMDLINE_FORCE etc, but introduces yet another variant on top of\nthose?\n\nThat does not seem like an improvement to me. I think it is great that\nyou are cleaning this up, but only if it means we can get rid of the\nold implementation.\n\n>             cmdline_size == 0) {\n> @@ -189,6 +195,7 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle,\n>                         goto fail_free_cmdline;\n>                 }\n>         }\n> +#endif\n>\n>         efi_info(\"Booting Linux Kernel...\\n\");\n>\n> diff --git a/drivers/firmware/efi/libstub/efistub.h b/drivers/firmware/efi/libstub/efistub.h\n> index 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>                                  unsigned long alignment,\n>                                  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);\n> diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c\n> index 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>         unsigned long bzimage_addr = (unsigned long)startup_32;\n>         unsigned long buffer_start, buffer_end;\n>         struct setup_header *hdr = &boot_params->hdr;\n> +       unsigned long cmdline_paddr = ((u64)hdr->cmd_line_ptr |\n> +                                      ((u64)boot_params->ext_cmd_line_ptr << 32));\n>         efi_status_t status;\n>\n>         efi_system_table = sys_table_arg;\n> @@ -735,6 +737,14 @@ unsigned long efi_main(efi_handle_t handle,\n>                 image_offset = 0;\n>         }\n>\n> +#ifdef CONFIG_GENERIC_CMDLINE\n> +       status = efi_handle_cmdline((char *)cmdline_paddr);\n> +       if (status != EFI_SUCCESS) {\n> +               efi_err(\"Failed to parse options\\n\");\n> +               goto fail;\n> +       }\n> +#else /* CONFIG_GENERIC_CMDLINE */\n> +\n>  #ifdef CONFIG_CMDLINE_BOOL\n>         status = efi_parse_options(CONFIG_CMDLINE);\n>         if (status != EFI_SUCCESS) {\n> @@ -743,8 +753,6 @@ unsigned long efi_main(efi_handle_t handle,\n>         }\n>  #endif\n>         if (!IS_ENABLED(CONFIG_CMDLINE_OVERRIDE)) {\n> -               unsigned long cmdline_paddr = ((u64)hdr->cmd_line_ptr |\n> -                                              ((u64)boot_params->ext_cmd_line_ptr << 32));\n>                 status = efi_parse_options((char *)cmdline_paddr);\n>                 if (status != EFI_SUCCESS) {\n>                         efi_err(\"Failed to parse options\\n\");\n> @@ -752,6 +760,7 @@ unsigned long efi_main(efi_handle_t handle,\n>                 }\n>         }\n>\n> +#endif\n>         /*\n>          * At this point, an initrd may already have been loaded by the\n>          * bootloader and passed via bootparams. We permit an initrd loaded\n> --\n> 2.25.1\n>","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\" (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=MPCLn42g;\n\tdkim-atps=neutral","lists.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=MPCLn42g;\n\tdkim-atps=neutral","lists.ozlabs.org; spf=pass (sender SPF authorized)\n smtp.mailfrom=kernel.org (client-ip=198.145.29.99; helo=mail.kernel.org;\n envelope-from=ardb@kernel.org; receiver=<UNKNOWN>)","lists.ozlabs.org; dkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=MPCLn42g;\n 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 4F9WWS1Rvrz9sWQ\n\tfor <patchwork-incoming@ozlabs.org>; Thu,  1 Apr 2021 03:10:44 +1100 (AEDT)","from boromir.ozlabs.org (localhost [IPv6:::1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4F9WWS0j7rz3bqM\n\tfor <patchwork-incoming@ozlabs.org>; Thu,  1 Apr 2021 03:10:44 +1100 (AEDT)","from mail.kernel.org (mail.kernel.org [198.145.29.99])\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 4F9WW24gLMz2xfy\n for <linuxppc-dev@lists.ozlabs.org>; Thu,  1 Apr 2021 03:10:22 +1100 (AEDT)","by mail.kernel.org (Postfix) with ESMTPSA id 5634560BD3\n for <linuxppc-dev@lists.ozlabs.org>; Wed, 31 Mar 2021 16:10:20 +0000 (UTC)","by mail-oi1-f181.google.com with SMTP id c16so20518322oib.3\n for <linuxppc-dev@lists.ozlabs.org>; Wed, 31 Mar 2021 09:10:20 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n s=k20201202; t=1617207020;\n bh=/1ZfUq/hSkP8vyLmN2wN3gF/K+0R8P1I95At/e2yk3o=;\n h=References:In-Reply-To:From:Date:Subject:To:Cc:From;\n b=MPCLn42gcnWhwN/zKbA8+c1PbkFnwg8YwYyuVGUM+PRQBAaqJailiFH6ekOnlpoCz\n f/gDaJ8Qq+HQLeaUhLP/jmgd9+Ue0CK/lohnrM2laPXY7/BFGINxJLz9kDlyuXG7yD\n PsUQMmNfnEhkD9y74gOqg3x+FCJQ2b7NTHEPZot9bGc6QEmDWRxdrLXrpcgJyM+VH4\n g1MFlnNSURc2Wti4P0kBL/M42y5bIj4CjxCGtcNcC5UlVKT0zrbISi6OplZuuHrQPa\n D9Sv+PSbuf1rNFDLO0ndktG+dsTlTWzCLE1OksBrdBB+UAVvYv0atkgWJVXgOp5RB9\n zwZF7FS+jZj5A==","X-Gm-Message-State":"AOAM5329m6MKm02SGvqVJdDSSjlzxxcb8uL90idIOAKi7bRZdvX7Arjo\n P5XglCV8C2A91gpE7CQrX46LAgn32WngeYkvmK8=","X-Google-Smtp-Source":"\n ABdhPJzyQnLqutk8wJtGUcalgJX2yCNn0BLIq/ju4C/c+FzWFIriO7+Ss7TW+wiuTsHll9sO+01CXGbsemmBHeRSmAk=","X-Received":"by 2002:aca:1a01:: with SMTP id a1mr2775869oia.33.1617207019681;\n Wed, 31 Mar 2021 09:10:19 -0700 (PDT)","MIME-Version":"1.0","References":"\n <41021d66db2ab427c14255d2a24bb4517c8b58fd.1617126961.git.danielwa@cisco.com>\n <e5d98d566c38d6f8516b8d9d1fd603ec1f131037.1617126961.git.danielwa@cisco.com>","In-Reply-To":"\n <e5d98d566c38d6f8516b8d9d1fd603ec1f131037.1617126961.git.danielwa@cisco.com>","From":"Ard Biesheuvel <ardb@kernel.org>","Date":"Wed, 31 Mar 2021 18:10:08 +0200","X-Gmail-Original-Message-ID":"\n <CAMj1kXG_rRLU2Hp_GaZyayxx6J+HaWyPHPmE-hEZawuxzZ4JXw@mail.gmail.com>","Message-ID":"\n <CAMj1kXG_rRLU2Hp_GaZyayxx6J+HaWyPHPmE-hEZawuxzZ4JXw@mail.gmail.com>","Subject":"Re: [PATCH 6/8] drivers: firmware: efi: libstub: enable generic\n commandline","To":"Daniel Walker <danielwa@cisco.com>, Arvind Sankar <nivedita@alum.mit.edu>","Content-Type":"text/plain; charset=\"UTF-8\"","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":"ob Herring <robh@kernel.org>, linux-efi <linux-efi@vger.kernel.org>,\n Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>,\n \"open list:LINUX FOR POWERPC \\(32-BIT AND 64-BIT\\)\"\n <linuxppc-dev@lists.ozlabs.org>, X86 ML <x86@kernel.org>,\n \"open list:MIPS\" <linux-mips@vger.kernel.org>,\n Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,\n xe-linux-external@cisco.com, Andrew Morton <akpm@linux-foundation.org>,\n Will Deacon <will@kernel.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>"}},{"id":2659280,"web_url":"http://patchwork.ozlabs.org/comment/2659280/","msgid":"<20210331182145.GJ2469518@zorba>","date":"2021-03-31T18:21:45","subject":"Re: [PATCH 6/8] drivers: firmware: efi: libstub: enable generic\n commandline","submitter":{"id":67374,"url":"http://patchwork.ozlabs.org/api/people/67374/","name":"Daniel Walker (danielwa)","email":"danielwa@cisco.com"},"content":"On Wed, Mar 31, 2021 at 06:10:08PM +0200, Ard Biesheuvel wrote:\n> (+ Arvind)\n> \n> On Tue, 30 Mar 2021 at 19:57, Daniel Walker <danielwa@cisco.com> wrote:\n> >\n> > This adds code to handle the generic command line changes.\n> > The efi code appears that it doesn't benefit as much from this design\n> > as it could.\n> >\n> > For example, if you had a prepend command line with \"nokaslr\" then\n> > you might be helpful to re-enable it in the boot loader or dts,\n> > but there appears to be no way to re-enable kaslr or some of the\n> > other options.\n> >\n> > Cc: xe-linux-external@cisco.com\n> > Signed-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(-)\n> >\n> > diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c\n> > index 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> >         return printed;\n> >  }\n> >\n> > +/**\n> > + * efi_handle_cmdline() - handle adding in building parts of the command line\n> > + * @cmdline:   kernel command line\n> > + *\n> > + * Add in the generic parts of the commandline and start the parsing of the\n> > + * command line.\n> > + *\n> > + * Return:     status code\n> > + */\n> > +efi_status_t efi_handle_cmdline(char const *cmdline)\n> > +{\n> > +       efi_status_t status;\n> > +\n> > +       status = efi_parse_options(CMDLINE_PREPEND);\n> > +       if (status != EFI_SUCCESS) {\n> > +               efi_err(\"Failed to parse options\\n\");\n> > +               return status;\n> > +       }\n> \n> Even though I am not a fan of the 'success handling' pattern,\n> duplicating the exact same error handling three times is not great\n> either. Could we reuse more of the code here?\n\nHow about\n\nefi_status_t status = 0;\n\nstatus |= efi_parse_options(CMDLINE_PREPEND);\n\nthen error checking once ?\n\n> > +\n> > +       status = efi_parse_options(IS_ENABLED(CONFIG_CMDLINE_OVERRIDE) ? \"\" : cmdline);\n> \n> What is the point of calling efi_parse_options() with an empty string?\n \nI could change it to if ((IS_ENABLED(CONFIG_CMDLINE_OVERRIDE)) ?\n\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> >                 goto fail;\n> >         }\n> >\n> > +#ifdef CONFIG_GENERIC_CMDLINE\n> > +       status = efi_handle_cmdline(cmdline_ptr);\n> > +       if (status != EFI_SUCCESS) {\n> > +               goto fail_free_cmdline;\n> > +       }\n> > +#else\n> >         if (IS_ENABLED(CONFIG_CMDLINE_EXTEND) ||\n> >             IS_ENABLED(CONFIG_CMDLINE_FORCE) ||\n> \n> Does this mean CONFIG_GENERIC_CMDLINE does not replace CMDLINE_EXTEND\n> / CMDLINE_FORCE etc, but introduces yet another variant on top of\n> those?\n> \n> That does not seem like an improvement to me. I think it is great that\n> you are cleaning this up, but only if it means we can get rid of the\n> old implementation.\n \nIt does replace extend and force. I was under the impression this code was\nshared between arm64 and arm32. If that's not the case I can delete the extend\nand force section. I haven't submitted a conversion for arm32 yet.\n\nDaniel","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=Mh3qzQkN;\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=Mh3qzQkN;\n\tdkim-atps=neutral","lists.ozlabs.org; spf=pass (sender SPF authorized)\n smtp.mailfrom=cisco.com (client-ip=173.37.86.76; helo=rcdn-iport-5.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=Mh3qzQkN; 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 4F9ZRG2PKVz9sVt\n\tfor <patchwork-incoming@ozlabs.org>; Thu,  1 Apr 2021 05:22:18 +1100 (AEDT)","from boromir.ozlabs.org (localhost [IPv6:::1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4F9ZRG1XWTz3brl\n\tfor <patchwork-incoming@ozlabs.org>; Thu,  1 Apr 2021 05:22:18 +1100 (AEDT)","from rcdn-iport-5.cisco.com (rcdn-iport-5.cisco.com [173.37.86.76])\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 4F9ZQq5rK8z2yx8\n for <linuxppc-dev@lists.ozlabs.org>; Thu,  1 Apr 2021 05:21:52 +1100 (AEDT)","from rcdn-core-9.cisco.com ([173.37.93.145])\n by rcdn-iport-5.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA;\n 31 Mar 2021 18:21:48 +0000","from zorba ([10.24.8.227])\n by rcdn-core-9.cisco.com (8.15.2/8.15.2) with ESMTPS id 12VILjhE015710\n (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO);\n Wed, 31 Mar 2021 18:21:47 GMT"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple;\n d=cisco.com; i=@cisco.com; l=3897; q=dns/txt; s=iport;\n t=1617214915; x=1618424515;\n h=date:from:to:cc:subject:message-id:references:\n mime-version:in-reply-to;\n bh=t8lk/7k5wkWXyrsD9aMvvKA4Te42fmRyrTbrrcgdlHo=;\n b=Mh3qzQkN8dB8hJlswW8NH363HeUouRgZUl7niJ7bFxHZiP06D+HI9DjW\n jJg2kJ2KXgMRGT6dUHYLzanpVXq4oOcTyzmajSIP9S0qhDgwlVGlDsHln\n hUU0W6E4XG/NxrmJR3hDXzGTALoybmXWm8ntenRa+Ce3XDPBNO+Ikt9aI Q=;","IronPort-HdrOrdr":"\n A9a23:WKfFL6jA4QpEqfo1THc148MX4HBQX4F13DAbvn1ZSRFFG/GwvcrGppsm/DXzjyscX2xltNCbIa+bQW7d85kd2/h1AZ6JWg76tGy0aLxz9IeK+UyDJwTS/vNQvJ0LT4FQE9v1ZGIWse/b502CH88k0J279smT9IPj5lNMaS0vVK169Qd+DW+gYy5LbS1LH4AwGpbZxucvnVudUE8aZMi6GXUJNtKrz7b2vanrbhIcCxks5BPmt1OVwYTnGBuV1Ap2aV1y6IolmFKoryXJoo2+rvf+8RPHzmnV9ZgTosf508BOHtbksLlzFhzcziC1eY9mR7qO+Bcyre3H0idSrPD85zE9Is9093TdOluQnCKo8Qzh3DEygkWSr2OlvQ==","X-IronPort-Anti-Spam-Filtered":"true","X-IronPort-Anti-Spam-Result":"\n A0AkAABzvGRg/5FdJa1aGwEBAQEBAQEBBQEBARIBAQEDAwEBAUCBPAYBAQELAYIqgUwBOTGMZYkuA5AIFopFgXwLAQEBDQEBNAQBAYRQAoF7AiU0CQ4CAwEBDAEBBQEBAQIBBgRxhW6GRQEFOj8QCxguPBsGE4V5qnd1gTSJCIFEFA6BFwGNSSYcgUlChC4+ijYEgkAGAXsUgmWQfwaCdopQgSCZb4EUgxGBI5s5MRCkSLgbAgQGBQIWgVQ6gVkzGggbFYMkUBkNjisWjkchAy84AgYKAQEDCY8JAQE","X-IronPort-AV":"E=Sophos;i=\"5.81,293,1610409600\"; d=\"scan'208\";a=\"609843726\"","Date":"Wed, 31 Mar 2021 11:21:45 -0700","From":"Daniel Walker <danielwa@cisco.com>","To":"Ard Biesheuvel <ardb@kernel.org>","Subject":"Re: [PATCH 6/8] drivers: firmware: efi: libstub: enable generic\n commandline","Message-ID":"<20210331182145.GJ2469518@zorba>","References":"\n <41021d66db2ab427c14255d2a24bb4517c8b58fd.1617126961.git.danielwa@cisco.com>\n <e5d98d566c38d6f8516b8d9d1fd603ec1f131037.1617126961.git.danielwa@cisco.com>\n <CAMj1kXG_rRLU2Hp_GaZyayxx6J+HaWyPHPmE-hEZawuxzZ4JXw@mail.gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"\n <CAMj1kXG_rRLU2Hp_GaZyayxx6J+HaWyPHPmE-hEZawuxzZ4JXw@mail.gmail.com>","X-Auto-Response-Suppress":"DR, OOF, AutoReply","X-Outbound-SMTP-Client":"10.24.8.227, [10.24.8.227]","X-Outbound-Node":"rcdn-core-9.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":"ob Herring <robh@kernel.org>, linux-efi <linux-efi@vger.kernel.org>,\n Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>,\n \"open list:LINUX FOR POWERPC \\(32-BIT AND 64-BIT\\)\"\n <linuxppc-dev@lists.ozlabs.org>, X86 ML <x86@kernel.org>,\n \"open list:MIPS\" <linux-mips@vger.kernel.org>,\n Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,\n Arvind Sankar <nivedita@alum.mit.edu>, xe-linux-external@cisco.com,\n Andrew Morton <akpm@linux-foundation.org>, Will Deacon <will@kernel.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>"}},{"id":2660531,"web_url":"http://patchwork.ozlabs.org/comment/2660531/","msgid":"<72fbd293-1d83-a558-4d7a-141576371864@csgroup.eu>","date":"2021-04-02T17:36:53","subject":"Re: [PATCH 6/8] drivers: firmware: efi: libstub: enable generic\n commandline","submitter":{"id":79086,"url":"http://patchwork.ozlabs.org/api/people/79086/","name":"Christophe Leroy","email":"christophe.leroy@csgroup.eu"},"content":"Le 30/03/2021 à 19:57, Daniel Walker a écrit :\n> This adds code to handle the generic command line changes.\n> The efi code appears that it doesn't benefit as much from this design\n> as it could.\n> \n> For example, if you had a prepend command line with \"nokaslr\" then\n> you might be helpful to re-enable it in the boot loader or dts,\n> but there appears to be no way to re-enable kaslr or some of the\n> other options.\n> \n> Cc: xe-linux-external@cisco.com\n> Signed-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(-)\n> \n> diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c\n> index 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\nI think we can refactor to first build the final command line, then call efi_parse_options() only \nonce after that.\n\nThe big advantage of GENERIC_CMDLINE should be to not address anymore CONFIG_CMDLINE_XXX options at \nall outside of linux/cmdline.h\n\n> +\n>   /**\n>    * efi_parse_options() - Parse EFI command line options\n>    * @cmdline:\tkernel command line\n> diff --git a/drivers/firmware/efi/libstub/efi-stub.c b/drivers/firmware/efi/libstub/efi-stub.c\n> index 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\nWhy an alternative ?\n\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>   \n> diff --git a/drivers/firmware/efi/libstub/efistub.h b/drivers/firmware/efi/libstub/efistub.h\n> index 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);\n> diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c\n> index 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>","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=2404:9400:2:0:216:3eff:fee1:b9f1; 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\n [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1])\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 4FBnLP6grCz9sRf\n\tfor <patchwork-incoming@ozlabs.org>; Sat,  3 Apr 2021 04:37:17 +1100 (AEDT)","from boromir.ozlabs.org (localhost [IPv6:::1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4FBnLP5g1wz3bxQ\n\tfor <patchwork-incoming@ozlabs.org>; Sat,  3 Apr 2021 04:37:17 +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 4FBnL35cGyz2xdL\n for <linuxppc-dev@lists.ozlabs.org>; Sat,  3 Apr 2021 04:36:59 +1100 (AEDT)","from localhost (mailhub1-int [192.168.12.234])\n by localhost (Postfix) with ESMTP id 4FBnKy4WWlz9v3qS;\n Fri,  2 Apr 2021 19:36:54 +0200 (CEST)","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 jNzMP97qRsnX; Fri,  2 Apr 2021 19:36:54 +0200 (CEST)","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 4FBnKy36stz9v3qR;\n Fri,  2 Apr 2021 19:36:54 +0200 (CEST)","from localhost (localhost [127.0.0.1])\n by messagerie.si.c-s.fr (Postfix) with ESMTP id 95F468BB77;\n Fri,  2 Apr 2021 19:36:56 +0200 (CEST)","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 AmiRaLq6LC2w; Fri,  2 Apr 2021 19:36:56 +0200 (CEST)","from [192.168.4.90] (unknown [192.168.4.90])\n by messagerie.si.c-s.fr (Postfix) with ESMTP id D381B8BB6F;\n Fri,  2 Apr 2021 19:36:55 +0200 (CEST)"],"X-Virus-Scanned":["Debian amavisd-new at c-s.fr","amavisd-new at c-s.fr"],"Subject":"Re: [PATCH 6/8] drivers: firmware: efi: libstub: enable generic\n commandline","To":"Daniel Walker <danielwa@cisco.com>, Will Deacon <will@kernel.org>,\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","References":"\n <41021d66db2ab427c14255d2a24bb4517c8b58fd.1617126961.git.danielwa@cisco.com>\n <e5d98d566c38d6f8516b8d9d1fd603ec1f131037.1617126961.git.danielwa@cisco.com>","From":"Christophe Leroy <christophe.leroy@csgroup.eu>","Message-ID":"<72fbd293-1d83-a558-4d7a-141576371864@csgroup.eu>","Date":"Fri, 2 Apr 2021 19:36:53 +0200","User-Agent":"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101\n Thunderbird/78.9.0","MIME-Version":"1.0","In-Reply-To":"\n <e5d98d566c38d6f8516b8d9d1fd603ec1f131037.1617126961.git.danielwa@cisco.com>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Language":"fr","Content-Transfer-Encoding":"8bit","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>"}},{"id":2661841,"web_url":"http://patchwork.ozlabs.org/comment/2661841/","msgid":"<20210406164224.GU2469518@zorba>","date":"2021-04-06T16:42:24","subject":"Re: [PATCH 6/8] drivers: firmware: efi: libstub: enable generic\n commandline","submitter":{"id":67374,"url":"http://patchwork.ozlabs.org/api/people/67374/","name":"Daniel Walker (danielwa)","email":"danielwa@cisco.com"},"content":"On Fri, Apr 02, 2021 at 07:36:53PM +0200, Christophe Leroy wrote:\n> \n> \n> Le 30/03/2021 à 19:57, Daniel Walker a écrit :\n> > This adds code to handle the generic command line changes.\n> > The efi code appears that it doesn't benefit as much from this design\n> > as it could.\n> > \n> > For example, if you had a prepend command line with \"nokaslr\" then\n> > you might be helpful to re-enable it in the boot loader or dts,\n> > but there appears to be no way to re-enable kaslr or some of the\n> > other options.\n> > \n> > Cc: xe-linux-external@cisco.com\n> > Signed-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(-)\n> > \n> > diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c\n> > index 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> > @@ -172,6 +173,40 @@ int efi_printk(const char *fmt, ...)\n> >   \treturn printed;\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> I think we can refactor to first build the final command line, then call\n> efi_parse_options() only once after that.\n \nI tried this, like what you did in your v4 .. The issues are similar to the\nprom_init.c problems. The environment is delicate and requires careful\nprogramming to get it done correctly.\n\n> The big advantage of GENERIC_CMDLINE should be to not address anymore\n> CONFIG_CMDLINE_XXX options at all outside of linux/cmdline.h\n \nI agree , but not I've found that it's not likely to get this all changed in a\nsingle series.\n\nDaniel","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=O+l2WdgJ;\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=O+l2WdgJ;\n\tdkim-atps=neutral","lists.ozlabs.org; spf=pass (sender SPF authorized)\n smtp.mailfrom=cisco.com (client-ip=173.37.86.75; helo=rcdn-iport-4.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=O+l2WdgJ; 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 4FFCxm1tKYz9sRf\n\tfor <patchwork-incoming@ozlabs.org>; Wed,  7 Apr 2021 02:42:52 +1000 (AEST)","from boromir.ozlabs.org (localhost [IPv6:::1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4FFCxm0jcWz3bnr\n\tfor <patchwork-incoming@ozlabs.org>; Wed,  7 Apr 2021 02:42:52 +1000 (AEST)","from rcdn-iport-4.cisco.com (rcdn-iport-4.cisco.com [173.37.86.75])\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 4FFCxM4xxsz2yZG\n for <linuxppc-dev@lists.ozlabs.org>; Wed,  7 Apr 2021 02:42:29 +1000 (AEST)","from alln-core-6.cisco.com ([173.36.13.139])\n by rcdn-iport-4.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA;\n 06 Apr 2021 16:42:26 +0000","from zorba ([10.24.14.212])\n by alln-core-6.cisco.com (8.15.2/8.15.2) with ESMTPS id 136GgOjZ008120\n (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO);\n Tue, 6 Apr 2021 16:42:26 GMT"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple;\n d=cisco.com; i=@cisco.com; l=3115; q=dns/txt; s=iport;\n t=1617727351; x=1618936951;\n h=date:from:to:cc:subject:message-id:references:\n mime-version:content-transfer-encoding:in-reply-to;\n bh=50Y5J3ymEIV3Iw/tW/yMYxTzDSV1S32YCccq6b0npb0=;\n b=O+l2WdgJHdqjz7CRsbSw3rpMz4eEj6h8Kr20AQHywZ/aSW09LiIA36ew\n xeHaV3IcjhsdurAAHMLXWbWwqqyzraSJ+ABZR47PewZ/KTaECjElElR69\n wUJCycTZupqKgElo3zL6cVgC5yKXYISYjcHxXbrLJ+n4nUZ45xBjIB9c/ A=;","IronPort-HdrOrdr":"\n A9a23:pIoZVqjAH57WgZJThgTPBhL7W3BQX6B13DAbvn1ZSRFFG/GwvcrGppsm/DXzjyscX2xltNCbIa+bQW7d85kd2/h1AZ6JWg76tGy0aLx45Yz5zDH6XwH4/OhR1aBvGpIObOHYJ158kMr8/U2EA88tqeP3kpyAqO/Cwx5WJz1CRLpn625CZzqzMkozfwVeAIp8KZz03LshmxOFWVA6Kvu2HWMEWe+rnaypqLvDbQQdDxAqrCmi5AnI1JfAHxKV3ggTXlp0qN9IzUH/nwP0/amluf2goyW960bo859UlNH9o+EsOOWwjKEuRgnEu0KBeJlmH4aPpikyp/uirGw3icDWrw07Vv4DjU/5TyWSvQbn3RXm3XII7XLvoGXo+UfLkIjeWC8wDdZHiMZiVibhr2AkvN16zctwrhuki6Y=","X-IronPort-Anti-Spam-Filtered":"true","X-IronPort-Anti-Spam-Result":"\n A0AKAABBjmxg/4sNJK1aGgEBAQEBAQEBAQEDAQEBARIBAQEBAgIBAQEBQIE+BQEBAQELAYIqgU0BOTGMZokuA5AMFopGgXwLAQEBDQEBNAQBAYEWAYM0AwICgXYCJTQJDgIDAQEMAQEFAQEBAgEGBHEThV2GRAEBAQMBMgFGBQsLGC48GwYThVghq051gTSBAYgfgUQUDoEXAY1MJxyBSUKENT6KNwSBVRBigQ9NgWKROgaNUoEgmXWBFIMVgSabRzIQpGG4PgIEBgUCFoFUOoFZMxoIGxWDJFAZDo4rFo5HIQMvOAIGAQkBAQMJjUQBAQ","X-IronPort-AV":"E=Sophos;i=\"5.82,310,1613433600\"; d=\"scan'208\";a=\"857077664\"","Date":"Tue, 6 Apr 2021 09:42:24 -0700","From":"Daniel Walker <danielwa@cisco.com>","To":"Christophe Leroy <christophe.leroy@csgroup.eu>","Subject":"Re: [PATCH 6/8] drivers: firmware: efi: libstub: enable generic\n commandline","Message-ID":"<20210406164224.GU2469518@zorba>","References":"\n <41021d66db2ab427c14255d2a24bb4517c8b58fd.1617126961.git.danielwa@cisco.com>\n <e5d98d566c38d6f8516b8d9d1fd603ec1f131037.1617126961.git.danielwa@cisco.com>\n <72fbd293-1d83-a558-4d7a-141576371864@csgroup.eu>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<72fbd293-1d83-a558-4d7a-141576371864@csgroup.eu>","X-Auto-Response-Suppress":"DR, OOF, AutoReply","X-Outbound-SMTP-Client":"10.24.14.212, [10.24.14.212]","X-Outbound-Node":"alln-core-6.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":"ob Herring <robh@kernel.org>, linux-efi@vger.kernel.org,\n Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>,\n linuxppc-dev@lists.ozlabs.org, x86@kernel.org, linux-mips@vger.kernel.org,\n linux-kernel@vger.kernel.org, xe-linux-external@cisco.com,\n Andrew Morton <akpm@linux-foundation.org>, Will Deacon <will@kernel.org>,\n Ard Biesheuvel <ardb@kernel.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>"}}]