* [PATCH v2] riscv: vector: Fix context save/restore with xtheadvector
@ 2025-05-23 10:25 Han Gao
2025-05-24 9:58 ` Andy Chiu
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Han Gao @ 2025-05-23 10:25 UTC (permalink / raw)
To: linux-riscv, Han Gao
Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
Charlie Jenkins, Andy Chiu, Jesse Taube, Conor Dooley,
Xiongchuan Tan, linux-kernel
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: d863910eabaf ("riscv: vector: Support xtheadvector save/restore")
Signed-off-by: Han Gao <rabenda.cn@gmail.com>
Tested-by: Xiongchuan Tan <tanxiongchuan@isrc.iscas.ac.cn>
Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>
---
Changes in v2:
Add fix tag
Improve commit mesage
v1: https://lore.kernel.org/linux-riscv/c221c98dc2369ea691e3eb664bf084dc909496f6.1747934680.git.rabenda.cn@gmail.com/
arch/riscv/include/asm/vector.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/arch/riscv/include/asm/vector.h b/arch/riscv/include/asm/vector.h
index e8a83f55be2b..7df6355023a3 100644
--- a/arch/riscv/include/asm/vector.h
+++ b/arch/riscv/include/asm/vector.h
@@ -200,11 +200,11 @@ static inline void __riscv_v_vstate_save(struct __riscv_v_ext_state *save_to,
THEAD_VSETVLI_T4X0E8M8D1
THEAD_VSB_V_V0T0
"add t0, t0, t4\n\t"
- THEAD_VSB_V_V0T0
+ THEAD_VSB_V_V8T0
"add t0, t0, t4\n\t"
- THEAD_VSB_V_V0T0
+ THEAD_VSB_V_V16T0
"add t0, t0, t4\n\t"
- THEAD_VSB_V_V0T0
+ THEAD_VSB_V_V24T0
: : "r" (datap) : "memory", "t0", "t4");
} else {
asm volatile (
@@ -236,11 +236,11 @@ static inline void __riscv_v_vstate_restore(struct __riscv_v_ext_state *restore_
THEAD_VSETVLI_T4X0E8M8D1
THEAD_VLB_V_V0T0
"add t0, t0, t4\n\t"
- THEAD_VLB_V_V0T0
+ THEAD_VLB_V_V8T0
"add t0, t0, t4\n\t"
- THEAD_VLB_V_V0T0
+ THEAD_VLB_V_V16T0
"add t0, t0, t4\n\t"
- THEAD_VLB_V_V0T0
+ THEAD_VLB_V_V24T0
: : "r" (datap) : "memory", "t0", "t4");
} else {
asm volatile (
--
2.47.2
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] riscv: vector: Fix context save/restore with xtheadvector
2025-05-23 10:25 [PATCH v2] riscv: vector: Fix context save/restore with xtheadvector Han Gao
@ 2025-05-24 9:58 ` Andy Chiu
2025-05-26 2:37 ` Yanteng Si
2025-06-12 20:10 ` patchwork-bot+linux-riscv
2 siblings, 0 replies; 4+ messages in thread
From: Andy Chiu @ 2025-05-24 9:58 UTC (permalink / raw)
To: Han Gao
Cc: linux-riscv, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Alexandre Ghiti, Charlie Jenkins, Jesse Taube, Conor Dooley,
Xiongchuan Tan, linux-kernel
On Fri, May 23, 2025 at 6:26 PM Han Gao <rabenda.cn@gmail.com> wrote:
>
> 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: d863910eabaf ("riscv: vector: Support xtheadvector save/restore")
> Signed-off-by: Han Gao <rabenda.cn@gmail.com>
> Tested-by: Xiongchuan Tan <tanxiongchuan@isrc.iscas.ac.cn>
> Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>
Reviewed-by: Andy Chiu <andybnac@gmail.com>
> ---
>
> Changes in v2:
> Add fix tag
> Improve commit mesage
>
> v1: https://lore.kernel.org/linux-riscv/c221c98dc2369ea691e3eb664bf084dc909496f6.1747934680.git.rabenda.cn@gmail.com/
>
> arch/riscv/include/asm/vector.h | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/arch/riscv/include/asm/vector.h b/arch/riscv/include/asm/vector.h
> index e8a83f55be2b..7df6355023a3 100644
> --- a/arch/riscv/include/asm/vector.h
> +++ b/arch/riscv/include/asm/vector.h
> @@ -200,11 +200,11 @@ static inline void __riscv_v_vstate_save(struct __riscv_v_ext_state *save_to,
> THEAD_VSETVLI_T4X0E8M8D1
> THEAD_VSB_V_V0T0
> "add t0, t0, t4\n\t"
> - THEAD_VSB_V_V0T0
> + THEAD_VSB_V_V8T0
> "add t0, t0, t4\n\t"
> - THEAD_VSB_V_V0T0
> + THEAD_VSB_V_V16T0
> "add t0, t0, t4\n\t"
> - THEAD_VSB_V_V0T0
> + THEAD_VSB_V_V24T0
> : : "r" (datap) : "memory", "t0", "t4");
> } else {
> asm volatile (
> @@ -236,11 +236,11 @@ static inline void __riscv_v_vstate_restore(struct __riscv_v_ext_state *restore_
> THEAD_VSETVLI_T4X0E8M8D1
> THEAD_VLB_V_V0T0
> "add t0, t0, t4\n\t"
> - THEAD_VLB_V_V0T0
> + THEAD_VLB_V_V8T0
> "add t0, t0, t4\n\t"
> - THEAD_VLB_V_V0T0
> + THEAD_VLB_V_V16T0
> "add t0, t0, t4\n\t"
> - THEAD_VLB_V_V0T0
> + THEAD_VLB_V_V24T0
> : : "r" (datap) : "memory", "t0", "t4");
> } else {
> asm volatile (
> --
> 2.47.2
>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] riscv: vector: Fix context save/restore with xtheadvector
2025-05-23 10:25 [PATCH v2] riscv: vector: Fix context save/restore with xtheadvector Han Gao
2025-05-24 9:58 ` Andy Chiu
@ 2025-05-26 2:37 ` Yanteng Si
2025-06-12 20:10 ` patchwork-bot+linux-riscv
2 siblings, 0 replies; 4+ messages in thread
From: Yanteng Si @ 2025-05-26 2:37 UTC (permalink / raw)
To: Han Gao, linux-riscv
Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
Charlie Jenkins, Andy Chiu, Jesse Taube, Conor Dooley,
Xiongchuan Tan, linux-kernel
在 5/23/25 6:25 PM, Han Gao 写道:
> 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: d863910eabaf ("riscv: vector: Support xtheadvector save/restore")
> Signed-off-by: Han Gao <rabenda.cn@gmail.com>
> Tested-by: Xiongchuan Tan <tanxiongchuan@isrc.iscas.ac.cn>
> Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>
Reviewed-by: Yanteng Si <si.yanteng@linux.dev>
Thanks,
Yanteng
> ---
>
> Changes in v2:
> Add fix tag
> Improve commit mesage
>
> v1: https://lore.kernel.org/linux-riscv/c221c98dc2369ea691e3eb664bf084dc909496f6.1747934680.git.rabenda.cn@gmail.com/
>
> arch/riscv/include/asm/vector.h | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/arch/riscv/include/asm/vector.h b/arch/riscv/include/asm/vector.h
> index e8a83f55be2b..7df6355023a3 100644
> --- a/arch/riscv/include/asm/vector.h
> +++ b/arch/riscv/include/asm/vector.h
> @@ -200,11 +200,11 @@ static inline void __riscv_v_vstate_save(struct __riscv_v_ext_state *save_to,
> THEAD_VSETVLI_T4X0E8M8D1
> THEAD_VSB_V_V0T0
> "add t0, t0, t4\n\t"
> - THEAD_VSB_V_V0T0
> + THEAD_VSB_V_V8T0
> "add t0, t0, t4\n\t"
> - THEAD_VSB_V_V0T0
> + THEAD_VSB_V_V16T0
> "add t0, t0, t4\n\t"
> - THEAD_VSB_V_V0T0
> + THEAD_VSB_V_V24T0
> : : "r" (datap) : "memory", "t0", "t4");
> } else {
> asm volatile (
> @@ -236,11 +236,11 @@ static inline void __riscv_v_vstate_restore(struct __riscv_v_ext_state *restore_
> THEAD_VSETVLI_T4X0E8M8D1
> THEAD_VLB_V_V0T0
> "add t0, t0, t4\n\t"
> - THEAD_VLB_V_V0T0
> + THEAD_VLB_V_V8T0
> "add t0, t0, t4\n\t"
> - THEAD_VLB_V_V0T0
> + THEAD_VLB_V_V16T0
> "add t0, t0, t4\n\t"
> - THEAD_VLB_V_V0T0
> + THEAD_VLB_V_V24T0
> : : "r" (datap) : "memory", "t0", "t4");
> } else {
> asm volatile (
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] riscv: vector: Fix context save/restore with xtheadvector
2025-05-23 10:25 [PATCH v2] riscv: vector: Fix context save/restore with xtheadvector Han Gao
2025-05-24 9:58 ` Andy Chiu
2025-05-26 2:37 ` Yanteng Si
@ 2025-06-12 20:10 ` patchwork-bot+linux-riscv
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+linux-riscv @ 2025-06-12 20:10 UTC (permalink / raw)
To: Han Gao
Cc: linux-riscv, paul.walmsley, palmer, aou, alex, charlie, andybnac,
jesse, conor.dooley, tanxiongchuan, linux-kernel
Hello:
This patch was applied to riscv/linux.git (fixes)
by Palmer Dabbelt <palmer@dabbelt.com>:
On Fri, 23 May 2025 18:25:56 +0800 you wrote:
> 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: d863910eabaf ("riscv: vector: Support xtheadvector save/restore")
> Signed-off-by: Han Gao <rabenda.cn@gmail.com>
> Tested-by: Xiongchuan Tan <tanxiongchuan@isrc.iscas.ac.cn>
> Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>
>
> [...]
Here is the summary with links:
- [v2] riscv: vector: Fix context save/restore with xtheadvector
https://git.kernel.org/riscv/c/4262bd0d9cc7
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-06-12 22:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-23 10:25 [PATCH v2] riscv: vector: Fix context save/restore with xtheadvector Han Gao
2025-05-24 9:58 ` Andy Chiu
2025-05-26 2:37 ` Yanteng Si
2025-06-12 20:10 ` patchwork-bot+linux-riscv
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).