Commit 32121c81 authored by Raghavendra Rao Ananta's avatar Raghavendra Rao Ananta Committed by Marc Zyngier
Browse files

KVM: arm64: Use kvm_arch_flush_remote_tlbs()



Stop depending on CONFIG_HAVE_KVM_ARCH_TLB_FLUSH_ALL and opt to
standardize on kvm_arch_flush_remote_tlbs() since it avoids
duplicating the generic TLB stats across architectures that implement
their own remote TLB flush.

This adds an extra function call to the ARM64 kvm_flush_remote_tlbs()
path, but that is a small cost in comparison to flushing remote TLBs.

In addition, instead of just incrementing remote_tlb_flush_requests
stat, the generic interface would also increment the
remote_tlb_flush stat.

Signed-off-by: default avatarRaghavendra Rao Ananta <rananta@google.com>
Reviewed-by: default avatarShaoqin Huang <shahuang@redhat.com>
Reviewed-by: default avatarGavin Shan <gshan@redhat.com>
Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20230811045127.3308641-4-rananta@google.com
parent cfb0c08e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1113,6 +1113,8 @@ int __init kvm_set_ipa_limit(void);
#define __KVM_HAVE_ARCH_VM_ALLOC
struct kvm *kvm_arch_alloc_vm(void);

#define __KVM_HAVE_ARCH_FLUSH_REMOTE_TLBS

static inline bool kvm_vm_is_protected(struct kvm *kvm)
{
	return false;
+0 −1
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ menuconfig KVM
	select MMU_NOTIFIER
	select PREEMPT_NOTIFIERS
	select HAVE_KVM_CPU_RELAX_INTERCEPT
	select HAVE_KVM_ARCH_TLB_FLUSH_ALL
	select KVM_MMIO
	select KVM_GENERIC_DIRTYLOG_READ_PROTECT
	select KVM_XFER_TO_GUEST_WORK
+3 −3
Original line number Diff line number Diff line
@@ -161,15 +161,15 @@ static bool memslot_is_logging(struct kvm_memory_slot *memslot)
}

/**
 * kvm_flush_remote_tlbs() - flush all VM TLB entries for v7/8
 * kvm_arch_flush_remote_tlbs() - flush all VM TLB entries for v7/8
 * @kvm:	pointer to kvm structure.
 *
 * Interface to HYP function to flush all VM TLB entries
 */
void kvm_flush_remote_tlbs(struct kvm *kvm)
int kvm_arch_flush_remote_tlbs(struct kvm *kvm)
{
	++kvm->stat.generic.remote_tlb_flush_requests;
	kvm_call_hyp(__kvm_tlb_flush_vmid, &kvm->arch.mmu);
	return 0;
}

static bool kvm_is_device_pfn(unsigned long pfn)