mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-08-20 06:01:26 +02:00
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>
29 lines
652 B
C
29 lines
652 B
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Copyright 2020, Heinrich Schuchardt <xypron.glpk@gmx.de>
|
|
*/
|
|
|
|
#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(map_sysmem(addr, size), ptr + size);
|
|
unmap_sysmem(ptr);
|
|
}
|
|
|
|
void invalidate_icache_all(void)
|
|
{
|
|
struct sandbox_state *state = state_get_current();
|
|
|
|
/* Clang uses (char *) parameters, GCC (void *) */
|
|
__builtin___clear_cache((void *)state->ram_buf,
|
|
(void *)(state->ram_buf + state->ram_size));
|
|
}
|