Re: [PATCH] asm-generic: add dma-mapping-linear.h

Russell King
2009-06-04T12:45:37Z

On Thu, Jun 04, 2009 at 04:57:12PM +0900, FUJITA Tomonori wrote:
> ? Why we don't need to remove stale cache after DMA_FROM_DEVICE
> transfer?

Think about a CPU which does speculative prefetches into the cache (which
later ARMs do).

The result is that, for a DMA_FROM_DEVICE transfer, you need to:

1. ensure that no cache writebacks occur to the region while DMA is
being performed
2. ensure that any data which is present in the cache for the region
is invalidated once DMA has completed

If you don't have speculative prefetches, then (1) and (2) can be (and
are at present) combined into the initial mapping setup or whenever the
buffer is handed from the CPUs ownership to the DMA device's ownership.

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/