Re: DMA API issues

From: Takashi Iwai
Date: Tue Jun 22 2004 - 05:52:12 EST


At Tue, 22 Jun 2004 00:08:38 +0100,
Russell King wrote:
>
> 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

Well, I thought the address handling can be dependent on the device
type, thus passing the both virtual and BUS addresses _might_ help to
calculate the DMA address in some cases. But forget it, seems
exaggerated.


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