diff options
author | Avi Kivity <avi@redhat.com> | 2012-09-12 06:53:08 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2012-09-20 06:00:07 -0400 |
commit | edc2ae84eb40a3c062210fe01af1cae1633cc810 (patch) | |
tree | 2e286495eef839146cb720429dae0cc98aa968bf /arch/x86 | |
parent | 8ea667f259e3767fd3ee85a885c14e417835695e (diff) |
KVM: MMU: Optimize gpte_access() slightly
If nx is disabled, then is gpte[63] is set we will hit a reserved
bit set fault before checking permissions; so we can ignore the
setting of efer.nxe.
Reviewed-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kvm/paging_tmpl.h | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index bf7b4ffafab8..064bcb32d84e 100644 --- a/arch/x86/kvm/paging_tmpl.h +++ b/arch/x86/kvm/paging_tmpl.h | |||
@@ -106,10 +106,8 @@ static unsigned FNAME(gpte_access)(struct kvm_vcpu *vcpu, pt_element_t gpte) | |||
106 | unsigned access; | 106 | unsigned access; |
107 | 107 | ||
108 | access = (gpte & (PT_WRITABLE_MASK | PT_USER_MASK)) | ACC_EXEC_MASK; | 108 | access = (gpte & (PT_WRITABLE_MASK | PT_USER_MASK)) | ACC_EXEC_MASK; |
109 | |||
110 | #if PTTYPE == 64 | 109 | #if PTTYPE == 64 |
111 | if (vcpu->arch.mmu.nx) | 110 | access &= ~(gpte >> PT64_NX_SHIFT); |
112 | access &= ~(gpte >> PT64_NX_SHIFT); | ||
113 | #endif | 111 | #endif |
114 | return access; | 112 | return access; |
115 | } | 113 | } |