riscv: Allocate user's vector context in the first-use trap
authorAndy Chiu <andy.chiu@sifive.com>
Mon, 5 Jun 2023 11:07:08 +0000 (11:07 +0000)
committerPalmer Dabbelt <palmer@rivosinc.com>
Thu, 8 Jun 2023 14:16:44 +0000 (07:16 -0700)
commitcd054837243b5f36ff395c21135ff153871180f1
tree101828d8efbf173f12cb8a4faa58dbc0b093d209
parent3a2df6323defbb42234aaae804a8ad6af397016a
riscv: Allocate user's vector context in the first-use trap

Vector unit is disabled by default for all user processes. Thus, a
process will take a trap (illegal instruction) into kernel at the first
time when it uses Vector. Only after then, the kernel allocates V
context and starts take care of the context for that user process.

Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Link: https://lore.kernel.org/r/3923eeee-e4dc-0911-40bf-84c34aee962d@linaro.org
Signed-off-by: Andy Chiu <andy.chiu@sifive.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20230605110724.21391-12-andy.chiu@sifive.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/include/asm/insn.h
arch/riscv/include/asm/vector.h
arch/riscv/kernel/traps.c
arch/riscv/kernel/vector.c