From: Tom Rini Date: Fri, 10 Feb 2017 07:15:24 -0500 Subject: [U-Boot] [U-Boot, v4, 3/5] api: bootelf: go: flush cache before starting In-Reply-To: <20170210130740.f3d76dab8425b0fa48bebe97@bidouilliste.com> References: <20170131111708.12614-4-manu@bidouilliste.com> <20170208150054.GU26129@bill-the-cat> <20170210130740.f3d76dab8425b0fa48bebe97@bidouilliste.com> Message-ID: <20170210121524.GZ26129@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Fri, Feb 10, 2017 at 01:07:40PM +0100, Emmanuel Vadot wrote: > On Wed, 8 Feb 2017 10:00:54 -0500 > Tom Rini wrote: > > > On Tue, Jan 31, 2017 at 12:17:06PM +0100, Emmanuel Vadot wrote: > > > > > From: Warner Losh > > > > > > 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. > > > > > > Reviewed-by: Tom Rini > > > Signed-off-by: Emmanuel Vadot > > > Reviewed-by: Simon Glass > > > --- > > > api/api.c | 5 +++++ > > > cmd/boot.c | 4 ++++ > > > cmd/elf.c | 5 +++++ > > > 3 files changed, 14 insertions(+) > > > > > > diff --git a/api/api.c b/api/api.c > > > index c368511704..88b5df77c0 100644 > > > --- a/api/api.c > > > +++ b/api/api.c > > > @@ -290,6 +290,11 @@ static int API_dev_close(va_list ap) > > > if (!err) > > > di->state = DEV_STA_CLOSED; > > > > > > + if (dcache_status()) > > > + flush_dcache_all(); > > > + if (icache_status()) > > > + invalidate_icache_all(); > > > + > > > > So this runs into a problem. Building for sandbox, or many many other > > platforms gives us: > > undefined reference to `dcache_status' > > undefined reference to `flush_dcache_all' > > undefined reference to `icache_status' > > undefined reference to `invalidate_icache_all' > > > > At the high level, we have a few problems. We don't have a global "has > > icache" and "has dcache" support CONFIG symbol. We also have a few > > instances of weak functions that end up being no-ops in these cases, but > > it's not quite correct to use them in this case, possibly. For example, > > PowerPC does have dcache support and functions but no flush_dcache_all > > (and only sometimes a flush_dcache() that looks like it would be > > _all()), and same for icache. > > Hi Tom, > > Will depending on CONFIG_CMD_CACHE will be acceptable ? > This is the easiest fix that I can think of. That will continue to bring in the PowerPC side of the problem. I'll see about doing a little research to confirm what I said about the cache functions on PowerPC and we can move from there. -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: