:: commit 21e15f3791f90167e402cfaf1b450f77a61e3e4d

Mintsuki <mintsuki@protonmail.com> — 2026-03-14 23:34

parents: 31202dc374

protos/linux_risc: Clean caches before aarch64 kernel entry

diff --git a/common/protos/linux_risc.c b/common/protos/linux_risc.c
index 57d789b0..9e164a3c 100644
--- a/common/protos/linux_risc.c
+++ b/common/protos/linux_risc.c
@@ -380,6 +380,11 @@ noreturn static void jump_to_kernel(struct boot_param *p) {
     printv("linux: device tree blob at %p\n", p->dtb);
 
     void (*kernel_entry)(uint64_t dtb, uint64_t res0, uint64_t res1, uint64_t res2) = p->kernel_base;
+
+    // Clean caches for the loaded kernel image
+    clean_dcache_poc((uintptr_t)p->kernel_base, (uintptr_t)p->kernel_base + p->kernel_size);
+    inval_icache_pou((uintptr_t)p->kernel_base, (uintptr_t)p->kernel_base + p->kernel_size);
+
     asm ("msr daifset, 0xF");
     kernel_entry((uint64_t)p->dtb, 0, 0, 0);
 #elif defined(__loongarch__)
tab: 248 wrap: offon