devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Rob Herring <robh+dt@kernel.org>,
	Pantelis Antoniou <pantelis.antoniou@konsulko.com>,
	Frank Rowand <frowand.list@gmail.com>,
	devicetree@vger.kernel.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Bill Mills <bill.mills@linaro.org>,
	Anmar Oueja <anmar.oueja@linaro.org>,
	Masahiro Yamada <masahiroy@kernel.org>
Subject: Re: [PATCH] of: unittest: Statically apply overlays using fdtoverlay
Date: Mon, 18 Jan 2021 17:30:25 +1100	[thread overview]
Message-ID: <20210118063025.GI2089552@yekko.fritz.box> (raw)
In-Reply-To: <20210115054450.ab2xrohlxg7nnzpn@vireshk-i7>

[-- Attachment #1: Type: text/plain, Size: 6454 bytes --]

On Fri, Jan 15, 2021 at 11:14:50AM +0530, Viresh Kumar wrote:
> +David,
> 
> On 14-01-21, 09:01, Rob Herring wrote:
> > On Wed, Jan 13, 2021 at 11:03 PM Viresh Kumar <viresh.kumar@linaro.org> wrote:
> > >
> > > On 11-01-21, 09:46, Rob Herring wrote:
> > > > On Fri, Jan 8, 2021 at 2:41 AM Viresh Kumar <viresh.kumar@linaro.org> wrote:
> > > > >
> > > > > Now that fdtoverlay is part of the kernel build, start using it to test
> > > > > the unitest overlays we have by applying them statically.
> > > >
> > > > Nice idea.
> > > >
> > > > > The file overlay_base.dtb have symbols of its own and we need to apply
> > > > > overlay.dtb to overlay_base.dtb alone first to make it work, which gives
> > > > > us intermediate-overlay.dtb file.
> > > >
> > > > Okay? If restructuring things helps we should do that. Frank?
> > >
> > > Frank, do we want to do something about it ? Maybe make overlay_base.dts an dtsi
> > > and include it from testcases.dts like the other ones ?
> > 
> > No, because overlay_base.dts is an overlay dt.

So.. I was confused for a bit here, because the overlay_base.dts
you're discussing is the one in the kernel tree, not the one in the
dtc tree.

The kernel file is confusing to me.  It has the /plugin/ tag which
should be used for overlays, but the rest of the file looks like a
base tree rather than an overlay.  There's even a comment saying "Base
device tree that overlays will be applied against".  But it goes on to
talk about __fixups__ and __local__fixups__ which will never be
generated for a based tree.

Oh.. and then there's terminology confusion.  dtc has had compile time
resolved overlays for a very long time.  Those are usually .dtsi
files, and should generally not have /plugin/.

More recent is the support for run-time overlays - .dtbo output files,
which are usually generated from a .dts with /plugin/.  They usually
should *not* have a "/ { ... } " stanza, since that indicates the base
portion of the tree.

> What property of a file makes it an overlay ? Just the presence of
> /plugin/; ?

Yes and no.  Generally that's how it should work , but it looks to me
like the presence of /plugin/ there is just wrong.  /plugin/ basically
just activates some extra dtc features, though, so it is possible to
"manually" construct a valid overlay without it.

> David, we are talking about the overlay base[1] file here. The
> fdtoverlay tool
> fails to apply it to testcases.dts file (in the same directory) because none of
> its nodes have the __overlay__ label and the dtc routine overlay_merge() [2]
> skips them intentionally.

testcases.dts also has /plugin/ and again, it's not really clear if
that's right.

The point of /plugin/ is that it will automatically generate the
__overlay__ subnodes from dtc's &label { ... } or &{/path} { ... }
syntax, so you wouldn't expect to see __overlay__ in the source.

> > I think we need an
> > empty, minimal base.dtb to apply overlay_base.dtbo to.
> 
> One way out is adding an (almost-empty) testcase-data-2 in testcases.dtb, that
> will make it work.
> 
> > And then fdtoverlay needs a fix to apply overlays to the root node?
> 
> It isn't just root node I think, but any node for which the __overlay__ label
> isn't there.
> 
> So this can make it all work if everyone is fine with it:
> 
> diff --git a/drivers/of/unittest-data/overlay_base.dts b/drivers/of/unittest-data/overlay_base.dts
> index 99ab9d12d00b..59172c4c9e5a 100644
> --- a/drivers/of/unittest-data/overlay_base.dts
> +++ b/drivers/of/unittest-data/overlay_base.dts
> @@ -11,8 +11,7 @@
>   * dtc will create nodes "/__symbols__" and "/__local_fixups__".
>   */
>  
> -/ {
> -       testcase-data-2 {
> +       &overlay_base {
>                 #address-cells = <1>;
>                 #size-cells = <1>;
>  
> @@ -89,5 +88,3 @@ retail_1: vending@50000 {
>                 };
>  
>         };
> -};
> -
> diff --git a/drivers/of/unittest-data/testcases.dts b/drivers/of/unittest-data/testcases.dts
> index a85b5e1c381a..539dc7d9eddc 100644
> --- a/drivers/of/unittest-data/testcases.dts
> +++ b/drivers/of/unittest-data/testcases.dts
> @@ -11,6 +11,11 @@ node-remove {
>                         };
>                 };
>         };
> +
> +       overlay_base: testcase-data-2 {
> +               #address-cells = <1>;
> +               #size-cells = <1>;
> +       };
> 
> -------------------------8<-------------------------
> 
> And then we can do this to the Makefile over my changes.
> 
> -------------------------8<-------------------------
> 
> diff --git a/drivers/of/unittest-data/Makefile b/drivers/of/unittest-data/Makefile
> index 9f3eb30b78f1..8cc23311b778 100644
> --- a/drivers/of/unittest-data/Makefile
> +++ b/drivers/of/unittest-data/Makefile
> @@ -41,7 +41,6 @@ DTC_FLAGS_testcases += -Wno-interrupts_property
>  
>  # Apply all overlays (except overlay_bad_* as they are not supposed to apply and
>  # fail build) statically with fdtoverlay
> -intermediate-overlay   := overlay.dtb
>  master                 := overlay_0.dtb overlay_1.dtb overlay_2.dtb \
>                            overlay_3.dtb overlay_4.dtb overlay_5.dtb \
>                            overlay_6.dtb overlay_7.dtb overlay_8.dtb \
> @@ -50,15 +49,12 @@ master                      := overlay_0.dtb overlay_1.dtb overlay_2.dtb \
>                            overlay_gpio_01.dtb overlay_gpio_02a.dtb \
>                            overlay_gpio_02b.dtb overlay_gpio_03.dtb \
>                            overlay_gpio_04a.dtb overlay_gpio_04b.dtb \
> -                          intermediate-overlay.dtb
> +                          overlay_base.dtb overlay.dtb
>  
>  quiet_cmd_fdtoverlay = fdtoverlay $@
>        cmd_fdtoverlay = $(objtree)/scripts/dtc/fdtoverlay -o $@ -i $^
>  
> -$(obj)/intermediate-overlay.dtb: $(obj)/overlay_base.dtb $(addprefix $(obj)/,$(intermediate-overlay))
> -       $(call if_changed,fdtoverlay)
> -
>  $(obj)/master.dtb: $(obj)/testcases.dtb $(addprefix $(obj)/,$(master))
>         $(call if_changed,fdtoverlay)
>  
> -always-$(CONFIG_OF_OVERLAY) += intermediate-overlay.dtb master.dtb
> +always-$(CONFIG_OF_OVERLAY) += master.dtb
> 

-- 
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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2021-01-18  6:53 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-07  5:15 [PATCH V2 1/2] scripts: dtc: Add fdtoverlay.c and fdtdump.c to DTC_SOURCE Viresh Kumar
2021-01-07  5:15 ` [PATCH V2 2/2] scripts: dtc: Build fdtoverlay and fdtdump tools Viresh Kumar
2021-01-07  5:45   ` Masahiro Yamada
2021-01-07  6:25     ` [PATCH V3 " Viresh Kumar
2021-01-12  0:44       ` Frank Rowand
2021-01-12  5:08         ` Viresh Kumar
2021-01-12 18:34           ` Frank Rowand
2021-01-13  4:55             ` Viresh Kumar
2021-01-12  0:55       ` Frank Rowand
2021-01-12  4:48         ` Viresh Kumar
2021-01-19 16:28   ` [PATCH V2 " Frank Rowand
2021-01-19 16:34     ` Frank Rowand
2021-01-08  8:41 ` [PATCH] of: unittest: Statically apply overlays using fdtoverlay Viresh Kumar
2021-01-11 15:46   ` Rob Herring
2021-01-11 22:09     ` Frank Rowand
2021-01-14  5:03     ` Viresh Kumar
2021-01-14 15:01       ` Rob Herring
2021-01-15  5:44         ` Viresh Kumar
2021-01-18  3:54           ` Frank Rowand
2021-01-19  2:30             ` Frank Rowand
2021-01-18  6:30           ` David Gibson [this message]
2021-01-19  2:29             ` Frank Rowand
2021-01-11 22:06   ` Frank Rowand
2021-01-12  1:22     ` Bill Mills
2021-01-12  8:37       ` Viresh Kumar
2021-01-12 10:16         ` Bill Mills
2021-01-12 18:17           ` Frank Rowand
2021-01-12 14:04     ` Rob Herring
2021-01-12 19:06       ` Frank Rowand
2021-01-12 19:41         ` Rob Herring
2021-01-12 20:05           ` Frank Rowand
2021-01-12 20:46             ` Rob Herring
2021-01-13  2:20               ` Frank Rowand
2021-01-13 15:05                 ` Rob Herring
2021-01-13 17:21                   ` Frank Rowand
2021-01-14  5:00   ` Viresh Kumar
2021-01-19  2:25     ` Frank Rowand
2021-01-19  2:21   ` frowand.list
2021-01-19  8:05     ` Viresh Kumar
2021-01-19 15:44       ` Frank Rowand
2021-01-20  5:06         ` Viresh Kumar
2021-01-20  6:20           ` Viresh Kumar
2021-01-21  5:00           ` Frank Rowand
2021-01-21  5:09             ` Viresh Kumar
2021-01-21  6:41             ` David Gibson
2021-01-11 22:13 ` [PATCH V2 1/2] scripts: dtc: Add fdtoverlay.c and fdtdump.c to DTC_SOURCE Frank Rowand
2021-01-12  4:45   ` Viresh Kumar
2021-01-19 16:21 ` Frank Rowand
2021-01-19 16:31   ` Frank Rowand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210118063025.GI2089552@yekko.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=anmar.oueja@linaro.org \
    --cc=bill.mills@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=pantelis.antoniou@konsulko.com \
    --cc=robh+dt@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).