api: Flush cache when closing api
PATCH 3/5 api: Flush cache when closing api
--- api/api.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
api/api.c +11 -0
@@ -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 +return err; }
Signature · 1 line
2.16.3
PATCH 3/5 api: Flush cache when closing api
Quoted 16 lines · Emmanuel Vadot
Signed-off-by Emmanuel Vadot <[email protected]>---
api/api.c| 11 +++++++++++1 file changed, 11 insertions(+)api/api.c +0
-0@@ -290,6 +290,17 @@ static int API_dev_close(va_list ap)if (!err) di->state =DEV_STA_CLOSED ;
api/api.c static int API_dev_close(va_list ap) · line 302
Quoted 10 lines
api/api.c +10
-0+#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.
Quoted 6 lines
api/api.c +0
-0return err; }Signature · 1 line
2.16.3
PATCH 3/5 api: Flush cache when closing api
Quoted 16 lines · On Mon, 30 Apr 2018 10:37:50 +0200 "Dr. Philipp Tomsich"…
Quoted 16 lines · Emmanuel Vadot
Signed-off-by Emmanuel Vadot <[email protected]>---
api/api.c| 11 +++++++++++1 file changed, 11 insertions(+)api/api.c +0
-0@@ -290,6 +290,17 @@ static int API_dev_close(va_list ap)if (!err) di->state =DEV_STA_CLOSED ;
Quoted 15 lines
api/api.c static int API_dev_close(va_list ap) · line 302
Quoted 10 lines
api/api.c +10
-0+#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_allandinvalidate_icache_allweak-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
But if everybody is happy with me adding some global weak function for
caches I'll do that.
Quoted 6 lines
Quoted 6 lines
api/api.c +0
-0return err; }Signature · 1 line
2.16.3
Signature · 1 line
Emmanuel Vadot <[email protected]> <[email protected]>
PATCH 3/5 api: Flush cache when closing api
Hi,
Quoted 19 lines · Emmanuel Vadot
Quoted 16 lines · On Mon, 30 Apr 2018 10:37:50 +0200 "Dr. Philipp Tomsich"…
Quoted 16 lines · Emmanuel Vadot
Signed-off-by Emmanuel Vadot <[email protected]>---
api/api.c| 11 +++++++++++1 file changed, 11 insertions(+)api/api.c +0
-0@@ -290,6 +290,17 @@ static int API_dev_close(va_list ap)if (!err) di->state =DEV_STA_CLOSED ;
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
api/api.c +4
-0+#if defined(CONFIG_SYS_HAVE_DCACHE_MAINTENANCE ) && \ + !defined(CONFIG_SYS_DCACHE_OFF ) +if (dcache_status ()) +flush_dcache_all ();Quoted 8 lines
api/api.c static int API_dev_close(va_list ap) · line 302
Quoted 6 lines
api/api.c +6
-0+#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_alland
invalidate_icache_all
Quoted 1 line
Quoted 1 line
weak-functions and provide a default implementation that does nothing.
Those
Quoted 1 line
Quoted 1 line
architectures that then need to implement specific cache maintenance,
could
Quoted 8 lines
Quoted 1 line
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.htmlBut if everybody is happy with me adding some global weak function for
caches I'll do that.
I'm not very happy about it. Weak functions are just so hard to figure out. Is it called or not? The lack of link-time error is painful when debugging.
Regards,
Simon
PATCH 3/5 api: Flush cache when closing api
In reply to Emmanuel VadotQuoted 35 lines · Emmanuel Vadot
Quoted 16 lines · On Mon, 30 Apr 2018 10:37:50 +0200 "Dr. Philipp Tomsich"…
Quoted 16 lines · Emmanuel Vadot
Signed-off-by Emmanuel Vadot <[email protected]>---
api/api.c| 11 +++++++++++1 file changed, 11 insertions(+)api/api.c +0
-0@@ -290,6 +290,17 @@ static int API_dev_close(va_list ap)if (!err) di->state =DEV_STA_CLOSED ;Quoted 15 lines
api/api.c static int API_dev_close(va_list ap) · line 302
Quoted 10 lines
api/api.c +10
-0+#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_allandinvalidate_icache_allweak-functions and provide a default implementation that does nothing. Those architectures that then need to implement specific cache maintenance, could override these as required.
Quoted 2 lines
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.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180504/681acce0/attachment.sig>