linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: linux-mips@linux-mips.org, linux-ia64@vger.kernel.org,
	linux-sh@vger.kernel.org, linux-mm@kvack.org,
	sparclinux@vger.kernel.org, linux-arch@vger.kernel.org,
	'Stephen Rothwell' <sfr@canb.auug.org.au>,
	'Jonathan Corbet' <corbet@lwn.net>,
	x86@kernel.org, 'Arnd Bergmann' <arnd@arndb.de>,
	'Matthew Wilcox' <matthew@wil.cx>,
	microblaze-uclinux@itee.uq.edu.au,
	linaro-mm-sig@lists.linaro.org,
	Andrzej Pietrasiewicz <andrzej.p@samsung.com>,
	'Thomas Gleixner' <tglx@linutronix.de>,
	linux-arm-kernel@lists.infradead.org, discuss@x86-64.org,
	linux-kernel@vger.kernel.org,
	'Kyungmin Park' <kyungmin.park@samsung.com>,
	linux-alpha@vger.kernel.org,
	'Andrew Morton' <akpm@linux-foundation.org>,
	linuxppc-dev@lists.ozlabs.org
Subject: RE: [PATCH 00/14] DMA-mapping framework redesign preparation
Date: Tue, 27 Dec 2011 17:53:13 +0000	[thread overview]
Message-ID: <1325008393.14252.5.camel@dabdike> (raw)
In-Reply-To: <000901ccc471$15db8bc0$4192a340$%szyprowski@samsung.com>

On Tue, 2011-12-27 at 09:25 +0100, Marek Szyprowski wrote:
[...]
> > > Usually these drivers don't touch the buffer data at all, so the mapping
> > > in kernel virtual address space is not needed. We can introduce
> > > DMA_ATTRIB_NO_KERNEL_MAPPING attribute which lets kernel to skip/ignore
> > > creation of kernel virtual mapping. This way we can save previous
> > > vmalloc area and simply some mapping operation on a few architectures.
> > 
> > I really think this wants to be a separate function.  dma_alloc_coherent
> > is for allocating memory to be shared between the kernel and a driver;
> > we already have dma_map_sg for mapping userspace I/O as an alternative
> > interface.  This feels like it's something different again rather than
> > an option to dma_alloc_coherent.
> 
> That is just a starting point for the discussion. 
> 
> I thought about this API a bit and came to conclusion that there is no much
> difference between a dma_alloc_coherent which creates a mapping in kernel
> virtual space and the one that does not. It is just a hint from the driver
> that it will not use that mapping at all. Of course this attribute makes sense
> only together with adding a dma_mmap_attrs() call, because otherwise drivers
> won't be able to get access to the buffer data.

This depends.  On Virtually indexed systems like PA-RISC, there are two
ways of making a DMA range coherent.  One is to make the range uncached.
This is incredibly slow and not what we do by default, but it can be
used to make multiple mappings coherent.  The other is to load the
virtual address up as a coherence index into the IOMMU.  This makes it a
full peer in the coherence process, but means we can only designate a
single virtual range to be coherent (not multiple mappings unless they
happen to be congruent).  Perhaps it doesn't matter that much, since I
don't see a use for this on PA, but if any other architecture works the
same, you'd have to designate a single mapping as the coherent one and
essentially promise not to use the other mapping if we followed our
normal coherence protocols.

Obviously, the usual range we currently make coherent is the kernel
mapping (that's actually the only virtual address we have by the time
we're deep in the iommu code), so designating a different virtual
address would need some surgery to the guts of the iommu code.

James

  reply	other threads:[~2011-12-27 18:01 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-23 12:27 [PATCH 00/14] DMA-mapping framework redesign preparation Marek Szyprowski
2011-12-23 12:27 ` [PATCH 01/14] common: dma-mapping: introduce alloc_attrs and free_attrs methods Marek Szyprowski
2012-01-16  1:57   ` David Gibson
2011-12-23 12:27 ` [PATCH 02/14] X86: adapt for dma_map_ops changes Marek Szyprowski
2011-12-23 12:27 ` [PATCH 03/14] MIPS: " Marek Szyprowski
2012-02-13 10:35   ` [PATCH 03/14 v2] " Marek Szyprowski
2012-02-13 10:41     ` Sergei Shtylyov
2012-02-13 12:41       ` [PATCH 03/14 v3] " Marek Szyprowski
2011-12-23 12:27 ` [PATCH 04/14] PowerPC: " Marek Szyprowski
2012-01-16  8:09   ` David Gibson
2012-02-13 10:36   ` [PATCH 04/14 v2] " Marek Szyprowski
2011-12-23 12:27 ` [PATCH 05/14] IA64: " Marek Szyprowski
2012-03-27 21:20   ` Tony Luck
2012-03-27 21:53     ` Luck, Tony
2011-12-23 12:27 ` [PATCH 06/14] SPARC: " Marek Szyprowski
2011-12-23 12:27 ` [PATCH 07/14] Alpha: " Marek Szyprowski
2011-12-23 12:27 ` [PATCH 08/14] SH: " Marek Szyprowski
2011-12-23 12:27 ` [PATCH 09/14] Microblaze: " Marek Szyprowski
2011-12-23 12:27 ` [PATCH 10/14] Unicore32: " Marek Szyprowski
2011-12-23 12:27 ` [PATCH 11/14] common: dma-mapping: remove old alloc_coherent and free_coherent methods Marek Szyprowski
2011-12-23 12:27 ` [PATCH 12/14] common: dma-mapping: introduce mmap method Marek Szyprowski
2011-12-23 12:27 ` [PATCH 13/14] common: DMA-mapping: add WRITE_COMBINE attribute Marek Szyprowski
2011-12-23 12:27 ` [PATCH 14/14] common: DMA-mapping: add NON-CONSISTENT attribute Marek Szyprowski
2011-12-23 16:35 ` [PATCH 00/14] DMA-mapping framework redesign preparation Matthew Wilcox
2011-12-24  7:00   ` Benjamin Herrenschmidt
2011-12-27  8:25   ` Marek Szyprowski
2011-12-27 17:53     ` James Bottomley [this message]
2011-12-28 12:52       ` Marek Szyprowski
2012-01-10  8:42 ` Marek Szyprowski
2012-02-13 10:40 ` [PATCH] Hexagon: adapt for dma_map_ops changes Marek Szyprowski
2012-02-24 15:48 ` [PATCH 00/14] DMA-mapping framework redesign preparation Arnd Bergmann

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=1325008393.14252.5.camel@dabdike \
    --to=james.bottomley@hansenpartnership.com \
    --cc=akpm@linux-foundation.org \
    --cc=andrzej.p@samsung.com \
    --cc=arnd@arndb.de \
    --cc=corbet@lwn.net \
    --cc=discuss@x86-64.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=m.szyprowski@samsung.com \
    --cc=matthew@wil.cx \
    --cc=microblaze-uclinux@itee.uq.edu.au \
    --cc=sfr@canb.auug.org.au \
    --cc=sparclinux@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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).