iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Robin Murphy <robin.murphy@arm.com>
Cc: Tomasz Figa <tfiga@chromium.org>,
	Daniel Kurtz <djkurtz@chromium.org>,
	Lin PoChun <pochun.lin@mediatek.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Yingjoe Chen <yingjoe.chen@mediatek.com>,
	Will Deacon <will.deacon@arm.com>,
	linux-media@vger.kernel.org, Thierry Reding <treding@nvidia.com>,
	"open list:IOMMU DRIVERS" <iommu@lists.linux-foundation.org>,
	"Bobby Batacharia (via Google Docs)" <Bobby.Batacharia@arm.com>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Yong Wu <yong.wu@mediatek.com>, Pawel Osciak <pawel@osciak.com>,
	Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
	Joerg Roedel <joro@8bytes.org>,
	thunder.leizhen@huawei.com,
	Catalin Marinas <catalin.marinas@arm.com>,
	linux-mediatek@lists.infradead.org
Subject: Re: [PATCH v6 1/3] iommu: Implement common IOMMU ops for DMA mapping
Date: Tue, 3 Nov 2015 18:40:19 +0000	[thread overview]
Message-ID: <20151103184019.GD8644@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <5638F1C4.3000900@arm.com>

On Tue, Nov 03, 2015 at 05:41:24PM +0000, Robin Murphy wrote:
> Hi Tomasz,
> 
> On 02/11/15 13:43, Tomasz Figa wrote:
> >Agreed. The dma_map_*() API is not guaranteed to return a single
> >contiguous part of virtual address space for any given SG list.
> >However it was understood to be able to map buffers contiguously
> >mappable by the CPU into a single segment and users,
> >videobuf2-dma-contig in particular, relied on this.
> 
> I don't follow that - _any_ buffer made of page-sized chunks is going to be
> mappable contiguously by the CPU; it's clearly impossible for the streaming
> DMA API itself to offer such a guarantee, because it's entirely orthogonal
> to the presence or otherwise of an IOMMU.

Tomasz's use of "virtual address space" above in combination with the
DMA API is really confusing.

dma_map_sg() does *not* construct a CPU view of the passed scatterlist.
The only thing dma_map_sg() might do with virtual addresses is to use
them as a way to achieve cache coherence for one particular view of
that memory, that being the kernel's own lowmem mapping and any kmaps.
It doesn't extend to vmalloc() or userspace mappings of the memory.

If the scatterlist is converted to an array of struct page pointers,
it's possible to map it with vmap(), but it's implementation defined
whether such a mapping will receive cache maintanence as part of the
DMA API or not.  (If you have PIPT caches, it will, if they're VIPT
caches, maybe not.)

There is a separate set of calls to deal with the flushing issues for
vmap()'d memory in this case - see flush_kernel_vmap_range() and
invalidate_kernel_vmap_range().

-- 
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

  reply	other threads:[~2015-11-03 18:40 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-01 19:13 [PATCH v6 0/3] arm64: IOMMU-backed DMA mapping Robin Murphy
     [not found] ` <cover.1443718557.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
2015-10-01 19:13   ` [PATCH v6 1/3] iommu: Implement common IOMMU ops for " Robin Murphy
     [not found]     ` <ab8e1caa40d6da1afa4a49f30242ef4e6e1f17df.1443718557.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
2015-10-26 13:44       ` Yong Wu
2015-10-26 16:55         ` Robin Murphy
2015-10-30  1:17           ` Daniel Kurtz
2015-10-30 14:09             ` Joerg Roedel
     [not found]               ` <20151030140923.GJ27420-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2015-10-30 18:18                 ` Mark Hounschell
2015-10-30 14:27             ` Robin Murphy
2015-11-02 13:11               ` Daniel Kurtz
2015-11-02 13:43                 ` Tomasz Figa
2015-11-03 17:41                   ` Robin Murphy
2015-11-03 18:40                     ` Russell King - ARM Linux [this message]
2015-11-04  5:15                       ` Tomasz Figa
     [not found]                         ` <CAAFQd5COY-dvBE73R=sUWoGfXR9CvgurGchYgXB6y9eqQ=BBUQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-11-04  9:10                           ` Russell King - ARM Linux
2015-11-04  5:12                     ` Tomasz Figa
     [not found]                       ` <CAAFQd5A4TcvkDMFezqEpkfWL+7yO2v=Hm=twk=p-NpADPpvqEQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-11-04  9:27                         ` Russell King - ARM Linux
2015-11-04  9:48                           ` Tomasz Figa
     [not found]                             ` <CAAFQd5ApSFC6Pm4tDhZbJOVZ7szCx=diKUtGXq=M9a5Y_4qzOQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-11-04 10:50                               ` Russell King - ARM Linux
2015-11-09 13:11                       ` Robin Murphy
2015-11-17 12:02             ` Marek Szyprowski
2015-10-01 19:13   ` [PATCH v6 2/3] arm64: Add IOMMU dma_ops Robin Murphy
2015-10-07  9:03     ` Anup Patel
     [not found]       ` <CAAhSdy2tpAfH+i=1axDkmRqZixsbVhd-_9VGvpyQ=5e06v=Kpg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-10-07 16:36         ` Robin Murphy
2015-10-07 17:40           ` Anup Patel
     [not found]     ` <80cb035144a2648a5d94eb1fec3336f17ad249f1.1443718557.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
2015-10-06 11:00       ` Yong Wu
2015-10-07 16:07         ` Robin Murphy
     [not found]           ` <56154349.8040101-5wv7dgnIgG8@public.gmane.org>
2015-10-09  5:44             ` Yong Wu
2015-10-14 11:47       ` Joerg Roedel
2015-10-14 13:35       ` Catalin Marinas
     [not found]         ` <20151014133538.GG4239-M2fw3Uu6cmfZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
2015-10-14 16:34           ` Robin Murphy
2015-11-04  8:39       ` Yong Wu
2015-11-04 13:11         ` Robin Murphy
     [not found]           ` <563A0419.9070100-5wv7dgnIgG8@public.gmane.org>
2015-11-04 17:35             ` Laura Abbott
2015-10-01 19:14   ` [PATCH v6 3/3] arm64: Hook up " Robin Murphy
2015-10-13 12:12   ` [PATCH v6 0/3] arm64: IOMMU-backed DMA mapping Robin Murphy
     [not found]     ` <561CF53E.7000809-5wv7dgnIgG8@public.gmane.org>
2015-10-14 11:50       ` joro-zLv9SwRftAIdnm+yROfE0A
     [not found]         ` <20151014115013.GM27420-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2015-10-14 18:19           ` Robin Murphy
2015-10-15 15:04   ` 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=20151103184019.GD8644@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=Bobby.Batacharia@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=djkurtz@chromium.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=kyungmin.park@samsung.com \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=m.szyprowski@samsung.com \
    --cc=pawel@osciak.com \
    --cc=pochun.lin@mediatek.com \
    --cc=robin.murphy@arm.com \
    --cc=tfiga@chromium.org \
    --cc=thunder.leizhen@huawei.com \
    --cc=treding@nvidia.com \
    --cc=will.deacon@arm.com \
    --cc=yingjoe.chen@mediatek.com \
    --cc=yong.wu@mediatek.com \
    /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).