Problems with dma_alloc_coherent()
Paul Mackerras
paulus at samba.org
Sat Apr 3 08:54:50 EST 2004
John Whitney writes:
> As an exemplification of the problem I am having with the current
> DMA/PCI API:
>
> I am developing a Generic DMA driver. DMA providers register
> themselves with it. Clients ask the DMA core driver to please have a
> registered driver transfer the data from one location to another, and
> call them back when it is complete.
It sounds like you have the model of a DMA controller that is separate
from any I/O device that needs to transfer data to/from memory, and
you want to use it to transfer data from one memory location to
another. Just like in the bad old days of the PC/XT. :)
That is not the model that PCI/DMA API is designed for. The model it
is designed for is one where you have a bridge, often with an IOMMU
that remaps bus addresses to memory addresses on a page granularity,
and behind that you have a bus-master capable device. Thus the
PCI/DMA API takes care of setting up an appropriate translation in the
IOMMU (if any) and returning the bus address that the driver should
use. The way that the driver gives the bus address to the device is
very device-dependent and isn't handled by the API.
If you want to write code to handle a separate DMA controller, go
ahead. You will need to design your own separate API for it. I
wouldn't try to make it too general, though, since there are very few
systems these days that have DMA controllers (as distinct from
bus-master capable I/O devices).
Paul.
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
More information about the Linuxppc-dev
mailing list