virt inclusion category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/10293 ---------------------------------------- Route `kvm_tlb_flush_vmid_range()` through the directed TLBI mechanism. When `kvm_tlbi_direct_enabled()` returns true, the invalidation range is sent to each vCPU as a pending TLBI request. Each vCPU performs the local TLBI when it next enters the guest. Suggested-by: Yanan Wang <wangyanan55@huawei.com> Signed-off-by: Jinqian Yang <yangjinqian1@huawei.com> --- arch/arm64/kvm/hyp/pgtable.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c index 4b6adcf5a206..4a93a1dbc682 100644 --- a/arch/arm64/kvm/hyp/pgtable.c +++ b/arch/arm64/kvm/hyp/pgtable.c @@ -10,8 +10,10 @@ #include <linux/bitfield.h> #include <asm/cacheflush.h> #include <asm/cpufeature.h> +#include <asm/kvm_mmu.h> #include <asm/kvm_pgtable.h> #include <asm/kvm_pvm.h> +#include <asm/kvm_tlbi.h> #include <asm/memory.h> #include <asm/stage2_pgtable.h> @@ -705,6 +707,13 @@ void kvm_tlb_flush_vmid_range(struct kvm_s2_mmu *mmu, { unsigned long pages = size >> PAGE_SHIFT; +#ifdef CONFIG_KVM_ARM_DIRECT_TLBI + if (kvm_tlbi_direct_enabled(kvm_s2_mmu_to_kvm(mmu))) { + kvm_tlbi_request_flush_range(kvm_s2_mmu_to_kvm(mmu), addr, size); + return; + } +#endif + if (!system_supports_tlb_range() || pages > MAX_TLBI_RANGE_PAGES) { kvm_call_hyp(__kvm_tlb_flush_vmid, mmu); return; -- 2.33.0