Re: [PATCH] [1/4] x86_64: Fail dma_alloc_coherent on dma less devices
From: Andi Kleen
Date: Sat Aug 18 2007 - 15:04:20 EST
On Saturday 18 August 2007 19:22:18 Linus Torvalds wrote:
>
> Hmm. I think this is wrong.
>
> Why? Because the regular 32-bit x86 code does this all completely
> differently, and doesn't use dma_mask at all. Instead, it _only_ uses
> dev->coherent_dma_mask (which, considering the name of the function,
> would seem to make sense).
Yes, see my discussion with Alan. Likely this needs to be handled
in the caller to really fix the problem (pata_pcmcia oopsing when
it passes a DMA incapable pcmcia device to dma_alloc_coherent)
Another possible fix proposed by James was to give the pcmcia
devices a dma_mask of 0 which would also work.
> Considering that the oops comes from this:
>
> /* Kludge to make it bug-to-bug compatible with i386. i386
> uses the normal dma_mask for alloc_coherent. */
> dma_mask &= *dev->dma_mask;
>
> and that that code is *old*, and comes from when this file was called
> arch/x86_64/kernel/pci-gart.c, and the comment doesn't seem to even be
It might be outdated or it might now. The kludge was needed for Alsa because old
i386 ignored the consistent mask and they didn't always set it correctly, but that
should be obsolete now? I'm not quite sure because sound devices
are not always well tested on large memory systems which are the only
ones who show this problem. Takashi, do you know if all alsa drivers
set consistent mask correctly now?
But I didn't want to touch that that late -- can do it for .24.
Still failing is probably correct in this case so I included the patch.
-Andi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/