Skip to contentSkip to conversation

Add KConfig option for cache maintenance availability

PATCH New Emmanuel Vadot 3 participants 3 messages Apr 30, 2018 – May 23, 2018

lore
Share & tools
lore
#0 lore raw

cover Add KConfig option for cache maintenance availability

Hi,

In order to correctly exectute some binaries on some arch we need to flush the data cache or instructions cache. Some arch offer helper functions for this while others don't (or don't have the ability to do this in hardware). Introduce some kconfig option name SYS_HAVE_DCACHE_MAINTENANCE and SYS_HAVE_ICACHE_MAINTENANCE and enable it on some arm CPU that have cache maintenance helpers.
I cannot test all arch but arch maintainers are welcome to select thoses options where it is appropriate.
The three last patches are the place we need to flush the cache while trying to boot the FreeBSD loader and have been in FreeBSD since a long time now.

Emmanuel Vadot (5):
arch: Add SYS_HAVE_DCACHE_MAINTENANCE and SYS_HAVE_ICACHE_MAINTENANCE
arch: arm: Select SYS_HAVE_{D,I}CACHE_MAINTENANCE kconfig where
appropriate
api: Flush cache when closing api
cmd: go: Flush cache before starting
cmd: bootelf: Flush cache before starting

 api/api.c        | 11 +++++++++++
 arch/Kconfig     | 12 ++++++++++++
 arch/arm/Kconfig |  7 +++++++
 cmd/boot.c       | 10 ++++++++++
 cmd/elf.c        | 11 +++++++++++
 5 files changed, 51 insertions(+)
Signature · 1 line
2.16.3
#1 lore raw

cover Add KConfig option for cache maintenance availability

Hi,

Quoted 8 lines · Emmanuel Vadot

Hi,

In order to correctly exectute some binaries on some arch we need to flush the data cache or instructions cache. Some arch offer helper functions for this while others don't (or don't have the ability to do this in hardware). Introduce some kconfig option name SYS_HAVE_DCACHE_MAINTENANCE and SYS_HAVE_ICACHE_MAINTENANCE and enable it on some arm CPU that have cache maintenance helpers.

It was decided that instead of flushing/invalidating caches, architectures should add support for allocating coherent data in the first place.

See the discussion here:
https://patchwork.ozlabs.org/patch/826131/

Thanks,
Faiz

#2 lore raw

cover Add KConfig option for cache maintenance availability

Hi Faiz,

Quoted 16 lines · On Tue, 22 May 2018 11:47:41 +0530 Faiz Abbas <[email protected]> wrote:

Hi,

Quoted 8 lines · Emmanuel Vadot

Hi,

In order to correctly exectute some binaries on some arch we need to flush the data cache or instructions cache. Some arch offer helper functions for this while others don't (or don't have the ability to do this in hardware). Introduce some kconfig option name SYS_HAVE_DCACHE_MAINTENANCE and SYS_HAVE_ICACHE_MAINTENANCE and enable it on some arm CPU that have cache maintenance helpers.

It was decided that instead of flushing/invalidating caches, architectures should add support for allocating coherent data in the first place.

Quoted 5 lines

See the discussion here:
https://patchwork.ozlabs.org/patch/826131/

Thanks,
Faiz

Thanks for the heads up.
Are you working on on this for arm ?

Cheers,

Signature · 1 line
Emmanuel Vadot <[email protected]> <[email protected]>