LWN.net Logo

Making the DMA subsystem bus-independent

The Linux kernel has an elaborate set of support routines for performing DMA I/O operations. The DMA layer makes it possible to do high performance I/O without worrying (much) about the underlying, architecture-specific details. Some processors have cache-coherent memory (so that devices see data written from memory immediately), while others require explicit cache flushes. Some require the use of bounce buffers for some memory regions. Others can do nice scatter/gather operations through the use of bus mapping registers. By using the DMA layer (documented in the kernel source in DMA-mapping.txt and in Chapter 13 of Linux Device Drivers), driver writers need not worry about any of that stuff.

At least, they need not worry if their hardware is on a PCI bus. The DMA layer was written with broader applicability in mind, but the current implementation is PCI-specific.

James Bottomley has sent out a proposal to change all that. Why not, says James, fold the DMA code into the generic device model subsystem and make it more broadly available? The biggest part of his patch is concerned with renaming; the pci_* functions become dma_* instead, and they take a struct device argument, rather than struct pci_dev. The patch also includes some changes to make it easy for suitably-written drivers to fall back to inconsistent (non-cache-coherent) memory when consistent memory is not available.

As of this writing, there had been no public reaction to the proposal. The patch clearly heads in the direction the developers want to go, however, and it also includes the obligatory compatibility layer. One would assume that any objections would be based on details, and not the general idea.


(Log in to post comments)

Copyright © 2002, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds