devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] Documentation: devicetree: add description for generic bus properties
@ 2013-11-27 17:28 Dave Martin
       [not found] ` <20131127172806.GC2291-M5GwZQ6tE7x5pKCnmE3YQBJ8xKzm50AiAL8bYrjMMd8@public.gmane.org>
  0 siblings, 1 reply; 37+ messages in thread
From: Dave Martin @ 2013-11-27 17:28 UTC (permalink / raw)
  To: devicetree
  Cc: Mark Rutland, Stephen Warren, Greg KH, Will Deacon,
	Thierry Reding, Grant Likely, linux-arm-kernel, Hiroshi Doyu

Hi all,

SoC architectures are getting increasingly complex in ways that are not
transparent to software.

A particular emerging issue is that of multi-master SoCs, which may have
different address views, IOMMUs, and coherency behaviour from one master
to the next.

DT can't describe multi-master systems today except for PCI DMA and
similar.  This comes with constraints and assumptions that won't work
for emerging SoC bus architectures.  On-SoC, a device's interface to the
system can't be described in terms of a single interface to a single
"bus".

Different masters may have different views of the system too.  Software
needs to understand the true topology in order to do address mapping,
coherency management etc., in any generic way.

One piece of the puzzle is to define how to describe these topologies in
DT.

The other is how to get the right abstractions in the kernel to drive
these systems in a generic way.

The following proposal (originally from Will) begins to address the DT
part.

Comments encouraged -- I anticipate it may take some discussion to
reach a consensus here.

Cheers
---Dave


>From will.deacon@arm.com Wed Nov 20 12:06:22 2013
Date: Wed, 20 Nov 2013 12:06:13 +0000
Subject: [PATCH RFC v2] Documentation: devicetree: add description for generic bus properties

This patch documents properties that can be used as part of bus and
device bindings in order to describe their linkages within the system
topology.

Use of these properties allows topological parsing to occur in generic
library code, making it easier for bus drivers to parse information
regarding their upstream masters and potentially allows us to treat
the slave and master interfaces separately for a given device.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---

A number of discussion points remain to be resolved:

  - Use of the ranges property and describing slave vs master bus
    address ranges. In the latter case, we actually want to describe our
    address space with respect to the bus on which the bus masters,
    rather than the parent. This could potentially be achieved by adding
    properties such as dma-parent and dma-ranges (already used by PPC?)

  - Describing masters that master through multiple different buses

  - How on Earth this fits in with the Linux device model (it doesn't)

  - Interaction with IOMMU bindings (currently under discussion)

Cheers,

Will

 .../devicetree/bindings/arm/coherent-bus.txt       | 110 +++++++++++++++++++++
 1 file changed, 110 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/coherent-bus.txt

diff --git a/Documentation/devicetree/bindings/arm/coherent-bus.txt b/Documentation/devicetree/bindings/arm/coherent-bus.txt
new file mode 100644
index 000000000000..e3fbc2e491c7
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/coherent-bus.txt
@@ -0,0 +1,110 @@
+* Generic binding to describe a coherent bus
+
+In some systems, devices (peripherals and/or CPUs) do not share
+coherent views of memory, while on other systems sets of devices may
+share a coherent view of memory depending on the static bus topology
+and/or dynamic configuration of both the bus and device. Establishing
+such dynamic configurations requires appropriate topological information
+to be communicated to the operating system.
+
+This binding document attempts to define a set of generic properties
+which can be used to encode topological information in bus and device
+nodes.
+
+
+* Terminology
+
+  - Port                : An interface over which memory transactions
+                          can propagate. A port may act as a master,
+                          slave or both (see below).
+
+  - Master port         : A port capable of issuing memory transactions
+                          to a slave. For example, a port connecting a
+                          DMA controller to main memory.
+
+  - Slave port          : A port capable of responding to memory
+                          transactions received by a master. For
+                          example, a port connecting the control
+                          registers of an MMIO device to a peripheral
+                          bus.
+
+  **Note** The ports on a bus to which masters are connected are
+           referred to as slave ports on that bus.
+
+
+* Properties
+
+  - #slave-port-cells   : A property of the bus, describing the number
+                          of cells required for an upstream master
+                          device to encode a single slave port on the
+                          bus. The actual encoding is defined by the
+                          bus binding.
+
+  - slave-ports         : A property of a device mastering through a
+                          downstream bus, describing the set of slave
+                          ports on the bus to which the device is
+                          connected. The property takes the form of a
+                          list of pairs, where each pair contains a
+                          phandle to the bus node as its first element
+                          and #slave-port-cells cells (for the bus
+                          referred to in the first element) as the
+                          second element.
+
+
+* Example
+
+        my-coherent-bus {
+                compatible = "acme,coherent-bus-9000";
+                #address-cells = <1>;
+                #size-cells = <1>;
+                reg = <0xba5e0000 0x10000>;
+
+                [...]        /* More bus-specific properties */
+
+                /*
+                 * Slave ports on this bus can be identified with a
+                 * single cell.
+                 */
+                #slave-port-cells = <1>;
+
+                /* 1:1 address space mapping with our parent bus. */
+                ranges;
+
+                /*
+                 * These devices all have at least their *slave* interfaces
+                 * on the coherent bus.
+                 */
+                dma0@0xfff00000 {
+                        compatible = "acme,coherent-dma-9000";
+                        reg = <0xfff00000 0x10000>;
+
+                        [...]        /* More dma-specific properties */
+
+                        /*
+                         * The DMA controller can master through two
+                         * ports on the coherent bus, using port
+                         * identifiers '0' and '1'.
+                         */
+                        slave-ports = <&my-coherent-bus 0>,
+                                      <&my-coherent-bus 1>;
+                };
+
+                [...]        /* More devices */
+        };
+
+        /*
+         * A device that can master through the coherent bus, but has its
+         * slave interface elsewhere.
+         */
+        dma1@0xfff80000 {
+                compatible = "acme,coherent-dma-9000";
+                reg = <0xfff80000 0x10000>;
+
+                [...]        /* More dma-specific properties */
+
+                /*
+                 * The DMA controller can master through a single port
+                 * on the coherent bus above, using port identifier '8'.
+                 */
+                slave-ports = <&my-coherent-bus 8>;
+        };
-- 
1.8.2.2

^ permalink raw reply related	[flat|nested] 37+ messages in thread
* Re: [RFC PATCH] Documentation: devicetree: add description for generic bus properties
@ 2013-11-28 16:50 Dave Martin
  0 siblings, 0 replies; 37+ messages in thread
From: Dave Martin @ 2013-11-28 16:50 UTC (permalink / raw)
  To: Will Deacon
  Cc: Greg KH, Mark Rutland,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Stephen Warren, Thierry Reding,
	grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Hiroshi Doyu

On Thu, Nov 28, 2013 at 10:28:45AM +0000, Will Deacon wrote:
> Hi Greg,
> 
> On Wed, Nov 27, 2013 at 11:06:50PM +0000, Greg KH wrote:
> > On Wed, Nov 27, 2013 at 05:28:06PM +0000, Dave Martin wrote:
> > > >From will.deacon-5wv7dgnIgG8@public.gmane.org Wed Nov 20 12:06:22 2013
> > > A number of discussion points remain to be resolved:
> > > 
> > >   - Use of the ranges property and describing slave vs master bus
> > >     address ranges. In the latter case, we actually want to describe our
> > >     address space with respect to the bus on which the bus masters,
> > >     rather than the parent. This could potentially be achieved by adding
> > >     properties such as dma-parent and dma-ranges (already used by PPC?)
> > > 
> > >   - Describing masters that master through multiple different buses
> > > 
> > >   - How on Earth this fits in with the Linux device model (it doesn't)
> > 
> > How does this _not_ fit into the Linux device model?  What am I missing
> > here that precludes the use of the "driver/device/bus" model we have
> > today?

The physical-sockets history of buses like PCI tends to force a simple
tree-like topology as a natural consequence.  You also end up with
closely linked topologies for power, clocks, interrupts etc., because
those all pass through the same sockets, so it's difficult to have a
different structure.

On SoC, those constraints have never existed and are not followed.  A
device's interface to the system is almost always split into multiple
connections, not covered by a single design or standard.  The problem
now is that increasing complexity means that the sometimes bizarre
topology features of SoCs are becoming less and less transparent for
software.

The device model currently seems to assume that certain things (power,
DMA and MMIO accessibility) follow the tree (which may not work for many
SoCs), and some other things (clocks, regulators, interrupts etc.) are
not incorporated at all -- making them independent, but it may make some
abstractions impossible today.

How much this matters for actual systems is hard to foresee yet.  Since
not _all_ possible insanities find their way into silicon.  The
onus should certainly be on us (i.e., the ARM/SoC community) to
demonstrate if the device model needs to change, and to find practical
ways to change it that minimise the resulting churn.

> The main problem is that we have devices which slave on one bus and master
> on another. That then complicates probing, power-management, IOMMU
> configuration, address mapping (e.g. I walk the slave buses to figure out
> where the slave registers live, but then I need a way to work out where
> exactly I master on a different bus) and dynamic coherency, amongst other
> things.
> 
> If we try to use the current infrastructure then we end up with one bus per
> device, which usually ends up being a fake bus representing both the slave
> and master buses (which is how the platform bus gets abused) and then device
> drivers having their own idea of the system topology where it's required.
> 
> This is fairly horrible and doesn't work for anything other than the trivial
> case, where one or both of the buses are `dumb' and don't require any work
> from Linux.

If we can come up with some generic bus type that is just a container for
a load of hooks that know how to deal with various aspects of each device's
interface to the system, on a per-device basis, than may be a start.

The platform bus kinda serves that role, but the trouble with that is that
it doesn't encourage any abstraction at all.  In the face of increasing
complexity, abstraction is desperately needed.

> > >  .../devicetree/bindings/arm/coherent-bus.txt       | 110 +++++++++++++++++++++
> > 
> > Why "arm"?
> > 
> > What makes it ARM specific?
> 
> This is just an RFC, so I'd be happy to put the binding somewhere more
> broad. I'm not sure how much of an issue this is outside of the SoC space,
> though.

I think that the ARM community are the ones who care the most today,
so are likely to make the most noise about it.

The binding is entirely generic in concept, so we should certainly
push for it to be non-ARM-specific.  Non-ARM SoCs will likely need
to solve this problem too at some point.

Cheers
---Dave
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2013-12-04 20:27 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-27 17:28 [RFC PATCH] Documentation: devicetree: add description for generic bus properties Dave Martin
     [not found] ` <20131127172806.GC2291-M5GwZQ6tE7x5pKCnmE3YQBJ8xKzm50AiAL8bYrjMMd8@public.gmane.org>
2013-11-27 23:06   ` Greg KH
2013-11-28 10:28     ` Will Deacon
2013-11-28 17:33       ` Dave Martin
     [not found]         ` <20131128173339.GB4634-M5GwZQ6tE7x5pKCnmE3YQBJ8xKzm50AiAL8bYrjMMd8@public.gmane.org>
2013-11-28 19:13           ` Greg KH
2013-11-28 19:39             ` Dave Martin
     [not found]               ` <20131128193917.GC4634-M5GwZQ6tE7x5pKCnmE3YQBJ8xKzm50AiAL8bYrjMMd8@public.gmane.org>
2013-11-28 21:25                 ` Greg KH
2013-11-29 11:44                   ` Will Deacon
     [not found]                     ` <20131129114453.GC21336-MRww78TxoiP5vMa5CHWGZ34zcgK1vI+I0E9HWUfgJXw@public.gmane.org>
2013-11-29 17:37                       ` Greg KH
2013-11-29 18:01                         ` Will Deacon
     [not found]                           ` <20131129180110.GJ31000-MRww78TxoiP5vMa5CHWGZ34zcgK1vI+I0E9HWUfgJXw@public.gmane.org>
2013-11-29 18:11                             ` Greg KH
2013-11-29 18:15                               ` Will Deacon
     [not found]       ` <20131128102845.GB21354-MRww78TxoiP5vMa5CHWGZ34zcgK1vI+I0E9HWUfgJXw@public.gmane.org>
2013-11-28 19:10         ` Greg KH
2013-11-28 20:33   ` Thierry Reding
2013-11-28 21:10     ` Jason Gunthorpe
     [not found]       ` <20131128211009.GA26447-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2013-11-28 22:22         ` Thierry Reding
2013-11-28 23:31           ` Jason Gunthorpe
     [not found]             ` <20131128233147.GA19387-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2013-11-29  2:35               ` Greg KH
     [not found]                 ` <20131129023554.GA14239-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2013-11-29  9:37                   ` Thierry Reding
     [not found]                     ` <20131129093713.GC22771-AwZRO8vwLAwmlAP/+Wk3EA@public.gmane.org>
2013-11-29  9:57                       ` Russell King - ARM Linux
     [not found]                         ` <20131129095703.GV16735-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2013-11-29 10:43                           ` Thierry Reding
2013-11-29 13:13                         ` Dave Martin
     [not found]                           ` <20131129131359.GH4634-M5GwZQ6tE7x5pKCnmE3YQBJ8xKzm50AiAL8bYrjMMd8@public.gmane.org>
2013-11-29 13:29                             ` Russell King - ARM Linux
2013-11-29 17:43                             ` Greg KH
2013-11-29 17:42                       ` Greg KH
     [not found]                         ` <20131129174223.GB5635-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2013-11-29 19:45                           ` Thierry Reding
2013-12-04 18:43                   ` Mark Brown
     [not found]                     ` <20131204184345.GA29268-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2013-12-04 19:03                       ` Greg KH
     [not found]                         ` <20131204190312.GA5070-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2013-12-04 20:27                           ` Mark Brown
2013-11-29  9:57               ` Thierry Reding
2013-11-29 14:13                 ` Dave Martin
2013-11-29 11:58             ` Dave Martin
     [not found]               ` <20131129115815.GC3136-M5GwZQ6tE7x5pKCnmE3YQBJ8xKzm50AiAL8bYrjMMd8@public.gmane.org>
2013-11-29 18:43                 ` Jason Gunthorpe
2013-12-02 20:25                   ` Dave Martin
     [not found]                     ` <20131202202543.GC2312-M5GwZQ6tE7x5pKCnmE3YQBJ8xKzm50AiAL8bYrjMMd8@public.gmane.org>
2013-12-03  0:07                       ` Jason Gunthorpe
2013-12-03 11:45                         ` Dave Martin
  -- strict thread matches above, loose matches on Subject: below --
2013-11-28 16:50 Dave Martin

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).