diff options
author | Raghavendra Rao Ananta <rananta@google.com> | 2023-08-11 04:51:22 +0000 |
---|---|---|
committer | Marc Zyngier <maz@kernel.org> | 2023-08-17 09:40:35 +0100 |
commit | 6354d15052ec88273c24beae4c99e31c3d3889b6 (patch) | |
tree | bbeceba2726c61fc443a722d35180fca61fe4f79 /arch/arm64/kvm/hyp/vhe/tlb.c | |
parent | 4d73a9c13aaa78b149ac04b02f0ee7973f233bfa (diff) | |
download | lwn-6354d15052ec88273c24beae4c99e31c3d3889b6.tar.gz lwn-6354d15052ec88273c24beae4c99e31c3d3889b6.zip |
KVM: arm64: Implement __kvm_tlb_flush_vmid_range()
Define __kvm_tlb_flush_vmid_range() (for VHE and nVHE)
to flush a range of stage-2 page-tables using IPA in one go.
If the system supports FEAT_TLBIRANGE, the following patches
would conveniently replace global TLBI such as vmalls12e1is
in the map, unmap, and dirty-logging paths with ripas2e1is
instead.
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-10-rananta@google.com
Diffstat (limited to 'arch/arm64/kvm/hyp/vhe/tlb.c')
-rw-r--r-- | arch/arm64/kvm/hyp/vhe/tlb.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/arch/arm64/kvm/hyp/vhe/tlb.c b/arch/arm64/kvm/hyp/vhe/tlb.c index e69da550cdc5..46bd43f61d76 100644 --- a/arch/arm64/kvm/hyp/vhe/tlb.c +++ b/arch/arm64/kvm/hyp/vhe/tlb.c @@ -143,6 +143,34 @@ void __kvm_tlb_flush_vmid_ipa_nsh(struct kvm_s2_mmu *mmu, __tlb_switch_to_host(&cxt); } +void __kvm_tlb_flush_vmid_range(struct kvm_s2_mmu *mmu, + phys_addr_t start, unsigned long pages) +{ + struct tlb_inv_context cxt; + unsigned long stride; + + /* + * Since the range of addresses may not be mapped at + * the same level, assume the worst case as PAGE_SIZE + */ + stride = PAGE_SIZE; + start = round_down(start, stride); + + dsb(ishst); + + /* Switch to requested VMID */ + __tlb_switch_to_guest(mmu, &cxt); + + __flush_s2_tlb_range_op(ipas2e1is, start, pages, stride, 0); + + dsb(ish); + __tlbi(vmalle1is); + dsb(ish); + isb(); + + __tlb_switch_to_host(&cxt); +} + void __kvm_tlb_flush_vmid(struct kvm_s2_mmu *mmu) { struct tlb_inv_context cxt; |