* Re: [Alsa-devel] RFC: dma_mmap_coherent() for powerpc/ppc architecture and ALSA?
2006-06-12 14:42 ` Gerhard Pircher
@ 2006-06-14 14:42 ` Takashi Iwai
0 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2006-06-14 14:42 UTC (permalink / raw)
To: Gerhard Pircher; +Cc: linuxppc-dev, rlrevell, alsa-devel, linux-kernel, benh
At Mon, 12 Jun 2006 16:42:54 +0200,
Gerhard Pircher wrote:
>
> > > But as far as I understand this would require a rewrite of all the
> > > ALSA drivers (or at least a rewrite of the ALSA's DMA helper
> > > functions).
> >
> > Yes. The change of ALSA side has been also on my tree. But it was
> > still pending since I'm not satisfied with the design yet.
> > If you're interested in it, let me know. I'll post the patch.
>
> Yes, please! Then I can test, if the dma_mmap_coherent() patch works on
> my non cache coherent powerpc machine.
For using dma_mmap_coherent(), the patch below should suffice.
(Also you need to enable HAVE_DMA_MMAP_COHERENT there not only for
ARM.)
> Do you think the DMA Layer/ALSA patches will go upstream in one of
> the next ALSA/Linux kernel versions?
Definitely no 2.6.18 material yet.
Takashi
diff -r 08577d0b45ef sound/core/pcm_native.c
--- a/sound/core/pcm_native.c Tue Jun 13 12:01:14 2006 +0200
+++ b/sound/core/pcm_native.c Wed Jun 14 16:40:32 2006 +0200
@@ -3123,6 +3123,10 @@ static int snd_pcm_mmap_control(struct s
}
#endif /* coherent mmap */
+#if defined(CONFIG_ARM)
+#define HAVE_DMA_MMAP_COHERENT
+#endif
+
/*
* nopage callback for mmapping a RAM page
*/
@@ -3166,6 +3170,14 @@ static struct vm_operations_struct snd_p
.nopage = snd_pcm_mmap_data_nopage,
};
+#ifdef HAVE_DMA_MMAP_COHERENT
+static struct vm_operations_struct snd_pcm_vm_ops_data_one_map =
+{
+ .open = snd_pcm_mmap_data_open,
+ .close = snd_pcm_mmap_data_close,
+};
+#endif
+
/*
* mmap the DMA buffer on RAM
*/
@@ -3175,6 +3187,16 @@ static int snd_pcm_default_mmap(struct s
area->vm_ops = &snd_pcm_vm_ops_data;
area->vm_private_data = substream;
area->vm_flags |= VM_RESERVED;
+#ifdef HAVE_DMA_MMAP_COHERENT
+ if (substream->dma_buffer.dev.type == SNDRV_DMA_TYPE_DEV) {
+ area->vm_ops = &snd_pcm_vm_ops_data_one_map;
+ if (dma_mmap_coherent(substream->dma_buffer.dev.dev, area,
+ substream->runtime->dma_area,
+ substream->runtime->dma_addr,
+ area->vm_end - area->vm_start))
+ return -EAGAIN;
+ }
+#endif
atomic_inc(&substream->mmap_count);
return 0;
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Re: [Alsa-devel] RFC: dma_mmap_coherent() for powerpc/ppc architecture and ALSA?
@ 2006-06-28 20:27 Gerhard Pircher
2006-06-29 9:27 ` Takashi Iwai
0 siblings, 1 reply; 6+ messages in thread
From: Gerhard Pircher @ 2006-06-28 20:27 UTC (permalink / raw)
To: Takashi Iwai; +Cc: linuxppc-dev, rlrevell, alsa-devel, linux-kernel, benh
Hi,
It took a little bit longer to integrate the patch, as I didn't figure out first how to implement the __dma_mmap_coherent() function for PPC systems with CONFIG_NOT_COHERENT_CACHE defined. :)
Unfortunately my system still crashes within snd_pcm_mmap_data_nopage()
(sound/core/pcm_native.c), as you can see below. I guess it tries to remap
a DMA buffer allocated by the not cache coherent DMA memory allocation
function in arch/ppc/kernel/dma-mapping.c.
Jun 28 21:59:30 localhost kernel: [ 199.869609] Using dma_mmap_coherent for mmaping DMA buffer!
Jun 28 21:59:30 localhost kernel: [ 199.925075] Oops: kernel access of bad area, sig: 11 [#1]
Jun 28 21:59:30 localhost kernel: [ 199.925106] NIP: E226FF44 LR: E226FF94 CTR: E226FEA4
Jun 28 21:59:30 localhost kernel: [ 199.925116] REGS: d2577d30 TRAP: 0600 Not tainted (2.6.16.16-a1-2)
Jun 28 21:59:30 localhost kernel: [ 199.925121] MSR: 00009032 <EE,ME,IR,DR> CR: 44048444 XER: 00000000
Jun 28 21:59:30 localhost kernel: [ 199.925134] DAR: 99A9999D, DSISR: 00000120
Jun 28 21:59:30 localhost kernel: [ 199.925140] TASK = d242cd10[4338] 'totem' THREAD: d2576000
Jun 28 21:59:30 localhost kernel: [ 199.925144] GPR00: 99A9999D D2577DE0 D242CD10 C0C826A0 00000000 D2577E08 D275F000 D36DC328
Jun 28 21:59:30 localhost kernel: [ 199.925158] GPR08: 02000000 00004000 00000000 99A99999 84048444 10054698 00000000 10196A58
Jun 28 21:59:30 localhost kernel: [ 199.925172] GPR16: 00000000 00000000 00000000 D36DC328 02000000 329FE000 00000000 00000000
Jun 28 21:59:30 localhost kernel: [ 199.925184] GPR24: DE5A6B20 DFA63C80 329FE000 DFA63C80 D20AD804 D275F7F8 D2576000 D2577E08
Jun 28 21:59:30 localhost kernel: [ 199.925199] NIP [E226FF44] snd_pcm_mmap_data_nopage+0xa0/0x12c [snd_pcm]
Jun 28 21:59:30 localhost kernel: [ 199.925300] LR [E226FF94] snd_pcm_mmap_data_nopage+0xf0/0x12c [snd_pcm]
Jun 28 21:59:30 localhost kernel: [ 199.925325] Call Trace:
Jun 28 21:59:30 localhost kernel: [ 199.925330] [D2577DE0] [C0010050] update_mmu_cache+0xe4/0xf4 (unreliable)
Jun 28 21:59:30 localhost kernel: [ 199.925361] [D2577E00] [C004F1D8] do_no_page+0xa4/0x6a4
Jun 28 21:59:30 localhost kernel: [ 199.925387] [D2577E60] [C004FA24] __handle_mm_fault+0x12c/0x328
Jun 28 21:59:30 localhost kernel: [ 199.925398] [D2577E90] [C000F740] do_page_fault+0x140/0x384
Jun 28 21:59:30 localhost kernel: [ 199.925407] [D2577F40] [C0004AC0] handle_page_fault+0xc/0x80
Jun 28 21:59:30 localhost kernel: [ 199.925423] Instruction dump:
Jun 28 21:59:30 localhost kernel: [ 199.925427] 812a0218 3d60c038 800b938c 7d292214 3d294000 5529c9f4 7c604a14 80030000
Jun 28 21:59:30 localhost kernel: [ 199.925441] 7c6b1b78 70094000 40820044 380b0004 <7d200028> 31290001 7d20012d 40a2fff4
Comments?
Thanks!
Gerhard
-------- Original-Nachricht --------
Datum: Wed, 14 Jun 2006 16:42:48 +0200
Von: Takashi Iwai <tiwai@suse.de>
An: Gerhard Pircher <gerhard_pircher@gmx.net>
Betreff: Re: [Alsa-devel] RFC: dma_mmap_coherent() for powerpc/ppc architecture and ALSA?
> At Mon, 12 Jun 2006 16:42:54 +0200,
> Gerhard Pircher wrote:
> >
> > > > But as far as I understand this would require a rewrite of all the
> > > > ALSA drivers (or at least a rewrite of the ALSA's DMA helper
> > > > functions).
> > >
> > > Yes. The change of ALSA side has been also on my tree. But it was
> > > still pending since I'm not satisfied with the design yet.
> > > If you're interested in it, let me know. I'll post the patch.
> >
> > Yes, please! Then I can test, if the dma_mmap_coherent() patch works on
> > my non cache coherent powerpc machine.
>
> For using dma_mmap_coherent(), the patch below should suffice.
> (Also you need to enable HAVE_DMA_MMAP_COHERENT there not only for
> ARM.)
>
> > Do you think the DMA Layer/ALSA patches will go upstream in one of
> > the next ALSA/Linux kernel versions?
>
> Definitely no 2.6.18 material yet.
>
>
> Takashi
--
Echte DSL-Flatrate dauerhaft für 0,- Euro*!
"Feel free" mit GMX DSL! http://www.gmx.net/de/go/dsl
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Alsa-devel] RFC: dma_mmap_coherent() for powerpc/ppc architecture and ALSA?
2006-06-28 20:27 Re: [Alsa-devel] RFC: dma_mmap_coherent() for powerpc/ppc architecture and ALSA? Gerhard Pircher
@ 2006-06-29 9:27 ` Takashi Iwai
2006-06-29 21:15 ` Gerhard Pircher
0 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2006-06-29 9:27 UTC (permalink / raw)
To: Gerhard Pircher; +Cc: linuxppc-dev, rlrevell, alsa-devel, linux-kernel, benh
At Wed, 28 Jun 2006 22:27:53 +0200,
Gerhard Pircher wrote:
>
> Hi,
>
> It took a little bit longer to integrate the patch, as I didn't figure out first how to implement the __dma_mmap_coherent() function for PPC systems with CONFIG_NOT_COHERENT_CACHE defined. :)
>
> Unfortunately my system still crashes within snd_pcm_mmap_data_nopage()
> (sound/core/pcm_native.c), as you can see below. I guess it tries to remap
> a DMA buffer allocated by the not cache coherent DMA memory allocation
> function in arch/ppc/kernel/dma-mapping.c.
Strange, nopage will be never called if you apply my patch and modify
to use dma_mmap_coherent().
Takashi
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Alsa-devel] RFC: dma_mmap_coherent() for powerpc/ppc architecture and ALSA?
2006-06-29 9:27 ` Takashi Iwai
@ 2006-06-29 21:15 ` Gerhard Pircher
2006-06-30 9:12 ` Takashi Iwai
0 siblings, 1 reply; 6+ messages in thread
From: Gerhard Pircher @ 2006-06-29 21:15 UTC (permalink / raw)
To: Takashi Iwai; +Cc: linux-kernel, alsa-devel, rlrevell, linuxppc-dev
-------- Original-Nachricht --------
Datum: Thu, 29 Jun 2006 11:27:15 +0200
Von: Takashi Iwai <tiwai@suse.de>
An: Gerhard Pircher <gerhard_pircher@gmx.net>
Betreff: Re: [Alsa-devel] RFC: dma_mmap_coherent() for powerpc/ppc architecture and ALSA?
> At Wed, 28 Jun 2006 22:27:53 +0200,
> Gerhard Pircher wrote:
> >
> > Hi,
> >
> > It took a little bit longer to integrate the patch, as I didn't figure
> out first how to implement the __dma_mmap_coherent() function for PPC
> systems with CONFIG_NOT_COHERENT_CACHE defined. :)
> >
> > Unfortunately my system still crashes within snd_pcm_mmap_data_nopage()
> > (sound/core/pcm_native.c), as you can see below. I guess it tries to
> remap
> > a DMA buffer allocated by the not cache coherent DMA memory allocation
> > function in arch/ppc/kernel/dma-mapping.c.
>
> Strange, nopage will be never called if you apply my patch and modify
> to use dma_mmap_coherent().
>
>
> Takashi
>
That's indeed strange! I'm sure that the new code is called by the sound drivers. Should snd_pcm_mmap_data_nopage() not be used at all anymore, or are there any cases that could still trigger a call of snd_pcm_mmap_data_nopage()?
Gerhard
--
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Alsa-devel] RFC: dma_mmap_coherent() for powerpc/ppc architecture and ALSA?
2006-06-29 21:15 ` Gerhard Pircher
@ 2006-06-30 9:12 ` Takashi Iwai
2006-06-30 18:21 ` Gerhard Pircher
0 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2006-06-30 9:12 UTC (permalink / raw)
To: Gerhard Pircher; +Cc: linux-kernel, alsa-devel, rlrevell, linuxppc-dev
At Thu, 29 Jun 2006 23:15:13 +0200,
Gerhard Pircher wrote:
>
>
> -------- Original-Nachricht --------
> Datum: Thu, 29 Jun 2006 11:27:15 +0200
> Von: Takashi Iwai <tiwai@suse.de>
> An: Gerhard Pircher <gerhard_pircher@gmx.net>
> Betreff: Re: [Alsa-devel] RFC: dma_mmap_coherent() for powerpc/ppc architecture and ALSA?
>
> > At Wed, 28 Jun 2006 22:27:53 +0200,
> > Gerhard Pircher wrote:
> > >
> > > Hi,
> > >
> > > It took a little bit longer to integrate the patch, as I didn't figure
> > out first how to implement the __dma_mmap_coherent() function for PPC
> > systems with CONFIG_NOT_COHERENT_CACHE defined. :)
> > >
> > > Unfortunately my system still crashes within snd_pcm_mmap_data_nopage()
> > > (sound/core/pcm_native.c), as you can see below. I guess it tries to
> > remap
> > > a DMA buffer allocated by the not cache coherent DMA memory allocation
> > > function in arch/ppc/kernel/dma-mapping.c.
> >
> > Strange, nopage will be never called if you apply my patch and modify
> > to use dma_mmap_coherent().
> >
> >
> > Takashi
> >
> That's indeed strange! I'm sure that the new code is called by the
> sound drivers. Should snd_pcm_mmap_data_nopage() not be used at all
> anymore, or are there any cases that could still trigger a call of
> snd_pcm_mmap_data_nopage()?
What is the type of buffer are you using? If it's a buffer
pre-allocated via snd_pcm_lib_preallocate*() with SNDRV_DMA_TYPE_DEV,
there should be no snd_pcm_mmap_data_nopage call. For other types,
there can be. For example, the patch still doesn't solve the problems
with drivers using sg-buffer.
Takashi
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Alsa-devel] RFC: dma_mmap_coherent() for powerpc/ppc architecture and ALSA?
2006-06-30 9:12 ` Takashi Iwai
@ 2006-06-30 18:21 ` Gerhard Pircher
0 siblings, 0 replies; 6+ messages in thread
From: Gerhard Pircher @ 2006-06-30 18:21 UTC (permalink / raw)
To: Takashi Iwai; +Cc: linuxppc-dev, rlrevell, alsa-devel, linux-kernel
-------- Original-Nachricht --------
Datum: Fri, 30 Jun 2006 11:12:00 +0200
Von: Takashi Iwai <tiwai@suse.de>
An: Gerhard Pircher <gerhard_pircher@gmx.net>
Betreff: Re: [Alsa-devel] RFC: dma_mmap_coherent() for powerpc/ppc architecture and ALSA?
>
> What is the type of buffer are you using? If it's a buffer
> pre-allocated via snd_pcm_lib_preallocate*() with SNDRV_DMA_TYPE_DEV,
> there should be no snd_pcm_mmap_data_nopage call. For other types,
> there can be. For example, the patch still doesn't solve the problems
> with drivers using sg-buffer.
>
I added a debug output and it shows a buffer of SNDRV_DMA_TYPE_DEV_SG type. Well, then I'll hack the kernel to use the normal DMA allocation functions for ALSA instead of the non cache coherent ones and will wait until the ALSA core has been adapted for dma_mmap_coherent().
Or what would have to be done to get it working for SG buffers?
Thanks!
Gerhard
--
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-06-30 18:21 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-28 20:27 Re: [Alsa-devel] RFC: dma_mmap_coherent() for powerpc/ppc architecture and ALSA? Gerhard Pircher
2006-06-29 9:27 ` Takashi Iwai
2006-06-29 21:15 ` Gerhard Pircher
2006-06-30 9:12 ` Takashi Iwai
2006-06-30 18:21 ` Gerhard Pircher
-- strict thread matches above, loose matches on Subject: below --
2006-06-10 8:22 Gerhard Pircher
2006-06-12 10:51 ` Takashi Iwai
2006-06-12 14:42 ` Gerhard Pircher
2006-06-14 14:42 ` [Alsa-devel] " Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox