mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 19:07:52 +00:00
kvm: mmu: remove is_present_gpte()
We have two versions of the above function. To prevent confusion and bugs in the future, remove the non-FNAME version entirely and replace all calls with the actual check. Signed-off-by: Bandan Das <bsd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
8d5cf1610d
commit
812f30b234
4 changed files with 3 additions and 8 deletions
|
@ -3189,7 +3189,7 @@ static int mmu_alloc_shadow_roots(struct kvm_vcpu *vcpu)
|
||||||
MMU_WARN_ON(VALID_PAGE(root));
|
MMU_WARN_ON(VALID_PAGE(root));
|
||||||
if (vcpu->arch.mmu.root_level == PT32E_ROOT_LEVEL) {
|
if (vcpu->arch.mmu.root_level == PT32E_ROOT_LEVEL) {
|
||||||
pdptr = vcpu->arch.mmu.get_pdptr(vcpu, i);
|
pdptr = vcpu->arch.mmu.get_pdptr(vcpu, i);
|
||||||
if (!is_present_gpte(pdptr)) {
|
if (!(pdptr & PT_PRESENT_MASK)) {
|
||||||
vcpu->arch.mmu.pae_root[i] = 0;
|
vcpu->arch.mmu.pae_root[i] = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,11 +93,6 @@ static inline int kvm_mmu_reload(struct kvm_vcpu *vcpu)
|
||||||
return kvm_mmu_load(vcpu);
|
return kvm_mmu_load(vcpu);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int is_present_gpte(unsigned long pte)
|
|
||||||
{
|
|
||||||
return pte & PT_PRESENT_MASK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Currently, we have two sorts of write-protection, a) the first one
|
* Currently, we have two sorts of write-protection, a) the first one
|
||||||
* write-protects guest page to sync the guest modification, b) another one is
|
* write-protects guest page to sync the guest modification, b) another one is
|
||||||
|
|
|
@ -131,7 +131,7 @@ static inline void FNAME(protect_clean_gpte)(unsigned *access, unsigned gpte)
|
||||||
static inline int FNAME(is_present_gpte)(unsigned long pte)
|
static inline int FNAME(is_present_gpte)(unsigned long pte)
|
||||||
{
|
{
|
||||||
#if PTTYPE != PTTYPE_EPT
|
#if PTTYPE != PTTYPE_EPT
|
||||||
return is_present_gpte(pte);
|
return pte & PT_PRESENT_MASK;
|
||||||
#else
|
#else
|
||||||
return pte & 7;
|
return pte & 7;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -540,7 +540,7 @@ int load_pdptrs(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, unsigned long cr3)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
for (i = 0; i < ARRAY_SIZE(pdpte); ++i) {
|
for (i = 0; i < ARRAY_SIZE(pdpte); ++i) {
|
||||||
if (is_present_gpte(pdpte[i]) &&
|
if ((pdpte[i] & PT_PRESENT_MASK) &&
|
||||||
(pdpte[i] &
|
(pdpte[i] &
|
||||||
vcpu->arch.mmu.guest_rsvd_check.rsvd_bits_mask[0][2])) {
|
vcpu->arch.mmu.guest_rsvd_check.rsvd_bits_mask[0][2])) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
Loading…
Reference in a new issue