Skip to content

Commit 8c3ce49

Browse files
committed
RISC-V: KVM: Don't clear hgatp CSR in kvm_arch_vcpu_put()
We might have RISC-V systems (such as QEMU) where VMID is not part of the TLB entry tag so these systems will have to flush all TLB entries upon any change in hgatp.VMID. Currently, we zero-out hgatp CSR in kvm_arch_vcpu_put() and we re-program hgatp CSR in kvm_arch_vcpu_load(). For above described systems, this will flush all TLB entries whenever VCPU exits to user-space hence reducing performance. This patch fixes above described performance issue by not clearing hgatp CSR in kvm_arch_vcpu_put(). Fixes: 34bde9d ("RISC-V: KVM: Implement VCPU world-switch") Cc: [email protected] Signed-off-by: Anup Patel <[email protected]> Signed-off-by: Anup Patel <[email protected]>
1 parent a44e2c2 commit 8c3ce49

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

arch/riscv/kvm/vcpu.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -653,8 +653,6 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
653653
vcpu->arch.isa);
654654
kvm_riscv_vcpu_host_fp_restore(&vcpu->arch.host_context);
655655

656-
csr_write(CSR_HGATP, 0);
657-
658656
csr->vsstatus = csr_read(CSR_VSSTATUS);
659657
csr->vsie = csr_read(CSR_VSIE);
660658
csr->vstvec = csr_read(CSR_VSTVEC);

0 commit comments

Comments
 (0)