All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joerg Roedel <jroedel-l3A5Bk7waGM@public.gmane.org>
To: Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	"iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org"
	<iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH 04/12] iommu/arm-smmu: Convert to iommu_capable() API function
Date: Tue, 9 Sep 2014 15:57:10 +0200	[thread overview]
Message-ID: <20140909135710.GE2519@suse.de> (raw)
In-Reply-To: <20140908165136.GW26030-5wv7dgnIgG8@public.gmane.org>

Hi Will,

On Mon, Sep 08, 2014 at 05:51:36PM +0100, Will Deacon wrote:
> On Fri, Sep 05, 2014 at 11:52:56AM +0100, Joerg Roedel wrote:
> >  	switch (cap) {
> >  	case IOMMU_CAP_CACHE_COHERENCY:
> > -		return features & ARM_SMMU_FEAT_COHERENT_WALK;
> > +		/*
> > +		 * Use ARM_SMMU_FEAT_COHERENT_WALK as an indicator on whether
> > +		 * the SMMU can force coherency on the DMA transaction. If it
> > +		 * supports COHERENT_WALK it must be behind a coherent
> > +		 * interconnect.
> > +		 * A domain can be attached to any SMMU, so to reliably support
> > +		 * IOMMU_CAP_CACHE_COHERENCY all SMMUs in the system need to be
> > +		 * behind a coherent interconnect.
> > +		 */
> 
> I don't think we should rely on the SMMU's advertisement of the coherent
> table walk to mean anything other than `the SMMU can emit cacheable page
> table walks'. The actual walker is a separate observer, and could have a
> different route to memory than transactions flowing through the SMMU.

Okay, so this should be advertised via DT then.

> In reality, all we can report here is what the SMMU (as opposed to the rest
> of the system) is capable of. The SMMU can always emit cacheable
> transactions for a master if a stage-1 translation is in use so, without
> extending the device-tree binding, we should report true here
> unconditionally.

Sounds more like we should return false here unconditionally until we
have a reliable way to tell whether this feature is available, no? When
we return true the user of the IOMMU-API might rely on coherency that is
not available.

> An alternative is to extend the device-tree bindings to have something like
> "dma-coherent" for the SMMU node, which would imply that the interconnect is
> configured to honour snoops from the SMMU into the CPU caches. We might want
> an additional property on top of that to indicate that the table walker is
> also coherent (and we could check this against our ARM_SMMU_FEAT_COHERENT_WALK
> flag)

Sounds like a good idea, as long as there is no other way to detect
this.


	Joerg

WARNING: multiple messages have this Message-ID (diff)
From: Joerg Roedel <jroedel@suse.de>
To: Will Deacon <will.deacon@arm.com>
Cc: Joerg Roedel <joro@8bytes.org>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	devicetree@vger.kernel.org
Subject: Re: [PATCH 04/12] iommu/arm-smmu: Convert to iommu_capable() API function
Date: Tue, 9 Sep 2014 15:57:10 +0200	[thread overview]
Message-ID: <20140909135710.GE2519@suse.de> (raw)
In-Reply-To: <20140908165136.GW26030@arm.com>

Hi Will,

On Mon, Sep 08, 2014 at 05:51:36PM +0100, Will Deacon wrote:
> On Fri, Sep 05, 2014 at 11:52:56AM +0100, Joerg Roedel wrote:
> >  	switch (cap) {
> >  	case IOMMU_CAP_CACHE_COHERENCY:
> > -		return features & ARM_SMMU_FEAT_COHERENT_WALK;
> > +		/*
> > +		 * Use ARM_SMMU_FEAT_COHERENT_WALK as an indicator on whether
> > +		 * the SMMU can force coherency on the DMA transaction. If it
> > +		 * supports COHERENT_WALK it must be behind a coherent
> > +		 * interconnect.
> > +		 * A domain can be attached to any SMMU, so to reliably support
> > +		 * IOMMU_CAP_CACHE_COHERENCY all SMMUs in the system need to be
> > +		 * behind a coherent interconnect.
> > +		 */
> 
> I don't think we should rely on the SMMU's advertisement of the coherent
> table walk to mean anything other than `the SMMU can emit cacheable page
> table walks'. The actual walker is a separate observer, and could have a
> different route to memory than transactions flowing through the SMMU.

Okay, so this should be advertised via DT then.

> In reality, all we can report here is what the SMMU (as opposed to the rest
> of the system) is capable of. The SMMU can always emit cacheable
> transactions for a master if a stage-1 translation is in use so, without
> extending the device-tree binding, we should report true here
> unconditionally.

Sounds more like we should return false here unconditionally until we
have a reliable way to tell whether this feature is available, no? When
we return true the user of the IOMMU-API might rely on coherency that is
not available.

> An alternative is to extend the device-tree bindings to have something like
> "dma-coherent" for the SMMU node, which would imply that the interconnect is
> configured to honour snoops from the SMMU into the CPU caches. We might want
> an additional property on top of that to indicate that the table walker is
> also coherent (and we could check this against our ARM_SMMU_FEAT_COHERENT_WALK
> flag)

Sounds like a good idea, as long as there is no other way to detect
this.


	Joerg


  parent reply	other threads:[~2014-09-09 13:57 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-05 10:52 [PATCH 00/12] iommu: Convert iommu_domain_has_cap() to iommu_capable() Joerg Roedel
2014-09-05 10:52 ` Joerg Roedel
     [not found] ` <1409914384-21191-1-git-send-email-joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2014-09-05 10:52   ` [PATCH 01/12] iommu: Introduce iommu_capable API function Joerg Roedel
2014-09-05 10:52     ` Joerg Roedel
2014-09-05 10:52   ` [PATCH 02/12] iommu: Convert iommu-caps from define to enum Joerg Roedel
2014-09-05 10:52     ` Joerg Roedel
2014-09-05 10:52   ` [PATCH 03/12] iommu/amd: Convert to iommu_capable() API function Joerg Roedel
2014-09-05 10:52     ` Joerg Roedel
2014-09-05 10:52   ` [PATCH 04/12] iommu/arm-smmu: " Joerg Roedel
2014-09-05 10:52     ` Joerg Roedel
     [not found]     ` <1409914384-21191-5-git-send-email-joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2014-09-08 16:51       ` Will Deacon
2014-09-08 16:51         ` Will Deacon
     [not found]         ` <20140908165136.GW26030-5wv7dgnIgG8@public.gmane.org>
2014-09-09 13:57           ` Joerg Roedel [this message]
2014-09-09 13:57             ` Joerg Roedel
2014-09-17  8:53           ` [PATCH 04/13 v2] iommu/arm-smmu: Convert to iommu_capable() API function function Joerg Roedel
2014-09-17  8:53             ` Joerg Roedel
     [not found]             ` <20140917085312.GE2533-l3A5Bk7waGM@public.gmane.org>
2014-09-19 16:42               ` Will Deacon
2014-09-19 16:42                 ` Will Deacon
     [not found]                 ` <20140919164220.GI20773-5wv7dgnIgG8@public.gmane.org>
2014-09-22 15:36                   ` Joerg Roedel
2014-09-22 15:36                     ` Joerg Roedel
2014-09-05 10:52   ` [PATCH 05/12] iommu/fsl: Convert to iommu_capable() API function Joerg Roedel
2014-09-05 10:52     ` Joerg Roedel
2014-09-09 18:38     ` Varun Sethi
2014-09-05 10:52   ` [PATCH 06/12] iommu/vt-d: " Joerg Roedel
2014-09-05 10:52     ` Joerg Roedel
2014-09-05 10:52   ` [PATCH 07/12] iommu/msm: " Joerg Roedel
2014-09-05 10:52     ` Joerg Roedel
2014-09-05 10:53   ` [PATCH 08/12] iommu/tegra: " Joerg Roedel
2014-09-05 10:53     ` Joerg Roedel
2014-09-05 10:53   ` [PATCH 09/12] kvm: iommu: Convert to use new " Joerg Roedel
2014-09-05 10:53     ` Joerg Roedel
     [not found]     ` <1409914384-21191-10-git-send-email-joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2014-09-17  8:29       ` Joerg Roedel
2014-09-17  8:29         ` Joerg Roedel
2014-09-05 10:53   ` [PATCH 10/12] vfio: " Joerg Roedel
2014-09-05 10:53     ` Joerg Roedel
     [not found]     ` <1409914384-21191-11-git-send-email-joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2014-09-08 23:14       ` Alex Williamson
2014-09-08 23:14         ` Alex Williamson
2014-09-05 10:53   ` [PATCH 11/12] IB/usnic: " Joerg Roedel
2014-09-05 10:53     ` Joerg Roedel
     [not found]     ` <1409914384-21191-12-git-send-email-joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2014-09-17  8:30       ` Joerg Roedel
2014-09-17  8:30         ` Joerg Roedel
2014-09-05 10:53   ` [PATCH 12/12] iommu: Remove iommu_domain_has_cap() " Joerg Roedel
2014-09-05 10:53     ` Joerg Roedel

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=20140909135710.GE2519@suse.de \
    --to=jroedel-l3a5bk7wagm@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@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.