xref: /openbmc/linux/tools/arch/x86/include/uapi/asm/vmx.h (revision df0e68c1)
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  * vmx.h: VMX Architecture related definitions
4  * Copyright (c) 2004, Intel Corporation.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms and conditions of the GNU General Public License,
8  * version 2, as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along with
16  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
17  * Place - Suite 330, Boston, MA 02111-1307 USA.
18  *
19  * A few random additions are:
20  * Copyright (C) 2006 Qumranet
21  *    Avi Kivity <avi@qumranet.com>
22  *    Yaniv Kamay <yaniv@qumranet.com>
23  *
24  */
25 #ifndef _UAPIVMX_H
26 #define _UAPIVMX_H
27 
28 
29 #define VMX_EXIT_REASONS_FAILED_VMENTRY         0x80000000
30 #define VMX_EXIT_REASONS_SGX_ENCLAVE_MODE	0x08000000
31 
32 #define EXIT_REASON_EXCEPTION_NMI       0
33 #define EXIT_REASON_EXTERNAL_INTERRUPT  1
34 #define EXIT_REASON_TRIPLE_FAULT        2
35 #define EXIT_REASON_INIT_SIGNAL			3
36 #define EXIT_REASON_SIPI_SIGNAL         4
37 
38 #define EXIT_REASON_INTERRUPT_WINDOW    7
39 #define EXIT_REASON_NMI_WINDOW          8
40 #define EXIT_REASON_TASK_SWITCH         9
41 #define EXIT_REASON_CPUID               10
42 #define EXIT_REASON_HLT                 12
43 #define EXIT_REASON_INVD                13
44 #define EXIT_REASON_INVLPG              14
45 #define EXIT_REASON_RDPMC               15
46 #define EXIT_REASON_RDTSC               16
47 #define EXIT_REASON_VMCALL              18
48 #define EXIT_REASON_VMCLEAR             19
49 #define EXIT_REASON_VMLAUNCH            20
50 #define EXIT_REASON_VMPTRLD             21
51 #define EXIT_REASON_VMPTRST             22
52 #define EXIT_REASON_VMREAD              23
53 #define EXIT_REASON_VMRESUME            24
54 #define EXIT_REASON_VMWRITE             25
55 #define EXIT_REASON_VMOFF               26
56 #define EXIT_REASON_VMON                27
57 #define EXIT_REASON_CR_ACCESS           28
58 #define EXIT_REASON_DR_ACCESS           29
59 #define EXIT_REASON_IO_INSTRUCTION      30
60 #define EXIT_REASON_MSR_READ            31
61 #define EXIT_REASON_MSR_WRITE           32
62 #define EXIT_REASON_INVALID_STATE       33
63 #define EXIT_REASON_MSR_LOAD_FAIL       34
64 #define EXIT_REASON_MWAIT_INSTRUCTION   36
65 #define EXIT_REASON_MONITOR_TRAP_FLAG   37
66 #define EXIT_REASON_MONITOR_INSTRUCTION 39
67 #define EXIT_REASON_PAUSE_INSTRUCTION   40
68 #define EXIT_REASON_MCE_DURING_VMENTRY  41
69 #define EXIT_REASON_TPR_BELOW_THRESHOLD 43
70 #define EXIT_REASON_APIC_ACCESS         44
71 #define EXIT_REASON_EOI_INDUCED         45
72 #define EXIT_REASON_GDTR_IDTR           46
73 #define EXIT_REASON_LDTR_TR             47
74 #define EXIT_REASON_EPT_VIOLATION       48
75 #define EXIT_REASON_EPT_MISCONFIG       49
76 #define EXIT_REASON_INVEPT              50
77 #define EXIT_REASON_RDTSCP              51
78 #define EXIT_REASON_PREEMPTION_TIMER    52
79 #define EXIT_REASON_INVVPID             53
80 #define EXIT_REASON_WBINVD              54
81 #define EXIT_REASON_XSETBV              55
82 #define EXIT_REASON_APIC_WRITE          56
83 #define EXIT_REASON_RDRAND              57
84 #define EXIT_REASON_INVPCID             58
85 #define EXIT_REASON_VMFUNC              59
86 #define EXIT_REASON_ENCLS               60
87 #define EXIT_REASON_RDSEED              61
88 #define EXIT_REASON_PML_FULL            62
89 #define EXIT_REASON_XSAVES              63
90 #define EXIT_REASON_XRSTORS             64
91 #define EXIT_REASON_UMWAIT              67
92 #define EXIT_REASON_TPAUSE              68
93 #define EXIT_REASON_BUS_LOCK            74
94 
95 #define VMX_EXIT_REASONS \
96 	{ EXIT_REASON_EXCEPTION_NMI,         "EXCEPTION_NMI" }, \
97 	{ EXIT_REASON_EXTERNAL_INTERRUPT,    "EXTERNAL_INTERRUPT" }, \
98 	{ EXIT_REASON_TRIPLE_FAULT,          "TRIPLE_FAULT" }, \
99 	{ EXIT_REASON_INIT_SIGNAL,           "INIT_SIGNAL" }, \
100 	{ EXIT_REASON_SIPI_SIGNAL,           "SIPI_SIGNAL" }, \
101 	{ EXIT_REASON_INTERRUPT_WINDOW,      "INTERRUPT_WINDOW" }, \
102 	{ EXIT_REASON_NMI_WINDOW,            "NMI_WINDOW" }, \
103 	{ EXIT_REASON_TASK_SWITCH,           "TASK_SWITCH" }, \
104 	{ EXIT_REASON_CPUID,                 "CPUID" }, \
105 	{ EXIT_REASON_HLT,                   "HLT" }, \
106 	{ EXIT_REASON_INVD,                  "INVD" }, \
107 	{ EXIT_REASON_INVLPG,                "INVLPG" }, \
108 	{ EXIT_REASON_RDPMC,                 "RDPMC" }, \
109 	{ EXIT_REASON_RDTSC,                 "RDTSC" }, \
110 	{ EXIT_REASON_VMCALL,                "VMCALL" }, \
111 	{ EXIT_REASON_VMCLEAR,               "VMCLEAR" }, \
112 	{ EXIT_REASON_VMLAUNCH,              "VMLAUNCH" }, \
113 	{ EXIT_REASON_VMPTRLD,               "VMPTRLD" }, \
114 	{ EXIT_REASON_VMPTRST,               "VMPTRST" }, \
115 	{ EXIT_REASON_VMREAD,                "VMREAD" }, \
116 	{ EXIT_REASON_VMRESUME,              "VMRESUME" }, \
117 	{ EXIT_REASON_VMWRITE,               "VMWRITE" }, \
118 	{ EXIT_REASON_VMOFF,                 "VMOFF" }, \
119 	{ EXIT_REASON_VMON,                  "VMON" }, \
120 	{ EXIT_REASON_CR_ACCESS,             "CR_ACCESS" }, \
121 	{ EXIT_REASON_DR_ACCESS,             "DR_ACCESS" }, \
122 	{ EXIT_REASON_IO_INSTRUCTION,        "IO_INSTRUCTION" }, \
123 	{ EXIT_REASON_MSR_READ,              "MSR_READ" }, \
124 	{ EXIT_REASON_MSR_WRITE,             "MSR_WRITE" }, \
125 	{ EXIT_REASON_INVALID_STATE,         "INVALID_STATE" }, \
126 	{ EXIT_REASON_MSR_LOAD_FAIL,         "MSR_LOAD_FAIL" }, \
127 	{ EXIT_REASON_MWAIT_INSTRUCTION,     "MWAIT_INSTRUCTION" }, \
128 	{ EXIT_REASON_MONITOR_TRAP_FLAG,     "MONITOR_TRAP_FLAG" }, \
129 	{ EXIT_REASON_MONITOR_INSTRUCTION,   "MONITOR_INSTRUCTION" }, \
130 	{ EXIT_REASON_PAUSE_INSTRUCTION,     "PAUSE_INSTRUCTION" }, \
131 	{ EXIT_REASON_MCE_DURING_VMENTRY,    "MCE_DURING_VMENTRY" }, \
132 	{ EXIT_REASON_TPR_BELOW_THRESHOLD,   "TPR_BELOW_THRESHOLD" }, \
133 	{ EXIT_REASON_APIC_ACCESS,           "APIC_ACCESS" }, \
134 	{ EXIT_REASON_EOI_INDUCED,           "EOI_INDUCED" }, \
135 	{ EXIT_REASON_GDTR_IDTR,             "GDTR_IDTR" }, \
136 	{ EXIT_REASON_LDTR_TR,               "LDTR_TR" }, \
137 	{ EXIT_REASON_EPT_VIOLATION,         "EPT_VIOLATION" }, \
138 	{ EXIT_REASON_EPT_MISCONFIG,         "EPT_MISCONFIG" }, \
139 	{ EXIT_REASON_INVEPT,                "INVEPT" }, \
140 	{ EXIT_REASON_RDTSCP,                "RDTSCP" }, \
141 	{ EXIT_REASON_PREEMPTION_TIMER,      "PREEMPTION_TIMER" }, \
142 	{ EXIT_REASON_INVVPID,               "INVVPID" }, \
143 	{ EXIT_REASON_WBINVD,                "WBINVD" }, \
144 	{ EXIT_REASON_XSETBV,                "XSETBV" }, \
145 	{ EXIT_REASON_APIC_WRITE,            "APIC_WRITE" }, \
146 	{ EXIT_REASON_RDRAND,                "RDRAND" }, \
147 	{ EXIT_REASON_INVPCID,               "INVPCID" }, \
148 	{ EXIT_REASON_VMFUNC,                "VMFUNC" }, \
149 	{ EXIT_REASON_ENCLS,                 "ENCLS" }, \
150 	{ EXIT_REASON_RDSEED,                "RDSEED" }, \
151 	{ EXIT_REASON_PML_FULL,              "PML_FULL" }, \
152 	{ EXIT_REASON_XSAVES,                "XSAVES" }, \
153 	{ EXIT_REASON_XRSTORS,               "XRSTORS" }, \
154 	{ EXIT_REASON_UMWAIT,                "UMWAIT" }, \
155 	{ EXIT_REASON_TPAUSE,                "TPAUSE" }, \
156 	{ EXIT_REASON_BUS_LOCK,              "BUS_LOCK" }
157 
158 #define VMX_EXIT_REASON_FLAGS \
159 	{ VMX_EXIT_REASONS_FAILED_VMENTRY,	"FAILED_VMENTRY" }
160 
161 #define VMX_ABORT_SAVE_GUEST_MSR_FAIL        1
162 #define VMX_ABORT_LOAD_HOST_PDPTE_FAIL       2
163 #define VMX_ABORT_LOAD_HOST_MSR_FAIL         4
164 
165 #endif /* _UAPIVMX_H */
166