Question on Linux DMA routines

Grant Grundler grundler@cup.hp.com
Thu, 30 Nov 2000 09:31:14 -0800


"Gunneswara Marripudi" wrote:
> Hi Grant,
> 
> I have a quick question on Linux 2.3 DMA routines.

2.3 is dead. You mean 2.4.


> If I allocate and map memory using pci_alloc_consistent(),
> do I still need to call pci_dma_sync_single() if there is a 
> need to ensure the coherency? The documentation on it
> at DMA-mapping.txt is ambiguous (at least to me). 

No - it's not needed.

> - Consistent DMA mappings which are usually mapped at driver
> 113   initialization, unmapped at the end and for which the hardware should
> 114   guarantee that the device and the cpu can access the data
> 115   in parallel and will see updates made by each other without any
> 116   explicit software flushing.
> 117 
> 118   Think of "consistent" as "synchronous" or "coherent".
> 
> 
> It says that h/w should guarantee the consistency and I'm not sure 
> what if the underlying platform is not fully coherent.

The HW *is* fully coherent when the CPU doesn't cache the pages.
Only systems with PCX-L/L2 CPU (need to) operate this way.
All other platforms have an I/O MMU which manages the coherency.

You might be confused because HPUX doesn't ever use uncached memory
for I/O since it has dma_sync() macro instead. And device driver writers
are "trained" to use that.


grant

Grant Grundler
Unix Systems Enablement Lab
+1.408.447.7253