Re: [PATCH] dtc: Merge nodes if possible in plugins

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Hello and thanks for the quick response, my comments below.

On Tue, Sep 11, 2018 at 8:14 AM David Gibson
<david@xxxxxxxxxxxxxxxxxxxxx> wrote:
>
> On Mon, Sep 10, 2018 at 11:55:10PM +0200, Fredrik Markstrom wrote:
> > This patch makes it possible to use references to labels in plugins
> > without creating additional fragments.
> >
> > Previously the dts below would generate two fragments:
> >
> > /dts-v1/;
> > /plugin/;
> > &x { a: a@0 {};};
> > &a { b {}; };
> >
> > Signed-off-by: Fredrik Markstrom <fredrik.markstrom@xxxxxxxxx>
>
> I've considered a change like this before, and it might be a good
> idea.  I'm not certain though, because it does make the mapping
> between what appears in the dts and the dtbo a bit less obvious than
> it might be otherwise.
>
> Do you have a concrete reason to prefer this approach?

I left it out the first time because I'm not sure our use case is 100%
spot on :)

The short story is that a lot of dtsi:s (which we want to reuse)
written for non-overlays are on this form (starting with a reference)
and the kernel (at least 4.1) doesn't seem to be able to resolve
dependencies between fragments.

The long story is: Basically we have a huge and deep device tree (lots
of fpga:s) and each major part of the tree is
kept in it's own dtsi in which starts with a reference to where it's
supposed to be inserted
(like most (or at least a lot) of the dtsi:s in mainline). We now want
to break things out and load
fpga:s and device trees from user-space.

I'm not sure I understand what the drawback is.

/Fredrik

>
> > ---
> >  dtc-parser.y | 12 ++++++------
> >  1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/dtc-parser.y b/dtc-parser.y
> > index dd70ebf..4f2f6dd 100644
> > --- a/dtc-parser.y
> > +++ b/dtc-parser.y
> > @@ -196,13 +196,13 @@ devicetree:
> >                        *   versioninfo plugindecl memreserves devicetree
> >                        * so $-1 is what we want (plugindecl)
> >                        */
> > -                     if ($<flags>-1 & DTSF_PLUGIN) {
> > -                             add_orphan_node($1, $3, $2);
> > -                     } else {
> > -                             struct node *target = get_node_by_ref($1, $2);
> > +                     struct node *target = get_node_by_ref($1, $2);
> >
> > -                             if (target)
> > -                                     merge_nodes(target, $3);
> > +                     if (target)
> > +                             merge_nodes(target, $3);
> > +                     else {
> > +                             if ($<flags>-1 & DTSF_PLUGIN)
> > +                                     add_orphan_node($1, $3, $2);
> >                               else
> >                                       ERROR(&@2, "Label or path %s not found", $2);
> >                       }
>
> --
> David Gibson                    | I'll have my music baroque, and my code
> david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
>                                 | _way_ _around_!
> http://www.ozlabs.org/~dgibson



-- 
/Fredrik



[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux