[PATCH v2] OF: Handle CMDLINE when /chosen node is not present

Palmer Dabbelt palmer at sifive.com
Mon Oct 22 15:55:26 PDT 2018

On Mon, 22 Oct 2018 15:42:13 PDT (-0700), robh at kernel.org wrote:
> On Mon, Oct 15, 2018 at 05:20:10PM +0300, Nick Kossifidis wrote:
>> The /chosen node is optional so we should handle CMDLINE regardless
>> the presence of /chosen/bootargs. Move handling of CMDLINE in
>> early_init_dt_scan() instead.
> I looked at this a while back. I'm not sure this behavior can be changed
> without breaking some MIPS platforms that could be relying on the
> current behavior. But trying to make sense of the MIPS code is a
> challenge and they have some other issues in this area.
> Can't this be fixed by making /chosen manditory? I'd expect ultimately
> you are always going to need it.
> I'd rather not resort to making this per arch. There's also some effort
> to consolidate cmd line handling[1].

I'd rather make /chosen mandatory on RISC-V than to have per-arch handling, as 
like you've said there's already too much duplication.  That said, it does seem 
like a bug to me because the behavior seems somewhat arbitrary -- an empty 
/chosen node causing the built-in command-line argument handling to go off the 
rails just smells so buggy.

If that's the case, could we at least have something like 
"CONFIG_OF_CHOSEN_IS_MANDATORY" that provides a warning when there is no 
/chosen node and is set on architecture where the spec mandates /chosen?

I've added linux-mips to see if anyone has any ideas.

More information about the linux-riscv mailing list