Currently our only DMA API is highly PCI specific (making any non-pci bus with
a DMA controller create fake PCI devices to help it function).
Now that we have the generic device model, it should be equally possible to
rephrase the entire API for generic devices instead of pci_devs.
This patch does just that (for x86---although I also have working code for
parisc, that's where I actually tested the DMA capability).
The API is substantially the same as the PCI DMA one, with one important
exception with regard to consistent memory:
The PCI api has pci_alloc_consistent which allocates only consistent memory
and fails the allocation if none is available thus leading to driver writers
who might need to function with inconsistent memory to detect this and employ
a fallback strategy.
The new DMA API allows a driver to advertise its level of consistent memory
compliance to dma_alloc_consistent. There are essentially two levels:
- I only work with consistent memory, fail if I cannot get it, or
- I can work with inconsistent memory, try consistent first but return
inconsistent if it's not available.
The idea is that the memory type can be coded into dma_addr_t which the
subsequent memory sync operations can use to determine whether
wback/invalidate should be a nop or not.
Using this scheme allows me to eliminate all the inconsistent memory fallbacks
from my drivers.
Comments welcome.
James
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Sat Dec 07 2002 - 22:00:19 EST