]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
riscv: set trap vector earlier
authoryang.zhang <yang.zhang@hexintek.com>
Wed, 8 May 2024 02:24:45 +0000 (10:24 +0800)
committerPalmer Dabbelt <palmer@rivosinc.com>
Fri, 12 Jul 2024 15:55:31 +0000 (08:55 -0700)
The exception vector of the booting hart is not set before enabling
the mmu and then still points to the value of the previous firmware,
typically _start. That makes it hard to debug setup_vm() when bad
things happen. So fix that by setting the exception vector earlier.

Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Signed-off-by: yang.zhang <yang.zhang@hexintek.com>
Link: https://lore.kernel.org/r/20240508022445.6131-1-gaoshanliukou@163.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/kernel/head.S

index a00f7523cb91f20516df57a2a05cf70343773e32..356d5397b2a252c759e21def29d34e91a4b6f314 100644 (file)
@@ -305,6 +305,9 @@ SYM_CODE_START(_start_kernel)
 #else
        mv a0, a1
 #endif /* CONFIG_BUILTIN_DTB */
+       /* Set trap vector to spin forever to help debug */
+       la a3, .Lsecondary_park
+       csrw CSR_TVEC, a3
        call setup_vm
 #ifdef CONFIG_MMU
        la a0, early_pg_dir