RISC-V: KVM: Cleanup stale TLB entries when host CPU changes
authorAnup Patel <apatel@ventanamicro.com>
Mon, 9 May 2022 05:14:11 +0000 (10:44 +0530)
committerAnup Patel <anup@brainfault.org>
Fri, 20 May 2022 03:39:18 +0000 (09:09 +0530)
commit92e450507d5612d399d0abee8447305a43a412cc
tree61378ba67bac1ee1f7483ed51213f409f2322bd4
parent13acfec2dbccfafff3331a3810cd7dde2fb16891
RISC-V: KVM: Cleanup stale TLB entries when host CPU changes

On RISC-V platforms with hardware VMID support, we share same
VMID for all VCPUs of a particular Guest/VM. This means we might
have stale G-stage TLB entries on the current Host CPU due to
some other VCPU of the same Guest which ran previously on the
current Host CPU.

To cleanup stale TLB entries, we simply flush all G-stage TLB
entries by VMID whenever underlying Host CPU changes for a VCPU.

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Reviewed-by: Atish Patra <atishp@rivosinc.com>
Signed-off-by: Anup Patel <anup@brainfault.org>
arch/riscv/include/asm/kvm_host.h
arch/riscv/kvm/tlb.c
arch/riscv/kvm/vcpu.c