summaryrefslogtreecommitdiffstats
path: root/arch/riscv/kernel/traps.c
diff options
context:
space:
mode:
authorAtish Patra <atish.patra@wdc.com>2020-07-16 01:30:06 +0200
committerPalmer Dabbelt <palmerdabbelt@google.com>2020-07-30 20:37:48 +0200
commit79b1feba54558bfb7df7c516dab29a7c9dba093c (patch)
tree9ca9147c34ce65cb5e59485675978dca7b21d7dc /arch/riscv/kernel/traps.c
parentriscv: Select ARCH_HAS_DEBUG_VM_PGTABLE (diff)
downloadlinux-79b1feba54558bfb7df7c516dab29a7c9dba093c.tar.xz
linux-79b1feba54558bfb7df7c516dab29a7c9dba093c.zip
RISC-V: Setup exception vector early
The trap vector is set only in trap_init which may be too late in some cases. Early ioremap/efi spits many warning messages which may be useful. Setup the trap vector early so that any warning/bug can be handled before generic code invokes trap_init. Signed-off-by: Atish Patra <atish.patra@wdc.com> Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
Diffstat (limited to 'arch/riscv/kernel/traps.c')
-rw-r--r--arch/riscv/kernel/traps.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/arch/riscv/kernel/traps.c b/arch/riscv/kernel/traps.c
index 7d95cce5e47c..ad14f4466d92 100644
--- a/arch/riscv/kernel/traps.c
+++ b/arch/riscv/kernel/traps.c
@@ -174,13 +174,7 @@ int is_valid_bugaddr(unsigned long pc)
}
#endif /* CONFIG_GENERIC_BUG */
+/* stvec & scratch is already set from head.S */
void trap_init(void)
{
- /*
- * Set sup0 scratch register to 0, indicating to exception vector
- * that we are presently executing in the kernel
- */
- csr_write(CSR_SCRATCH, 0);
- /* Set the exception vector address */
- csr_write(CSR_TVEC, &handle_exception);
}