devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Cc: Dave Martin <Dave.Martin-5wv7dgnIgG8@public.gmane.org>,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Mark Rutland <Mark.Rutland-5wv7dgnIgG8@public.gmane.org>,
	Shaik Ameer Basha
	<shaik.ameer-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>,
	Grant Grundler <grundler-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
	Will Deacon <Will.Deacon-5wv7dgnIgG8@public.gmane.org>,
	Jason Gunthorpe
	<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>,
	Marc Zyngier <Marc.Zyngier-5wv7dgnIgG8@public.gmane.org>,
	Thierry Reding
	<thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Hiroshi Doyu <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Subject: Re: [RFC] Describing arbitrary bus mastering relationships in DT
Date: Fri, 02 May 2014 18:14:58 +0200	[thread overview]
Message-ID: <6774053.rAccqTeoiQ@wuerfel> (raw)
In-Reply-To: <20140501173248.GD3732-M5GwZQ6tE7x5pKCnmE3YQBJ8xKzm50AiAL8bYrjMMd8@public.gmane.org>

On Thursday 01 May 2014 18:32:48 Dave Martin wrote:
> (Note, this is a long mail -- people in a hurry may want to skip to
> "Outline binding" to get a feel for what is bring proposed, before
> returning to the background wording.)
> 
> As highlighted in some previous discussions[1], it is becoming possible
> to build ARM-based SoCs that seem to be impossible to describe using the
> DT bindings currently specified by ePAPR.  This is driven by increasing
> complexity of interconnects, the appearance of IOMMUs, MSI-capable
> interrupt controllers and multiple bus masters.
> 
> This issue is not fundamental to ARM and could apply to other SoC
> families with a similar bus architecture, but most of the current
> discussion in this area has been about how to address these
> requirements for ARM SoCs.
> 
> This RFC is an outline for some core bindings to solve part of the
> problem of describing such systems, particularly how to describe master/
> slave relationships not currently representable in DT.  It is premature
> to make a concrete proposal yet: rather I'm presenting this as a starting
> point for discussion initially.
> 
> The intent is not to rewrite existing bindings, but to define a common
> DT approach for describing otherwise problematic features of future
> systems.  Actual Linux support for this could be implemented as needed.

Thanks a lot for getting this rolling!


> ** Outline binding **
> 
> generic device node property: "slaves"
> 
> 	optional
> 
> 	type : cell array consisting of one or more phandles
> 
> 	Implies that the device represented by the containing node
> 	can issue transactions to the referenced node.
> 
> 	The referenced node is any bus or device node, and is
> 	interpreted in the usual way, including the treatment
> 	of ranges, #address-cells and #size-cells.  If the
> 	referenced node has a non-empty ranges property, the
> 	referencing node's #address-cells must be the same as
> 	that of the referenced node's device tree parent.

I guess you mean "dma-ranges" here, not "ranges", right?
I don't see how "ranges" is even relevant for this.

Don't you need arguments to the phandle? It seems that in most
cases, you need at least one of a dma-ranges like translation
or a master ID. What you need would be specific to the slave.

It may be best to make the ranges explicit here and then also
allow additional fields depending on e.g. a #dma-slave-cells
property in the slave.

For instance, a 32-bit master on a a 64-bit bus that has master-id
23 would look like

	otherbus: axi@somewhere{
		#address-cells = <2>;
		#size-cells = <2>;
	};

	somemaster@somewhere {
		#address-cells = <1>;
		#size-cells = <1>;
		slaves = <&otherbus  // phandle
				0     // local address
				0 0   // remote address
				0x1 0 // size
				23>;  // master id
	};

> Questions:
> 
> 1) Should the names "slaves" and "slave" be globally generic?
> 
>    Pro: Making them generic permits some processing to be done on the DT
>    without knowing the individual bindings for every node, such as
>    figuring out the global DMA mask.  It should also encourage adoption
>    of the bindings as a common approach.
> 
>    Con: Namespace pollution
> 
>    Otherwise, there could be a special string in the node's compatible
>    list (strictly not "simple-bus") to indicate that these properties
>    should be interpreted.
> 
>    The alternative is for the way of identifying a node's slaves to be
>    binding-specific.  This makes some generic operations on the DT
>    impossible without knowing all the bindings, such as analysing
>    reachability or determining the effective DMA mask.  This analysis
>    can be performed using generic bindings alone today, for systems
>    describable by ePAPR.  Breaking this concept feels like a backward
>    step.

How about being slightly more specific, using "dma-slaves" and
"dma-slave-names" etc?

> 2) The generic "slave" node(s) are for convenience and readability.
>    They could be made eliminated by using child nodes with
>    binding-specific names and referencing them in "slaves".  This is a
>    bit more awkward, but has the same expressive power.
> 
>    Should the generic "slave" nodes go away?

I would prefer not having to have subnodes for the simple case
where you just need to reference one slave iommu from a master
device.

It could be a recommendation for devices that have multiple slaves,
but I still haven't seen an example where this is actually needed.

> 3) Should "slave" or "slaves" be traversable for bridge- or bus-like
>    nodes?
> 
>    Saying "no" to this makes it impossible for the reachability graph of
>    the DT to contain cycles.  This is a clear benefit for any software
>    attempting to parse the DT in a robust way.  Only the first link,
>    from the initiating master to the first bridge, would be permitted
>    to be a "slaves" link.
> 
>    Ideally, we would want an IOMMU's bridge-like role to be represented
>    by some deep node in the DT: it can't usually be on the global path
>    from / since CPUs typically don't master through the IOMMU.
> 
>    Parsers could be made robust while still permitting this, by
>    truncating the search if the initial master node is reached.
>    Ill-formed DTs could contains cycles that can't be resolved in
>    this way, e.g., A -> B -> B.  For now it might be reasonable to
>    check for this in dtc.

I wouldn't be worried about cycles. We can just declare them forbidden
in the binding. Anything can break if you supply a broken DT, this
is the least of the problems.

	Arnd
--
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

  parent reply	other threads:[~2014-05-02 16:14 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-01 17:32 [RFC] Describing arbitrary bus mastering relationships in DT Dave Martin
     [not found] ` <20140501173248.GD3732-M5GwZQ6tE7x5pKCnmE3YQBJ8xKzm50AiAL8bYrjMMd8@public.gmane.org>
2014-05-02 11:05   ` Thierry Reding
2014-05-02 12:32     ` Arnd Bergmann
2014-05-02 13:23       ` Thierry Reding
2014-05-02 15:19         ` Arnd Bergmann
2014-05-02 17:43           ` Dave Martin
     [not found]             ` <20140502174301.GE3805-M5GwZQ6tE7x5pKCnmE3YQBJ8xKzm50AiAL8bYrjMMd8@public.gmane.org>
2014-05-05 15:14               ` Arnd Bergmann
2014-05-09 10:33                 ` Dave Martin
     [not found]                   ` <20140509103309.GA3875-M5GwZQ6tE7x5pKCnmE3YQBJ8xKzm50AiAL8bYrjMMd8@public.gmane.org>
2014-05-09 11:15                     ` Arnd Bergmann
2014-05-09 14:59                     ` Grant Grundler
2014-05-02 18:55           ` Stephen Warren
     [not found]             ` <5363EA31.3000509-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2014-05-02 19:02               ` Arnd Bergmann
2014-05-09 10:45                 ` Dave Martin
2014-05-02 18:50         ` Stephen Warren
     [not found]           ` <5363E8E9.6000908-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2014-05-02 19:06             ` Arnd Bergmann
2014-05-09 10:56               ` Dave Martin
     [not found]                 ` <20140509105638.GB3921-M5GwZQ6tE7x5pKCnmE3YQBJ8xKzm50AiAL8bYrjMMd8@public.gmane.org>
2014-05-12 16:19                   ` Stephen Warren
     [not found]                     ` <5370F484.9030209-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2014-05-12 18:10                       ` Arnd Bergmann
2014-05-12 18:29                         ` Stephen Warren
     [not found]                           ` <537112FC.1040204-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2014-05-12 19:53                             ` Arnd Bergmann
2014-05-12 20:02                             ` Grant Grundler
2014-05-02 16:19     ` Dave Martin
2014-05-02 16:14   ` Arnd Bergmann [this message]
2014-05-02 17:31     ` Dave Martin
     [not found]       ` <20140502173120.GD3805-M5GwZQ6tE7x5pKCnmE3YQBJ8xKzm50AiAL8bYrjMMd8@public.gmane.org>
2014-05-02 18:17         ` Jason Gunthorpe
     [not found]           ` <20140502181750.GD3179-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2014-05-09 14:16             ` Dave Martin
     [not found]               ` <20140509141633.GD3921-M5GwZQ6tE7x5pKCnmE3YQBJ8xKzm50AiAL8bYrjMMd8@public.gmane.org>
2014-05-09 17:10                 ` Jason Gunthorpe
2014-05-02 20:36         ` Arnd Bergmann
2014-05-09 13:26           ` Dave Martin

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=6774053.rAccqTeoiQ@wuerfel \
    --to=arnd-r2ngtmty4d4@public.gmane.org \
    --cc=Dave.Martin-5wv7dgnIgG8@public.gmane.org \
    --cc=Marc.Zyngier-5wv7dgnIgG8@public.gmane.org \
    --cc=Mark.Rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=Will.Deacon-5wv7dgnIgG8@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=grundler-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=shaik.ameer-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
    --cc=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@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).