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

2016-10-14 Thread york sun
On 10/14/2016 01:01 PM, York Sun wrote:
> 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 
>

Pardon me for this mess up. I thought I put the following addresses in 
Series-cc. But evidentially I did it wrong.

York


>   Thierry Reding ,
>   Radha Mohan Chintakuntla ,
>   Alison Wang ,
>   Albert Aribaud ,
>   Sergey Temerkhanov ,
>   Stephen Warren 

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2016-10-14 Thread York Sun
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 

Thierry Reding ,
Radha Mohan Chintakuntla ,
Alison Wang ,
Albert Aribaud ,
Sergey Temerkhanov ,
Stephen Warren 

---
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

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot