Skip to contentSkip to conversation

Emu10k memory allocation (PCI DMA trouble)

alsa-devel Jaroslav Kysela 1 participant 1 message Mar 19, 2001 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 11 lines · Dimitri Shlyakhtenko

As I have previosly reported in this mailing list, large soundfont files cannot be loaded with the alsa-0.9.0beta1 (and I suspect alsa-0.9.0beta2, since the underlying problem was not fixed) under linux-2.4.2. The reason for this is that the memory for the soundfont file is allocated via pci_malloc_consistent(); this call frequently fails, and there is a limit on the amount of memory that can be allocated this way (see my earlier posts titled "use of pci_malloc_consistent()").

The enclosed patch solves this problem. [Note: I am not sure if it works on a non-i386 architechture].

This patch is wrong by design. The whole problem is that in pci_alloc_consistent function (linux/arch/i386/kernel/pcm-dma.c) is this condition:

	if (hwdev == NULL || hwdev->dma_mask != 0xffffffff)
		gfp |= GFP_DMA;

So, you have two changes: hack this function or hack the ALSA code where the dma_mask is set PCI_SET_DMA_MASK(pci, 0x7fffffff); (emu10k1.c).

Ask hardware vendors who think that the 2GB physical memory limit is good enough.

Is any chance to fix this code in the official kernel tree? I think that the x86 machines with <=2GB memory could not use the GFP_DMA flag. Also, other soundcards have some other limits like 256MB, so I suggest to havea condition like for the x86 platform:

	if (hwdev == NULL || hwdev->dma_mask < (max_mapnr << PAGE_SHIFT))
		gfp |= GFP_DMA;

						Jaroslav

-----
Jaroslav Kysela <[email protected]>
SuSE Linux http://www.suse.com
ALSA project http://www.alsa-project.org