[kvm-unit-tests PATCH 16/32] x86: vmx exit reason descriptions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Peter Feiner <pfeiner@xxxxxxxxxx>

Signed-off-by: Peter Feiner <pfeiner@xxxxxxxxxx>
Signed-off-by: David Matlack <dmatlack@xxxxxxxxxx>
---
 x86/vmx.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 x86/vmx.h | 11 +++++++++-
 2 files changed, 79 insertions(+), 1 deletion(-)

diff --git a/x86/vmx.c b/x86/vmx.c
index e6c11b013d94..cd4cb1219040 100644
--- a/x86/vmx.c
+++ b/x86/vmx.c
@@ -425,6 +425,75 @@ static inline int vmx_off()
 	return ret;
 }
 
+static const char * const exit_reason_descriptions[] = {
+	[VMX_EXC_NMI]		= "VMX_EXC_NMI",
+	[VMX_EXTINT]		= "VMX_EXTINT",
+	[VMX_TRIPLE_FAULT]	= "VMX_TRIPLE_FAULT",
+	[VMX_INIT]		= "VMX_INIT",
+	[VMX_SIPI]		= "VMX_SIPI",
+	[VMX_SMI_IO]		= "VMX_SMI_IO",
+	[VMX_SMI_OTHER]		= "VMX_SMI_OTHER",
+	[VMX_INTR_WINDOW]	= "VMX_INTR_WINDOW",
+	[VMX_NMI_WINDOW]	= "VMX_NMI_WINDOW",
+	[VMX_TASK_SWITCH]	= "VMX_TASK_SWITCH",
+	[VMX_CPUID]		= "VMX_CPUID",
+	[VMX_GETSEC]		= "VMX_GETSEC",
+	[VMX_HLT]		= "VMX_HLT",
+	[VMX_INVD]		= "VMX_INVD",
+	[VMX_INVLPG]		= "VMX_INVLPG",
+	[VMX_RDPMC]		= "VMX_RDPMC",
+	[VMX_RDTSC]		= "VMX_RDTSC",
+	[VMX_RSM]		= "VMX_RSM",
+	[VMX_VMCALL]		= "VMX_VMCALL",
+	[VMX_VMCLEAR]		= "VMX_VMCLEAR",
+	[VMX_VMLAUNCH]		= "VMX_VMLAUNCH",
+	[VMX_VMPTRLD]		= "VMX_VMPTRLD",
+	[VMX_VMPTRST]		= "VMX_VMPTRST",
+	[VMX_VMREAD]		= "VMX_VMREAD",
+	[VMX_VMRESUME]		= "VMX_VMRESUME",
+	[VMX_VMWRITE]		= "VMX_VMWRITE",
+	[VMX_VMXOFF]		= "VMX_VMXOFF",
+	[VMX_VMXON]		= "VMX_VMXON",
+	[VMX_CR]		= "VMX_CR",
+	[VMX_DR]		= "VMX_DR",
+	[VMX_IO]		= "VMX_IO",
+	[VMX_RDMSR]		= "VMX_RDMSR",
+	[VMX_WRMSR]		= "VMX_WRMSR",
+	[VMX_FAIL_STATE]	= "VMX_FAIL_STATE",
+	[VMX_FAIL_MSR]		= "VMX_FAIL_MSR",
+	[VMX_MWAIT]		= "VMX_MWAIT",
+	[VMX_MTF]		= "VMX_MTF",
+	[VMX_MONITOR]		= "VMX_MONITOR",
+	[VMX_PAUSE]		= "VMX_PAUSE",
+	[VMX_FAIL_MCHECK]	= "VMX_FAIL_MCHECK",
+	[VMX_TPR_THRESHOLD]	= "VMX_TPR_THRESHOLD",
+	[VMX_APIC_ACCESS]	= "VMX_APIC_ACCESS",
+	[VMX_GDTR_IDTR]		= "VMX_GDTR_IDTR",
+	[VMX_LDTR_TR]		= "VMX_LDTR_TR",
+	[VMX_EPT_VIOLATION]	= "VMX_EPT_VIOLATION",
+	[VMX_EPT_MISCONFIG]	= "VMX_EPT_MISCONFIG",
+	[VMX_INVEPT]		= "VMX_INVEPT",
+	[VMX_PREEMPT]		= "VMX_PREEMPT",
+	[VMX_INVVPID]		= "VMX_INVVPID",
+	[VMX_WBINVD]		= "VMX_WBINVD",
+	[VMX_XSETBV]		= "VMX_XSETBV",
+	[VMX_APIC_WRITE]	= "VMX_APIC_WRITE",
+	[VMX_RDRAND]		= "VMX_RDRAND",
+	[VMX_INVPCID]		= "VMX_INVPCID",
+	[VMX_VMFUNC]		= "VMX_VMFUNC",
+	[VMX_RDSEED]		= "VMX_RDSEED",
+	[VMX_PML_FULL]		= "VMX_PML_FULL",
+	[VMX_XSAVES]		= "VMX_XSAVES",
+	[VMX_XRSTORS]		= "VMX_XRSTORS",
+};
+
+const char *exit_reason_description(u64 reason)
+{
+	if (reason >= ARRAY_SIZE(exit_reason_descriptions))
+		return "(unknown)";
+	return exit_reason_descriptions[reason] ? : "(unused)";
+}
+
 void print_vmexit_info()
 {
 	u64 guest_rip, guest_rsp;
diff --git a/x86/vmx.h b/x86/vmx.h
index 2328f0eee05d..3e4015660797 100644
--- a/x86/vmx.h
+++ b/x86/vmx.h
@@ -317,7 +317,15 @@ enum Reason {
 	VMX_PREEMPT		= 52,
 	VMX_INVVPID		= 53,
 	VMX_WBINVD		= 54,
-	VMX_XSETBV		= 55
+	VMX_XSETBV		= 55,
+	VMX_APIC_WRITE		= 56,
+	VMX_RDRAND		= 57,
+	VMX_INVPCID		= 58,
+	VMX_VMFUNC		= 59,
+	VMX_RDSEED		= 61,
+	VMX_PML_FULL		= 62,
+	VMX_XSAVES		= 63,
+	VMX_XRSTORS		= 64,
 };
 
 enum Ctrl_exi {
@@ -659,6 +667,7 @@ static inline bool invvpid(unsigned long type, u16 vpid, u64 gva)
 	return ret;
 }
 
+const char *exit_reason_description(u64 reason);
 void print_vmexit_info();
 void print_vmentry_failure_info(struct vmentry_failure *failure);
 void ept_sync(int type, u64 eptp);
-- 
2.12.2.816.g2cccc81164-goog




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux