All of lore.kernel.org
 help / color / mirror / Atom feed
From: York Sun <york.sun@nxp.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [Resend RFC PATCH 2/2] armv8: Fix flush_dcache_all function
Date: Fri, 14 Oct 2016 13:17:57 -0700	[thread overview]
Message-ID: <1476476277-10527-3-git-send-email-york.sun@nxp.com> (raw)
In-Reply-To: <1476476277-10527-1-git-send-email-york.sun@nxp.com>

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

  parent reply	other threads:[~2016-10-14 20:17 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-14 20:17 [U-Boot] [Resend RFC PATCH 0/2] Fix armv8 cache flushing York Sun
2016-10-14 20:17 ` [U-Boot] [Resend RFC PATCH 1/2] armv8: Fix dcache disable function York Sun
2016-10-14 20:23   ` Stephen Warren
2016-10-17 21:22   ` Stephen Warren
2016-10-19 15:25   ` Stephen Warren
2016-10-19 17:18     ` Stephen Warren
2016-10-19 22:32       ` york sun
2016-10-19 23:01         ` Stephen Warren
2016-10-20  5:06           ` york sun
2016-10-20 18:34             ` Stephen Warren
2016-10-21 19:31               ` york sun
2016-10-24 10:59                 ` Mark Rutland
2016-10-26 19:47                   ` Stephen Warren
2016-10-26 19:54                     ` york sun
2016-10-26 20:12                       ` Stephen Warren
2016-10-26 20:29                         ` york sun
2016-10-26 21:00                           ` Stephen Warren
2016-10-26 21:04                             ` york sun
     [not found]                     ` <d51c8f86-19c7-48d8-9335-097e8f574b76@nxp.com>
2016-10-26 21:02                       ` york sun
     [not found]                       ` <060025e2-128b-8c11-1804-fab1aa686f85@nxp.com>
2016-10-28 17:38                         ` york sun
2016-10-28 17:56                           ` Stephen Warren
2016-10-28 18:17                             ` york sun
2016-10-28 18:32                               ` Stephen Warren
2016-10-28 21:35                                 ` york sun
2016-11-07 14:11                                   ` Mark Rutland
2016-11-07 16:23                                     ` york sun
2016-11-07 14:03                                 ` Mark Rutland
2016-10-24 10:44     ` Mark Rutland
2016-10-26 19:41       ` Stephen Warren
2016-10-14 20:17 ` York Sun [this message]
2016-10-14 20:29   ` [U-Boot] [Resend RFC PATCH 2/2] armv8: Fix flush_dcache_all function Stephen Warren
2016-10-14 20:38     ` york sun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1476476277-10527-3-git-send-email-york.sun@nxp.com \
    --to=york.sun@nxp.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.