[U-Boot] [PATCH] ARMv8: Bug fix of dcache_disable()

fenghua at phytium.com.cn fenghua at phytium.com.cn
Mon Feb 9 09:51:59 CET 2015


From: David Feng <fenghua at phytium.com.cn>

The cache disable operation shoud be performed after flush_dcache_all().
If cache disable operation is performed before
flush_dcache_all(), flush_dcache_all() store data directly to memory
and may be overrided by data copy in cache.

Signed-off-by: David Feng <fenghua at phytium.com.cn>
---
 arch/arm/cpu/armv8/cache_v8.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/cpu/armv8/cache_v8.c b/arch/arm/cpu/armv8/cache_v8.c
index 9dbcdf2..dc2fc8c 100644
--- a/arch/arm/cpu/armv8/cache_v8.c
+++ b/arch/arm/cpu/armv8/cache_v8.c
@@ -124,9 +124,10 @@ void dcache_disable(void)
 	if (!(sctlr & CR_C))
 		return;
 
+	flush_dcache_all();
+
 	set_sctlr(sctlr & ~(CR_C|CR_M));
 
-	flush_dcache_all();
 	__asm_invalidate_tlb_all();
 }
 
-- 
1.7.9.5




More information about the U-Boot mailing list