aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/paging_tmpl.h
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2010-09-10 11:31:01 -0400
committerAvi Kivity <avi@redhat.com>2010-10-24 04:52:44 -0400
commit2d48a985c7bbcd72b4e92e301ea96bf1252ffc61 (patch)
treedf3c876c8754f57dfc255175ba5f4d9da7c08c77 /arch/x86/kvm/paging_tmpl.h
parent81407ca553c0c852b8cd3f38f3ec362d307f829b (diff)
KVM: MMU: Track NX state in struct kvm_mmu
With Nested Paging emulation the NX state between the two MMU contexts may differ. To make sure that always the right fault error code is recorded this patch moves the NX state into struct kvm_mmu so that the code can distinguish between L1 and L2 NX state. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/paging_tmpl.h')
-rw-r--r--arch/x86/kvm/paging_tmpl.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index a28f09bb76c6..2bdd843ad63f 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -105,7 +105,7 @@ static unsigned FNAME(gpte_access)(struct kvm_vcpu *vcpu, pt_element_t gpte)
105 105
106 access = (gpte & (PT_WRITABLE_MASK | PT_USER_MASK)) | ACC_EXEC_MASK; 106 access = (gpte & (PT_WRITABLE_MASK | PT_USER_MASK)) | ACC_EXEC_MASK;
107#if PTTYPE == 64 107#if PTTYPE == 64
108 if (is_nx(vcpu)) 108 if (vcpu->arch.mmu.nx)
109 access &= ~(gpte >> PT64_NX_SHIFT); 109 access &= ~(gpte >> PT64_NX_SHIFT);
110#endif 110#endif
111 return access; 111 return access;
@@ -272,7 +272,7 @@ error:
272 walker->error_code |= PFERR_WRITE_MASK; 272 walker->error_code |= PFERR_WRITE_MASK;
273 if (user_fault) 273 if (user_fault)
274 walker->error_code |= PFERR_USER_MASK; 274 walker->error_code |= PFERR_USER_MASK;
275 if (fetch_fault && is_nx(vcpu)) 275 if (fetch_fault && mmu->nx)
276 walker->error_code |= PFERR_FETCH_MASK; 276 walker->error_code |= PFERR_FETCH_MASK;
277 if (rsvd_fault) 277 if (rsvd_fault)
278 walker->error_code |= PFERR_RSVD_MASK; 278 walker->error_code |= PFERR_RSVD_MASK;