Problems with dma_alloc_coherent()

Matt Porter mporter at kernel.crashing.org
Fri Apr 2 03:05:46 EST 2004


On Thu, Apr 01, 2004 at 10:59:56AM -0500, John Whitney wrote:
> In the process of reworking my Generic DMA core for the 2.6 kernel, I
> noticed that dma_alloc_coherent() returns NULL in all cases on a
> cache-coherent platform.  Instead, I think it would be better if this
> routine returned a block of contiguous memory (not cache-inhibited), as
> pci_alloc_consistent() does.

Yeah, that's really broken.  The changeover to dma-mapping.h is
incomplete.  Tom and I were just talking about this because I
think it exposes a bigger problem.  What I originally wanted
was the PCI DMA API defined in terms of the generic DMA API
on ppc32.  He just pointed out asm-generic/pci-dma-compat.h that
we can leverage to do that.

> To that end, I am submitting the attached patch which modifies
> dma_alloc_coherent() and dma_free_coherent() to do just this for
> cache-coherent platforms.

Your patch fixes the problem but exposes the bigger issue that we
are starting to duplicate code since on ppc32 PCI DMA API and DMA
API are handled the same on the backend.

In the meantime (I think Tom volunteered to clean this up!), I think
this needs to go in so we are at least functional.

-Matt

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc-dev mailing list