[alsa-devel] [PATCH 16/16] alsa sound support for mips

Atsushi Nemoto anemo at mba.ocn.ne.jp
Fri Apr 20 11:39:20 CEST 2007

On Wed, 18 Apr 2007 22:13:02 +0800, Fuxin Zhang <fxzhang at ict.ac.cn> 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

More information about the Alsa-devel mailing list