[PATCH] riscv: Add sysctl to control discard of vstate during syscall
Radim Krčmář
rkrcmar at ventanamicro.com
Mon Jul 21 07:54:25 PDT 2025
2025-07-21T14:35:38+02:00, Radim Krčmář <rkrcmar at ventanamicro.com>:
> Shouldn't the RISC-V Linux syscall ABI be defined somewhere?
To clarify this point. My issue is with the following part in
Documentation/arch/riscv/vector.rst:
>> As indicated by version 1.0 of the V extension [1], vector registers are
>> clobbered by system calls.
>> [...]
>> 1: https://github.com/riscv/riscv-v-spec/blob/master/calling-convention.adoc
The ISA does not say that vector registers are clobbered by system
calls. All the ISA says is:
"This Appendix is only a placeholder to help explain the conventions
used in the code examples, and is not considered frozen or
part of the ratification process. The official RISC-V psABI document
is being expanded to specify the vector calling conventions."
while the RISC-V psABI says:
"The calling convention for system calls does not fall within the
scope of this document. Please refer to the documentation of the
RISC-V execution environment interface (e.g OS kernel ABI, SBI)."
We made a circular dependency, misinterpreted the ISA, and probably
implemented a suboptimal syscall ABI -- preserving vector registers
seems strictly better.
> How come we could have broken it with 9657e9b7d253?
We changed the ABI once, so maybe we can change it back?
Thanks.
More information about the linux-riscv
mailing list