KVM: x86/mmu: Skip invalid roots when zapping leaf SPTEs for GFN range
authorSean Christopherson <seanjc@google.com>
Thu, 11 Jan 2024 02:00:44 +0000 (18:00 -0800)
committerSean Christopherson <seanjc@google.com>
Fri, 23 Feb 2024 00:28:45 +0000 (16:28 -0800)
commit99b85fda91b164b91a0d4e0aae376f32dc38d59c
treee8ddec9b821086319aa948c5584493b74a650c77
parent6577f1efdff443277b19c0fbe4b933404e7c84e6
KVM: x86/mmu: Skip invalid roots when zapping leaf SPTEs for GFN range

When zapping a GFN in response to an APICv or MTRR change, don't zap SPTEs
for invalid roots as KVM only needs to ensure the guest can't use stale
mappings for the GFN.  Unlike kvm_tdp_mmu_unmap_gfn_range(), which must
zap "unreachable" SPTEs to ensure KVM doesn't mark a page accessed/dirty,
kvm_tdp_mmu_zap_leafs() isn't used (and isn't intended to be used) to
handle freeing of host memory.

Link: https://lore.kernel.org/r/20240111020048.844847-5-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/mmu/tdp_mmu.c