KVM: arm64: Implement kvm_arch_flush_remote_tlbs_range()
authorRaghavendra Rao Ananta <rananta@google.com>
Fri, 11 Aug 2023 04:51:24 +0000 (04:51 +0000)
committerMarc Zyngier <maz@kernel.org>
Thu, 17 Aug 2023 08:40:35 +0000 (09:40 +0100)
Implement kvm_arch_flush_remote_tlbs_range() for arm64
to invalidate the given range in the TLB.

Signed-off-by: Raghavendra Rao Ananta <rananta@google.com>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Reviewed-by: Shaoqin Huang <shahuang@redhat.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20230811045127.3308641-12-rananta@google.com
arch/arm64/include/asm/kvm_host.h
arch/arm64/kvm/mmu.c

index 44ae44b502cff361a88bdb51811e0bed7f0a047e..f623b989ddd184034c928cb70f4ee9c39ebf6cb0 100644 (file)
@@ -1115,6 +1115,8 @@ struct kvm *kvm_arch_alloc_vm(void);
 
 #define __KVM_HAVE_ARCH_FLUSH_REMOTE_TLBS
 
+#define __KVM_HAVE_ARCH_FLUSH_REMOTE_TLBS_RANGE
+
 static inline bool kvm_vm_is_protected(struct kvm *kvm)
 {
        return false;
index 3494659d939c67ce35836741e2c5c4314cbf46bc..c73cec7975192e0d0583ad01b98d25349f85ac4c 100644 (file)
@@ -172,6 +172,14 @@ int kvm_arch_flush_remote_tlbs(struct kvm *kvm)
        return 0;
 }
 
+int kvm_arch_flush_remote_tlbs_range(struct kvm *kvm,
+                                     gfn_t gfn, u64 nr_pages)
+{
+       kvm_tlb_flush_vmid_range(&kvm->arch.mmu,
+                               gfn << PAGE_SHIFT, nr_pages << PAGE_SHIFT);
+       return 0;
+}
+
 static bool kvm_is_device_pfn(unsigned long pfn)
 {
        return !pfn_is_map_memory(pfn);