diff options
author | Dong, Eddie <eddie.dong@intel.com> | 2009-03-31 11:03:45 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-06-10 04:48:36 -0400 |
commit | 20c466b56168ddccf034c136510d73e4a0e18605 (patch) | |
tree | 92da7e4f5daab7ed5573b64819e8b1389d1c1287 | |
parent | 93ba03c2e2aba23b042cc15eef83b7a66d3ac17a (diff) |
KVM: Use rsvd_bits_mask in load_pdptrs()
Also remove bit 5-6 from rsvd_bits_mask per latest SDM.
Signed-off-by: Eddie Dong <Eddie.Dong@intel.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r-- | arch/x86/kvm/mmu.c | 8 | ||||
-rw-r--r-- | arch/x86/kvm/mmu.h | 5 | ||||
-rw-r--r-- | arch/x86/kvm/x86.c | 3 |
3 files changed, 10 insertions, 6 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index b2c8e28021c..da3ad3cf314 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -225,11 +225,6 @@ static int is_nx(struct kvm_vcpu *vcpu) | |||
225 | return vcpu->arch.shadow_efer & EFER_NX; | 225 | return vcpu->arch.shadow_efer & EFER_NX; |
226 | } | 226 | } |
227 | 227 | ||
228 | static int is_present_pte(unsigned long pte) | ||
229 | { | ||
230 | return pte & PT_PRESENT_MASK; | ||
231 | } | ||
232 | |||
233 | static int is_shadow_present_pte(u64 pte) | 228 | static int is_shadow_present_pte(u64 pte) |
234 | { | 229 | { |
235 | return pte != shadow_trap_nonpresent_pte | 230 | return pte != shadow_trap_nonpresent_pte |
@@ -2195,6 +2190,9 @@ static void reset_rsvds_bits_mask(struct kvm_vcpu *vcpu, int level) | |||
2195 | context->rsvd_bits_mask[1][0] = ~0ull; | 2190 | context->rsvd_bits_mask[1][0] = ~0ull; |
2196 | break; | 2191 | break; |
2197 | case PT32E_ROOT_LEVEL: | 2192 | case PT32E_ROOT_LEVEL: |
2193 | context->rsvd_bits_mask[0][2] = | ||
2194 | rsvd_bits(maxphyaddr, 63) | | ||
2195 | rsvd_bits(7, 8) | rsvd_bits(1, 2); /* PDPTE */ | ||
2198 | context->rsvd_bits_mask[0][1] = exb_bit_rsvd | | 2196 | context->rsvd_bits_mask[0][1] = exb_bit_rsvd | |
2199 | rsvd_bits(maxphyaddr, 62); /* PDE */ | 2197 | rsvd_bits(maxphyaddr, 62); /* PDE */ |
2200 | context->rsvd_bits_mask[0][0] = exb_bit_rsvd | | 2198 | context->rsvd_bits_mask[0][0] = exb_bit_rsvd | |
diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h index eaab2145f62..3494a2fb136 100644 --- a/arch/x86/kvm/mmu.h +++ b/arch/x86/kvm/mmu.h | |||
@@ -75,4 +75,9 @@ static inline int is_paging(struct kvm_vcpu *vcpu) | |||
75 | return vcpu->arch.cr0 & X86_CR0_PG; | 75 | return vcpu->arch.cr0 & X86_CR0_PG; |
76 | } | 76 | } |
77 | 77 | ||
78 | static inline int is_present_pte(unsigned long pte) | ||
79 | { | ||
80 | return pte & PT_PRESENT_MASK; | ||
81 | } | ||
82 | |||
78 | #endif | 83 | #endif |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 7fe83fe145f..70ee81e50d9 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -234,7 +234,8 @@ int load_pdptrs(struct kvm_vcpu *vcpu, unsigned long cr3) | |||
234 | goto out; | 234 | goto out; |
235 | } | 235 | } |
236 | for (i = 0; i < ARRAY_SIZE(pdpte); ++i) { | 236 | for (i = 0; i < ARRAY_SIZE(pdpte); ++i) { |
237 | if ((pdpte[i] & 1) && (pdpte[i] & 0xfffffff0000001e6ull)) { | 237 | if (is_present_pte(pdpte[i]) && |
238 | (pdpte[i] & vcpu->arch.mmu.rsvd_bits_mask[0][2])) { | ||
238 | ret = 0; | 239 | ret = 0; |
239 | goto out; | 240 | goto out; |
240 | } | 241 | } |