Subject: Re: [PATCH] Sam440ep support

From: Benjamin Herrenschmidt <[email-masked]>
Date: Tue, 06 May 2008 21:25:53 +1000

On Tue, 2008-05-06 at 13:14 +0200, Takashi Iwai wrote:
> > sg allocations are usually lists of page, so virt_to_page shouldn't
> be a
> > problem in the first place, though we still need some way to get the
> > right prot attributes.
> 
> The problem is that ALSA SG buffer is composed from pages allocated
> via dma_alloc_coherent(), and the pages are retrieved via virt_to_page
> for DMA pages, as found in sound/core/sgbuf.c.
> 
> I didn't care about SG-buffer cases in my initial patch, and it's a
> bit messy.  The current code requires page lists becasue it calls
> vmap() to get a virtually linear buffer.

Hrm... the problem is that you aren't supposed to make up sglists with
the result of dma_alloc_coherent... It might be a limitation of our core
DMA API, but that's we have to deal with today..

If you're going to make up sglists and call vmap, you should allocate
pages with normal GFP. If that is a problem vs. DMA'bility of those
pages, then ... we have a problem :-)

I don't think we can easily update the DMA API at this stage. What we
could do is provide a way to retrieve the struct page array from the
result of dma_alloc_coherent...

Ben.