[PATCH] mem: add flush callback to sync caches for execution

Sascha Hauer s.hauer at pengutronix.de
Mon Apr 13 23:31:02 PDT 2026


On Mon, Apr 13, 2026 at 12:28:12PM +0200, Ahmad Fatoum wrote:
> barebox always calls sync_caches_for_execution() on boot, but it can be
> useful to trigger it manually when testing:
> 
> - memcpy -s /dev/zero -d /dev/mem 0 $TFA_REGION_BASE $TFA_REGION_SIZE
> - sync /dev/mem # flush D$ and invalidate I$
> - smc -i        # check if PSCI monitor is still usable
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum at barebox.org>
> ---
>  drivers/misc/mem.c | 8 ++++++++
>  1 file changed, 8 insertions(+)

Reverted this one. It breaks compilation on riscv:

In file included from drivers/misc/mem.c:9:
arch/riscv/include/asm/cache.h: In function 'local_flush_icache_all':
arch/riscv/include/asm/cache.h:25:9: error: implicit declaration of function 'riscv_vendor_id' [-Werror=implicit-function-declaration]
   25 |  switch(riscv_vendor_id()) {

And PowerPC:

powerpc-603e-linux-gnu-ld: drivers/misc/mem.o: in function `mem_flush':
drivers/misc/mem.c:13:(.text.mem_flush+0xc): undefined reference to `sync_caches_for_execution'
make[1]: *** [Makefile:1099: barebox] Error 1

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list