From: Daniel Walker <danielwa@cisco.com>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: ob Herring <robh@kernel.org>,
linux-efi@vger.kernel.org,
Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>,
linuxppc-dev@lists.ozlabs.org, x86@kernel.org,
linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
xe-linux-external@cisco.com,
Andrew Morton <akpm@linux-foundation.org>,
Will Deacon <will@kernel.org>, Ard Biesheuvel <ardb@kernel.org>
Subject: Re: [PATCH 6/8] drivers: firmware: efi: libstub: enable generic commandline
Date: Tue, 6 Apr 2021 09:42:24 -0700 [thread overview]
Message-ID: <20210406164224.GU2469518@zorba> (raw)
In-Reply-To: <72fbd293-1d83-a558-4d7a-141576371864@csgroup.eu>
On Fri, Apr 02, 2021 at 07:36:53PM +0200, Christophe Leroy wrote:
>
>
> Le 30/03/2021 à 19:57, Daniel Walker a écrit :
> > This adds code to handle the generic command line changes.
> > The efi code appears that it doesn't benefit as much from this design
> > as it could.
> >
> > For example, if you had a prepend command line with "nokaslr" then
> > you might be helpful to re-enable it in the boot loader or dts,
> > but there appears to be no way to re-enable kaslr or some of the
> > other options.
> >
> > Cc: xe-linux-external@cisco.com
> > Signed-off-by: Daniel Walker <danielwa@cisco.com>
> > ---
> > .../firmware/efi/libstub/efi-stub-helper.c | 35 +++++++++++++++++++
> > drivers/firmware/efi/libstub/efi-stub.c | 7 ++++
> > drivers/firmware/efi/libstub/efistub.h | 1 +
> > drivers/firmware/efi/libstub/x86-stub.c | 13 +++++--
> > 4 files changed, 54 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c
> > index aa8da0a49829..c155837cedc9 100644
> > --- a/drivers/firmware/efi/libstub/efi-stub-helper.c
> > +++ b/drivers/firmware/efi/libstub/efi-stub-helper.c
> > @@ -13,6 +13,7 @@
> > #include <linux/efi.h>
> > #include <linux/kernel.h>
> > #include <linux/printk.h> /* For CONSOLE_LOGLEVEL_* */
> > +#include <linux/cmdline.h>
> > #include <asm/efi.h>
> > #include <asm/setup.h>
> > @@ -172,6 +173,40 @@ int efi_printk(const char *fmt, ...)
> > return printed;
> > }
> > +/**
> > + * efi_handle_cmdline() - handle adding in building parts of the command line
> > + * @cmdline: kernel command line
> > + *
> > + * Add in the generic parts of the commandline and start the parsing of the
> > + * command line.
> > + *
> > + * Return: status code
> > + */
> > +efi_status_t efi_handle_cmdline(char const *cmdline)
> > +{
> > + efi_status_t status;
> > +
> > + status = efi_parse_options(CMDLINE_PREPEND);
> > + if (status != EFI_SUCCESS) {
> > + efi_err("Failed to parse options\n");
> > + return status;
> > + }
> > +
> > + status = efi_parse_options(IS_ENABLED(CONFIG_CMDLINE_OVERRIDE) ? "" : cmdline);
> > + if (status != EFI_SUCCESS) {
> > + efi_err("Failed to parse options\n");
> > + return status;
> > + }
> > +
> > + status = efi_parse_options(CMDLINE_APPEND);
> > + if (status != EFI_SUCCESS) {
> > + efi_err("Failed to parse options\n");
> > + return status;
> > + }
> > +
> > + return EFI_SUCCESS;
> > +}
>
> I think we can refactor to first build the final command line, then call
> efi_parse_options() only once after that.
I tried this, like what you did in your v4 .. The issues are similar to the
prom_init.c problems. The environment is delicate and requires careful
programming to get it done correctly.
> The big advantage of GENERIC_CMDLINE should be to not address anymore
> CONFIG_CMDLINE_XXX options at all outside of linux/cmdline.h
I agree , but not I've found that it's not likely to get this all changed in a
single series.
Daniel
next prev parent reply other threads:[~2021-04-06 16:42 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-30 17:56 [PATCH 1/8] CMDLINE: add generic builtin command line Daniel Walker
2021-03-30 17:56 ` [PATCH 2/8] CMDLINE: drivers: of: ifdef out cmdline section Daniel Walker
2021-03-30 19:49 ` Rob Herring
2021-03-30 23:17 ` Daniel Walker
2021-04-07 22:59 ` Rob Herring
2021-04-09 1:26 ` Daniel Walker
2021-04-02 17:32 ` Christophe Leroy
2021-04-06 16:35 ` Daniel Walker
2021-03-30 17:56 ` [PATCH 3/8] powerpc: convert strcpy to strlcpy in prom_init Daniel Walker
2021-04-02 17:32 ` Christophe Leroy
2021-03-30 17:56 ` [PATCH 4/8] CMDLINE: powerpc: convert to generic builtin command line Daniel Walker
2021-04-02 17:34 ` Christophe Leroy
2021-04-06 16:38 ` Daniel Walker
2021-03-30 17:57 ` [PATCH 5/8] CMDLINE: mips: " Daniel Walker
2021-03-30 17:57 ` [PATCH 6/8] drivers: firmware: efi: libstub: enable generic commandline Daniel Walker
2021-03-31 16:10 ` Ard Biesheuvel
2021-03-31 18:21 ` Daniel Walker
2021-04-02 17:36 ` Christophe Leroy
2021-04-06 16:42 ` Daniel Walker [this message]
2021-03-30 17:57 ` [PATCH 7/8] CMDLINE: x86: convert to generic builtin command line Daniel Walker
2021-03-30 17:57 ` [PATCH 8/8] CMDLINE: arm64: " Daniel Walker
2021-04-02 17:28 ` [PATCH 1/8] CMDLINE: add " Christophe Leroy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210406164224.GU2469518@zorba \
--to=danielwa@cisco.com \
--cc=akpm@linux-foundation.org \
--cc=ardb@kernel.org \
--cc=christophe.leroy@csgroup.eu \
--cc=daniel@gimpelevich.san-francisco.ca.us \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=robh@kernel.org \
--cc=will@kernel.org \
--cc=x86@kernel.org \
--cc=xe-linux-external@cisco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).