aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Chiu <[email protected]>2024-01-15 05:59:27 +0000
committerPalmer Dabbelt <[email protected]>2024-01-16 07:14:00 -0800
commit5b6048f2ff710196c85ce14373febe8be5115bbe (patch)
tree5f618b35a76dd50561a6bec9f82c548ba0f344c5
parentd6c78f1ca3e8ec3fd1afa1bc567cdf083e7af9fe (diff)
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]>
-rw-r--r--arch/riscv/kernel/vector.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/riscv/kernel/vector.c b/arch/riscv/kernel/vector.c
index 66e8c6ab09d2..c1f28bc89ec6 100644
--- a/arch/riscv/kernel/vector.c
+++ b/arch/riscv/kernel/vector.c
@@ -122,7 +122,8 @@ static inline void riscv_v_ctrl_set(struct task_struct *tsk, int cur, int nxt,
ctrl |= VSTATE_CTRL_MAKE_NEXT(nxt);
if (inherit)
ctrl |= PR_RISCV_V_VSTATE_CTRL_INHERIT;
- tsk->thread.vstate_ctrl = ctrl;
+ tsk->thread.vstate_ctrl &= ~PR_RISCV_V_VSTATE_CTRL_MASK;
+ tsk->thread.vstate_ctrl |= ctrl;
}
bool riscv_v_vstate_ctrl_user_allowed(void)