From: Russell King <rmk@arm.linux.org.uk>
To: Andrea Arcangeli <andrea@suse.de>,
William Lee Irwin III <wli@holomorphy.com>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Jeff Garzik <jgarzik@pobox.com>,
James Bottomley <James.Bottomley@steeleye.com>,
Linux Arch list <linux-arch@vger.kernel.org>,
Linus Torvalds <torvalds@osdl.org>,
David Woodhouse <dwmw2@infradead.org>,
Christoph Hellwig <hch@infradead.org>,
Andrew Morton <akpm@osdl.org>
Subject: Re: can device drivers return non-ram via vm_ops->nopage?
Date: Thu, 25 Mar 2004 20:25:44 +0000 [thread overview]
Message-ID: <20040325202543.B16585@flint.arm.linux.org.uk> (raw)
In-Reply-To: <20040323124027.D25134@flint.arm.linux.org.uk>; from rmk@arm.linux.org.uk on Tue, Mar 23, 2004 at 12:40:27PM +0000
On Tue, Mar 23, 2004 at 12:40:27PM +0000, Russell King wrote:
> On Tue, Mar 23, 2004 at 01:34:39PM +0100, Andrea Arcangeli wrote:
> > anyways Linus vetoed the lazy approch so we probably should give it up
> > (the one thing I like most is to avoid the branch in the fast path).
>
> I don't think he did - he vetoed adding another special condition to
> the fast path, or returning non-RAM pages via ->nopage.
>
> However, I do not believe he has vetoed an architecture implementing
> dma_coherent_mmap() in such a way that it uses the ->nopage method,
> _provided_ ->nopage returns valid struct pages.
Ok, since this thread seems to have died without much action happening,
its time to re-start it (but note - I probably won't be around tomorrow.)
I'd like to get the dma_coherent_mmap() API sorted out such that everyone
is happy, and we can progress it.
From what I've gathered, we seem to be happy with the dma_coherent_mmap()
approach. Is everyone happy with these prototypes?
int dma_coherent_mmap(struct device *dev, struct vm_area_struct *vma,
void *cpu_addr, dma_addr_t dma_addr, size_t size);
and, for the PA-RISC architecture (c/o James Bottomley):
void dma_coherent_munmap(struct device *dev, struct vm_area_struct *vma,
void *cpu_addr, dma_addr_t dma_addr, size_t size);
where:
- dev: the device for which this coherent region was created for
- vma: VM area struct describing the requested user mapping
- cpu_addr: the address returned from dma_alloc_coherent
- dma_addr: the DMA cookie returned from dma_alloc_coherent
- size: the size of the DMA allocation
As far as ARM goes, we (currently) only need cpu_addr to look up the
data associated with the kernels coherent DMA mapping. Whether the
other arguments are useful depends on what other architectures require.
Is everyone happy with the name, or would people prefer it to be more
consistent with the other dma_xxx_coherent() functions (iow,
dma_mmap_coherent?)
PS, one of my pet annoyances with the DMA API is that dma_alloc_coherent()
doesn't return/take some architecturally defined structure, and that
there aren't accessor macros like dma_cpu_addr() dma_device_addr().
This means that we end up carrying around several bits of data, which
may be the same on some architectures. People objected to this in 2.4,
and we ended up adding that yucky "DECLARE_PCI_UNMAP_ADDR" stuff - which
may happen during 2.6 to the DMA API. Adding these further APIs is just
making this mistake worse IMO. It's really a 2.7 problem though. And
yes, I've just talked people out of the prototypes I've proposed above.
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 PCMCIA - http://pcmcia.arm.linux.org.uk/
2.6 Serial core
next prev parent reply other threads:[~2004-03-25 20:25 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20040321204931.A11519@infradead.org>
[not found] ` <1079902670.17681.324.camel@imladris.demon.co.uk>
[not found] ` <Pine.LNX.4.58.0403211349340.1106@ppc970.osdl.org>
[not found] ` <20040321222327.D26708@flint.arm.linux.org.uk>
[not found] ` <405E1859.5030906@pobox.com>
[not found] ` <20040321225117.F26708@flint.arm.linux.org.uk>
[not found] ` <Pine.LNX.4.58.0403211504550.1106@ppc970.osdl.org>
[not found] ` <20040321234515.G26708@flint.arm.linux.org.uk>
[not found] ` <20040322002349.GZ2045@holomorphy.com>
[not found] ` <405E3387.1050505@pobox.com>
2004-03-22 3:45 ` can device drivers return non-ram via vm_ops->nopage? William Lee Irwin III
2004-03-22 4:41 ` James Bottomley
2004-03-22 4:46 ` William Lee Irwin III
2004-03-22 4:56 ` James Bottomley
2004-03-22 5:26 ` Benjamin Herrenschmidt
2004-03-22 11:58 ` Andrea Arcangeli
2004-03-22 12:05 ` Russell King
2004-03-22 12:34 ` Andrea Arcangeli
2004-03-22 9:30 ` Russell King
2004-03-22 15:04 ` James Bottomley
2004-03-22 15:15 ` Russell King
2004-03-22 15:27 ` James Bottomley
2004-03-22 21:50 ` Benjamin Herrenschmidt
2004-03-22 22:18 ` Jeff Garzik
2004-03-22 22:35 ` William Lee Irwin III
2004-03-22 23:57 ` Benjamin Herrenschmidt
2004-03-23 0:22 ` David Woodhouse
2004-03-23 2:07 ` William Lee Irwin III
2004-03-23 9:28 ` Russell King
2004-03-23 9:34 ` David Woodhouse
2004-03-23 10:04 ` Russell King
2004-03-23 10:05 ` William Lee Irwin III
2004-03-23 11:29 ` Benjamin Herrenschmidt
2004-03-23 11:35 ` Andrea Arcangeli
2004-03-23 11:44 ` William Lee Irwin III
2004-03-23 12:34 ` Andrea Arcangeli
2004-03-23 12:40 ` Russell King
2004-03-23 15:25 ` Linus Torvalds
2004-03-23 15:36 ` Andrea Arcangeli
2004-03-23 15:46 ` Linus Torvalds
2004-03-23 15:50 ` Russell King
2004-03-23 22:10 ` Benjamin Herrenschmidt
2004-03-25 20:25 ` Russell King [this message]
2004-03-28 10:17 ` Russell King
2004-03-23 12:49 ` William Lee Irwin III
2004-03-22 23:19 ` Russell King
2004-03-22 23:35 ` Jeff Garzik
2004-03-23 2:26 ` James Bottomley
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=20040325202543.B16585@flint.arm.linux.org.uk \
--to=rmk@arm.linux.org.uk \
--cc=James.Bottomley@steeleye.com \
--cc=akpm@osdl.org \
--cc=andrea@suse.de \
--cc=benh@kernel.crashing.org \
--cc=dwmw2@infradead.org \
--cc=hch@infradead.org \
--cc=jgarzik@pobox.com \
--cc=linux-arch@vger.kernel.org \
--cc=torvalds@osdl.org \
--cc=wli@holomorphy.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