From: Tom Rini Date: Fri, 4 May 2018 18:10:02 -0400 Subject: [U-Boot] [PATCH 3/5] api: Flush cache when closing api In-Reply-To: <20180504091249.abb2f41ee0fc3c29a8385c9c@bidouilliste.com> References: <20180430083431.72606-1-manu@freebsd.org> <20180504091249.abb2f41ee0fc3c29a8385c9c@bidouilliste.com> Message-ID: <20180504221002.GU12235@bill-the-cat.ec.rr.com> 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, May 04, 2018 at 09:12:49AM +0200, Emmanuel Vadot wrote: > On Mon, 30 Apr 2018 10:37:50 +0200 > "Dr. Philipp Tomsich" wrote: > > > > > > On 30 Apr 2018, at 10:34, Emmanuel Vadot wrote: > > > > > > Signed-off-by: Emmanuel Vadot > > > --- > > > api/api.c | 11 +++++++++++ > > > 1 file changed, 11 insertions(+) > > > > > > diff --git a/api/api.c b/api/api.c > > > index 7eee2fc083..7d1608b520 100644 > > > --- a/api/api.c > > > +++ b/api/api.c > > > @@ -290,6 +290,17 @@ static int API_dev_close(va_list ap) > > > if (!err) > > > di->state = DEV_STA_CLOSED; > > > > > > +#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 > > > > Wouldn?t it be a cleaner option to make flush_dcache_all and invalidate_icache_all > > weak-functions and provide a default implementation that does nothing. Those > > architectures that then need to implement specific cache maintenance, could > > override these as required. > > Tom had some concern about using weak function for this, see > https://lists.denx.de/pipermail/u-boot/2017-February/280652.html In this specific case before we could use weak functions we would need to do some wide-ranging cleanups for consistently named and functional cache functions. -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: