public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] ARM v7: Flush icache when executing a program with go
@ 2013-05-14 14:16 Henrik Nordström
  2013-05-15 15:11 ` Albert ARIBAUD
  0 siblings, 1 reply; 18+ messages in thread
From: Henrik Nordström @ 2013-05-14 14:16 UTC (permalink / raw)
  To: u-boot

Tom Rini wanted me to post this again. There is no change from previous
version.

I do agree with Wolfgang Denk that this really SHOULD NOT be arch
specific. The only reason why I made this ARMv7 specific is because
blindly calling invalidate_icache_all() from the go command will cause
loud complains on other arches where the icache is not
supported/enabled. The question is what is the correct solution

- Doing it arch specific like this (or other arch aproach?)

- Change invalidate_icache_all() to be silent if the icache is not
enabled/supported?

- Something else?

---

ARM v7 runs with icache enabled. For reliable results the go command
needs to flush the icache before jumping or it may risk running
cached instructions that differ from what currently is in memory.

---
 arch/arm/cpu/armv7/Makefile   |    1 +
 arch/arm/cpu/armv7/cmd_boot.c |   37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/cmd_boot.c

diff --git a/arch/arm/cpu/armv7/Makefile b/arch/arm/cpu/armv7/Makefile
index 4fdbee4..da1b5e8 100644
--- a/arch/arm/cpu/armv7/Makefile
+++ b/arch/arm/cpu/armv7/Makefile
@@ -31,6 +31,7 @@ COBJS	+= cache_v7.o
 
 COBJS	+= cpu.o
 COBJS	+= syslib.o
+COBJS	+= cmd_boot.o
 
 ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA20),)
 SOBJS	+= lowlevel_init.o
diff --git a/arch/arm/cpu/armv7/cmd_boot.c b/arch/arm/cpu/armv7/cmd_boot.c
new file mode 100644
index 0000000..6758a55
--- /dev/null
+++ b/arch/arm/cpu/armv7/cmd_boot.c
@@ -0,0 +1,37 @@
+/*
+ * (C) Copyright 2000-2003
+ * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+/*
+ * Misc boot support
+ */
+#include <common.h>
+#include <command.h>
+
+#ifdef CONFIG_CMD_GO
+unsigned long do_go_exec(ulong (*entry)(int, char * const []), int argc,
+				 char * const argv[])
+{
+	invalidate_icache_all();
+	return entry(argc, argv);
+}
+#endif
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2013-05-21 21:57 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-14 14:16 [U-Boot] ARM v7: Flush icache when executing a program with go Henrik Nordström
2013-05-15 15:11 ` Albert ARIBAUD
2013-05-15 16:34   ` Henrik Nordström
2013-05-15 16:44     ` Albert ARIBAUD
2013-05-15 16:51       ` Tom Rini
2013-05-15 17:39         ` Albert ARIBAUD
2013-05-16  1:54           ` Henrik Nordström
2013-05-16  7:14             ` Wolfgang Denk
2013-05-16 13:37               ` Tom Rini
2013-05-16 15:37                 ` Henrik Nordström
2013-05-16 22:13                   ` Wolfgang Denk
2013-05-17 12:16                     ` Henrik Nordström
2013-05-20  0:55                       ` Kuo-Jung Su
2013-05-21 12:37                         ` Wolfgang Denk
2013-05-21 12:26                       ` Wolfgang Denk
2013-05-21 21:57                         ` Henrik Nordström
2013-05-21 12:38                   ` Kees Jongenburger
2013-05-21 16:45                     ` Albert ARIBAUD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox