summaryrefslogtreecommitdiff
path: root/arch/sandbox/cpu/cache.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2024-11-27 11:17:19 -0600
committerTom Rini <trini@konsulko.com>2024-12-02 16:34:30 -0600
commite46e4d6fd7f969f0e60b0f54b69830da543b0d96 (patch)
tree7e46dc3af99af6a435d4f7dd924182d427cb0c5b /arch/sandbox/cpu/cache.c
parentbda30f83f9a218bbcf6f58a5ad15eb00a5bd3c4b (diff)
sandbox: efi_loader: Correct use of addresses as pointers
The cache-flush function is incorrect which causes a crash in the remoteproc tests with arm64. Fix both problems by using map_sysmem() to convert an address to a pointer and map_to_sysmem() to convert a pointer to an address. Also update the image-loader's cache-flushing logic. Signed-off-by: Simon Glass <sjg@chromium.org> Fixes: 3286d223fd7 ("sandbox: implement invalidate_icache_all()") Acked-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Changes in v6: - Re-introduce Changes in v2: - Drop message about EFI_LOADER arch/sandbox/cpu/cache.c | 8 +++++++- drivers/remoteproc/rproc-elf-loader.c | 18 +++++++++++------- lib/efi_loader/efi_image_loader.c | 3 ++- 3 files changed, 20 insertions(+), 9 deletions(-) Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'arch/sandbox/cpu/cache.c')
-rw-r--r--arch/sandbox/cpu/cache.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/sandbox/cpu/cache.c b/arch/sandbox/cpu/cache.c
index c8a5e64214b..96b3da47e8e 100644
--- a/arch/sandbox/cpu/cache.c
+++ b/arch/sandbox/cpu/cache.c
@@ -4,12 +4,18 @@
*/
#include <cpu_func.h>
+#include <mapmem.h>
#include <asm/state.h>
void flush_cache(unsigned long addr, unsigned long size)
{
+ void *ptr;
+
+ ptr = map_sysmem(addr, size);
+
/* Clang uses (char *) parameters, GCC (void *) */
- __builtin___clear_cache((void *)addr, (void *)(addr + size));
+ __builtin___clear_cache(map_sysmem(addr, size), ptr + size);
+ unmap_sysmem(ptr);
}
void invalidate_icache_all(void)