From 37bf542c9ee19d54b295f0a6b70df9237d5c702d Mon Sep 17 00:00:00 2001 From: Ville Juven Date: Fri, 9 Jun 2023 13:42:48 +0300 Subject: [PATCH] mpfs/mpfs_shead.S: Remove MMU mappings and flush TLB upon boot This fixes warm reset crash when trying to access memory via old stale MMU mappings --- arch/risc-v/src/mpfs/mpfs_shead.S | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/risc-v/src/mpfs/mpfs_shead.S b/arch/risc-v/src/mpfs/mpfs_shead.S index 508025ff31..9c124c4011 100644 --- a/arch/risc-v/src/mpfs/mpfs_shead.S +++ b/arch/risc-v/src/mpfs/mpfs_shead.S @@ -84,6 +84,11 @@ __start: la gp, __global_pointer$ .option pop + /* Remove MMU mappings (if any) and flush TLB */ + + csrw satp, zero + sfence.vma x0, x0 + /* Make sure the writes to CSR stick before continuing */ fence