Skip to content

Commit 4262bd0

Browse files
RevySRpalmer-dabbelt
authored andcommitted
riscv: vector: Fix context save/restore with xtheadvector
Previously only v0-v7 were correctly saved/restored, and the context of v8-v31 are damanged. Correctly save/restore v8-v31 to avoid breaking userspace. Fixes: d863910 ("riscv: vector: Support xtheadvector save/restore") Cc: [email protected] Signed-off-by: Han Gao <[email protected]> Tested-by: Xiongchuan Tan <[email protected]> Reviewed-by: Charlie Jenkins <[email protected]> Reviewed-by: Yanteng Si <[email protected]> Reviewed-by: Andy Chiu <[email protected]> Link: https://lore.kernel.org/r/9b9eb2337f3d5336ce813721f8ebea51e0b2b553.1747994822.git.rabenda.cn@gmail.com Signed-off-by: Alexandre Ghiti <[email protected]> Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 19272b3 commit 4262bd0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

arch/riscv/include/asm/vector.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,11 @@ static inline void __riscv_v_vstate_save(struct __riscv_v_ext_state *save_to,
205205
THEAD_VSETVLI_T4X0E8M8D1
206206
THEAD_VSB_V_V0T0
207207
"add t0, t0, t4\n\t"
208-
THEAD_VSB_V_V0T0
208+
THEAD_VSB_V_V8T0
209209
"add t0, t0, t4\n\t"
210-
THEAD_VSB_V_V0T0
210+
THEAD_VSB_V_V16T0
211211
"add t0, t0, t4\n\t"
212-
THEAD_VSB_V_V0T0
212+
THEAD_VSB_V_V24T0
213213
: : "r" (datap) : "memory", "t0", "t4");
214214
} else {
215215
asm volatile (
@@ -241,11 +241,11 @@ static inline void __riscv_v_vstate_restore(struct __riscv_v_ext_state *restore_
241241
THEAD_VSETVLI_T4X0E8M8D1
242242
THEAD_VLB_V_V0T0
243243
"add t0, t0, t4\n\t"
244-
THEAD_VLB_V_V0T0
244+
THEAD_VLB_V_V8T0
245245
"add t0, t0, t4\n\t"
246-
THEAD_VLB_V_V0T0
246+
THEAD_VLB_V_V16T0
247247
"add t0, t0, t4\n\t"
248-
THEAD_VLB_V_V0T0
248+
THEAD_VLB_V_V24T0
249249
: : "r" (datap) : "memory", "t0", "t4");
250250
} else {
251251
asm volatile (

0 commit comments

Comments
 (0)