All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hiroshi Doyu <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
To: Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>,
	Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cc: Mark Rutland <Mark.Rutland-5wv7dgnIgG8@public.gmane.org>,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	"iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org"
	<iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
	Thierry Reding
	<thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
Subject: Re: [PATCH v5] devicetree: Add generic IOMMU device tree bindings
Date: Fri, 15 Aug 2014 15:29:41 +0300	[thread overview]
Message-ID: <87tx5ehr62.fsf@nvidia.com> (raw)
In-Reply-To: <20140815115110.GO27466-5wv7dgnIgG8@public.gmane.org>


Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org> writes:

> On Thu, Aug 14, 2014 at 07:47:42AM +0100, Hiroshi Doyu wrote:
>> Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>> 
>> > +Multiple-master IOMMU:
>> > +----------------------
>> > +
>> > +       iommu {
>> > +               /* the specifier represents the ID of the master */
>> > +               #iommu-cells = <1>;
>> > +       };
>> > +
>> > +       master@1 {
>> > +               /* device has master ID 42 in the IOMMU */
>> > +               iommus = <&{/iommu} 42>;
>> > +       };
>> > +
>> > +       master@2 {
>> > +               /* device has master IDs 23 and 24 in the IOMMU */
>> > +               iommus = <&{/iommu} 23>, <&{/iommu} 24>;
>> > +       };
>> 
>> I think that this "master ID" will be parsed in IOMMU driver. For
>> example, ARM,SMMU expects "streamID" as "master ID", right?
>> 
>> If a SoC has a feature to configure to assign streamID to devices at
>> runtime, "streamID" is not equal to "master ID".
>> 
>>   iommus = <&{/smmu} "soc specific master ID">;
>> 
>> "soc master ID" needs to be translated into "streamID" by SoC SW. It
>> seems that ARM,SMMU kernel driver doesn't expect this kind of ID
>> translation. If ARM,SMMU kernel driver is used as is, "soc master ID"
>> would be incompatible? ARM,SMMU needs such translation before
>> parsing. Is this my understanding right?
>> 
>> If so I think that this master ID configuration/translation may be quite
>> reasonable requirment for SoC using ARM,SMMU.
>> 
>> Can we consider this ID translation within ARM,SMMU compatibility?
>> 
>> IOW, is it possible to implement some SoC specific hook for ID
>> translation/configuration in ARM,SMMU kernel driver?
>
> I think there's some confusion here. The ARM architected SMMU does not
> perform any StreamID translation -- it sees an incoming ID and uses that to
> lookup a set of translation tables. However, for hotpluggable buses (e.g.
> PCI), we need a way to communicate the StreamIDs for a newly discovered
> device to the SMMU. I expect that this would be described as a translation
> from another ID (e.g. requester id for PCI), so *that* is where the
> translation occurs.
>
> This translation can be described as a simple base + offset calculation,
> e.g. StreamID = RequesterID + offset. Ideally, you'd have one offset per
> host controller (and described in the host controller DT node), but you
> could also imagine building tables where each RequesterID maps to a
> different StreamID.
>
> The final thing to mention is that some SoCs may have device hotplug
> architectures that aren't like PCIe, so we may well need glue code there to
> `allocate' StreamIDs from a fixed portion of the numberspace.

Ok, I can assume that, when parsing generic IOMMU binding, SoC specific
callback could be called from ARM,SMMU driver to assign allocated
"StreamIDs" to thier "RequesterIDs".

IOW, IOMMU generic binding for ARM,SMMU can have RequresterID instead of
StreamID.

  Not:
  	iommus = <&{/arm-smmu} "StreamID">;
  
  Instead, can be:
  	iommus = <&{/arm-smmu} "RequresterID">;

If I extend the above, even ARM,SMMU driver could have any number of
params, which SoC requires with keeping "arm,mmu-*" compatibility?

  	iommus = <&{/arm-msmmu} param1 param2 param3 param4 .....>;

How to parse params depends on SoC. Parsing params is done at SoC
callback, right?

> We don't need to solve all of these problems in one go, but the base +
> offset code will certainly be useful; not just for the SMMU but also for
> the GIC (where we have DeviceIDs). Mark Rutland is looking at this.

Any pointer would be really appreciated.

WARNING: multiple messages have this Message-ID (diff)
From: hdoyu@nvidia.com (Hiroshi Doyu)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v5] devicetree: Add generic IOMMU device tree bindings
Date: Fri, 15 Aug 2014 15:29:41 +0300	[thread overview]
Message-ID: <87tx5ehr62.fsf@nvidia.com> (raw)
In-Reply-To: <20140815115110.GO27466@arm.com>


Will Deacon <will.deacon@arm.com> writes:

> On Thu, Aug 14, 2014 at 07:47:42AM +0100, Hiroshi Doyu wrote:
>> Thierry Reding <thierry.reding@gmail.com> writes:
>> 
>> > +Multiple-master IOMMU:
>> > +----------------------
>> > +
>> > +       iommu {
>> > +               /* the specifier represents the ID of the master */
>> > +               #iommu-cells = <1>;
>> > +       };
>> > +
>> > +       master at 1 {
>> > +               /* device has master ID 42 in the IOMMU */
>> > +               iommus = <&{/iommu} 42>;
>> > +       };
>> > +
>> > +       master at 2 {
>> > +               /* device has master IDs 23 and 24 in the IOMMU */
>> > +               iommus = <&{/iommu} 23>, <&{/iommu} 24>;
>> > +       };
>> 
>> I think that this "master ID" will be parsed in IOMMU driver. For
>> example, ARM,SMMU expects "streamID" as "master ID", right?
>> 
>> If a SoC has a feature to configure to assign streamID to devices at
>> runtime, "streamID" is not equal to "master ID".
>> 
>>   iommus = <&{/smmu} "soc specific master ID">;
>> 
>> "soc master ID" needs to be translated into "streamID" by SoC SW. It
>> seems that ARM,SMMU kernel driver doesn't expect this kind of ID
>> translation. If ARM,SMMU kernel driver is used as is, "soc master ID"
>> would be incompatible? ARM,SMMU needs such translation before
>> parsing. Is this my understanding right?
>> 
>> If so I think that this master ID configuration/translation may be quite
>> reasonable requirment for SoC using ARM,SMMU.
>> 
>> Can we consider this ID translation within ARM,SMMU compatibility?
>> 
>> IOW, is it possible to implement some SoC specific hook for ID
>> translation/configuration in ARM,SMMU kernel driver?
>
> I think there's some confusion here. The ARM architected SMMU does not
> perform any StreamID translation -- it sees an incoming ID and uses that to
> lookup a set of translation tables. However, for hotpluggable buses (e.g.
> PCI), we need a way to communicate the StreamIDs for a newly discovered
> device to the SMMU. I expect that this would be described as a translation
> from another ID (e.g. requester id for PCI), so *that* is where the
> translation occurs.
>
> This translation can be described as a simple base + offset calculation,
> e.g. StreamID = RequesterID + offset. Ideally, you'd have one offset per
> host controller (and described in the host controller DT node), but you
> could also imagine building tables where each RequesterID maps to a
> different StreamID.
>
> The final thing to mention is that some SoCs may have device hotplug
> architectures that aren't like PCIe, so we may well need glue code there to
> `allocate' StreamIDs from a fixed portion of the numberspace.

Ok, I can assume that, when parsing generic IOMMU binding, SoC specific
callback could be called from ARM,SMMU driver to assign allocated
"StreamIDs" to thier "RequesterIDs".

IOW, IOMMU generic binding for ARM,SMMU can have RequresterID instead of
StreamID.

  Not:
  	iommus = <&{/arm-smmu} "StreamID">;
  
  Instead, can be:
  	iommus = <&{/arm-smmu} "RequresterID">;

If I extend the above, even ARM,SMMU driver could have any number of
params, which SoC requires with keeping "arm,mmu-*" compatibility?

  	iommus = <&{/arm-msmmu} param1 param2 param3 param4 .....>;

How to parse params depends on SoC. Parsing params is done at SoC
callback, right?

> We don't need to solve all of these problems in one go, but the base +
> offset code will certainly be useful; not just for the SMMU but also for
> the GIC (where we have DeviceIDs). Mark Rutland is looking at this.

Any pointer would be really appreciated.

  parent reply	other threads:[~2014-08-15 12:29 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-31 10:43 [PATCH v5] devicetree: Add generic IOMMU device tree bindings Thierry Reding
2014-07-31 10:43 ` Thierry Reding
2014-07-31 18:09 ` Laurent Pinchart
2014-07-31 18:09   ` Laurent Pinchart
     [not found] ` <1406803383-11601-1-git-send-email-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-07-31 10:54   ` Mark Rutland
2014-07-31 10:54     ` Mark Rutland
2014-07-31 12:04   ` Joerg Roedel
2014-07-31 12:04     ` Joerg Roedel
     [not found]     ` <20140731120424.GK9809-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2014-07-31 15:38       ` Olof Johansson
2014-07-31 15:38         ` Olof Johansson
     [not found]         ` <CAOesGMiS_MJNnkfPOsqxV27=rXPgT9UNbp-+VhpMRNf9u0+-eA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-07-31 16:36           ` Joerg Roedel
2014-07-31 16:36             ` Joerg Roedel
     [not found]             ` <20140731163611.GM9809-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2014-07-31 17:14               ` Olof Johansson
2014-07-31 17:14                 ` Olof Johansson
     [not found]                 ` <CAOesGMjovbqn86Q97_SCgsC4jeZf1M_gTKk-Twjr_=6rvnXTCg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-07-31 17:23                   ` Joerg Roedel
2014-07-31 17:23                     ` Joerg Roedel
2014-08-14  6:47   ` Hiroshi Doyu
2014-08-14  6:47     ` Hiroshi Doyu
     [not found]     ` <87a9774lf5.fsf-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2014-08-14 14:45       ` Varun Sethi
2014-08-14 14:45         ` Varun Sethi
     [not found]         ` <cfb1d2ff66004685b7ead3f5e6321681-AZ66ij2kwaacCcN9WK45f+O6mTEJWrR4XA4E9RH9d+qIuWR1G4zioA@public.gmane.org>
2014-08-14 16:04           ` Hiroshi Doyu
2014-08-14 16:04             ` Hiroshi Doyu
     [not found]             ` <87y4ur2h23.fsf-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2014-08-19  9:52               ` Varun Sethi
2014-08-19  9:52                 ` Varun Sethi
     [not found]                 ` <d9fb045d54244f26a773ba45ad3caa2d-AZ66ij2kwaacCcN9WK45f+O6mTEJWrR4XA4E9RH9d+qIuWR1G4zioA@public.gmane.org>
2014-08-19 10:03                   ` Hiroshi Doyu
2014-08-19 10:03                     ` Hiroshi Doyu
     [not found]                     ` <87zjf0hk3b.fsf-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2014-08-19 10:47                       ` Varun Sethi
2014-08-19 10:47                         ` Varun Sethi
     [not found]                         ` <a0244b6befa9407fb6c2c35cc29f92f7-AZ66ij2kwaacCcN9WK45f+O6mTEJWrR4XA4E9RH9d+qIuWR1G4zioA@public.gmane.org>
2014-08-19 11:03                           ` Hiroshi Doyu
2014-08-19 11:03                             ` Hiroshi Doyu
     [not found]                             ` <87wqa4hhcr.fsf-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2014-08-19 12:01                               ` Varun Sethi
2014-08-19 12:01                                 ` Varun Sethi
2014-08-15 11:51       ` Will Deacon
2014-08-15 11:51         ` Will Deacon
     [not found]         ` <20140815115110.GO27466-5wv7dgnIgG8@public.gmane.org>
2014-08-15 12:29           ` Hiroshi Doyu [this message]
2014-08-15 12:29             ` Hiroshi Doyu
     [not found]             ` <87tx5ehr62.fsf-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2014-08-15 13:14               ` Will Deacon
2014-08-15 13:14                 ` Will Deacon
2014-08-19 12:11           ` Varun Sethi
2014-08-19 12:11             ` Varun Sethi
     [not found]             ` <6a3d4048ddb84bd19c847adf7f02fc52-AZ66ij2kwaacCcN9WK45f+O6mTEJWrR4XA4E9RH9d+qIuWR1G4zioA@public.gmane.org>
2014-08-22 15:33               ` Will Deacon
2014-08-22 15:33                 ` Will Deacon

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=87tx5ehr62.fsf@nvidia.com \
    --to=hdoyu-ddmlm1+adcrqt0dzr+alfa@public.gmane.org \
    --cc=Mark.Rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=arnd-r2nGTMty4D4@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=will.deacon-5wv7dgnIgG8@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 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.