Skip to content

Commit 5b6048f

Browse files
AndybnACTpalmer-dabbelt
authored andcommitted
riscv: vector: use a mask to write vstate_ctrl
riscv_v_ctrl_set() should only touch bits within PR_RISCV_V_VSTATE_CTRL_MASK. So, use the mask when we really set task's vstate_ctrl. Signed-off-by: Andy Chiu <[email protected]> Tested-by: Björn Töpel <[email protected]> Tested-by: Lad Prabhakar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent d6c78f1 commit 5b6048f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/riscv/kernel/vector.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ static inline void riscv_v_ctrl_set(struct task_struct *tsk, int cur, int nxt,
122122
ctrl |= VSTATE_CTRL_MAKE_NEXT(nxt);
123123
if (inherit)
124124
ctrl |= PR_RISCV_V_VSTATE_CTRL_INHERIT;
125-
tsk->thread.vstate_ctrl = ctrl;
125+
tsk->thread.vstate_ctrl &= ~PR_RISCV_V_VSTATE_CTRL_MASK;
126+
tsk->thread.vstate_ctrl |= ctrl;
126127
}
127128

128129
bool riscv_v_vstate_ctrl_user_allowed(void)

0 commit comments

Comments
 (0)