aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mm/cache-v6.S
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2009-10-31 12:52:16 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-02-15 10:22:25 -0500
commit2ffe2da3e71652d4f4cae19539b5c78c2a239136 (patch)
tree1b69404360a47369c858e54643bab6836015ddbd /arch/arm/mm/cache-v6.S
parent702b94bff3c50542a6e4ab9a4f4cef093262fe65 (diff)
ARM: dma-mapping: fix for speculative prefetching
ARMv6 and ARMv7 CPUs can perform speculative prefetching, which makes DMA cache coherency handling slightly more interesting. Rather than being able to rely upon the CPU not accessing the DMA buffer until DMA has completed, we now must expect that the cache could be loaded with possibly stale data from the DMA buffer. Where DMA involves data being transferred to the device, we clean the cache before handing it over for DMA, otherwise we invalidate the buffer to get rid of potential writebacks. On DMA Completion, if data was transferred from the device, we invalidate the buffer to get rid of any stale speculative prefetches. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Tested-By: Santosh Shilimkar <santosh.shilimkar@ti.com>
Diffstat (limited to 'arch/arm/mm/cache-v6.S')
-rw-r--r--arch/arm/mm/cache-v6.S10
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/arm/mm/cache-v6.S b/arch/arm/mm/cache-v6.S
index a11934e53fbd..9d89c67a1cc3 100644
--- a/arch/arm/mm/cache-v6.S
+++ b/arch/arm/mm/cache-v6.S
@@ -271,10 +271,9 @@ ENTRY(v6_dma_flush_range)
271 */ 271 */
272ENTRY(v6_dma_map_area) 272ENTRY(v6_dma_map_area)
273 add r1, r1, r0 273 add r1, r1, r0
274 cmp r2, #DMA_TO_DEVICE 274 teq r2, #DMA_FROM_DEVICE
275 beq v6_dma_clean_range 275 beq v6_dma_inv_range
276 bcs v6_dma_inv_range 276 b v6_dma_clean_range
277 b v6_dma_flush_range
278ENDPROC(v6_dma_map_area) 277ENDPROC(v6_dma_map_area)
279 278
280/* 279/*
@@ -284,6 +283,9 @@ ENDPROC(v6_dma_map_area)
284 * - dir - DMA direction 283 * - dir - DMA direction
285 */ 284 */
286ENTRY(v6_dma_unmap_area) 285ENTRY(v6_dma_unmap_area)
286 add r1, r1, r0
287 teq r2, #DMA_TO_DEVICE
288 bne v6_dma_inv_range
287 mov pc, lr 289 mov pc, lr
288ENDPROC(v6_dma_unmap_area) 290ENDPROC(v6_dma_unmap_area)
289 291