From 7774b82e4aaa6fa98d1430b02d614eadd339a8a2 Mon Sep 17 00:00:00 2001 From: whensun Date: Fri, 28 Aug 2026 14:31:04 -0700 Subject: [PATCH] lib: sbi: Fix FP state enable in sbi_fp_save sbi_fp_save() currently sets mstatus.VS before executing floating-point store instructions. VS controls vector state and does not enable floating-point instructions. Set mstatus.FS instead, matching sbi_fp_restore(), so floating-point state can be saved when FS was previously Off. Fixes: 718e1d194f5a ("lib: sbi: Add floating-point context save/restore support.") Signed-off-by: whensun Co-developed-by: Huamao Wu Signed-off-by: Huamao Wu Link: https://lore.kernel.org/r/20260828213104.84490-1-theodoruswensanfebruanto025@gmail.com Signed-off-by: Anup Patel --- lib/sbi/sbi_fp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sbi/sbi_fp.c b/lib/sbi/sbi_fp.c index c8941252..38fb7a01 100644 --- a/lib/sbi/sbi_fp.c +++ b/lib/sbi/sbi_fp.c @@ -20,7 +20,7 @@ void sbi_fp_save(struct sbi_fp_context *dst) if (!dst) return; - mstatus_orig = csr_read_set(CSR_MSTATUS, MSTATUS_VS); + mstatus_orig = csr_read_set(CSR_MSTATUS, MSTATUS_FS); asm volatile( #if defined(__riscv_d)