[PATCH 2/8] CMDLINE: drivers: of: ifdef out cmdline section

Rob Herring robh at kernel.org
Thu Apr 8 08:59:15 AEST 2021


On Tue, Mar 30, 2021 at 04:17:53PM -0700, Daniel Walker wrote:
> On Tue, Mar 30, 2021 at 02:49:13PM -0500, Rob Herring wrote:
> > On Tue, Mar 30, 2021 at 12:57 PM Daniel Walker <danielwa at cisco.com> wrote:
> > >
> > > It looks like there's some seepage of cmdline stuff into
> > > the generic device tree code. This conflicts with the
> > > generic cmdline implementation so I remove it in the case
> > > when that's enabled.
> > >
> > > Cc: xe-linux-external at cisco.com
> > > Signed-off-by: Ruslan Ruslichenko <rruslich at cisco.com>
> > > Signed-off-by: Daniel Walker <danielwa at cisco.com>
> > > ---
> > >  drivers/of/fdt.c | 14 ++++++++++++++
> > >  1 file changed, 14 insertions(+)
> > >
> > > diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> > > index dcc1dd96911a..d8805cd9717a 100644
> > > --- a/drivers/of/fdt.c
> > > +++ b/drivers/of/fdt.c
> > > @@ -25,6 +25,7 @@
> > >  #include <linux/serial_core.h>
> > >  #include <linux/sysfs.h>
> > >  #include <linux/random.h>
> > > +#include <linux/cmdline.h>
> > >
> > >  #include <asm/setup.h>  /* for COMMAND_LINE_SIZE */
> > >  #include <asm/page.h>
> > > @@ -1050,6 +1051,18 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
> > >
> > >         /* Retrieve command line */
> > >         p = of_get_flat_dt_prop(node, "bootargs", &l);
> > > +
> > > +#if defined(CONFIG_GENERIC_CMDLINE) && defined(CONFIG_GENERIC_CMDLINE_OF)
> > 
> > Moving in the wrong direction... This code already has too many
> > #ifdef's. I like Christophe's version as it gets rid of all the code
> > here.
>  
> It's temporary .. Notice CONFIG_GENERIC_CMDLINE_OF is only used on PowerPC. I
> experienced doubling on arm64 when this was used (i.e. the append and prepend
> was added twice).
> 
> I don't think there are any other users which can't be moved outside the device
> tree code, but powerpc uses this function three times during boot up plus the
> prom_init user. It's possible to use the generic command line in all four places,
> but it become space inefficient.

What's the 3rd use? I count kaslr code and in 
early_init_dt_scan_chosen_ppc. Do we need to build the command line for 
kaslr seed? Getting any build time value from the kernel is pointless.

Rob


More information about the Linuxppc-dev mailing list