summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSean Christopherson <seanjc@google.com>2022-04-23 05:47:42 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2022-05-03 13:22:32 +0200
commit54eb3ef56f36827aad90915df33387d4c2b5df5a (patch)
tree5195007378fe1da49eb190efde28e6e9981f410f /lib
parentKVM: x86/mmu: Don't treat fully writable SPTEs as volatile (modulo A/D) (diff)
downloadlinux-54eb3ef56f36827aad90915df33387d4c2b5df5a.tar.xz
linux-54eb3ef56f36827aad90915df33387d4c2b5df5a.zip
KVM: x86/mmu: Move shadow-present check out of spte_has_volatile_bits()
Move the is_shadow_present_pte() check out of spte_has_volatile_bits() and into its callers. Well, caller, since only one of its two callers doesn't already do the shadow-present check. Opportunistically move the helper to spte.c/h so that it can be used by the TDP MMU, which is also the primary motivation for the shadow-present change. Unlike the legacy MMU, the TDP MMU uses a single path for clear leaf and non-leaf SPTEs, and to avoid unnecessary atomic updates, the TDP MMU will need to check is_last_spte() prior to calling spte_has_volatile_bits(), and calling is_last_spte() without first calling is_shadow_present_spte() is at best odd, and at worst a violation of KVM's loosely defines SPTE rules. Note, mmu_spte_clear_track_bits() could likely skip the write entirely for SPTEs that are not shadow-present. Leave that cleanup for a future patch to avoid introducing a functional change, and because the shadow-present check can likely be moved further up the stack, e.g. drop_large_spte() appears to be the only path that doesn't already explicitly check for a shadow-present SPTE. No functional change intended. Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson <seanjc@google.com> Message-Id: <20220423034752.1161007-3-seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'lib')
0 files changed, 0 insertions, 0 deletions