Skip to contentSkip to conversation

RFC: dma_mmap_coherent() for powerpc/ppc architecture and ALSA?

Alsa-devel Gerhard Pircher 4 participants 10 messages Jun 28, 2006 – Oct 25, 2006

lore
Share & tools
lore
#0 lore raw

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 <[email protected]>
An: Gerhard Pircher <[email protected]>
Betreff: Re: [Alsa-devel] RFC: dma_mmap_coherent() for powerpc/ppc architecture and ALSA?

Quoted 25 lines

At Mon, 12 Jun 2006 16:42:54 +0200,

Quoted 11 lines · Gerhard Pircher
Quoted 8 lines
Quoted 4 lines

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.)

Quoted 2 lines

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

Signature · 7 lines
Echte DSL-Flatrate dauerhaft für 0,- Euro*!
"Feel free" mit GMX DSL! http://www.gmx.net/de/go/dsl

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
#1 lore raw

At Wed, 28 Jun 2006 22:27:53 +0200,

Quoted 9 lines · Gerhard Pircher

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

Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

#2 lore raw

-------- Original-Nachricht --------
Datum: Thu, 29 Jun 2006 11:27:15 +0200
Von: Takashi Iwai <[email protected]>
An: Gerhard Pircher <[email protected]>
Betreff: Re: [Alsa-devel] RFC: dma_mmap_coherent() for powerpc/ppc architecture and ALSA?

Quoted 12 lines

At Wed, 28 Jun 2006 22:27:53 +0200,

Quoted 4 lines · Gerhard Pircher

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. :)

Quoted 3 lines

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

Quoted 9 lines
Quoted 2 lines

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

Signature · 7 lines
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
#3 lore raw

At Thu, 29 Jun 2006 23:15:13 +0200,

Quoted 27 lines · Gerhard Pircher

-------- Original-Nachricht --------
Datum: Thu, 29 Jun 2006 11:27:15 +0200
Von: Takashi Iwai <[email protected]>
An: Gerhard Pircher <[email protected]>
Betreff: Re: [Alsa-devel] RFC: dma_mmap_coherent() for powerpc/ppc architecture and ALSA?

Quoted 19 lines

At Wed, 28 Jun 2006 22:27:53 +0200,

Quoted 4 lines · Gerhard Pircher

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. :)

Quoted 3 lines

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

Quoted 2 lines

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().

Quoted 6 lines
Quoted 2 lines

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

Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

#4 lore raw

-------- Original-Nachricht --------
Datum: Fri, 30 Jun 2006 11:12:00 +0200
Von: Takashi Iwai <[email protected]>
An: Gerhard Pircher <[email protected]>
Betreff: Re: [Alsa-devel] RFC: dma_mmap_coherent() for powerpc/ppc architecture and ALSA?

Quoted 7 lines

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

Signature · 7 lines
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
#5 lore raw

[RFC] Porting AmigaOne platform code from ppc to powerpc

Hi!

I'm working on the AmigaOne Linux kernel port. The AmigaOne is a G3/G4 desktop system and makes use of U-boot v1.1.0 as firmware. I intend to port the current code base of this platform to the powerpc architecture, but I'm not sure how to address this.

The "problem" is the device tree required by the powerpc architecture. The AmigaOne's U-boot version doesn't support the flattened device tree yet and also requires a special flash rom programmer tool (I guess it adds some sort of dongle code to the flash rom content). Otherwise users won't be able to boot AmigaOS4. Thus using a newer U-boot version is not really an option and AFAIK the OS4 developers are not going to update their U-boot version.

Well, some time ago I read about a CUIMAGE target that can be used to get powerpc-arch kernels working on old U-boot versions by using a precompiled/static device tree. I don't think that this approch makes sense for a desktop platform, which uses different CPUs (750FX, 750GX, 7410, 7450, 7455, etc..), PCI/AGP cards, etc.

Any advice for me in this case?

Regards,

Gerhard

Signature · 2 lines
GMX DSL-Flatrate 0,- Euro* - Überall, wo DSL verfügbar ist!
NEU: Jetzt bis zu 16.000 kBit/s! http://www.gmx.net/de/go/dsl
#6 lore raw

Re: [RFC] Porting AmigaOne platform code from ppc to powerpc

Quoted 9 lines · Gerhard Pircher

Hi!

I'm working on the AmigaOne Linux kernel port. The AmigaOne is a G3/G4 desktop system and makes use of U-boot v1.1.0 as firmware. I intend to port the current code base of this platform to the powerpc architecture, but I'm not sure how to address this.

The "problem" is the device tree required by the powerpc architecture. The AmigaOne's U-boot version doesn't support the flattened device tree yet and also requires a special flash rom programmer tool (I guess it adds some sort of dongle code to the flash rom content). Otherwise users won't be able to boot AmigaOS4. Thus using a newer U-boot version is not really an option and AFAIK the OS4 developers are not going to update their U-boot version.

Well, some time ago I read about a CUIMAGE target that can be used to get powerpc-arch kernels working on old U-boot versions by using a precompiled/static device tree. I don't think that this approch makes sense for a desktop platform, which uses different CPUs (750FX, 750GX, 7410, 7450, 7455, etc..), PCI/AGP cards, etc.

Any advice for me in this case?

You can also look at the rework being done currently on zImage wrappers. Among others, they have the ability to embed a device-tree.

Ben.

#7 lore raw

Crash with highmem support enabled

Hi,

I'm trying to get highmem support working on my AmigaOne. The machine is equipped with 1.5G RAM. Unfortunately the kernel crashes early in the boot process, so I couldn't save the crash log. But it seems to crash during the initialization of the radeonfb driver.

I guess this has something to do with the IO block mapping, which is implemented in the amigaone_setup.c file and looks like this:

{
/* Remap ISA/PCI IO space first to get it mapped by BATs. */ io_block_mapping(0xfe000000, 0xfe000000, 0x01000000, _PAGE_IO); /* Remap ISA memory for framebuffer (U-boot framebuffer). */ io_block_mapping(0xfd000000, 0xfd000000, 0x01000000, _PAGE_IO); /* Remap PROM I/O space to 0xfc000000, to get a window for non
* cache coherent DMA support at 0xff100000.
*/
io_block_mapping(0xfc000000, 0xff000000, 0x01000000, _PAGE_IO); }

The addresses below 0xfc000000 belong to the PCI memory space (0x80000000-0xfbffffff).

Thus I moved the highmem base to 0xfc000000, since the PCI memory is not ioremap'd. But the kernel still crashes.

Can somebody give me a hint how to get highmem working? I'm not sure what the real problem is, as also other platforms (PReP, sandpoint) ioremap the address space from 0xfe000000 to 0xffffffff.

Gerhard

Signature · 2 lines
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
#8 lore raw

Re: Crash with highmem support enabled

Quoted 2 lines · Gerhard Pircher

I guess this has something to do with the IO block mapping, which is implemented in the amigaone_setup.c file and looks like this:

Why on earth are you still using io_block_mapping?

Paul.

#9 lore raw

Re: Crash with highmem support enabled

-------- Original-Nachricht --------
Datum: Wed, 25 Oct 2006 15:34:50 +1000
Von: Paul Mackerras <[email protected]>
An: "Gerhard Pircher" <[email protected]>
Betreff: Re: Crash with highmem support enabled

Quoted 6 lines
Quoted 2 lines · Gerhard Pircher

I guess this has something to do with the IO block mapping, which is implemented in the amigaone_setup.c file and looks like this:

Why on earth are you still using io_block_mapping?

What should be used instead? ioremap()? The io_block_mapping() code was copied over from the PReP platform code in arch/ppc/platforms/.

In the meantime I found out that highmem failed due to the IO block mapping (sometimes it is good to look at the code ;). The mapping is needed for the AmigaOne/U-boot framebuffer to be able to access the ISA memory and I/O. Where and when can I savely remap (no 1:1 remapping) the ISA space so that the framebuffer survives the MMU initialization?

thanks!

Gerhard

Signature · 2 lines
GMX DSL-Flatrate 0,- Euro* - Überall, wo DSL verfügbar ist!
NEU: Jetzt bis zu 16.000 kBit/s! http://www.gmx.net/de/go/dsl