Skip to content

Commit 15a3b9f

Browse files
NonerKaoCharlesWu465
authored andcommitted
Fix DSP condition during context switch
Before this patch, on a (has_fpu && !has_dsp) bitmap, the context switch process always tries to save/restore non-existing DSP CSR, and thus causes non-recoverable illegal instruction exception.
1 parent 6728285 commit 15a3b9f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

arch/riscv/include/asm/switch_to.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,10 @@ static inline void __switch_to_aux(struct task_struct *prev,
8181
fstate_restore(next, task_pt_regs(next));
8282
#endif
8383
#ifdef CONFIG_DSP
84-
dspstate_save(prev);
85-
dspstate_restore(next);
84+
if (has_dsp) {
85+
dspstate_save(prev);
86+
dspstate_restore(next);
87+
}
8688
#endif
8789
}
8890

0 commit comments

Comments
 (0)