public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 7/9] libfdt: Add overlay application function
Date: Wed, 15 Jun 2016 20:19:35 +1000	[thread overview]
Message-ID: <20160615101935.GA16563@voom.fritz.box> (raw)
In-Reply-To: <7E8A7CBD-D682-45E5-AD2C-19F137E5ED38@konsulko.com>

On Wed, Jun 15, 2016 at 12:34:00PM +0300, Pantelis Antoniou wrote:
> Hi David,
> 
> > On Jun 15, 2016, at 06:14 , David Gibson <david@gibson.dropbear.id.au> wrote:
> > 
> > On Tue, Jun 14, 2016 at 12:22:23PM +0300, Pantelis Antoniou wrote:
> >> Hi David,
> >>> On Jun 14, 2016, at 03:25 , David Gibson <david@gibson.dropbear.id.au> wrote:
> >>> On Fri, Jun 10, 2016 at 05:28:11PM +0300, Pantelis Antoniou wrote:
> > [snip]
> >>>>> +static int fdt_overlay_merge(void *dt, void *dto)
> >>>>> +{
> >>>>> +	int root, fragment;
> >>>>> +
> >>>>> +	root = fdt_path_offset(dto, "/");
> >>>>> +	if (root < 0)
> >>>>> +		return root;
> >>>>> +
> >>>>> +	fdt_for_each_subnode(dto, fragment, root) {
> >>>>> +		const char *name = fdt_get_name(dto, fragment, NULL);
> >>>>> +		uint32_t target;
> >>>>> +		int overlay;
> >>>>> +		int ret;
> >>>>> +
> >>>>> +		if (strncmp(name, "fragment", 8))
> >>>>> +			continue;
> >>>>> +
> >>>> 
> >>>> This is incorrect. The use of ?fragment? is a convention only.
> >>>> The real test whether the node is an overlay fragment is that
> >>>> it contains a target property.
> >>> 
> >>> Hmm.. I dislike that approach.  First, it means that if new target
> >>> types are introduced in future, older code is likely to silently
> >>> ignore such fragments instead of realizing that it doesn't know how to
> >>> apply themm.  Second, it raises weird issues if some node down within
> >>> a fragment also happens to have a property called "target?.
> >> 
> >> Not really. If new targets are introduced then the fragment will be ignored.
> > 
> > Yes.. and that's bad.
> 
> That?s arguable.

!?!  No, really, silent partial application is just horrible.

> >> We can have an argument about what is better to do (report an error or 
> >> ignore a fragment) but what it comes down to is that that applicator
> >> does not know how to handle the new target method.
> > 
> > Sure, let's have the argument.  The overlay is constructed on the
> > assumption that all the pieces will be applied, or none of them.  A
> > silent, partial application is an awful, awful failure mode.  We
> > absolutely should report an error, and in order to do so we need to
> > know what are applicable fragments, whether or not we understand the
> > target designation (or any other meta-data the fragment has).
> 
> This way also allows having nodes being something other than fragments.
> 
> So instead of being painted into a corner (all subnodes that are not
> named ?fragment at X? are errors), we have flexibility in introducing
> nodes that contain configuration data for the loader.

There's no significant difference between the approaches from this
point of view.  Metadata nodes are certainly possible (we already have
__symbols__ and __fixups__) but calling them something other than
fragment@ is no harder than leaving off the target property.  In fact
even if it was workable, calling new metadata nodes fragment@ would be
stupidly confusing.

> > Given what's established so far, checking the name seems the obvious
> > way to do that.
> > 
> 
> Again, it?s arguable. Stricter checking against future-proofing.
> 
> >> There is no issues with any target properties inside a fragment because
> >> the check is not made recursively.
> > 
> > Ok, so the real test you're proposing is "at the top level AND has a
> > target property?.
> 
> Yes

-- 
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160615/127a5d13/attachment.sig>

  reply	other threads:[~2016-06-15 10:19 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-27  9:13 [U-Boot] [PATCH v2 0/9] cmd: fdt: Add device tree overlays support Maxime Ripard
2016-05-27  9:13 ` [U-Boot] [PATCH v2 1/9] cmd: fdt: Narrow the check for fdt addr Maxime Ripard
2016-06-10  0:34   ` Simon Glass
2016-06-10 13:55     ` Pantelis Antoniou
2016-05-27  9:13 ` [U-Boot] [PATCH v2 2/9] scripts: Makefile.lib: Sanitize DTB names Maxime Ripard
2016-06-10  0:34   ` Simon Glass
2016-06-10 13:59   ` Pantelis Antoniou
2016-05-27  9:13 ` [U-Boot] [PATCH v2 3/9] vsprintf: Include stdarg for va_list Maxime Ripard
2016-06-10  0:34   ` Simon Glass
2016-06-10 14:00   ` Pantelis Antoniou
2016-05-27  9:13 ` [U-Boot] [PATCH v2 4/9] libfdt: Add new headers and defines Maxime Ripard
2016-06-10  0:34   ` Simon Glass
2016-06-10 14:03   ` Pantelis Antoniou
2016-06-11 10:30     ` David Gibson
2016-06-13  9:28       ` Maxime Ripard
2016-06-16  0:39         ` Simon Glass
2016-05-27  9:13 ` [U-Boot] [PATCH v2 5/9] libfdt: Add iterator over properties Maxime Ripard
2016-06-10  2:51   ` Stefan Agner
2016-06-10 14:04   ` Pantelis Antoniou
2016-06-13  9:35     ` Maxime Ripard
2016-05-27  9:13 ` [U-Boot] [PATCH v2 6/9] libfdt: Add max phandle retrieval function Maxime Ripard
2016-06-10  2:55   ` Stefan Agner
2016-06-10 15:13   ` Pantelis Antoniou
2016-05-27  9:13 ` [U-Boot] [PATCH v2 7/9] libfdt: Add overlay application function Maxime Ripard
2016-06-10  3:38   ` Stefan Agner
2016-06-10 14:28   ` Pantelis Antoniou
2016-06-13  9:51     ` Maxime Ripard
2016-06-14  0:25     ` David Gibson
2016-06-14  9:22       ` Pantelis Antoniou
2016-06-15  3:14         ` David Gibson
2016-06-15  9:34           ` Pantelis Antoniou
2016-06-15 10:19             ` David Gibson [this message]
2016-06-15 10:23               ` Pantelis Antoniou
2016-06-15 14:49                 ` Warner Losh
2016-05-27  9:13 ` [U-Boot] [PATCH v2 8/9] cmd: fdt: add fdt overlay application subcommand Maxime Ripard
2016-06-10  0:34   ` Simon Glass
2016-06-10  3:45   ` Stefan Agner
2016-06-10 13:56   ` Pantelis Antoniou
2016-05-27  9:13 ` [U-Boot] [PATCH v2 9/9] tests: Introduce DT overlay tests Maxime Ripard
2016-06-10  0:34   ` Simon Glass
2016-06-10 15:20   ` Pantelis Antoniou

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=20160615101935.GA16563@voom.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=u-boot@lists.denx.de \
    /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