linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: V6 MPCore v6_dma_inv_range RWFO fix
@ 2010-11-23 22:28 Valentine Barshak
  2010-11-23 22:42 ` Russell King - ARM Linux
  0 siblings, 1 reply; 24+ messages in thread
From: Valentine Barshak @ 2010-11-23 22:28 UTC (permalink / raw)
  To: linux-arm-kernel

Cache ownership must be acqired by reading/writing data from the
cache line to make cache operation have the desired effect on the
SMP MPCore CPU. However, the ownership is never aquired in the
v6_dma_inv_range function when cleaning the first line and
flushing the last one, in case the address is not aligned
to D_CACHE_LINE_SIZE boundary.
Fix this by reading/writing data if needed, before performing
cache operations.

Signed-off-by: Valentine Barshak <vbarshak@mvista.com>
Signed-off-by: George G. Davis <gdavis@mvista.com>
---
 arch/arm/mm/cache-v6.S |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mm/cache-v6.S b/arch/arm/mm/cache-v6.S
index 99fa688..e0e5c6b 100644
--- a/arch/arm/mm/cache-v6.S
+++ b/arch/arm/mm/cache-v6.S
@@ -205,6 +205,10 @@ ENTRY(v6_flush_kern_dcache_area)
 v6_dma_inv_range:
 	tst	r0, #D_CACHE_LINE_SIZE - 1
 	bic	r0, r0, #D_CACHE_LINE_SIZE - 1
+#ifdef CONFIG_DMA_CACHE_RWFO
+	ldr	r2, [r0]			@ read for ownership
+	str	r2, [r0]			@ write for ownership
+#endif
 #ifdef HARVARD_CACHE
 	mcrne	p15, 0, r0, c7, c10, 1		@ clean D line
 #else
@@ -212,16 +216,16 @@ v6_dma_inv_range:
 #endif
 	tst	r1, #D_CACHE_LINE_SIZE - 1
 	bic	r1, r1, #D_CACHE_LINE_SIZE - 1
+#ifdef CONFIG_DMA_CACHE_RWFO
+	ldrne	r2, [r1]			@ read for ownership
+	strne	r2, [r1]			@ write for ownership
+#endif
 #ifdef HARVARD_CACHE
 	mcrne	p15, 0, r1, c7, c14, 1		@ clean & invalidate D line
 #else
 	mcrne	p15, 0, r1, c7, c15, 1		@ clean & invalidate unified line
 #endif
 1:
-#ifdef CONFIG_DMA_CACHE_RWFO
-	ldr	r2, [r0]			@ read for ownership
-	str	r2, [r0]			@ write for ownership
-#endif
 #ifdef HARVARD_CACHE
 	mcr	p15, 0, r0, c7, c6, 1		@ invalidate D line
 #else
@@ -229,6 +233,10 @@ v6_dma_inv_range:
 #endif
 	add	r0, r0, #D_CACHE_LINE_SIZE
 	cmp	r0, r1
+#ifdef CONFIG_DMA_CACHE_RWFO
+	ldrlo	r2, [r0]			@ read for ownership
+	strlo	r2, [r0]			@ write for ownership
+#endif
 	blo	1b
 	mov	r0, #0
 	mcr	p15, 0, r0, c7, c10, 4		@ drain write buffer
-- 
1.6.0.6

^ permalink raw reply related	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2010-12-10 16:49 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-23 22:28 [PATCH] ARM: V6 MPCore v6_dma_inv_range RWFO fix Valentine Barshak
2010-11-23 22:42 ` Russell King - ARM Linux
2010-11-24  0:24   ` George G. Davis
2010-11-24 10:32     ` Catalin Marinas
2010-11-24 15:14       ` George G. Davis
2010-11-24 10:42   ` Catalin Marinas
2010-11-24 15:10     ` George G. Davis
2010-11-24 15:35       ` Catalin Marinas
2010-11-24 17:33     ` Russell King - ARM Linux
2010-11-24 17:46       ` Catalin Marinas
2010-11-24 18:01         ` Russell King - ARM Linux
2010-11-24 18:07           ` Catalin Marinas
2010-11-24 18:39             ` [PATCH] ARM: V6 MPCore v6_dma_inv_range and v6_dma_flush_range " Valentine Barshak
2010-12-08 10:25               ` Valentine Barshak
2010-12-09 16:04               ` Catalin Marinas
2010-12-09 17:04                 ` Valentine Barshak
2010-12-09 22:07                 ` Stephen Boyd
2010-12-10  5:44                   ` George G. Davis
2010-12-10  5:26               ` George G. Davis
2010-12-10  9:50                 ` Catalin Marinas
2010-12-10 12:29                   ` Valentine Barshak
2010-12-10 16:49                     ` George G. Davis
2010-11-29 15:28             ` Valentine Barshak
2010-11-24 17:40   ` [PATCH] ARM: V6 MPCore v6_dma_inv_range " Valentine Barshak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).