Re: [PATCH 09/10] efi/x86: Support builtin command line

From: Ard Biesheuvel
Date: Wed Apr 29 2020 - 17:51:35 EST


On Wed, 29 Apr 2020 at 23:48, Arvind Sankar <nivedita@xxxxxxxxxxxx> wrote:
>
> On Wed, Apr 29, 2020 at 11:40:51PM +0200, Ard Biesheuvel wrote:
> > On Wed, 29 Apr 2020 at 23:39, Arvind Sankar <nivedita@xxxxxxxxxxxx> wrote:
> > >
> > > On Wed, Apr 29, 2020 at 09:07:32PM +0200, Ard Biesheuvel wrote:
> > > > On Wed, 29 Apr 2020 at 19:41, Arvind Sankar <nivedita@xxxxxxxxxxxx> wrote:
> > > > >
> > > > > Add support for the x86 CMDLINE_BOOL and CMDLINE_OVERRIDE configuration
> > > > > options.
> > > > >
> > > > > Signed-off-by: Arvind Sankar <nivedita@xxxxxxxxxxxx>
> > > > > ---
> > > > > drivers/firmware/efi/libstub/x86-stub.c | 12 ++++++++----
> > > > > 1 file changed, 8 insertions(+), 4 deletions(-)
> > > > >
> > > > > diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c
> > > > > index 85a924fecc87..0faba30d6406 100644
> > > > > --- a/drivers/firmware/efi/libstub/x86-stub.c
> > > > > +++ b/drivers/firmware/efi/libstub/x86-stub.c
> > > > > @@ -680,7 +680,6 @@ unsigned long efi_main(efi_handle_t handle,
> > > > > unsigned long buffer_start, buffer_end;
> > > > > struct setup_header *hdr = &boot_params->hdr;
> > > > > efi_status_t status;
> > > > > - unsigned long cmdline_paddr;
> > > > >
> > > > > efi_system_table = sys_table_arg;
> > > > >
> > > > > @@ -739,9 +738,14 @@ unsigned long efi_main(efi_handle_t handle,
> > > > > image_offset = 0;
> > > > > }
> > > > >
> > > > > - cmdline_paddr = ((u64)hdr->cmd_line_ptr |
> > > > > - ((u64)boot_params->ext_cmd_line_ptr << 32));
> > > > > - efi_parse_options((char *)cmdline_paddr);
> > > > > +#ifdef CONFIG_CMDLINE_BOOL
> > > > > + efi_parse_options(CONFIG_CMDLINE);
> > > > > +#endif
> > > >
> > > > Can we use IS_ENABLED() here as well?
> > >
> > > Unfortunately on x86, CONFIG_CMDLINE is not defined if
> > > CONFIG_CMDLINE_BOOL isn't enabled. So turning this into an
> > > IS_ENABLED(CONFIG_CMDLINE_BOOL) causes a compile error when it's
> > > disabled due to CONFIG_CMDLINE being an undeclared symbol.
> > >
> >
> > What about
> >
> > efi_parse_options(CONFIG_CMDLINE "");
> >
> > ?
>
> That's still a syntax error if CONFIG_CMDLINE is undefined, no? It's not
> defined to be empty -- it's undefined. IS_ENABLED doesn't work on
> string-valued options so I can't use IS_ENABLED(CONFIG_CMDLINE) either.

I see. Not the end of the world to have to keep it as is, I was just curious.