diff options
| author | Bo Gan <[email protected]> | 2026-06-05 04:32:10 -0700 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2026-06-16 12:31:01 +0530 |
| commit | 7dfaa4678213521e714a8a7cecb7f7a722dcd18a (patch) | |
| tree | efdaa950f7b78dec9b1e122e13340719ee8b878e | |
| parent | 1b3424d5c0901dcea24ca3427009b299662949a0 (diff) | |
include: sbi: set FS dirty in vsstatus when V=1
According to Privileged ISA 19.2.11:
Modifying the floating-point state when V=1 causes both fields
(vsstatus.FS and the HS-level sstatus.FS) to be set to 3 (Dirty)
Fixes: 130e65dd9d44 ("lib: sbi: Implement SET_FS_DIRTY() to make sure the mstatus FS dirty is set")
Signed-off-by: Bo Gan <[email protected]>
Reviewed-by: Anup Patel <[email protected]>
Tested-by: Anirudh Srinivasan <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Anup Patel <[email protected]>
| -rw-r--r-- | include/sbi/riscv_fp.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/include/sbi/riscv_fp.h b/include/sbi/riscv_fp.h index 03011af9..ff1dbc87 100644 --- a/include/sbi/riscv_fp.h +++ b/include/sbi/riscv_fp.h @@ -83,7 +83,11 @@ #define GET_FFLAGS() csr_read(CSR_FFLAGS) #define SET_FFLAGS(value) csr_write(CSR_FFLAGS, (value)) -#define SET_FS_DIRTY(regs) (regs->mstatus |= MSTATUS_FS) +#define SET_FS_DIRTY(regs) do { \ + if (sbi_regs_from_virt(regs)) \ + csr_set(CSR_VSSTATUS, MSTATUS_FS); \ + regs->mstatus |= MSTATUS_FS; \ +} while(0) #define GET_F32_RS1(insn, regs) (GET_F32_REG(insn, 15, regs)) #define GET_F32_RS2(insn, regs) (GET_F32_REG(insn, 20, regs)) |
