lkml.org 
[lkml]   [2004]   [Jun]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: DMA API issues
On Mon, Jun 21, 2004 at 03:35:42PM +0200, Takashi Iwai wrote:
> At Fri, 18 Jun 2004 20:43:22 +0100,
> Russell King wrote:
> >
> > On Fri, Jun 18, 2004 at 12:21:12PM -0700, Matt Porter wrote:
> > > > page_to_dma so that device specific dma addresses can be constructed.
> > >
> > > A struct device argument to page_to_dma seems like a no brainer to be
> > > included.
> >
> > Tony Lindgren recently submitted a patch for this:
> >
> > http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=1931/1
> >
> > which now pending for Linus. ARM platforms now have three macros to
> > define if they want to override the default struct page to DMA address
> > translation.
>
> Wouldn't it be nicer to define a more generic style like
>
> struct page *dma_to_page(struct device *, void *, dma_addr_t)

What's the 'void *' for? Hint: this has nothing to do with the virtual
address and DMA address returned from dma_alloc_coherent().

page_to_dma - converts a struct page to a DMA address for a given device
dma_to_virt - converts a DMA address to a CPU direct-mapped virtual address
virt_to_dma - converts a CPU direct-mapped virtual address to a DMA address

Each one well defined for our _current_ interfaces.

> Yes, the struct page pointer is needed for vma_ops.nopage in mmap on
> ALSA. So far, this is broken on some architectures like ARM. We need
> a proper conversion from virtual/bus pointer to a page struct.

Please get away from your nopage implementation. We've been around this
before with Linus, and the conclusion was that it's up to architectures
to provide a MMAP method for DMA memory, which _may_ use the nopage
method if and only if it is appropriate for their implementation.

There's just no way I'm going to implement a half-baked "nopage" function
for ALSA.

This is actually the same issue for some framebuffer devices as well -
which also need DMA MMAP to be correct.

--
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:04    [W:1.223 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site