Skip to content

Commit edc2ae8

Browse files
committed
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 <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
1 parent 8ea667f commit edc2ae8

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

arch/x86/kvm/paging_tmpl.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,8 @@ static unsigned FNAME(gpte_access)(struct kvm_vcpu *vcpu, pt_element_t gpte)
106106
unsigned access;
107107

108108
access = (gpte & (PT_WRITABLE_MASK | PT_USER_MASK)) | ACC_EXEC_MASK;
109-
110109
#if PTTYPE == 64
111-
if (vcpu->arch.mmu.nx)
112-
access &= ~(gpte >> PT64_NX_SHIFT);
110+
access &= ~(gpte >> PT64_NX_SHIFT);
113111
#endif
114112
return access;
115113
}

0 commit comments

Comments
 (0)