devicetree-compiler.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
To: Andrei Ziureaev <andreiziureaev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	andrei.ziureaev-5wv7dgnIgG8@public.gmane.org
Subject: Re: [RFC PATCH v3 0/4] dtc: Add a plugin interface
Date: Fri, 11 Sep 2020 17:06:40 +1000	[thread overview]
Message-ID: <20200911070640.GI66834@yekko.fritz.box> (raw)
In-Reply-To: <20200906131220.6192-1-andrei.ziureaev-5wv7dgnIgG8@public.gmane.org>

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

On Sun, Sep 06, 2020 at 02:12:16PM +0100, Andrei Ziureaev wrote:
> I added a simple live tree API. There's no longer a need to move any
> definitions. The live tree struct is hidden from plugins, so it's not an ABI.
> The API doesn't allow plugins to modify the live tree yet, but that will
> probably change later.

Hrm.  So.  Before we get into any of the details of implementation, I
think we need to be clear on what it means to expose the "live tree".
The live tree in dtc was never designed to be an exposed structure, so
we need to think about that carefully before we do expose it, because
we now have to consider stability of it across releases which we never
did before.

AFAICT the fact the tree is "live" (i.e. a pointer-based random access
representation) isn't really the relevant point here.  We could easily
enough serialize/deserialize the tree to get it into plugins, using
whatever format - and dtb is the obvious one.

What you're really after here is access to some of the internal
metadata that dtc maintains about the tree: line numbers at least,
possibly other things.

I think we really need to pin down *what* parts of this information
we need to expose to the plugins.  The data model for the information
that's going back and forth is more important than exactly how we
encode the data across the boundary.

> 
> I also removed the EXPORT_FUNCTION macro. Plugins now have to implement
> certain prototypes, defined in dtc-plugin.h. This allows plugins to be
> generated by tools.
> ===========
> 
> This is one possible implementation of a plugin interface for DTC.
> 
> A plugin interface would allow us to add checks in languages other than
> C. Specifically, it would allow DTC and DT Schema (which is written in
> Python) to be integrated.
> 
> It would also allow for better debugging of dts files. For example, DT
> Schema would be able to print dts source line information, without us
> having to add source line annotations to yaml files.
> 
> In the future, plugins will be allowed to modify the live tree and pass
> it back for further processing, but the API doesn't support that yet.
> 
> There's a question of whether we should relicense some headers to
> dual BSD to be able call Python code.
> 
> Any thoughts would be much appreciated.
> 
> Thanks,
> Andrei.
> 
> Changes in v3:
> - live tree API (dt.h and dt.c)
> - additional functionality in dtc.h
> - plugins have to implement prototypes
> - improved documentation
> 
> Changes in v2:
> - improved documentation
> - plugins must register with the build system
> - the "validate_fn_t" hook can return a status
> - define "struct reserve_info" in "dtc-plugin.h"
> - specify that minor versions are compatible
> - check if plugin_dir is NULL, just in case
> - better variable names in register_plugin_info
> 
> Andrei Ziureaev (4):
>   dtc: Add marker type functionality to dtc.h
>   dtc: Add a live tree API
>   dtc: Add plugin documentation and examples
>   dtc: Add a plugin interface
> 
>  Documentation/manual.txt         | 146 ++++++++++++++++++++++++++++
>  Makefile                         |  29 +++++-
>  Makefile.dtc                     |   1 +
>  dt.c                             | 158 +++++++++++++++++++++++++++++++
>  dt.h                             |  63 ++++++++++++
>  dtc-plugin.h                     |  76 +++++++++++++++
>  dtc.c                            | 142 ++++++++++++++++++++++++++-
>  dtc.h                            |  57 +++++++++++
>  plugins/example/Makefile.example |  27 ++++++
>  plugins/example/example.c        |  33 +++++++
>  treesource.c                     |   8 +-
>  11 files changed, 734 insertions(+), 6 deletions(-)
>  create mode 100644 dt.c
>  create mode 100644 dt.h
>  create mode 100644 dtc-plugin.h
>  create mode 100644 plugins/example/Makefile.example
>  create mode 100644 plugins/example/example.c
> 

-- 
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:[~2020-09-11  7:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-06 13:12 [RFC PATCH v3 0/4] dtc: Add a plugin interface Andrei Ziureaev
     [not found] ` <20200906131220.6192-1-andrei.ziureaev-5wv7dgnIgG8@public.gmane.org>
2020-09-06 13:12   ` [RFC PATCH v3 1/4] dtc: Add marker type functionality to dtc.h Andrei Ziureaev
2020-09-06 13:12   ` [RFC PATCH v3 2/4] dtc: Add a live tree API Andrei Ziureaev
     [not found]     ` <20200906131220.6192-3-andrei.ziureaev-5wv7dgnIgG8@public.gmane.org>
2020-09-07  1:44       ` Simon Glass
     [not found]         ` <CAPnjgZ09ve8x2kjx5KHqXJ9QFprk2uZdaKpAbTtaKYhA506gUw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-09-07 13:02           ` Andrei Ziureaev
2020-09-06 13:12   ` [RFC PATCH v3 3/4] dtc: Add plugin documentation and examples Andrei Ziureaev
2020-09-06 13:12   ` [RFC PATCH v3 4/4] dtc: Add a plugin interface Andrei Ziureaev
2020-09-11  7:06   ` David Gibson [this message]
     [not found]     ` <20200911070640.GI66834-l+x2Y8Cxqc4e6aEkudXLsA@public.gmane.org>
2020-09-13 12:25       ` [RFC PATCH v3 0/4] " Andrei Ziureaev

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=20200911070640.GI66834@yekko.fritz.box \
    --to=david-xt8fgy+axnrb3ne2bgzf6laj5h9x9tb+@public.gmane.org \
    --cc=andrei.ziureaev-5wv7dgnIgG8@public.gmane.org \
    --cc=andreiziureaev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@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 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).