From: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
To: Tomasz Figa <t.figa-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>,
Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>,
Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>,
Ian Campbell
<ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org>,
Olof Johansson <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>,
Grant Likely
<grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>,
Benoit Cousson <bcousson-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
Subject: Re: [PATCH 0/3] Extend dtc with data type handling
Date: Tue, 24 Dec 2013 22:57:16 +1100 [thread overview]
Message-ID: <20131224115716.GG12407@voom.fritz.box> (raw)
In-Reply-To: <2257946.KY9lGl9U4o@amdc1227>
[-- Attachment #1: Type: text/plain, Size: 2892 bytes --]
On Mon, Dec 23, 2013 at 08:00:54PM +0100, Tomasz Figa wrote:
> On Monday 23 of December 2013 23:08:14 David Gibson wrote:
> > On Fri, Dec 13, 2013 at 05:49:09PM +0100, Tomasz Figa wrote:
> > > This series intends to extend dtc with appropriate infrastructure
> > > to handle property data types. First, dtc is modified to preserve
> > > type information when parsing DTS. Then type guessing is implemented
> > > for flat and fs trees where type data is not available. After that,
> > > DTS generation code is modified to use only type information when
> > > printing property data.
> >
> > Hrm. I think this is completely backwards to the right approach.
> >
> > For dt checking what we want is a schema. That can specify datatypes
> > amongst other constraints, but in the end you can check the actual
> > bytes of the DT against the constraints imposed by the schema,
> > regardless of how those bytes are presented to the checker.
>
> Those constraints are usually types, so you need a way to extract them
> from source DTS.
You really don't.
Consumers of the dt intepret it without type information, because they
know what's supposed to be there. Likewise if we know the schema, we
can check whether the dt data fits it without having to have it
annotated with type information from another source.
> > By adding type information to the in-flight tree you're checking not
> > the actual content of the DT, but how you've chosen to express that
> > information in DTS format.
> >
> > More concretely, we should be able to schema-check trees in binary
> > format, not just source. With these patches that will fail if -I dtb
> > makes the wrong type guesses.
>
> I'm not quite sure what do you want to check in binary format, where
> properties are just strings of bytes. All you can check is whether there
> is enough bytes or possibly some value constraints on particular parts
> of it, but not types.
You can check that if a consumer interprets the dt bytes according to
the schema, it will get sane data - and that's exactly what matters.
If a schema specifies a string followed by a 32-bit integer, that
implies constraints on the bytes, and that's what matters to a dt
consumer. So we might expect:
prop = "abc", <0xabcdef00>;
But:
prop = <0x61626300>, "\xab\xcd\xef";
will still be interpreted correctly by the consumer, even though the
"type" information is wrong.
However:
prop = "a\0b", <0xabcdef00>;
will NOT be parsed correctly by the consumer, even though the "type"
information is correct.
> IMHO what we primarily need is source validation. Of course using schemas,
> but that's already decided.
--
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: Type: application/pgp-signature, Size: 819 bytes --]
prev parent reply other threads:[~2013-12-24 11:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-13 16:49 [PATCH 0/3] Extend dtc with data type handling Tomasz Figa
[not found] ` < 1386953352-25402-2-git-send-email-t.figa@samsung.com>
[not found] ` <1386953352-25402-1-git-send-email-t.figa-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-12-13 16:49 ` [PATCH 1/3] dtc: Keep type information from DTS Tomasz Figa
[not found] ` <1386953352-25402-2-git-send-email-t.figa-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-12-16 18:08 ` Stephen Warren
[not found] ` <52AF41A1.3000508-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-12-23 19:16 ` Tomasz Figa
2014-01-21 12:06 ` Grant Likely
[not found] ` <20140121120606.A2E7CC4054E-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2014-01-22 4:49 ` David Gibson
2013-12-13 16:49 ` [PATCH 2/3] dtc: Inject guessed type information in case of flat and fs trees Tomasz Figa
2013-12-13 16:49 ` [PATCH 3/3] dtc: Use type information when printing tree source Tomasz Figa
2013-12-23 12:08 ` [PATCH 0/3] Extend dtc with data type handling David Gibson
[not found] ` <20131223120814.GE12407-RXTfZT5YzpxwFLYp8hBm2A@public.gmane.org>
2013-12-23 19:00 ` Tomasz Figa
2013-12-24 11:57 ` David Gibson [this message]
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=20131224115716.GG12407@voom.fritz.box \
--to=david-xt8fgy+axnrb3ne2bgzf6laj5h9x9tb+@public.gmane.org \
--cc=bcousson-rdvid1DuHRBWk0Htik3J/w@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
--cc=ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org \
--cc=jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org \
--cc=olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org \
--cc=rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org \
--cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
--cc=t.figa-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.