diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-05-12 09:43:30 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-05-12 15:27:50 -0400 |
commit | 8965eb19386fdf5ccd0ef8b02593eb8560aa3416 (patch) | |
tree | 8107a8db856d7b02b8b4d7bb88e53db1df8344ef /arch/x86 | |
parent | 492c2e476eac010962850006c49df326919b284c (diff) |
x86/pci: fix broken ISA DMA
Rene Herman reported:
> commit 8779f2fc3b84ebb6c5181fb13d702e9944c16069
>
> "x86: don't try to allocate from DMA zone at first"
>
> breaks all of ISA DMA. Or all of ALSA ISA DMA at least. All
> ISA soundcards are silent following that commit -- no error
> messages, everything appears fine, just silence.
That patch is buggy. We had an implicit assumption that
dev = NULL for ISA devices that require 24bit DMA.
The recent work on x86 dma_alloc_coherent() breaks the ISA DMA buffer
allocation, which is represented by "dev = NULL" and requires 24bit
DMA implicitly.
Bisected-by: Rene Herman <rene.herman@keyaccess.nl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Rene Herman <rene.herman@keyaccess.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kernel/pci-dma.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c index 0c37f16b6950..c5ef1af8e79d 100644 --- a/arch/x86/kernel/pci-dma.c +++ b/arch/x86/kernel/pci-dma.c | |||
@@ -385,11 +385,13 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, | |||
385 | if (dma_alloc_from_coherent_mem(dev, size, dma_handle, &memory)) | 385 | if (dma_alloc_from_coherent_mem(dev, size, dma_handle, &memory)) |
386 | return memory; | 386 | return memory; |
387 | 387 | ||
388 | if (!dev) | 388 | if (!dev) { |
389 | dev = &fallback_dev; | 389 | dev = &fallback_dev; |
390 | gfp |= GFP_DMA; | ||
391 | } | ||
390 | dma_mask = dev->coherent_dma_mask; | 392 | dma_mask = dev->coherent_dma_mask; |
391 | if (dma_mask == 0) | 393 | if (dma_mask == 0) |
392 | dma_mask = DMA_32BIT_MASK; | 394 | dma_mask = (gfp & GFP_DMA) ? DMA_24BIT_MASK : DMA_32BIT_MASK; |
393 | 395 | ||
394 | /* Device not DMA able */ | 396 | /* Device not DMA able */ |
395 | if (dev->dma_mask == NULL) | 397 | if (dev->dma_mask == NULL) |
@@ -403,7 +405,7 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, | |||
403 | larger than 16MB and in this case we have a chance of | 405 | larger than 16MB and in this case we have a chance of |
404 | finding fitting memory in the next higher zone first. If | 406 | finding fitting memory in the next higher zone first. If |
405 | not retry with true GFP_DMA. -AK */ | 407 | not retry with true GFP_DMA. -AK */ |
406 | if (dma_mask <= DMA_32BIT_MASK) | 408 | if (dma_mask <= DMA_32BIT_MASK && !(gfp & GFP_DMA)) |
407 | gfp |= GFP_DMA32; | 409 | gfp |= GFP_DMA32; |
408 | #endif | 410 | #endif |
409 | 411 | ||