[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <360b1dc2-3816-af90-46f7-b27298b8f009@redhat.com>
Date: Tue, 28 Mar 2017 12:09:32 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: David Hildenbrand <david@...hat.com>, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org
Cc: bdas@...hat.com, dmatlack@...gle.com
Subject: Re: [PATCH 2/6] KVM: VMX: cleanup check for invalid EPT violation
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
Powered by blists - more mailing lists