Sudden ISA DMA problems
Hi,
I saw from the CVS ChangeLog that ALSA is moving away from the deprecated virt_to_bus() to the new pci_allocate_consistent() system calls. Unfortunately, this is causing problems for my ISA DMA sound driver (CS4231 / MPU401 based). I have currently "fixed" things by #undef-ing the ISA_USE_PCI_ALLOC in core/pcm_memory.c. Once I do this, I get sound out of my speakers again.
My soundcard also needs a DMA-able buffer so that it can upload its firmware. Previously, I used snd_malloc_pages(), and I tried changing this to snd_malloc_isa_pages(). However, you don't export this function, and even when I cut-and-pasted it into the source file, the firmware wouldn't upload until I used the virt_to_bus()-based compatibility version.
It would probably be a good idea to export the following functions:
snd_malloc_pci_pages()snd_malloc_isa_pages()snd_free_pci_pages()snd_free_isa_pages()
Does anyone have any idea why pci_allocate_consistent() isn't working here, please?
Cheers,
Chris
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel
Quoted 22 lines · On Sat, 16 Feb 2002, [iso-8859-1] Chris Rankin wrote:
Hi,
I saw from the CVS ChangeLog that ALSA is moving away from the deprecated
virt_to_bus()to the newpci_allocate_consistent()system calls. Unfortunately, this is causing problems for my ISA DMA sound driver (CS4231 / MPU401 based). I have currently "fixed" things by #undef-ing theISA_USE_PCI_ALLOCincore/pcm_memory.c. Once I do this, I get sound out of my speakers again.My soundcard also needs a DMA-able buffer so that it can upload its firmware. Previously, I used
snd_malloc_pages(), and I tried changing this tosnd_malloc_isa_pages(). However, you don't export this function, and even when I cut-and-pasted it into the source file, the firmware wouldn't upload until I used the virt_to_bus()-based compatibility version.It would probably be a good idea to export the following functions:
Quoted 7 lines
snd_malloc_pci_pages()snd_malloc_isa_pages()snd_free_pci_pages()snd_free_isa_pages()Does anyone have any idea why
pci_allocate_consistent()isn't working here, please?
Using pci_allocate_consistent() for ISA DMA allocation routines is definitely a bad idea. I added snd_malloc_isa_pages() code as you suggested to snd.o (it seems that it's good to abstract such bus specific allocation routines).
Jaroslav
-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project http://www.alsa-project.org
SuSE Linux http://www.suse.com
_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel
Quoted 7 lines · --- Jaroslav Kysela
Using
pci_allocate_consistent()for ISA DMA allocation routines is
definitely a bad idea. I addedsnd_malloc_isa_pages()code as you suggested to snd.o (it seems that it's good to abstract such bus specific
allocation routines).
Thanks, my driver is now both compiling and working again. (Just need to test "capture" mode now...) My only concern is that I thought that virt_to_bus() was going to disappear in 2.5, maybe even in future 2.4 kernels, leaving us with only pci_allocate_consistent(). I wouldn't mind, except that it doesn't seem to *work* for ISA DMA...!
Cheers,
Chris
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel
At Sun, 17 Feb 2002 10:29:20 +0100 (CET),
Quoted 30 lines · Jaroslav
Quoted 27 lines · On Sat, 16 Feb 2002, [iso-8859-1] Chris Rankin wrote:
Hi,
I saw from the CVS ChangeLog that ALSA is moving away from the deprecated
virt_to_bus()to the newpci_allocate_consistent()system calls. Unfortunately, this is causing problems for my ISA DMA sound driver (CS4231 / MPU401 based). I have currently "fixed" things by #undef-ing theISA_USE_PCI_ALLOCincore/pcm_memory.c. Once I do this, I get sound out of my speakers again.My soundcard also needs a DMA-able buffer so that it can upload its firmware. Previously, I used
snd_malloc_pages(), and I tried changing this tosnd_malloc_isa_pages(). However, you don't export this function, and even when I cut-and-pasted it into the source file, the firmware wouldn't upload until I used the virt_to_bus()-based compatibility version.It would probably be a good idea to export the following functions:
snd_malloc_pci_pages()snd_malloc_isa_pages()snd_free_pci_pages()snd_free_isa_pages()
Quoted 7 lines
Quoted 2 lines
Does anyone have any idea why
pci_allocate_consistent()isn't working here, please?Using
pci_allocate_consistent()for ISA DMA allocation routines is definitely a bad idea. I addedsnd_malloc_isa_pages()code as you suggested to snd.o (it seems that it's good to abstract such bus specific allocation routines).
I don't think it's so bad to use pci_allocate_consistent(). It gives the only generic way to get DMA buffer allocation over all architectures without virt_to_bus. If it doesn't work well, it should be a bug of this function..
Anyway, yes, it would be better to use a generic function until the kernel function is fixed. Thanks.
BTW, use of GFP_KERNEL for a large DMA buffer is safe on 2.4 too? For PCI buffers, when a module tries to allocate large memory areas with GFP_KERNEL, it stays blocking (and waiting for the enough space) and even more badly it cannot be killed.
Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel
Quoted 40 lines · Takashi Iwai
At Sun, 17 Feb 2002 10:29:20 +0100 (CET),
Quoted 30 lines · Jaroslav
Quoted 27 lines · On Sat, 16 Feb 2002, [iso-8859-1] Chris Rankin wrote:
Hi,
I saw from the CVS ChangeLog that ALSA is moving away from the deprecated
virt_to_bus()to the newpci_allocate_consistent()system calls. Unfortunately, this is causing problems for my ISA DMA sound driver (CS4231 / MPU401 based). I have currently "fixed" things by #undef-ing theISA_USE_PCI_ALLOCincore/pcm_memory.c. Once I do this, I get sound out of my speakers again.My soundcard also needs a DMA-able buffer so that it can upload its firmware. Previously, I used
snd_malloc_pages(), and I tried changing this tosnd_malloc_isa_pages(). However, you don't export this function, and even when I cut-and-pasted it into the source file, the firmware wouldn't upload until I used the virt_to_bus()-based compatibility version.It would probably be a good idea to export the following functions:
snd_malloc_pci_pages()snd_malloc_isa_pages()snd_free_pci_pages()snd_free_isa_pages()Quoted 7 lines
Quoted 2 lines
Does anyone have any idea why
pci_allocate_consistent()isn't working here, please?Using
pci_allocate_consistent()for ISA DMA allocation routines is definitely a bad idea. I addedsnd_malloc_isa_pages()code as you suggested to snd.o (it seems that it's good to abstract such bus specific allocation routines).
Quoted 4 lines
I don't think it's so bad to use
pci_allocate_consistent(). It gives the only generic way to get DMA buffer allocation over all architectures withoutvirt_to_bus. If it doesn't work well, it should be a bug of this function..
I verified the contents of pci_allocate_consistent() and I agree that it should work at least for i386 and alpha architectures so I reverted back your code.
Quoted 7 lines
Anyway, yes, it would be better to use a generic function until the kernel function is fixed. Thanks.
BTW, use of
GFP_KERNELfor a large DMA buffer is safe on 2.4 too? For PCI buffers, when a module tries to allocate large memory areas withGFP_KERNEL, it stays blocking (and waiting for the enough space) and even more badly it cannot be killed.
I removed dma_flags from isa pages allocation routines. We use GFP_ATOMIC|GFP_DMA like pci_allocate_consistent(). I'm not only sure about 2.2 kernels, but it's easy to fix this problem.
Jaroslav
-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project http://www.alsa-project.org
SuSE Linux http://www.suse.com
_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel
Quoted 5 lines · --- Jaroslav Kysela
I verified the contents of
pci_allocate_consistent()and I agree that it
should work at least for i386 and alpha architectures so I reverted back
your code.
Hi,
I have ported my driver to use the new snd_malloc_isa_pages() call ... and my driver is broken again. The interesting thing is that it does work *occasionally" and then I can both play music and upload the firmware. I was wondering if the dma_addr_t (which is really just a uint32, I think) has to have a value below a certain threshold before ISA DMA transfers will work? I am trying to test this theory now, but I need it to start working again first...
Chris
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel
Quoted 3 lines · --- Jaroslav Kysela
I removed
dma_flagsfrom isa pages allocation routines. We use
GFP_ATOMIC|GFP_DMA likepci_allocate_consistent().
Interesting ... my original and working code did the following:
buf = snd_malloc_pages(size, GFP_KERNEL | GFP_DMA);
and then used virt_to_bus(). I do not know what GFP_ATOMIC causes kmalloc() to do, but the net effect seems to be to prevent ISA DMA.
Chris
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel
Quoted 2 lines · --- Jaroslav Kysela
We use
GFP_ATOMIC|GFP_DMA likepci_allocate_consistent().
OK, I've hacked about a bit and it's not the presence of GFP_ATOMIC that causes trouble but the absence of GFP_DMA.
Note that the current code in snd_malloc_isa_pages() is:
dma_area = snd_malloc_pages(size,
GFP_ATOMIC|GFP_KERNEL);
Without the GFP_DMA, ISA DMA transfers on my machine do not work. GFP_DMA|GFP_ATOMIC|GFP_KERNEL is OK.
Chris
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel
Quoted 8 lines · On Mon, 18 Feb 2002, [iso-8859-1] Chris Rankin wrote:
Quoted 2 lines · --- Jaroslav Kysela
We use
GFP_ATOMIC|GFP_DMA likepci_allocate_consistent().OK, I've hacked about a bit and it's not the presence of
GFP_ATOMICthat causes trouble but the absence ofGFP_DMA.
Quoted 8 lines
Note that the current code in
snd_malloc_isa_pages()is:
dma_area= snd_malloc_pages(size,
GFP_ATOMIC|GFP_KERNEL);Without the
GFP_DMA, ISA DMA transfers on my machine do not work. GFP_DMA|GFP_ATOMIC|GFP_KERNEL is OK.
Obvious typo. Thanks you for this report.
Jaroslav
-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project http://www.alsa-project.org
SuSE Linux http://www.suse.com
_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel