lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230301030003.GA263873-robh@kernel.org>
Date:   Tue, 28 Feb 2023 21:00:03 -0600
From:   Rob Herring <robh@...nel.org>
To:     Frank Rowand <frowand.list@...il.com>
Cc:     Clément Léger <clement.leger@...tlin.com>,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        Lizhi Hou <lizhi.hou@...inx.com>,
        Allan Nielsen <allan.nielsen@...rochip.com>,
        Horatiu Vultur <horatiu.vultur@...rochip.com>,
        Steen Hegelund <steen.hegelund@...rochip.com>,
        Thomas Petazzoni <thomas.petazzoni@...tlin.com>
Subject: Re: [PATCH v3 1/2] of: create of_root if no dtb provided

On Tue, Feb 28, 2023 at 08:05:58PM -0600, Frank Rowand wrote:
> On 2/27/23 11:17, Rob Herring wrote:
> > On Thu, Feb 23, 2023 at 3:34 PM Frank Rowand <frowand.list@...il.com> wrote:
> >>
> >> When enabling CONFIG_OF on a platform where of_root is not populated by
> >> firmware, we end up without a root node. In order to apply overlays and
> >> create subnodes of the root node, we need one. Create this root node
> >> by unflattening an empty builtin dtb.
> >>
> >> If firmware provides a flattened device tree (FDT) then the FDT is
> >> unflattened via setup_arch().  Otherwise, setup_of() which is called
> >> immediately after setup_arch(), and will create the default root node
> >> if it does not exist.
> > 
> > Why do we need a hook after setup_arch() rather than an initcall?
> > 
> > Rob
> 
> It might work as an initcall today.  Maybe not in the future as other
> initcalls are added.

That's an argument for never using initcalls (not a bad one either). But 
we have them and we have little reason not to use them. Also, it's 
better to do things as late as possible I've found. The earlier you do 
things, the more architecture specific stuff you hit. That's a big 
reason for the remaining differences in FDT init across architectures. 
Maybe after setup_arch is late enough. IDK.

> But my main stream of thinking is that before the patch "we know" that
> the device tree data structure exists when setup_arch() returns.
> Adding setup_of() immediately after setup_arch() retains that
> guarantee, but one line later in start_kernel().

I get the logic. I'd just rather not add another hook between the DT 
code and the core/arch code. Especially for this niche usecase.

We already have the secondary init when sysfs is up. Can't we just do 
this there?

> I could have instead put the call to setup_of() into each architectures'
> setup_arch(), but that would just be duplicating the same code for each
> architecture, which did not seem like a good choice.

Uhh, no!

Rob

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ