aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorYan Zhao <yan.y.zhao@intel.com>2025-03-18 09:32:10 +0800
committerSean Christopherson <seanjc@google.com>2025-04-28 11:03:06 -0700
commitd17cc13cc484821b03e5c1cc5808ecb83d10027e (patch)
treedc7500a854cb73090df76b90880ec64e884a410a
parentKVM: x86/mmu: Further check old SPTE is leaf for spurious prefetch fault (diff)
downloadwireguard-linux-d17cc13cc484821b03e5c1cc5808ecb83d10027e.tar.xz
wireguard-linux-d17cc13cc484821b03e5c1cc5808ecb83d10027e.zip
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 <yan.y.zhao@intel.com> Link: https://lore.kernel.org/r/20250318013210.5701-1-yan.y.zhao@intel.com Signed-off-by: Sean Christopherson <seanjc@google.com>
-rw-r--r--arch/x86/kvm/mmu/tdp_mmu.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c
index f53402257217..d16e3e6e46a5 100644
--- a/arch/x86/kvm/mmu/tdp_mmu.c
+++ b/arch/x86/kvm/mmu/tdp_mmu.c
@@ -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;