[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2c3c8d8a7919f86a8062f93bf9dd56e2c8865459.camel@redhat.com>
Date: Wed, 06 Jul 2022 15:16:32 +0300
From: Maxim Levitsky <mlevitsk@...hat.com>
To: Sean Christopherson <seanjc@...gle.com>,
Paolo Bonzini <pbonzini@...hat.com>
Cc: Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, Oliver Upton <oupton@...gle.com>,
Peter Shier <pshier@...gle.com>
Subject: Re: [PATCH v2 20/21] KVM: selftests: Use uapi header to get VMX and
SVM exit reasons/codes
On Tue, 2022-06-14 at 20:47 +0000, Sean Christopherson wrote:
> Include the vmx.h and svm.h uapi headers that KVM so kindly provides
> instead of manually defining all the same exit reasons/code.
>
> Signed-off-by: Sean Christopherson <seanjc@...gle.com>
> ---
> .../selftests/kvm/include/x86_64/svm_util.h | 7 +--
> .../selftests/kvm/include/x86_64/vmx.h | 51 +------------------
> 2 files changed, 4 insertions(+), 54 deletions(-)
>
> diff --git a/tools/testing/selftests/kvm/include/x86_64/svm_util.h b/tools/testing/selftests/kvm/include/x86_64/svm_util.h
> index a339b537a575..7aee6244ab6a 100644
> --- a/tools/testing/selftests/kvm/include/x86_64/svm_util.h
> +++ b/tools/testing/selftests/kvm/include/x86_64/svm_util.h
> @@ -9,15 +9,12 @@
> #ifndef SELFTEST_KVM_SVM_UTILS_H
> #define SELFTEST_KVM_SVM_UTILS_H
>
> +#include <asm/svm.h>
> +
> #include <stdint.h>
> #include "svm.h"
> #include "processor.h"
>
> -#define SVM_EXIT_EXCP_BASE 0x040
> -#define SVM_EXIT_HLT 0x078
> -#define SVM_EXIT_MSR 0x07c
> -#define SVM_EXIT_VMMCALL 0x081
> -
> struct svm_test_data {
> /* VMCB */
> struct vmcb *vmcb; /* gva */
> diff --git a/tools/testing/selftests/kvm/include/x86_64/vmx.h b/tools/testing/selftests/kvm/include/x86_64/vmx.h
> index 99fa1410964c..e4206f69b716 100644
> --- a/tools/testing/selftests/kvm/include/x86_64/vmx.h
> +++ b/tools/testing/selftests/kvm/include/x86_64/vmx.h
> @@ -8,6 +8,8 @@
> #ifndef SELFTEST_KVM_VMX_H
> #define SELFTEST_KVM_VMX_H
>
> +#include <asm/vmx.h>
> +
> #include <stdint.h>
> #include "processor.h"
> #include "apic.h"
> @@ -100,55 +102,6 @@
> #define VMX_EPT_VPID_CAP_AD_BITS 0x00200000
>
> #define EXIT_REASON_FAILED_VMENTRY 0x80000000
> -#define EXIT_REASON_EXCEPTION_NMI 0
> -#define EXIT_REASON_EXTERNAL_INTERRUPT 1
> -#define EXIT_REASON_TRIPLE_FAULT 2
> -#define EXIT_REASON_INTERRUPT_WINDOW 7
> -#define EXIT_REASON_NMI_WINDOW 8
> -#define EXIT_REASON_TASK_SWITCH 9
> -#define EXIT_REASON_CPUID 10
> -#define EXIT_REASON_HLT 12
> -#define EXIT_REASON_INVD 13
> -#define EXIT_REASON_INVLPG 14
> -#define EXIT_REASON_RDPMC 15
> -#define EXIT_REASON_RDTSC 16
> -#define EXIT_REASON_VMCALL 18
> -#define EXIT_REASON_VMCLEAR 19
> -#define EXIT_REASON_VMLAUNCH 20
> -#define EXIT_REASON_VMPTRLD 21
> -#define EXIT_REASON_VMPTRST 22
> -#define EXIT_REASON_VMREAD 23
> -#define EXIT_REASON_VMRESUME 24
> -#define EXIT_REASON_VMWRITE 25
> -#define EXIT_REASON_VMOFF 26
> -#define EXIT_REASON_VMON 27
> -#define EXIT_REASON_CR_ACCESS 28
> -#define EXIT_REASON_DR_ACCESS 29
> -#define EXIT_REASON_IO_INSTRUCTION 30
> -#define EXIT_REASON_MSR_READ 31
> -#define EXIT_REASON_MSR_WRITE 32
> -#define EXIT_REASON_INVALID_STATE 33
> -#define EXIT_REASON_MWAIT_INSTRUCTION 36
> -#define EXIT_REASON_MONITOR_INSTRUCTION 39
> -#define EXIT_REASON_PAUSE_INSTRUCTION 40
> -#define EXIT_REASON_MCE_DURING_VMENTRY 41
> -#define EXIT_REASON_TPR_BELOW_THRESHOLD 43
> -#define EXIT_REASON_APIC_ACCESS 44
> -#define EXIT_REASON_EOI_INDUCED 45
> -#define EXIT_REASON_EPT_VIOLATION 48
> -#define EXIT_REASON_EPT_MISCONFIG 49
> -#define EXIT_REASON_INVEPT 50
> -#define EXIT_REASON_RDTSCP 51
> -#define EXIT_REASON_PREEMPTION_TIMER 52
> -#define EXIT_REASON_INVVPID 53
> -#define EXIT_REASON_WBINVD 54
> -#define EXIT_REASON_XSETBV 55
> -#define EXIT_REASON_APIC_WRITE 56
> -#define EXIT_REASON_INVPCID 58
> -#define EXIT_REASON_PML_FULL 62
> -#define EXIT_REASON_XSAVES 63
> -#define EXIT_REASON_XRSTORS 64
> -#define LAST_EXIT_REASON 64
>
> enum vmcs_field {
> VIRTUAL_PROCESSOR_ID = 0x00000000,
Reviewed-by: Maxim Levitsky <mlevitsk@...hat.com>
Best regards,
Maxim Levitsky
Powered by blists - more mailing lists