Skip to content

Commit 1441ca1

Browse files
Junaid Shahidbonzini
authored andcommitted
kvm: x86: mmu: Drop the need_remote_flush() function
This is only used by kvm_mmu_pte_write(), which no longer actually creates the new SPTE and instead just clears the old SPTE. So we just need to check if the old SPTE was shadow-present instead of calling need_remote_flush(). Hence we can drop this function. It was incomplete anyway as it didn't take access-tracking into account. This patch should not result in any functional change. Signed-off-by: Junaid Shahid <[email protected]> Reviewed-by: David Matlack <[email protected]> Reviewed-by: Sean Christopherson <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 959d6c4 commit 1441ca1

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

arch/x86/kvm/mmu/mmu.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5361,19 +5361,6 @@ void kvm_mmu_free_obsolete_roots(struct kvm_vcpu *vcpu)
53615361
__kvm_mmu_free_obsolete_roots(vcpu->kvm, &vcpu->arch.guest_mmu);
53625362
}
53635363

5364-
static bool need_remote_flush(u64 old, u64 new)
5365-
{
5366-
if (!is_shadow_present_pte(old))
5367-
return false;
5368-
if (!is_shadow_present_pte(new))
5369-
return true;
5370-
if ((old ^ new) & SPTE_BASE_ADDR_MASK)
5371-
return true;
5372-
old ^= shadow_nx_mask;
5373-
new ^= shadow_nx_mask;
5374-
return (old & ~new & SPTE_PERM_MASK) != 0;
5375-
}
5376-
53775364
static u64 mmu_pte_write_fetch_gpte(struct kvm_vcpu *vcpu, gpa_t *gpa,
53785365
int *bytes)
53795366
{
@@ -5519,7 +5506,7 @@ static void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
55195506
mmu_page_zap_pte(vcpu->kvm, sp, spte, NULL);
55205507
if (gentry && sp->role.level != PG_LEVEL_4K)
55215508
++vcpu->kvm->stat.mmu_pde_zapped;
5522-
if (need_remote_flush(entry, *spte))
5509+
if (is_shadow_present_pte(entry))
55235510
flush = true;
55245511
++spte;
55255512
}

0 commit comments

Comments
 (0)