summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorYong-Xuan Wang <yongxuan.wang@sifive.com>2026-07-21 22:52:02 -0700
committerAnup Patel <anup@brainfault.org>2026-08-08 19:18:11 +0530
commitdfdf1374fdeccb5b7e3d35186228e01ec5ea5f01 (patch)
tree40833cf0b0067f23f513c0f8911a08169faf5b49 /include/linux
parent735bc20c24187ca419c9d5e63860a54b91be34bd (diff)
KVM: RISC-V: Clear former VCPU cache on virtualization disable
When a CPU is taken offline or enters deep idle states, hypervisor CSR state is lost. The kvm_former_vcpu fast-path optimization caches the last VCPU that ran on each CPU to avoid expensive CSR restoration when the same VCPU is re-scheduled on the same CPU. However, if this cache is not cleared when CSR state is lost, the next VCPU entry will incorrectly skip CSR restoration, leading to corrupt hypervisor state. Add kvm_riscv_clear_former_vcpu() to invalidate the per-CPU cache and call it from kvm_arch_disable_virtualization_cpu() to ensure proper CSR restoration after CPU offline or system suspend events. 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: Nutty Liu <nutty.liu@hotmail.com> Reviewed-by: Anup Patel <anup@brainfault.org> Link: https://lore.kernel.org/r/20260721-kvm-cpu-pm-v4-1-146bf942547d@sifive.com Signed-off-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'include/linux')
0 files changed, 0 insertions, 0 deletions