[PATCH] arm64: Simplify checking for populated DT

Rob Herring robh at kernel.org
Fri Oct 29 07:20:45 PDT 2021


On Fri, Oct 29, 2021 at 4:38 AM Mark Rutland <mark.rutland at arm.com> wrote:
>
> Hi Rob,
>
> On Thu, Oct 28, 2021 at 01:33:55PM -0500, Rob Herring wrote:
> > Use of of_scan_flat_dt() function predates libfdt and is discouraged as
> > libfdt provides a nicer set of APIs. Rework dt_scan_depth1_nodes to use
> > libfdt calls directly. Rather than searching for any node not /chosen or
> > /hypervisor, let's just check for something always required which is the
> > arch timer.
>
> The reason for checking for /chosen and /hypervisor specifically was
> that we specifically permit a "stub" DT which only contains those nodes
> and nothing more. This is also mentioned in the comment block in
> acpi_boot_table_init().

There will be a compatibility problem if another node is ever added to the stub.

> I'm not keen on this change because it opens the door for people to
> place arbitrary things in the DT as long as they don't add a timer node,
> and I'd prefer that we continue to check for /chosen and /hypervisor
> specifically.

How would one use that? The DT is never unflattened. I guess
early_init_dt_scan() could find something.

> Can we re-implement the existing logic using libfdt calls? e.g. using
> fdt_for_each_subnode() on the root node?

Sure.

Rob



More information about the linux-arm-kernel mailing list