Skip to content

KVM: Add a common API for range-based TLB invalidation

David Matlack kvm kvm-riscv kvmarm linux-arm-kernel linux-mips linux-riscv 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest7 patches 5 repliesIn review
  2. v17 patches 8 repliesSuperseded

Changes in v2 from the cover letter

- Rebased on top of kvm-x86/next to resolve conflicts in changes slated for 6.3 [Sean]
- Drop CONFIG_HAVE_KVM_ARCH_TLB_FLUSH_ALL from virt/kvm/Kconfig [Oliver]

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7KVM: Rename kvm_arch_flush_remote_tlb() to kvm_arch_flush_remote_tlbs()arch/mips/include/asm/kvm_host.h arch/mips/kvm/mips.c arch/x86/include/asm/kvm_host.h +2 more+8 -80 replies
2/7KVM: arm64: Use kvm_arch_flush_remote_tlbs()arch/arm64/include/asm/kvm_host.h arch/arm64/kvm/Kconfig arch/arm64/kvm/mmu.c +2 more+6 -94 replies
3/7KVM: x86/mmu: Collapse kvm_flush_remote_tlbs_with_{range,address}() togetherarch/x86/kvm/mmu/mmu.c+6 -130 replies
4/7KVM: x86/mmu: Rename kvm_flush_remote_tlbs_with_address()arch/x86/kvm/mmu/mmu.c arch/x86/kvm/mmu/mmu_internal.h+8 -130 replies
5/7KVM: x86/MMU: Use gfn_t in kvm_flush_remote_tlbs_range()arch/x86/kvm/mmu/mmu.c arch/x86/kvm/mmu/mmu_internal.h+2 -20 replies
6/7KVM: Allow range-based TLB invalidation from common codearch/x86/include/asm/kvm_host.h arch/x86/kvm/mmu/mmu.c arch/x86/kvm/mmu/mmu_internal.h +2 more+27 -50 replies
7/7KVM: Move kvm_arch_flush_remote_tlbs_memslot() to common codearch/arm64/kvm/arm.c arch/mips/kvm/mips.c arch/riscv/kvm/mmu.c +4 more+23 -420 replies

Reviews trailers per patch

1 of 7 patches has a Reviewed-by or Acked-by.

PatchZenghui YuOliver Upton
1/7
2/7R-b A-b
3/7
4/7
5/7
6/7
7/7

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/7] KVM: Add a common API for range-based TLB invalidation

This series introduces a common API for performing range-based TLB invalidation. This is then used to supplant kvm_arch_flush_remote_tlbs_memslot() and pave the way for two other patch series:

1. https://lore.kernel.org/kvm/20230109215347.3119271-1-rananta at google.com/

Adds ARM support for range-based TLB invalidation and needs a mechanism to invoke it from common code. This series provides such a mechanism via kvm_arch_flush_remote_tlbs_range().

2. https://lore.kernel.org/kvm/20221208193857.4090582-1-dmatlack at google.com/

Refactors the TDP MMU into common code, which requires an API for range-based TLB invaliation.

This series is based on patches 29-33 from (2.), but I made some further cleanups after looking at it a second time.

Tested on x86_64 and ARM64 using KVM selftests.

Cc Raghavendra Rao Ananta <[email protected]>

v2:
- Rebased on top of kvm-x86/next to resolve conflicts in changes slated for 6.3 [Sean]
- Drop CONFIG_HAVE_KVM_ARCH_TLB_FLUSH_ALL from virt/kvm/Kconfig [Oliver]

v1: https://lore.kernel.org/kvm/20230119173559.2517103-1-dmatlack at google.com/

David Matlack (7):
KVM: Rename kvm_arch_flush_remote_tlb() to
kvm_arch_flush_remote_tlbs()
KVM: arm64: Use kvm_arch_flush_remote_tlbs()
KVM: x86/mmu: Collapse kvm_flush_remote_tlbs_with_{range,address}()
together
KVM: x86/mmu: Rename kvm_flush_remote_tlbs_with_address()
KVM: x86/MMU: Use gfn_t in kvm_flush_remote_tlbs_range()
KVM: Allow range-based TLB invalidation from common code
KVM: Move kvm_arch_flush_remote_tlbs_memslot() to common code

 arch/arm64/include/asm/kvm_host.h |  3 ++
 arch/arm64/kvm/Kconfig            |  1 -
 arch/arm64/kvm/arm.c              |  6 ----
 arch/arm64/kvm/mmu.c              |  6 ++--
 arch/mips/include/asm/kvm_host.h  |  4 +--
 arch/mips/kvm/mips.c              | 12 ++------
 arch/riscv/kvm/mmu.c              |  6 ----
 arch/x86/include/asm/kvm_host.h   |  7 +++--
 arch/x86/kvm/mmu/mmu.c            | 46 +++++++------------------------
 arch/x86/kvm/mmu/mmu_internal.h   |  7 ++---
 arch/x86/kvm/x86.c                |  2 +-
 include/linux/kvm_host.h          | 20 ++++++++++----
 virt/kvm/Kconfig                  |  3 --
 virt/kvm/kvm_main.c               | 35 +++++++++++++++++++----
 14 files changed, 73 insertions(+), 85 deletions(-)

base-commit: 503f0315c97739d3f8e645c500d81757dfbf76be
prerequisite-patch-id: 42a76ce7cec240776c21f674e99e893a3a6bee58
prerequisite-patch-id: c5ef6bbef252706b7e65b76dc9bd92cf320828f5
prerequisite-patch-id: c6e662cb6c369a47a027c25d3ccc7138a19b17f5
prerequisite-patch-id: 15a58bec64bf1537e6c9e2f52179fac652d441f7
prerequisite-patch-id: d5b6fea4724f4f2c3408b95d7ce5acdd4b528b10

Signature · 1 line
2.39.1.456.gfc5497dd1b-goog