aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/DMA-mapping.txt
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2006-04-01 13:21:52 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-04-14 15:25:26 -0400
commit21440d313358043b0ce5e43b00ff3c9b35a8616c (patch)
tree32f3ed659a76ad6e4a6061b57346178cf3fa6256 /Documentation/DMA-mapping.txt
parent2d1e1c754d641bb8a32f0ce909dcff32906830ef (diff)
[PATCH] dma doc updates
This updates the DMA API documentation to address a few issues: - The dma_map_sg() call results are used like pci_map_sg() results: using sg_dma_address() and sg_dma_len(). That's not wholly obvious to folk reading _only_ the "new" DMA-API.txt writeup. - Buffers allocated by dma_alloc_coherent() may not be completely free of coherency concerns ... some CPUs also have write buffers that may need to be flushed. - Cacheline coherence issues are now mentioned as being among issues which affect dma buffers, and complicate/prevent using of static and (especially) stack based buffers with the DMA calls. I don't think many drivers currently need to worry about flushing write buffers, but I did hit it with one SOC using external SDRAM for DMA descriptors: without explicit writebuffer flushing, the on-chip DMA controller accessed descriptors before the CPU completed the writes. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'Documentation/DMA-mapping.txt')
-rw-r--r--Documentation/DMA-mapping.txt22
1 files changed, 17 insertions, 5 deletions
diff --git a/Documentation/DMA-mapping.txt b/Documentation/DMA-mapping.txt
index 10bf4deb96aa..7c717699032c 100644
--- a/Documentation/DMA-mapping.txt
+++ b/Documentation/DMA-mapping.txt
@@ -58,11 +58,15 @@ translating each of those pages back to a kernel address using
58something like __va(). [ EDIT: Update this when we integrate 58something like __va(). [ EDIT: Update this when we integrate
59Gerd Knorr's generic code which does this. ] 59Gerd Knorr's generic code which does this. ]
60 60
61This rule also means that you may not use kernel image addresses 61This rule also means that you may use neither kernel image addresses
62(ie. items in the kernel's data/text/bss segment, or your driver's) 62(items in data/text/bss segments), nor module image addresses, nor
63nor may you use kernel stack addresses for DMA. Both of these items 63stack addresses for DMA. These could all be mapped somewhere entirely
64might be mapped somewhere entirely different than the rest of physical 64different than the rest of physical memory. Even if those classes of
65memory. 65memory could physically work with DMA, you'd need to ensure the I/O
66buffers were cacheline-aligned. Without that, you'd see cacheline
67sharing problems (data corruption) on CPUs with DMA-incoherent caches.
68(The CPU could write to one word, DMA would write to a different one
69in the same cache line, and one of them could be overwritten.)
66 70
67Also, this means that you cannot take the return of a kmap() 71Also, this means that you cannot take the return of a kmap()
68call and DMA to/from that. This is similar to vmalloc(). 72call and DMA to/from that. This is similar to vmalloc().
@@ -284,6 +288,11 @@ There are two types of DMA mappings:
284 288
285 in order to get correct behavior on all platforms. 289 in order to get correct behavior on all platforms.
286 290
291 Also, on some platforms your driver may need to flush CPU write
292 buffers in much the same way as it needs to flush write buffers
293 found in PCI bridges (such as by reading a register's value
294 after writing it).
295
287- Streaming DMA mappings which are usually mapped for one DMA transfer, 296- Streaming DMA mappings which are usually mapped for one DMA transfer,
288 unmapped right after it (unless you use pci_dma_sync_* below) and for which 297 unmapped right after it (unless you use pci_dma_sync_* below) and for which
289 hardware can optimize for sequential accesses. 298 hardware can optimize for sequential accesses.
@@ -303,6 +312,9 @@ There are two types of DMA mappings:
303 312
304Neither type of DMA mapping has alignment restrictions that come 313Neither type of DMA mapping has alignment restrictions that come
305from PCI, although some devices may have such restrictions. 314from PCI, although some devices may have such restrictions.
315Also, systems with caches that aren't DMA-coherent will work better
316when the underlying buffers don't share cache lines with other data.
317
306 318
307 Using Consistent DMA mappings. 319 Using Consistent DMA mappings.
308 320