summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmytro Maluka <dmaluka@chromium.org>2025-09-26 15:51:39 +0200
committerSean Christopherson <seanjc@google.com>2025-10-13 14:50:46 -0700
commitb850841a53c56665c1f623edd429b3fc1578e9a4 (patch)
treea5ad86e6fcaea4e70ce2340f1324db876b9370f8
parent3a8660878839faadb4f1a6dd72c3179c1df56787 (diff)
KVM: x86/mmu: Skip MMIO SPTE invalidation if enable_mmio_caching=0
If MMIO caching is disabled, there are no MMIO SPTEs to invalidate, so the costly zapping of all pages is unnecessary even in the unlikely case when the MMIO generation number has wrapped. Signed-off-by: Dmytro Maluka <dmaluka@chromium.org> Link: https://lore.kernel.org/r/20250926135139.1597781-1-dmaluka@chromium.org Signed-off-by: Sean Christopherson <seanjc@google.com>
-rw-r--r--arch/x86/kvm/mmu/mmu.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index 667d66cf76d5..18d69d48bc55 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -7364,6 +7364,9 @@ void kvm_mmu_invalidate_mmio_sptes(struct kvm *kvm, u64 gen)
{
WARN_ON_ONCE(gen & KVM_MEMSLOT_GEN_UPDATE_IN_PROGRESS);
+ if (!enable_mmio_caching)
+ return;
+
gen &= MMIO_SPTE_GEN_MASK;
/*