
RISC-V does not guarantee that stores to instruction memory are visible to instruction fetches (i.e. incoherent instruction caches). Invalidate the instruction cache to ensure the kernel function pointer points to the correct memory location.
Signed-off-by: Lukas Auer lukas.auer@aisec.fraunhofer.de ---
Changes in v2: - Clarify reasoning behind patch in commit message
arch/riscv/lib/bootm.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/arch/riscv/lib/bootm.c b/arch/riscv/lib/bootm.c index 2b5ccce933..c1cf618806 100644 --- a/arch/riscv/lib/bootm.c +++ b/arch/riscv/lib/bootm.c @@ -40,6 +40,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) return 1;
kernel = (void (*)(ulong, void *))images->ep; + invalidate_icache_all();
bootstage_mark(BOOTSTAGE_ID_RUN_OS);