All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pantelis Antoniou <panto@antoniou-consulting.com>
To: Joel A Fernandes <agnel.joel@gmail.com>
Cc: Grant Likely <grant.likely@secretlab.ca>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>, Russ Dill <Russ.Dill@ti.com>,
	Felipe Balbi <balbi@ti.com>, Benoit Cousson <b-cousson@ti.com>,
	Tony Lindgren <tony@atomide.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Koen Kooi <koen@dominion.thruhere.net>,
	Matt Porter <mporter@ti.com>,
	linux-omap@vger.kernel.org, Kevin Hilman <khilman@ti.com>,
	Paul Walmsley <paul@pwsan.com>,
	devicetree-discuss@lists.ozlabs.org,
	Rob Herring <robherring2@gmail.com>
Subject: Re: [PATCH 0/3] capebus moving omap_devices to mach-omap2
Date: Tue, 6 Nov 2012 09:14:54 +0100	[thread overview]
Message-ID: <4DA29B25-C056-4360-8768-05585485FE00@antoniou-consulting.com> (raw)
In-Reply-To: <CAD=GYpYsc4JrHiZfT9PzQQfas+=+emb=RLzvXV=Ec4JHKKK0AA@mail.gmail.com>

Hi Joel,

On Nov 6, 2012, at 4:06 AM, Joel A Fernandes wrote:

> Hi Grant,
> 
> On Mon, Nov 5, 2012 at 5:58 PM, Grant Likely <grant.likely@secretlab.ca> wrote:
>> 
>> 
>> Joel A Fernandes <agnel.joel@gmail.com> wrote:
>> 
>>> Hi Grant,
>>> 
>>> On Mon, Nov 5, 2012 at 2:14 PM, Grant Likely
>>> <grant.likely@secretlab.ca> wrote:
>>>> I'm open to suggestions if anyone has any. I have not objections to a
>>>> fixup approach, but I'm not comfortable with anything that is fragile
>>>> to modifications to the fragment.
>>> 
>>> I am fairly new to the DT world so please bear with me, but how about
>>> a method that resolves symbols the same way that the linux dynamic
>>> linker does when shared libraries are loaded?
>>> 
>>> A separate table (similar to .PLT/GOT sections  in the ELF object
>>> format) could be created when the fragment is loaded, and the phandle
>>> references could be fixed to point to the table offsets during compile
>>> time. This table would be a second level indirection and the kernel
>>> would populate this table with the in-kernel values of the phandles
>>> that the dt fragment refers to.
>> 
>> That's an interesting idea that is worth exploring. That would make
>> it possible to avoid a fixup stage, but it also means that any parsing
>> code must know how to handle the got-like table. It won't be
>> backwards compatible with existing tools. It also wouldn't easily
>> support the case of firmware applying the overlay and passing the
>> resulting tree to the kernel. Hmmm.... Not being backwards compatible
>> at the data level is a big problem. I really want a method that can
>> resolve back to the current data format or is a compatible extension
>> of it.
>> 
> 
> Is it meaningful or feasible to make the table a part of the tree
> structure itself? the table would initially be empty. If I'm right,
> this is how the GOT tables in ELF objects that refer to unresolved
> symbols in shared libraries are implemented as well, they are a part
> of the object and are loaded into memory and fixed up. If the table is
> a part of the DT data, the tools would then be able to parse such a
> tree. We could enforce that the got-like tree would strictly follow a
> predefined format.
> 
> Something along these lines would also avoid the need for a tree fix
> up. Do you think this reduces the difficulty of backward compatibility
> with the parsing tools and firmware loading?

To be honest here, we are discussing a new object format. 
There are a few twists IMO.

a) We definitely, absolutely, don't want to introduce anything that will
risk compatibility with devices already out there. The binary format
for device trees that don't need the dynamic resolution features we're
talking about here, should be be usable for those older devices.

b) Device tree is flexible enough to store the additional data in it's own
node format. So we shouldn't have any kind of binary data tacked on; this
ties with a) - make sure that the binary format doesn't change.

c) There is no need (at least AFAIKT) of having any other resolution type
than a phandle of a node.

d) Finally, for some use-cases the problem is simplified by not having
all the features of a true dynamic linker. For example for the capebus
case the 'base' DTS won't have any references to any fragments. It is only
the fragments that have unresolved references and only to the 'base' DTS.

> 
>>> 
>>> This might involve changes to the DT core, but as such, this method
>>> wouldn't suffer from the fragility problem of either base or fragment
>>> DT trees being modified.
>>> 
>>> The table itself could be added to the tree by the compiler, and the
>>> phandles could point to it (fixed). such phandles could be marked for
>>> special handling to facilitate the 1-level indirection.
>> 
>> That's part of the problem. Property values are essentially
>> anaonymous data. There is no mechanism currently for marking data
>> such as indicate which data values are phandles. If there were then
>> it would be a simple matter to find all the phandles and fix them up.
>> 
>> We could possibly add data type suppplementary properties to the tree
>> to solve that problem. They would have to be optional for the base
>> tree to retain backwards compatibility, but could be required on
>> overlays.
>> 
> 
> Sure, so if we add data type supplementary properties to the tree to
> indicate the data type as "indirect phandle", then kernel could refer
> to the index in the got-like table to fetch the actual phandle address
> (1-level of indirection), instead of directly using the address in the
> data field.
> 

I'm fine with this.

> 
> Thanks and Regards,
> 
> Joel

Regards

-- Pantelis


WARNING: multiple messages have this Message-ID (diff)
From: Pantelis Antoniou <panto@antoniou-consulting.com>
To: Joel A Fernandes <agnel.joel@gmail.com>
Cc: Grant Likely <grant.likely@secretlab.ca>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>, Russ Dill <Russ.Dill@ti.com>,
	Felipe Balbi <balbi@ti.com>, Benoit Cousson <b-cousson@ti.com>,
	Tony Lindgren <tony@atomide.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Koen Kooi <koen@dominion.thruhere.net>,
	Matt Porter <mporter@ti.com>,
	linux-omap@vger.kernel.org, Kevin Hilman <khilman@ti.com>,
	Paul Walmsley <paul@pwsan.com>,
	devicetree-discuss@lists.ozlabs.org,
	Rob Herring <robherring2@gmail.com>
Subject: Re: [PATCH 0/3] capebus moving omap_devices to mach-omap2
Date: Tue, 6 Nov 2012 09:14:54 +0100	[thread overview]
Message-ID: <4DA29B25-C056-4360-8768-05585485FE00@antoniou-consulting.com> (raw)
In-Reply-To: <CAD=GYpYsc4JrHiZfT9PzQQfas+=+emb=RLzvXV=Ec4JHKKK0AA@mail.gmail.com>

Hi Joel,

On Nov 6, 2012, at 4:06 AM, Joel A Fernandes wrote:

> Hi Grant,
> 
> On Mon, Nov 5, 2012 at 5:58 PM, Grant Likely <grant.likely@secretlab.ca> wrote:
>> 
>> 
>> Joel A Fernandes <agnel.joel@gmail.com> wrote:
>> 
>>> Hi Grant,
>>> 
>>> On Mon, Nov 5, 2012 at 2:14 PM, Grant Likely
>>> <grant.likely@secretlab.ca> wrote:
>>>> I'm open to suggestions if anyone has any. I have not objections to a
>>>> fixup approach, but I'm not comfortable with anything that is fragile
>>>> to modifications to the fragment.
>>> 
>>> I am fairly new to the DT world so please bear with me, but how about
>>> a method that resolves symbols the same way that the linux dynamic
>>> linker does when shared libraries are loaded?
>>> 
>>> A separate table (similar to .PLT/GOT sections  in the ELF object
>>> format) could be created when the fragment is loaded, and the phandle
>>> references could be fixed to point to the table offsets during compile
>>> time. This table would be a second level indirection and the kernel
>>> would populate this table with the in-kernel values of the phandles
>>> that the dt fragment refers to.
>> 
>> That's an interesting idea that is worth exploring. That would make
>> it possible to avoid a fixup stage, but it also means that any parsing
>> code must know how to handle the got-like table. It won't be
>> backwards compatible with existing tools. It also wouldn't easily
>> support the case of firmware applying the overlay and passing the
>> resulting tree to the kernel. Hmmm.... Not being backwards compatible
>> at the data level is a big problem. I really want a method that can
>> resolve back to the current data format or is a compatible extension
>> of it.
>> 
> 
> Is it meaningful or feasible to make the table a part of the tree
> structure itself? the table would initially be empty. If I'm right,
> this is how the GOT tables in ELF objects that refer to unresolved
> symbols in shared libraries are implemented as well, they are a part
> of the object and are loaded into memory and fixed up. If the table is
> a part of the DT data, the tools would then be able to parse such a
> tree. We could enforce that the got-like tree would strictly follow a
> predefined format.
> 
> Something along these lines would also avoid the need for a tree fix
> up. Do you think this reduces the difficulty of backward compatibility
> with the parsing tools and firmware loading?

To be honest here, we are discussing a new object format. 
There are a few twists IMO.

a) We definitely, absolutely, don't want to introduce anything that will
risk compatibility with devices already out there. The binary format
for device trees that don't need the dynamic resolution features we're
talking about here, should be be usable for those older devices.

b) Device tree is flexible enough to store the additional data in it's own
node format. So we shouldn't have any kind of binary data tacked on; this
ties with a) - make sure that the binary format doesn't change.

c) There is no need (at least AFAIKT) of having any other resolution type
than a phandle of a node.

d) Finally, for some use-cases the problem is simplified by not having
all the features of a true dynamic linker. For example for the capebus
case the 'base' DTS won't have any references to any fragments. It is only
the fragments that have unresolved references and only to the 'base' DTS.

> 
>>> 
>>> This might involve changes to the DT core, but as such, this method
>>> wouldn't suffer from the fragility problem of either base or fragment
>>> DT trees being modified.
>>> 
>>> The table itself could be added to the tree by the compiler, and the
>>> phandles could point to it (fixed). such phandles could be marked for
>>> special handling to facilitate the 1-level indirection.
>> 
>> That's part of the problem. Property values are essentially
>> anaonymous data. There is no mechanism currently for marking data
>> such as indicate which data values are phandles. If there were then
>> it would be a simple matter to find all the phandles and fix them up.
>> 
>> We could possibly add data type suppplementary properties to the tree
>> to solve that problem. They would have to be optional for the base
>> tree to retain backwards compatibility, but could be required on
>> overlays.
>> 
> 
> Sure, so if we add data type supplementary properties to the tree to
> indicate the data type as "indirect phandle", then kernel could refer
> to the index in the got-like table to fetch the actual phandle address
> (1-level of indirection), instead of directly using the address in the
> data field.
> 

I'm fine with this.

> 
> Thanks and Regards,
> 
> Joel

Regards

-- Pantelis

  reply	other threads:[~2012-11-06  8:15 UTC|newest]

Thread overview: 107+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-01 15:17 [PATCH 0/3] capebus moving omap_devices to mach-omap2 Pantelis Antoniou
2012-10-31 17:52 ` Tony Lindgren
2012-10-31 18:04   ` Pantelis Antoniou
2012-10-31 18:09     ` Tony Lindgren
2012-10-31 18:24       ` Pantelis Antoniou
2012-10-31 19:55       ` Benoit Cousson
2012-10-31 19:55         ` Benoit Cousson
2012-10-31 20:12         ` Pantelis Antoniou
2012-10-31 20:12           ` Pantelis Antoniou
2012-10-31 21:26           ` Tony Lindgren
2012-10-31 21:36             ` Pantelis Antoniou
2012-10-31 21:43               ` Tony Lindgren
2012-10-31 22:00                 ` Pantelis Antoniou
2012-10-31 22:16                   ` Tony Lindgren
2012-10-31 22:14               ` Felipe Balbi
2012-10-31 22:14                 ` Felipe Balbi
2012-11-01  7:02                 ` Pantelis Antoniou
2012-11-01  7:02                   ` Pantelis Antoniou
2012-11-01 10:23                   ` Cousson, Benoit
2012-11-01 10:23                     ` Cousson, Benoit
2012-11-01 10:39                     ` Pantelis Antoniou
2012-11-01 10:39                       ` Pantelis Antoniou
2012-11-01 11:04                       ` Felipe Balbi
2012-11-01 11:04                         ` Felipe Balbi
2012-11-01 11:26                         ` Pantelis Antoniou
2012-11-01 11:26                           ` Pantelis Antoniou
2012-11-01 12:40                           ` Felipe Balbi
2012-11-01 12:40                             ` Felipe Balbi
2012-11-01 12:57                             ` Pantelis Antoniou
2012-11-01 12:57                               ` Pantelis Antoniou
2012-11-01 13:16                               ` Felipe Balbi
2012-11-01 13:16                                 ` Felipe Balbi
2012-11-01 13:35                                 ` Pantelis Antoniou
2012-11-01 13:35                                   ` Pantelis Antoniou
2012-11-01 13:51                                   ` Alan Cox
2012-11-01 13:51                                     ` Alan Cox
2012-11-01 13:59                                     ` Pantelis Antoniou
2012-11-01 13:59                                       ` Pantelis Antoniou
2012-11-01 22:05                                       ` Felipe Balbi
2012-11-01 22:05                                         ` Felipe Balbi
2012-11-01 23:49                                         ` Russ Dill
2012-11-02  8:57                                           ` Felipe Balbi
2012-11-02  8:57                                             ` Felipe Balbi
2012-11-02  9:42                                             ` Russ Dill
2012-11-02 10:39                                               ` Koen Kooi
2012-11-02 10:39                                                 ` Koen Kooi
2012-11-02 11:00                                               ` Felipe Balbi
2012-11-02 11:00                                                 ` Felipe Balbi
2012-11-02 16:44                                                 ` Russ Dill
2012-11-02 11:21                                           ` Alan Cox
2012-11-02 12:32                                             ` Pantelis Antoniou
2012-11-05  0:37                                               ` Grant Likely
2012-11-05 15:37                                                 ` Pantelis Antoniou
2012-11-05 15:37                                                   ` Pantelis Antoniou
2012-11-05 19:10                                                   ` Grant Likely
2012-11-05 19:54                                                     ` Pantelis Antoniou
2012-11-05 19:54                                                       ` Pantelis Antoniou
2012-11-05 20:14                                                       ` Grant Likely
2012-11-05 22:59                                                         ` Joel A Fernandes
2012-11-05 23:58                                                           ` Grant Likely
2012-11-05 23:58                                                             ` Grant Likely
2012-11-06  3:06                                                             ` Joel A Fernandes
2012-11-06  8:14                                                               ` Pantelis Antoniou [this message]
2012-11-06  8:14                                                                 ` Pantelis Antoniou
2012-11-06 11:16                                                                 ` Grant Likely
2012-11-06 13:54                                                                   ` Pantelis Antoniou
2012-11-06 13:54                                                                     ` Pantelis Antoniou
2012-11-02 16:07                                             ` Jason Kridner
2012-11-02 16:07                                               ` Jason Kridner
2012-11-02 16:28                                               ` Alan Cox
2012-11-05  1:05                                               ` Grant Likely
2012-11-01 11:26                       ` Cousson, Benoit
2012-11-01 11:26                         ` Cousson, Benoit
2012-11-01 11:39                         ` Pantelis Antoniou
2012-11-01 11:39                           ` Pantelis Antoniou
2012-11-01 12:00                         ` Koen Kooi
2012-11-01 12:00                           ` Koen Kooi
2012-11-01 13:06                           ` Felipe Balbi
2012-11-01 13:06                             ` Felipe Balbi
2012-11-01 13:33                             ` Koen Kooi
2012-11-01 13:33                               ` Koen Kooi
2012-11-02  8:15                           ` Cousson, Benoit
2012-11-02  8:15                             ` Cousson, Benoit
2012-11-02  8:43                             ` Pantelis Antoniou
2012-11-03  8:23                               ` Kevin Hilman
2012-11-05  0:22                               ` Grant Likely
2012-11-05  0:22                                 ` Grant Likely
2012-11-05 13:25                                 ` Pantelis Antoniou
2012-11-05 13:25                                   ` Pantelis Antoniou
2012-11-05 14:34                                   ` Grant Likely
2012-11-05 15:34                                     ` Tony Lindgren
2012-11-05 15:34                                       ` Tony Lindgren
2012-11-05 15:56                                     ` Rob Herring
2012-11-05 15:56                                       ` Rob Herring
2012-11-05 19:40                                       ` Grant Likely
2012-11-01 15:18 ` [PATCH 1/3] omap-device: Remove __init from omap_device_build family functions Pantelis Antoniou
2012-11-01 15:18 ` [PATCH 2/3] da8xx-dt: Create da8xx DT adapter device Pantelis Antoniou
2012-11-01 14:36   ` Tomi Valkeinen
2012-11-01 14:38     ` Pantelis Antoniou
2012-11-01 15:18 ` [PATCH 3/3] ti-tscadc-dt: Create ti-tscadc-dt " Pantelis Antoniou
2012-11-01 18:50 [PATCH 0/3] capebus moving omap_devices to mach-omap2 Jason Kridner
2012-11-01 19:07 ` Tony Lindgren
2012-11-02  9:26 ` Cousson, Benoit
2012-11-02  9:26   ` Cousson, Benoit
2012-11-02 10:19   ` Koen Kooi
2012-11-02 10:19     ` Koen Kooi
2012-11-05  0:32     ` Grant Likely

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=4DA29B25-C056-4360-8768-05585485FE00@antoniou-consulting.com \
    --to=panto@antoniou-consulting.com \
    --cc=Russ.Dill@ti.com \
    --cc=agnel.joel@gmail.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=b-cousson@ti.com \
    --cc=balbi@ti.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --cc=khilman@ti.com \
    --cc=koen@dominion.thruhere.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=mporter@ti.com \
    --cc=paul@pwsan.com \
    --cc=robherring2@gmail.com \
    --cc=tony@atomide.com \
    /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.