[PATCH] armv6: invalidate cache on DMA_FROM_DEVICE/DMA_BIDIRECTIONAL
Jamie Iles
jamie.iles at picochip.com
Sun Dec 20 20:00:22 EST 2009
Some ARMv6 cores will use speculative prefetching. This can be a problem
when devices DMA to memory and the core prefetches data before the
device has written it. This can result in stale data being stored in
the cache. The DMA API will request the invalidation but this is
currently a no-op on v6. Use the same dma_unmap_area implementation as
for v7.
Signed-off-by: Jamie Iles <jamie.iles at picochip.com>
Cc: Russell King <rmk+kernel at arm.linux.org.uk>
---
arch/arm/mm/cache-v6.S | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mm/cache-v6.S b/arch/arm/mm/cache-v6.S
index a11934e..a4da9d2 100644
--- a/arch/arm/mm/cache-v6.S
+++ b/arch/arm/mm/cache-v6.S
@@ -284,6 +284,9 @@ ENDPROC(v6_dma_map_area)
* - dir - DMA direction
*/
ENTRY(v6_dma_unmap_area)
+ add r1, r1, r0
+ teq r2, #DMA_TO_DEVICE
+ bne v6_dma_inv_range
mov pc, lr
ENDPROC(v6_dma_unmap_area)
--
1.6.5.4
More information about the linux-arm-kernel
mailing list