From: William Lee Irwin III <wli@holomorphy.com>
To: rmk@arm.linux.org.uk, Linus Torvalds <torvalds@osdl.org>,
Jeff Garzik <jgarzik@pobox.com>,
David Woodhouse <dwmw2@infradead.org>,
Christoph Hellwig <hch@infradead.org>,
Andrew Morton <akpm@osdl.org>, Andrea Arcangeli <andrea@suse.de>,
linux-kernel@vger.kernel.org
Subject: Re: can device drivers return non-ram via vm_ops->nopage?
Date: Sun, 21 Mar 2004 16:23:49 -0800 [thread overview]
Message-ID: <20040322002349.GZ2045@holomorphy.com> (raw)
In-Reply-To: <20040321234515.G26708@flint.arm.linux.org.uk>
On Sun, Mar 21, 2004 at 11:45:15PM +0000, Russell King wrote:
> Ok, splitting hairs, for the coherent contiguous case, what about:
> int dma_coherent_map(struct vm_area_struct *vma, void *cpu_addr,
> dma_addr_t dma_addr, size_t size);
> and x86 would be:
> #define dma_coherent_map(vma,cpu_addr,dma_addr,size) \
> remap_page_range(vma, vma->vm_start, __pa(cpu_addr), \
> size, vma->vm_page_prot)
> This then leaves the PCI BAR case and the DMA coherent SG buffer case,
> though neither of those fall within my personal problem space at present.
Can we get an offset into the area as one of the args? Then scatter/gather
should be trivially constructible (via iteration) from the interface.
Maybe something like:
struct dma_scatterlist {
dma_addr_t dma_addr; /* DMA address */
void *cpu_addr; /* cpu address */
unsigned long length; /* in units of pages */
};
int dma_mmap_coherent_sg(struct dma_scatterlist *sglist,
int nr_sglist_elements, /* length of sglist */
struct vm_area_struct *vma, /* for address space */
unsigned long address, /* user virtual address */
unsigned long offset, /* offset (in pages) */
unsigned long nr_pages); /* length (in pages) */
int dma_munmap_coherent_sg(struct dma_scatterlist *sglist,
int nr_sglist_elements, /* length of sglist */
struct vm_area_struct *vma, /* for address space */
unsigned long address, /* user virtual address */
unsigned long offset, /* offset (in pages) */
unsigned long nr_pages); /* length (in pages) */
int dma_alloc_coherent_sg(struct dma_scatterlist **sglist,
unsigned long length); /* length in pages */
int dma_free_coherent_sg(struct dma_scatterlist **sglist,
unsigned long length); /* length in pages */
Would be useful? And these in turn would drive the dma_alloc_coherent()
and helpers like:
int dma_mmap_coherent(struct vm_area_struct *vma,
unsigned long address,
dma_addr_t dma_addr, /* DMA address */
void *cpu_addr, /* cpu address */
unsigned long nr_pages); /* length (in pages) */
int dma_munmap_coherent(struct vm_area_struct *vma,
unsigned long address,
dma_addr_t dma_addr, /* DMA address */
void *cpu_addr, /* cpu address */
unsigned long nr_pages); /* length (in pages) */
Does any of this sound like it's on the right track API-wise?
My thought on attacking the scatter/gather issue is basically centered
around "they're going to try to do it anyway, and if they don't have
something there to do it for them, they'll get it wrong."
-- wli
next prev parent reply other threads:[~2004-03-22 0:24 UTC|newest]
Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-20 13:30 can device drivers return non-ram via vm_ops->nopage? Andrea Arcangeli
2004-03-20 14:40 ` William Lee Irwin III
2004-03-20 15:06 ` Andrea Arcangeli
2004-03-20 15:27 ` William Lee Irwin III
2004-03-20 15:44 ` Russell King
2004-03-20 15:57 ` Andrea Arcangeli
2004-03-20 16:15 ` Russell King
2004-03-20 16:25 ` Andrea Arcangeli
2004-03-20 16:57 ` William Lee Irwin III
2004-03-20 17:48 ` Andrea Arcangeli
2004-03-20 19:03 ` Andrea Arcangeli
2004-03-20 15:58 ` Jaroslav Kysela
2004-03-20 16:09 ` Russell King
2004-03-20 19:44 ` Jaroslav Kysela
2004-03-20 22:23 ` Russell King
2004-03-20 22:45 ` William Lee Irwin III
2004-03-20 23:54 ` Russell King
2004-03-21 0:22 ` Zwane Mwaikambo
2004-03-22 4:46 ` Benjamin Herrenschmidt
2004-03-22 18:23 ` Richard Curnow
2004-03-21 0:23 ` William Lee Irwin III
2004-03-21 9:52 ` Arjan van de Ven
2004-03-21 10:39 ` Jaroslav Kysela
2004-03-22 4:43 ` Benjamin Herrenschmidt
2004-03-20 20:13 ` Andrew Morton
2004-03-20 20:28 ` Andrea Arcangeli
2004-03-20 20:50 ` William Lee Irwin III
2004-03-20 22:26 ` Russell King
2004-03-20 22:45 ` William Lee Irwin III
2004-03-21 20:45 ` David Woodhouse
2004-03-21 20:49 ` Christoph Hellwig
2004-03-21 20:57 ` David Woodhouse
2004-03-21 21:53 ` Linus Torvalds
2004-03-21 22:17 ` Jeff Garzik
2004-03-21 22:23 ` David Woodhouse
2004-03-21 22:23 ` Russell King
2004-03-21 22:34 ` Jeff Garzik
2004-03-21 22:42 ` David Woodhouse
2004-03-21 23:06 ` Jeff Garzik
2004-03-21 22:51 ` Russell King
2004-03-21 23:09 ` Jeff Garzik
2004-03-21 23:11 ` Linus Torvalds
2004-03-21 23:22 ` Jeff Garzik
2004-03-21 23:51 ` Linus Torvalds
2004-03-21 23:58 ` Russell King
2004-03-22 0:34 ` Andrea Arcangeli
2004-03-22 3:05 ` Linus Torvalds
2004-03-23 17:59 ` Andy Whitcroft
2004-03-23 17:58 ` David Woodhouse
2004-03-23 18:11 ` William Lee Irwin III
2004-03-22 0:02 ` David Woodhouse
2004-03-22 3:28 ` Linus Torvalds
2004-03-22 0:10 ` Jeff Garzik
2004-03-22 0:20 ` Russell King
2004-03-22 0:33 ` Jeff Garzik
2004-03-22 4:57 ` Benjamin Herrenschmidt
2004-03-21 23:45 ` Russell King
2004-03-22 0:23 ` William Lee Irwin III [this message]
2004-03-22 0:29 ` Jeff Garzik
2004-03-22 1:28 ` William Lee Irwin III
2004-03-22 6:36 ` William Lee Irwin III
2004-03-20 17:39 ` Linus Torvalds
2004-03-20 17:56 ` Andrea Arcangeli
2004-03-20 18:22 ` William Lee Irwin III
2004-03-21 3:13 ` Chris Wedgwood
2004-03-21 6:23 ` Christoph Hellwig
2004-03-21 7:00 ` Chris Wedgwood
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=20040322002349.GZ2045@holomorphy.com \
--to=wli@holomorphy.com \
--cc=akpm@osdl.org \
--cc=andrea@suse.de \
--cc=dwmw2@infradead.org \
--cc=hch@infradead.org \
--cc=jgarzik@pobox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rmk@arm.linux.org.uk \
--cc=torvalds@osdl.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