• Anup Patel's avatar
    RISC-V: KVM: Don't clear hgatp CSR in kvm_arch_vcpu_put() · 8c3ce496
    Anup Patel authored
    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: 34bde9d8 ("RISC-V: KVM: Implement VCPU world-switch")
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarAnup Patel <apatel@ventanamicro.com>
    Signed-off-by: default avatarAnup Patel <anup@brainfault.org>
    8c3ce496
vcpu.c 21.9 KB