[U-Boot] [Resend RFC PATCH 2/2] armv8: Fix flush_dcache_all function

York Sun york.sun at nxp.com
Fri Oct 14 22:17:57 CEST 2016


Previously it was believed L3 cache has to be flushed in order to guarantee
data integrity in main memory. However, flushing L3 cache may require EL3,
depending on SoC implementation. Flushing with virtual address can also
put data into main memory. The trick is to find the correct address range.
For U-Boot to function correctly, the stack needs to be flushed, up to the
top of ram used by U-Boot.

Signed-off-by: York Sun <york.sun at nxp.com>

---
Stephen Warren, your recently added flushing L3 cache for tegra (8e5d804).
Can you check if your board still works with this proposed change?

 arch/arm/cpu/armv8/cache_v8.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/arch/arm/cpu/armv8/cache_v8.c b/arch/arm/cpu/armv8/cache_v8.c
index 92d6277..f5494f8 100644
--- a/arch/arm/cpu/armv8/cache_v8.c
+++ b/arch/arm/cpu/armv8/cache_v8.c
@@ -430,14 +430,13 @@ void invalidate_dcache_all(void)
  */
 inline void flush_dcache_all(void)
 {
-	int ret;
+	ulong sp;
 
+	asm("mov %0, sp" : "=r"(sp) : );
+	/* Flush stack to the top of ram */
+	__asm_flush_dcache_range(sp, gd->ram_top);
+	/* Flush cache by way/set */
 	__asm_flush_dcache_all();
-	ret = __asm_flush_l3_cache();
-	if (ret)
-		debug("flushing dcache returns 0x%x\n", ret);
-	else
-		debug("flushing dcache successfully.\n");
 }
 
 /*
-- 
2.7.4



More information about the U-Boot mailing list