[U-Boot] ARM v7: Flush icache when executing a program with go

Albert ARIBAUD
2013-05-15T15:11:11Z

Hi Henrik,

On Tue, 14 May 2013 16:16:02 +0200, Henrik Nordstr?m
<henrik@henriknordstrom.net> wrote:

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

What is the rationale behind putting it in arch/ rather than in common/
by adding this to the existing common/cmd_boot.c file under ARMv7
conditionals?

Also:

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

IIUC, the issue is due to cache being enabled when doing the go, rather
than due to armv7 per se.

So, should we not have this icache flush conditioned at compile time on
cache being compiled in, and at run time on cache being enabled? This
way, we would automatically cater for the same issue appearing in other
ARM CPUs, and even more, in other architectures.

Amicalement,
--
Albert.