linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bandan Das <bsd@redhat.com>
To: kvm@vger.kernel.org
Cc: pbonzini@redhat.com, guangrong.xiao@linux.intel.com,
	kernellwp@gmail.com, linux-kernel@vger.kernel.org
Subject: [PATCH v2 3/5] mmu: remove is_present_gpte()
Date: Tue, 12 Jul 2016 18:18:50 -0400	[thread overview]
Message-ID: <1468361932-16580-4-git-send-email-bsd@redhat.com> (raw)
In-Reply-To: <1468361932-16580-1-git-send-email-bsd@redhat.com>

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>
---
 arch/x86/kvm/mmu.c         | 2 +-
 arch/x86/kvm/mmu.h         | 5 -----
 arch/x86/kvm/paging_tmpl.h | 2 +-
 arch/x86/kvm/x86.c         | 2 +-
 4 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index ae80aa4..c364dcb 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -3198,7 +3198,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;
 			}
diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h
index 66b33b9..ddc56e9 100644
--- a/arch/x86/kvm/mmu.h
+++ b/arch/x86/kvm/mmu.h
@@ -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
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index f2741db..a011054 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -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
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index b15f214..2e8618f 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -537,7 +537,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;
-- 
2.5.5

  parent reply	other threads:[~2016-07-12 22:19 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-12 22:18 [PATCH v2 0/5] Add support for EPT execute only for nested hypervisors Bandan Das
2016-07-12 22:18 ` [PATCH v2 1/5] mmu: extend the is_present check to 32 bits Bandan Das
2016-09-01 14:20   ` Li, Liang Z
2016-09-01 15:16     ` Paolo Bonzini
2016-07-12 22:18 ` [PATCH v2 2/5] mmu: don't set the present bit unconditionally Bandan Das
2016-07-13  8:10   ` Paolo Bonzini
2016-07-12 22:18 ` Bandan Das [this message]
2016-07-12 22:18 ` [PATCH v2 4/5] mmu: change unconditional setting of the u bit in fault bitmap Bandan Das
2016-07-13  8:23   ` Paolo Bonzini
2016-07-13  9:06     ` Paolo Bonzini
2016-07-12 22:18 ` [PATCH v2 5/5] vmx: advertise support for ept execute only Bandan Das
2016-07-13  9:20 ` [PATCH v2 0/5] Add support for EPT execute only for nested hypervisors Paolo Bonzini
2016-07-13  9:49   ` Fam Zheng
2016-07-13 10:03     ` Paolo Bonzini
2016-07-13 15:06   ` Bandan Das
2016-07-13 15:27     ` Paolo Bonzini
2016-07-13 15:47       ` Bandan Das
2016-07-14  6:56         ` Paolo Bonzini
2016-07-14 17:38           ` Bandan Das
2016-07-14 18:29             ` Paolo Bonzini
2016-07-14 18:52               ` Bandan Das

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1468361932-16580-4-git-send-email-bsd@redhat.com \
    --to=bsd@redhat.com \
    --cc=guangrong.xiao@linux.intel.com \
    --cc=kernellwp@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).