public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: grant.likely@secretlab.ca (Grant Likely)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 04/14] bus: mvebu-mbus: Add static window allocation to the DT binding
Date: Wed, 12 Jun 2013 11:48:32 +0100	[thread overview]
Message-ID: <20130612104832.DE33A3E0A56@localhost> (raw)
In-Reply-To: <20130608183851.GB2354@localhost>

On Sat, 8 Jun 2013 15:38:52 -0300, Ezequiel Garcia <ezequiel.garcia@free-electrons.com> wrote:
> Hi Jason, Arnd:
> 
> Thanks for your reviews!
> 
> I agree with most of your suggestions so far. However, I'd like to discuss
> one point before we move forward with the other (imo, less importants)
> issues. See below.
> 
> On Fri, Jun 07, 2013 at 02:00:54PM -0600, Jason Gunthorpe wrote:
> [...]
> > 
> > 
> > Is the ranges right though? I was expecting this:
> > 
> >  ranges = <0  0x012f0000 0  0x8000000>
> > 
> > The 2nd address cell in the 2dword space should almost always be 0.
> > 
> > The 2nd address cell should be interprited as the offset within the
> > target's window, not as some kind of physical base address.
> > 
> > >>+ (Note that the windowid cell is encoding the target ID = 0x01 and attribute
> > >>+ ID = 0x2f, and the selected base address for the window is 0xe8000000).
> > 
> > ... The proper place to indicate the base address for the window is in
> > the mbus ranges:
> > 
> > mbus {
> >    ranges = <0x012f0000 0  0xe8000000  0x8000000>
> >    devbus-bootcs {
> >        ranges = <0  0x012f0000 0  0x8000000>
> >    }
> > }
> > 
> > We shouldn't mangle the DT format just to make it convenient for
> > humans to write - if this is a major problem then I'd try to use the
> > preprocessor first.. There are several reasonable solutions down that
> > path, IMHO.
> > 
> 
> Right. I think we have two options here for laying the DT ranges.
> 
> 1) This is the proposal implied in the patchset I sent:
> 
> mbus {
> 	ranges = < we only put the internal-reg translation here>
> 	devbus-bootcs {
> 		ranges = <0 {target_id/attribute} {window_physical_base} {size}>
> 	}
> }
> 
> Of course the above DT will be actually incomplete, for it'll lack a proper ranges
> entry to translate the devbus-bootcs address. So we chosed to do it dynamically
> in the mbus driver (see patch 05/14), and add the missing entry.
> 
> The information of the physical window base address is in this case in
> each child (devbus-bootcs, bootrom, and so on). The MBus driver walks
> each of its first-level children and allocates the window based on the
> address declared in the ranges property of each child, as shown above.
> 
> This is done mostly to avoid having that in the mbus node, and the nightmare
> to maintain it produces. See below.
> 
> 2) This is what Jason is proposing in his mail:
> 
> mbus {
> 	ranges = <{target_id/attribute} 0 {window_physical_base} {size}>
> 	devbus-bootcs {
> 		ranges = <0 {target_id/attribute} 0 {size}>
> 	}
> }
> 
> Of course this looks much cleaner, but it forces a lot of duplication
> in the DT files. Now, if you see some of the recent patches we've been
> sending, I think this duplication is very error-prone, and it'll be a
> nightmare to maintain. Let me propose an example to show this
> duplication:
> 
> Let's suppose we have a board "A" with its armada-A.dts,
> and a common one armada.dtsi.
> 
> The common dtsi file would have this ranges property:
> 
> /* armada.dtsi */
> mbus {
> 	ranges = < internal_regs_id 0 internal_regs_base internal_regs_size
> 		         bootrom_id 0       bootrom_base       bootrom_size >
> }
> 
> The A board has a NOR connected to some devbus, so we need to add it
> to the ranges, but also need to duplicate the ones in the common dtsi:
> 
> /* armada-A.dts */
> mbus {
> 	ranges = < internal_regs_id 0 internal_regs_base internal_regs_size
> 		         bootrom_id 0       bootrom_base       bootrom_size
> 		         devbus0_id 0       devbus0_base       devbus0_size >
> }
> 
> Now, if we add something at the common level, and extend the ranges
> property in the common armada.dtsi, we also have to go through *each* of
> the per-board dts files (for *each* board) adding that entry, because
> entries *need* to be duplicated. Otherwise you're effectively
> "shadowing" the entries.
> 
> It is precisely for this reason that I've decided to adopt option #1
> instead! Now, I'm not saying I like that option particularly.
> In fact it has a couple issues as well:
> 
>   1. The DT is *incomplete* and needs to be completed by the MBus
>      driver which, IMHO, sucks.
> 
>   2. Changing the DT dynamically in the kernel, means that new
>      properties are allocated to replace old ones, but the old ones
>      are *never* released. So if for any reason we do this often,
>      we're effectively "leaking" memory.

3. Modify DTC to support appending to properties.

g.

  parent reply	other threads:[~2013-06-12 10:48 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-07 16:47 [PATCH 00/14] MBus device tree binding Ezequiel Garcia
2013-06-07 16:47 ` [PATCH 01/14] bus: mvebu-mbus: Use pr_fmt Ezequiel Garcia
2013-06-07 16:56   ` Thomas Petazzoni
2013-06-08 14:15   ` Jason Cooper
2013-06-07 16:47 ` [PATCH 02/14] bus: mvebu-mbus: Factor out initialization details Ezequiel Garcia
2013-06-07 16:47 ` [PATCH 03/14] bus: mvebu-mbus: Introduce device tree binding Ezequiel Garcia
2013-06-07 19:10   ` Arnd Bergmann
2013-06-07 19:44     ` Jason Gunthorpe
2013-06-07 19:53       ` Arnd Bergmann
2013-06-07 20:09         ` Jason Gunthorpe
2013-06-07 21:15           ` Arnd Bergmann
2013-06-08  0:26             ` Jason Gunthorpe
2013-06-08 17:29       ` Ezequiel Garcia
2013-06-07 16:47 ` [PATCH 04/14] bus: mvebu-mbus: Add static window allocation to the DT binding Ezequiel Garcia
2013-06-07 19:01   ` Arnd Bergmann
2013-06-07 20:00     ` Jason Gunthorpe
2013-06-07 21:07       ` Arnd Bergmann
2013-06-08 18:38       ` Ezequiel Garcia
2013-06-09  1:45         ` Jason Gunthorpe
2013-06-09 14:39           ` Ezequiel Garcia
2013-06-11 13:57           ` Ezequiel Garcia
2013-06-11 15:26             ` Arnd Bergmann
2013-06-11 21:50               ` Jason Gunthorpe
2013-06-11 22:22                 ` Sebastian Hesselbarth
2013-06-11 23:02                   ` Arnd Bergmann
2013-06-11 23:08                   ` Jason Gunthorpe
2013-06-12  7:37                     ` Sebastian Hesselbarth
2013-06-11 22:34                 ` Arnd Bergmann
2013-06-11 22:58                   ` Jason Gunthorpe
2013-06-11 23:10                     ` Arnd Bergmann
2013-06-12 11:14                   ` Grant Likely
2013-06-12 20:45                     ` Arnd Bergmann
2013-06-12 21:12                       ` Ezequiel Garcia
2013-06-12 21:26                         ` Jason Gunthorpe
2013-06-12 21:36                           ` Ezequiel Garcia
2013-06-12 21:52                             ` Arnd Bergmann
2013-06-12 22:02                               ` Jason Gunthorpe
2013-06-12 22:20                                 ` Arnd Bergmann
2013-06-12 22:24                                   ` Arnd Bergmann
2013-06-15 16:03                           ` Grant Likely
2013-06-12 20:02                 ` Ezequiel Garcia
2013-06-12 20:12                   ` Jason Gunthorpe
2013-06-12 21:50                   ` Arnd Bergmann
2013-06-12 11:07               ` Grant Likely
2013-06-12 11:43                 ` Arnd Bergmann
2013-06-12 11:54                   ` Grant Likely
2013-06-12 11:58                     ` Arnd Bergmann
2013-06-12 10:52           ` Grant Likely
2013-06-09 13:42         ` Arnd Bergmann
2013-06-09 14:34           ` Ezequiel Garcia
2013-06-09 15:37             ` Arnd Bergmann
2013-06-12 10:48         ` Grant Likely [this message]
2013-06-11 13:31     ` Ezequiel Garcia
2013-06-11 15:02       ` Arnd Bergmann
2013-06-07 16:47 ` [PATCH 05/14] bus: mvebu-mbus: Update the mbus-compatible node's ranges property Ezequiel Garcia
2013-06-12 10:25   ` Grant Likely
2013-06-07 16:47 ` [PATCH 06/14] ARM: mvebu: Initialize MBus using the DT binding Ezequiel Garcia
2013-06-07 16:47 ` [PATCH 07/14] ARM: mvebu: Remove the harcoded BootROM window allocation Ezequiel Garcia
2013-06-07 16:47 ` [PATCH 08/14] memory: mvebu-devbus: Remove address decoding window workaround Ezequiel Garcia
2013-06-07 16:47 ` [PATCH 09/14] ARM: mvebu: Add MBus to Armada 370/XP device tree Ezequiel Garcia
2013-06-07 16:47 ` [PATCH 10/14] ARM: mvebu: Add BootROM " Ezequiel Garcia
2013-06-07 16:47 ` [PATCH 11/14] ARM: mvebu: Relocate Armada 370/XP DeviceBus device tree nodes Ezequiel Garcia
2013-06-07 19:18   ` Arnd Bergmann
2013-06-07 16:47 ` [PATCH 12/14] ARM: mvebu: Remove device tree unused properties on A370 Ezequiel Garcia
2013-06-07 16:56   ` Thomas Petazzoni
2013-06-08 14:18   ` Jason Cooper
2013-06-07 16:47 ` [PATCH 13/14] ARM: mvebu: Relocate Armada 370 PCIe device tree nodes Ezequiel Garcia
2013-06-07 16:47 ` [PATCH 14/14] ARM: mvebu: Relocate Armada XP " Ezequiel Garcia

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=20130612104832.DE33A3E0A56@localhost \
    --to=grant.likely@secretlab.ca \
    --cc=linux-arm-kernel@lists.infradead.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