Skip to content

Commit 6a1ce99

Browse files
avpatelpalmer-dabbelt
authored andcommitted
RISC-V: Don't enable all interrupts in trap_init()
Historically, we have been enabling all interrupts for each HART in trap_init(). Ideally, we should only enable M-mode interrupts for M-mode kernel and S-mode interrupts for S-mode kernel in trap_init(). Currently, we get suprious S-mode interrupts on Kendryte K210 board running M-mode NO-MMU kernel because we are enabling all interrupts in trap_init(). To fix this, we only enable software and external interrupt in trap_init(). In future, trap_init() will only enable software interrupt and PLIC driver will enable external interrupt using CPU notifiers. Fixes: a4c3733 ("riscv: abstract out CSR names for supervisor vs machine mode") Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]> Tested-by: Palmer Dabbelt <[email protected]> [QMEU virt machine with SMP] [Palmer: Move the Fixes up to a newer commit] Reviewed-by: Palmer Dabbelt <[email protected]> Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent c68a903 commit 6a1ce99

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/riscv/kernel/traps.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,6 @@ void __init trap_init(void)
156156
csr_write(CSR_SCRATCH, 0);
157157
/* Set the exception vector address */
158158
csr_write(CSR_TVEC, &handle_exception);
159-
/* Enable all interrupts */
160-
csr_write(CSR_IE, -1);
159+
/* Enable interrupts */
160+
csr_write(CSR_IE, IE_SIE | IE_EIE);
161161
}

0 commit comments

Comments
 (0)