Consolidate is_large_pte and is_present_pte into a single helper. This will be used in a follow-up commit to check for present large-pages during Eager Page Splitting. No functional change intended. Signed-off-by: David Matlack <dmatlack@xxxxxxxxxx> --- arch/x86/kvm/mmu/spte.h | 5 +++++ arch/x86/kvm/mmu/tdp_mmu.c | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/mmu/spte.h b/arch/x86/kvm/mmu/spte.h index cc432f9a966b..e73c41d31816 100644 --- a/arch/x86/kvm/mmu/spte.h +++ b/arch/x86/kvm/mmu/spte.h @@ -257,6 +257,11 @@ static inline bool is_large_pte(u64 pte) return pte & PT_PAGE_SIZE_MASK; } +static inline bool is_large_present_pte(u64 pte) +{ + return is_shadow_present_pte(pte) && is_large_pte(pte); +} + static inline bool is_last_spte(u64 pte, int level) { return (level == PG_LEVEL_4K) || is_large_pte(pte); diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c index ff4d83ad7580..f8c4337f1fcf 100644 --- a/arch/x86/kvm/mmu/tdp_mmu.c +++ b/arch/x86/kvm/mmu/tdp_mmu.c @@ -1011,8 +1011,7 @@ int kvm_tdp_mmu_map(struct kvm_vcpu *vcpu, struct kvm_page_fault *fault) * than the target, that SPTE must be cleared and replaced * with a non-leaf SPTE. */ - if (is_shadow_present_pte(iter.old_spte) && - is_large_pte(iter.old_spte)) { + if (is_large_present_pte(iter.old_spte)) { if (!tdp_mmu_zap_spte_atomic(vcpu->kvm, &iter)) break; } -- 2.34.0.rc2.393.gf8c9666880-goog