[SRU,Disco] Revert "KVM: x86: Manually calculate reserved bits when loading PDPTRS"
diff mbox series

Message ID 20191112091628.152551-3-cascardo@canonical.com
State New
Headers show
Series
  • [SRU,Disco] Revert "KVM: x86: Manually calculate reserved bits when loading PDPTRS"
Related show

Commit Message

Thadeu Lima de Souza Cascardo Nov. 12, 2019, 9:16 a.m. UTC
BugLink: https://bugs.launchpad.net/bugs/1851709

This reverts commit 208007519a7385a57b0c0a3c180142a521594876.

This commit has caused failure to launch 64-bit linux VMs when kvm-intel
ept module parameter is off. It is off by default on old Intel CPUs.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
---
 arch/x86/kvm/x86.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

Patch
diff mbox series

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index f832fa5011cd..fd00cfdfb6c3 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -672,14 +672,8 @@  static int kvm_read_nested_guest_page(struct kvm_vcpu *vcpu, gfn_t gfn,
 				       data, offset, len, access);
 }
 
-static inline u64 pdptr_rsvd_bits(struct kvm_vcpu *vcpu)
-{
-	return rsvd_bits(cpuid_maxphyaddr(vcpu), 63) | rsvd_bits(5, 8) |
-	       rsvd_bits(1, 2);
-}
-
 /*
- * Load the pae pdptrs.  Return 1 if they are all valid, 0 otherwise.
+ * Load the pae pdptrs.  Return true is they are all valid.
  */
 int load_pdptrs(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, unsigned long cr3)
 {
@@ -698,7 +692,8 @@  int load_pdptrs(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, unsigned long cr3)
 	}
 	for (i = 0; i < ARRAY_SIZE(pdpte); ++i) {
 		if ((pdpte[i] & PT_PRESENT_MASK) &&
-		    (pdpte[i] & pdptr_rsvd_bits(vcpu))) {
+		    (pdpte[i] &
+		     vcpu->arch.mmu->guest_rsvd_check.rsvd_bits_mask[0][2])) {
 			ret = 0;
 			goto out;
 		}