vmx: refine validity check for guest linear address
authorLiang Li <liang.z.li@intel.com>
Thu, 18 Aug 2016 07:49:19 +0000 (15:49 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 7 Sep 2016 17:34:27 +0000 (19:34 +0200)
The validity check for the guest line address is inefficient,
check the invalid value instead of enumerating the valid ones.

Signed-off-by: Liang Li <liang.z.li@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx.c

index 5cede40e255241a1d8db2cc52f24505a5ced65ca..8d288046676496e4747983191d135bb51b814a28 100644 (file)
@@ -6109,7 +6109,7 @@ static int handle_ept_violation(struct kvm_vcpu *vcpu)
        exit_qualification = vmcs_readl(EXIT_QUALIFICATION);
 
        gla_validity = (exit_qualification >> 7) & 0x3;
-       if (gla_validity != 0x3 && gla_validity != 0x1 && gla_validity != 0) {
+       if (gla_validity == 0x2) {
                printk(KERN_ERR "EPT: Handling EPT violation failed!\n");
                printk(KERN_ERR "EPT: GPA: 0x%lx, GVA: 0x%lx\n",
                        (long unsigned int)vmcs_read64(GUEST_PHYSICAL_ADDRESS),