Re: Possible discrepancy regarding streaming DMA mappings in

David S. Miller (
Thu, 23 May 2002 22:59:27 -0700 (PDT)

From: William Jhun <>
Date: Thu, 23 May 2002 16:24:25 -0700

However, shouldn't pci_dma_sync_*() be called *before* each
PCI_DMA_TODEVICE DMA transfer (after the CPU write, of course) and
*after* each PCI_DMA_FROMDEVICE DMA transfer (before CPU access)? And,
of course, before and after a "bidirectional" DMA, if appropriate.

CPU owns the data before pci_map_{sg,single}(), afterwards device
owns the data. If CPU wants ownership again, it must wait for
device to finish with the data when do a pci_sync_{sg,single}().

You are thinking about CPU cache flushing, and that is a detail
handled transparently to the DMA apis. If you follow the rules
described in the documentation and in my previous paragraph,
the ARCH specific code does the right thing for you.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at