[Top] [All Lists]

Re: [PATCH 16/16] alsa sound support for mips

Subject: Re: [PATCH 16/16] alsa sound support for mips
From: Atsushi Nemoto <>
Date: Fri, 20 Apr 2007 18:39:20 +0900 (JST)
In-reply-to: <>
Original-recipient: rfc822;
References: <> <> <>
On Wed, 18 Apr 2007 22:13:02 +0800, Fuxin Zhang <> wrote:
> >> +#if defined(__mips__) && defined(CONFIG_DMA_NONCOHERENT)
> >> +  /* all mmap using uncached mode */
> >> +  area->vm_page_prot = pgprot_noncached(area->vm_page_prot);
> >> +  area->vm_flags |= ( VM_RESERVED | VM_IO);
> >>     
> >
> > VM_RESERVED will prevent the buffer from being freed.  I assume that is
> > another workaround for some kernel subsystem blowing up when being fed a
> > pointer to an uncached RAM address?  This smells like a memory leak.
> >
> >   
> Oh, VM_RESERVED should be a memory leak problem, we can remove it.
> I don't remember any case of other subsystem's problem, just did not 
> think much
> to add those flags.

I think pgprot_noncached() is needed because user mapping for a DMA
buffer (runtime->dma_area) should be uncache.  If so, doing this in
snd_pcm_mmap() looks a bit suspicious.  It seems snd_pcm_mmap_data()
is a place to do such an adjustment.  But for now, both
snd_pcm_mmap_status() and snd_pcm_mmap_control() returns -ENXIO for
MIPS so this is not a real problem.

And I wonder if VM_IO is really needed.  The area is a DMA buffer,
_not_ a memory mapped IO area, isn't it?

> > I would suggest to get rid of this ifdef with a new arch-specific function
> > like vmap_io_buffer which will do whatever a platform seems fit for this
> > case?
> >   
> I think arch-specific function is the correct way, but don't know what 
> the alsa gods think.

JFYI, there were some discussions on this topic a while ago:

and I'v seen MIPS version of dma_mmap_coherent(), etc. somewhere...

Atsushi Nemoto

<Prev in Thread] Current Thread [Next in Thread>