From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: snd_pcm_lib_preallocate_pages_for_all Date: Mon, 05 Jul 2004 11:17:28 +0200 Sender: alsa-devel-admin@lists.sourceforge.net Message-ID: References: Mime-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen") Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: <20040705100038.B17721@flint.arm.linux.org.uk> Errors-To: alsa-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org At Mon, 5 Jul 2004 10:00:39 +0100, Russell King wrote: > > On Mon, Jul 05, 2004 at 11:56:25AM +0300, Bo Henriksen wrote: > > It now crashes again. I have tried to preallocate the buffer using > > dma_alloc_coherent and free it with dma_free_coherent. This succeeds and > > I am using this in other drivers as well. I guess I am missing something > > else? > > Yes, ALSA assumes that memory returned from dma_alloc_coherent is > kernel direct mapped memory. ALSA is wrong in that assumption. > Hopefully ALSA people can help you further. The simplest solution is to disable mmap on your driver. (i.e. removing SNDRV_PCM_INFO_MMAP from info field of hw struct). The ALSA core part believes that the buffer is mmappable as long as that flag is set, regardless whether it's allocated via dma_alloc_coherent() or anything else. I have a hack on my local tree to adapt the new dma_to_*() macros for ARM, but it's not clean enough yet for merging to the main ALSA tree. I hope in future the kernel will have a support function for easier mmap as Russell proposed on lkml. Takashi ------------------------------------------------------- This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com