[U-Boot] ARM v7: Flush icache when executing a program with go
Henrik Nordström
henrik at henriknordstrom.net
Thu May 16 17:37:49 CEST 2013
tor 2013-05-16 klockan 09:37 -0400 skrev Tom Rini:
> That this topic keeps coming up is one of the reasons I asked Henrik to
> post this patch when I was looking over the Allwinner support queue. I
> thought this was a rather clever fixup.
For what it's worth a similar issue is also relevant to bootm, but it's
a bit different there trying to disable the icache entirely.
I do not like having these things arch specific. I implemented it as an
ARMv7 hook only because there is no general cross-platform u-boot
function for clearing the icache. I'd much rather have a generic
function call for invalidating the cache and leave it up to the arches
to get it implemented where needed.
icache_invalidate_all() is close to that call, except that it's only
reasonably possible to use it on ARMv7 currently. Trying to use it
anywhere else will give confusing (but correct) and unneeded errors on
the console, if it at all builds (requires CONFIG_CACHE).
Cluttering the places that need the flush with ARCH specific details
such as defines is generally not very maintainable. I'd rather have
those in the appropriate header.
> The problem is that with go we can't know 'size' for go because it's
> just a binary blob, so we need, roughly, flush_cache(gd->ram_top -
> gd->reloc_off, gd->ram_size) yes? That I believe is one of the points
> that wasn't solved in the last go-round here.
Yes.
For this approach the icache flushes need to go into the places where
data are loaded into memory. But that would be even worse performance
killer.
Or maybe just punt it. If you are on an arch with incoherent caches then
make sure to make use of the cache command to flush caches and maybe
even disable caches before using go.
Regards
Henrik
More information about the U-Boot
mailing list