Skip to content

Commit 6bc83cc

Browse files
damien-lemoalgregkh
authored andcommitted
riscv: Enable interrupts during syscalls with M-Mode
[ Upstream commit 643437b ] When running is M-Mode (no MMU config), MPIE does not get set. This results in all syscalls being executed with interrupts disabled as handle_exception never sets SR_IE as it always sees SR_PIE being cleared. Fix this by always force enabling interrupts in handle_syscall when CONFIG_RISCV_M_MODE is enabled. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> Reviewed-by: Palmer Dabbelt <palmerdabbelt@google.com> Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 094a4af commit 6bc83cc

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎arch/riscv/kernel/entry.S‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,15 @@ skip_context_tracking:
155155
tail do_trap_unknown
156156

157157
handle_syscall:
158+
#ifdef CONFIG_RISCV_M_MODE
159+
/*
160+
* When running is M-Mode (no MMU config), MPIE does not get set.
161+
* As a result, we need to force enable interrupts here because
162+
* handle_exception did not do set SR_IE as it always sees SR_PIE
163+
* being cleared.
164+
*/
165+
csrs CSR_STATUS, SR_IE
166+
#endif
158167
#if defined(CONFIG_TRACE_IRQFLAGS) || defined(CONFIG_CONTEXT_TRACKING)
159168
/* Recover a0 - a7 for system calls */
160169
REG_L a0, PT_A0(sp)

0 commit comments

Comments
 (0)