]> git.baikalelectronics.ru Git - kernel.git/commit
RISC-V: KVM: Implement VMID allocator
authorAnup Patel <anup.patel@wdc.com>
Mon, 27 Sep 2021 11:40:08 +0000 (17:10 +0530)
committerAnup Patel <anup@brainfault.org>
Mon, 4 Oct 2021 10:31:04 +0000 (16:01 +0530)
commit7431557b32e26c41b05bd2e60ae38427d967b6c9
treee973bf89d33068885ec7d4f4d9c91322a25fe66a
parent4c551d4c48ebb5941a2358eeb8961c93197e5d3a
RISC-V: KVM: Implement VMID allocator

We implement a simple VMID allocator for Guests/VMs which:
1. Detects number of VMID bits at boot-time
2. Uses atomic number to track VMID version and increments
   VMID version whenever we run-out of VMIDs
3. Flushes Guest TLBs on all host CPUs whenever we run-out
   of VMIDs
4. Force updates HW Stage2 VMID for each Guest VCPU whenever
   VMID changes using VCPU request KVM_REQ_UPDATE_HGATP

Signed-off-by: Anup Patel <anup.patel@wdc.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Alexander Graf <graf@amazon.com>
Acked-by: Palmer Dabbelt <palmerdabbelt@google.com>
arch/riscv/include/asm/kvm_host.h
arch/riscv/kvm/Makefile
arch/riscv/kvm/main.c
arch/riscv/kvm/tlb.S [new file with mode: 0644]
arch/riscv/kvm/vcpu.c
arch/riscv/kvm/vm.c
arch/riscv/kvm/vmid.c [new file with mode: 0644]