From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755011AbdC1KJi (ORCPT ); Tue, 28 Mar 2017 06:09:38 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:35279 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752968AbdC1KJg (ORCPT ); Tue, 28 Mar 2017 06:09:36 -0400 Subject: Re: [PATCH 2/6] KVM: VMX: cleanup check for invalid EPT violation To: David Hildenbrand , linux-kernel@vger.kernel.org, kvm@vger.kernel.org References: <1488996236-5676-1-git-send-email-pbonzini@redhat.com> <1488996236-5676-3-git-send-email-pbonzini@redhat.com> <5de81ced-c083-25e1-8954-6c232b9a7acd@redhat.com> <52507881-6444-8704-7c3a-a9c87f8e0a9b@redhat.com> Cc: bdas@redhat.com, dmatlack@google.com From: Paolo Bonzini Message-ID: <360b1dc2-3816-af90-46f7-b27298b8f009@redhat.com> Date: Tue, 28 Mar 2017 12:09:32 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <52507881-6444-8704-7c3a-a9c87f8e0a9b@redhat.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/03/2017 11:50, David Hildenbrand wrote: >> Do we have any define for this magic bit 7? >> >> #EPT_EXITQ_GLA_VALID 0x80 >> > Introducing > > #define EPT_VIOLATION_GLA_VALID_BIT > #define EPT_VIOLATION_GLA_VALID Done: diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h index cc54b7026567..bd084eafdb18 100644 --- a/arch/x86/include/asm/vmx.h +++ b/arch/x86/include/asm/vmx.h @@ -516,12 +516,14 @@ struct vmx_msr_entry { #define EPT_VIOLATION_READABLE_BIT 3 #define EPT_VIOLATION_WRITABLE_BIT 4 #define EPT_VIOLATION_EXECUTABLE_BIT 5 +#define EPT_VIOLATION_GLA_VALID_BIT 7 #define EPT_VIOLATION_ACC_READ (1 << EPT_VIOLATION_ACC_READ_BIT) #define EPT_VIOLATION_ACC_WRITE (1 << EPT_VIOLATION_ACC_WRITE_BIT) #define EPT_VIOLATION_ACC_INSTR (1 << EPT_VIOLATION_ACC_INSTR_BIT) #define EPT_VIOLATION_READABLE (1 << EPT_VIOLATION_READABLE_BIT) #define EPT_VIOLATION_WRITABLE (1 << EPT_VIOLATION_WRITABLE_BIT) #define EPT_VIOLATION_EXECUTABLE (1 << EPT_VIOLATION_EXECUTABLE_BIT) +#define EPT_VIOLATION_GLA_VALID (1 << EPT_VIOLATION_GLA_VALID_BIT) /* * VM-instruction error numbers diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 7f2f5b790a84..62984d01d7b5 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -6211,7 +6211,7 @@ static int handle_ept_violation(struct kvm_vcpu *vcpu) exit_qualification = vmcs_readl(EXIT_QUALIFICATION); - if ((exit_qualification & 0x80) == 0) { + if (!(exit_qualification & EPT_VIOLATION_GLA_VALID)) { 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), and pushed to kvm/queue. Paolo