Commit d17cc13c authored by Yan Zhao's avatar Yan Zhao Committed by Sean Christopherson
Browse files

KVM: x86/tdp_mmu: Merge prefetch and access checks for spurious faults



Combine prefetch and is_access_allowed() checks into a unified path to
detect spurious faults, since both cases now share identical logic.

No functional changes.

Signed-off-by: default avatarYan Zhao <yan.y.zhao@intel.com>
Link: https://lore.kernel.org/r/20250318013210.5701-1-yan.y.zhao@intel.com


Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
parent ea9fcdf7
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -1153,12 +1153,8 @@ static int tdp_mmu_map_handle_target_level(struct kvm_vcpu *vcpu,
	if (WARN_ON_ONCE(sp->role.level != fault->goal_level))
		return RET_PF_RETRY;

	if (fault->prefetch && is_shadow_present_pte(iter->old_spte) &&
	    is_last_spte(iter->old_spte, iter->level))
		return RET_PF_SPURIOUS;

	if (is_shadow_present_pte(iter->old_spte) &&
	    is_access_allowed(fault, iter->old_spte) &&
	    (fault->prefetch || is_access_allowed(fault, iter->old_spte)) &&
	    is_last_spte(iter->old_spte, iter->level))
		return RET_PF_SPURIOUS;