All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 5/5] cmd: bootelf: Flush cache before starting
@ 2018-04-30  8:34 Emmanuel Vadot
  0 siblings, 0 replies; only message in thread
From: Emmanuel Vadot @ 2018-04-30  8:34 UTC (permalink / raw)
  To: u-boot

Some application might load some code at location that contain stale
cache entries. Before running a elf or raw binary, flush the caches
if they are enabled.

Signed-off-by: Emmanuel Vadot <manu@freebsd.org>
---
 cmd/elf.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/cmd/elf.c b/cmd/elf.c
index 5b59fc6329..f372306de5 100644
--- a/cmd/elf.c
+++ b/cmd/elf.c
@@ -109,6 +109,17 @@ static unsigned long do_bootelf_exec(ulong (*entry)(int, char * const[]),
 {
 	unsigned long ret;
 
+#if defined(CONFIG_SYS_HAVE_DCACHE_MAINTENANCE) && \
+	!defined(CONFIG_SYS_DCACHE_OFF)
+	if (dcache_status())
+		flush_dcache_all();
+#endif
+#if defined(CONFIG_SYS_HAVE_ICACHE_MAINTENANCE) && \
+	!defined(CONFIG_SYS_ICACHE_OFF)
+	if (icache_status())
+		invalidate_icache_all();
+#endif
+
 	/*
 	 * pass address parameter as argv[0] (aka command name),
 	 * and all remaining args
-- 
2.16.3

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-04-30  8:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-30  8:34 [U-Boot] [PATCH 5/5] cmd: bootelf: Flush cache before starting Emmanuel Vadot

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.