]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
KVM: RISC-V: SBI FWFT: Mark vCPU CSRs dirty after setting feature value
authorYong-Xuan Wang <yongxuan.wang@sifive.com>
Mon, 1 Jun 2026 10:26:22 +0000 (03:26 -0700)
committerAnup Patel <anup@brainfault.org>
Fri, 5 Jun 2026 16:08:58 +0000 (21:38 +0530)
Mark the vCPU CSRs as dirty after successfully setting an FWFT feature
value. FWFT features may modify CSRs (e.g., pointer masking modifies
henvcfg.PMM), and failing to mark them dirty can lead to the guest
observing stale CSR state after vCPU scheduling or migration.

Fixes: 1323a5cfe52c ("KVM: riscv: Skip CSR restore if VCPU is reloaded on the same core")
Signed-off-by: Yong-Xuan Wang <yongxuan.wang@sifive.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20260601-kvm-get_reg_list-v2-v5-1-415d08a2813b@sifive.com
Signed-off-by: Anup Patel <anup@brainfault.org>
arch/riscv/kvm/vcpu_sbi_fwft.c

index 2eab15339694f66b5462f5f08da41fbfffe2fc27..5e4aafb0cbf16f69ceedd3c1739502586679d716 100644 (file)
@@ -521,6 +521,7 @@ static int kvm_sbi_ext_fwft_set_reg(struct kvm_vcpu *vcpu, unsigned long reg_num
                break;
        case 2:
                ret = conf->feature->set(vcpu, conf, true, value);
+               vcpu->arch.csr_dirty = true;
                break;
        default:
                return -ENOENT;