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

From: Russell King
Date: Thu Jun 04 2009 - 08:45:49 EST


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/
maintainer of:
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/