Linux IOMMU Development
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>
To: Alex Williamson
	<alex.williamson-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: "iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org"
	<iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
	"tech-lrHrjnjw1UfHK3s98zE1ajGjJy/sRE9J@public.gmane.org"
	<tech-lrHrjnjw1UfHK3s98zE1ajGjJy/sRE9J@public.gmane.org>,
	"kvmarm-FPEHb7Xf0XXUo1n7N8X6UoWGPAHP3yOg@public.gmane.org"
	<kvmarm-FPEHb7Xf0XXUo1n7N8X6UoWGPAHP3yOg@public.gmane.org>,
	Eric Auger <eric.auger-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Subject: Re: [PATCH v5 0/4] vfio: type1: support for ARM SMMUS with VFIO_IOMMU_TYPE1
Date: Thu, 5 Mar 2015 18:09:21 +0000	[thread overview]
Message-ID: <20150305180921.GD8163@arm.com> (raw)
In-Reply-To: <1425578066.5200.331.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

On Thu, Mar 05, 2015 at 05:54:26PM +0000, Alex Williamson wrote:
> On Thu, 2015-03-05 at 18:34 +0100, Eric Auger wrote:
> > Ironically, since the correction of the IOMMU_CAP_CACHE_COHERENCY bug
> > (https://lkml.org/lkml/2015/1/29/514) in vfio_iommu_type1.c, my Calxeda
> > Midway VFIO use case is not working anymore. This is also observable
> > when I do not apply at all the whole [PATCH v5 0/4] vfio: type1: support
> > for ARM SMMUS with VFIO_IOMMU_TYPE1 series.
> > 
> > My understanding is this series should not be requested for me since my
> > xgmac device does not care about the XN attribute.
> > 
> > My understanding is that without the bug or the series, the IOMMU_CACHE
> > flag is set whereas before it was not. Patching vfio_iommu_type1.c
> > vfio_iommu_type1_attach_group and unsetting IOMMU_CAP_CACHE_COHERENCY
> > makes the use case functional again.
> > 
> > I do not understand the exact semantic of IOMMU_CAP_CACHE_COHERENCY. I
> > see the arm smmu always returns true, and if my understanding is correct
> > the vfio_iommu_type1 sets the IOMMU_CACHE attribute which eventually
> > make the ARM SMMU sets the memory attribute to cacheable in the PTE. But
> > naively I would say the interco used in Midway may not be cache coherent
> > capability (ARM ACE, ACE-lite), hence the issue.
> > 
> > Please could you share your knowledge/understanding about this topic.
> > Adding Will in to ;-)
> 
> This patch series should change nothing about how the IOMMU_CACHE
> mapping flag is used, it was a bug in the enum to bitmap translation
> that broke/fixed your use case.  VFIO type1 IOMMU always uses
> IOMMU_CACHE when available.  On x86 the effect is that DMA is coherent
> with the processor cache (ie. the PCIe NoSnoop attribute is ignored).
> This means that KVM can continue to ignore certain cache operations,
> like writeback-invalidate (WBINVD), that would otherwise need to be
> emulated.  We may need a separate flag and capability if ARM SMMU is
> doing something different with the flag.  Thanks,

On ARM, coherency isn't really a property of the SMMU. Sure, the SMMU can
emit cacheable transactions (which is what the capability basically means),
but whether or not they snoop the CPU caches depends on the system
configuration. I'd expect the "dma-coherent" property of the *master* to
indicate whether that is the case.

Will

  parent reply	other threads:[~2015-03-05 18:09 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-04 16:07 [PATCH v5 0/4] vfio: type1: support for ARM SMMUS with VFIO_IOMMU_TYPE1 Baptiste Reynal
2015-03-04 16:07 ` [PATCH v5 1/4] vfio: implement iommu driver capabilities with an enum Baptiste Reynal
2015-03-04 16:07 ` [PATCH v5 3/4] vfio: type1: replace vfio_domains_have_iommu_cache with generic function Baptiste Reynal
     [not found] ` <1425485274-5709-1-git-send-email-b.reynal-lrHrjnjw1UfHK3s98zE1ajGjJy/sRE9J@public.gmane.org>
2015-03-04 16:07   ` [PATCH v5 2/4] vfio: introduce the VFIO_DMA_MAP_FLAG_NOEXEC flag Baptiste Reynal
2015-03-04 16:07   ` [PATCH v5 4/4] vfio: type1: implement " Baptiste Reynal
2015-03-04 17:45   ` [PATCH v5 0/4] vfio: type1: support for ARM SMMUS with VFIO_IOMMU_TYPE1 Alex Williamson
2015-03-05 10:16     ` Baptiste Reynal
     [not found]     ` <1425491104.5200.268.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-03-05 17:34       ` Eric Auger
     [not found]         ` <54F893C3.6020006-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-03-05 17:54           ` Alex Williamson
     [not found]             ` <1425578066.5200.331.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-03-05 18:09               ` Will Deacon [this message]
2015-03-05 21:11           ` Alex Williamson
     [not found]             ` <1425589915.5200.336.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-03-06  9:04               ` Eric Auger
     [not found]                 ` <54F96D96.8040207-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-03-06 10:41                   ` Will Deacon
     [not found]                     ` <20150306104148.GC22377-5wv7dgnIgG8@public.gmane.org>
2015-03-06 11:27                       ` Baptiste Reynal
     [not found]                         ` <CAN9JPjHWcXuzkByJY1gnbvi28nZX8RBbZXDA2t-VeK6v8OrSRg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-06 12:41                           ` Eric Auger
2015-03-06 13:17                           ` Eric Auger
     [not found]                             ` <54F9A8EE.9020008-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-03-06 13:44                               ` Baptiste Reynal
2015-03-06 14:46                     ` Alex Williamson

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=20150305180921.GD8163@arm.com \
    --to=will.deacon-5wv7dgnigg8@public.gmane.org \
    --cc=alex.williamson-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=eric.auger-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=kvmarm-FPEHb7Xf0XXUo1n7N8X6UoWGPAHP3yOg@public.gmane.org \
    --cc=tech-lrHrjnjw1UfHK3s98zE1ajGjJy/sRE9J@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