Skip to content

Commit d17cc13

Browse files
yanzhao56sean-jc
authored andcommitted
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: Yan Zhao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent ea9fcdf commit d17cc13

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

arch/x86/kvm/mmu/tdp_mmu.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,12 +1153,8 @@ static int tdp_mmu_map_handle_target_level(struct kvm_vcpu *vcpu,
11531153
if (WARN_ON_ONCE(sp->role.level != fault->goal_level))
11541154
return RET_PF_RETRY;
11551155

1156-
if (fault->prefetch && is_shadow_present_pte(iter->old_spte) &&
1157-
is_last_spte(iter->old_spte, iter->level))
1158-
return RET_PF_SPURIOUS;
1159-
11601156
if (is_shadow_present_pte(iter->old_spte) &&
1161-
is_access_allowed(fault, iter->old_spte) &&
1157+
(fault->prefetch || is_access_allowed(fault, iter->old_spte)) &&
11621158
is_last_spte(iter->old_spte, iter->level))
11631159
return RET_PF_SPURIOUS;
11641160

0 commit comments

Comments
 (0)