kvm: mmu: remove is_present_gpte()
authorBandan Das <bsd@redhat.com>
Tue, 12 Jul 2016 22:18:50 +0000 (18:18 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 14 Jul 2016 07:02:47 +0000 (09:02 +0200)
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>
arch/x86/kvm/mmu.c
arch/x86/kvm/mmu.h
arch/x86/kvm/paging_tmpl.h
arch/x86/kvm/x86.c

index 55a20c0524feafba41a9fb8907cb33cf17e12dd8..6471f8788bd2f34b7d8d7e83a9ef069e6f8cbf3b 100644 (file)
@@ -3189,7 +3189,7 @@ static int mmu_alloc_shadow_roots(struct kvm_vcpu *vcpu)
                MMU_WARN_ON(VALID_PAGE(root));
                if (vcpu->arch.mmu.root_level == PT32E_ROOT_LEVEL) {
                        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;
                                continue;
                        }
index 66b33b96a31b47138c9fef94c20e034d07678cb7..ddc56e91f2e491ff26631ccc432b2cf15cec05a0 100644 (file)
@@ -93,11 +93,6 @@ static inline int kvm_mmu_reload(struct kvm_vcpu *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
  * write-protects guest page to sync the guest modification, b) another one is
index bc019f70e0b6bb374d851bdb3be32ea09e49768b..fda5b64ae8f11c96bc5357f63d180a5b19b2daf3 100644 (file)
@@ -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)
 {
 #if PTTYPE != PTTYPE_EPT
-       return is_present_gpte(pte);
+       return pte & PT_PRESENT_MASK;
 #else
        return pte & 7;
 #endif
index 0cc6cf834cdd7f1b695d6c247fd5fd74d3eab83a..bb6e8bfaee3b6824423e92b2e48603593dbf1d05 100644 (file)
@@ -540,7 +540,7 @@ int load_pdptrs(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, unsigned long cr3)
                goto out;
        }
        for (i = 0; i < ARRAY_SIZE(pdpte); ++i) {
-               if (is_present_gpte(pdpte[i]) &&
+               if ((pdpte[i] & PT_PRESENT_MASK) &&
                    (pdpte[i] &
                     vcpu->arch.mmu.guest_rsvd_check.rsvd_bits_mask[0][2])) {
                        ret = 0;
This page took 0.030806 seconds and 5 git commands to generate.