[alsa-devel] Audio buffer mmap-ing on sh arch vs. cache aliasing problem

Pawel MOLL pawel.moll at st.com
Fri Sep 26 13:25:17 CEST 2008


> > IIRC, a similar buffer handling (via vmalloc) is used in video
> > drivers.  I suppose they don't work as well, right?

Well, our FB driver is aware of the problem. I can't say much about
other ones...

> > DRM driver uses __vmalloc() with PAGE_KERNEL_NOCACHE, but it's only
> > for PPC32 non-coherent.

Hm. PPC with non-coherent cache?

/*
 * Only on coherent architectures, we can mmap the status and the control records
 * for effcient data transfer.  On others, we have to use HWSYNC ioctl...
 */
#if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_ALPHA)
                                   ^^^^^^^^^^
/*
 * mmap status record
 */
static struct page * snd_pcm_mmap_status_nopage(struct vm_area_struct *area,
                                                unsigned long address, int *type)

> x86 does it also, via its PAGE_AGP definition.
> 
> There are not that many platforms that define PAGE_KERNEL_NOCACHE though,
> so this gets a bit messy..

Oh, bloody hell, I haven't realised that!

> Yeah, that's not sexy, but maybe the only working case right now
> > (better with arch-specific ifdefs).

The question is what ifdefs to use ;-) Because the cached/uncached
decision must be consistent between snd_pcm_default_mmap() and buffer
allocation...

What a mess! ;-)

Paweł



More information about the Alsa-devel mailing list