xref: /linux/arch/x86/include/uapi/asm/vmx.h (revision 2f4073e0)
1e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2af170c50SDavid Howells /*
3af170c50SDavid Howells  * vmx.h: VMX Architecture related definitions
4af170c50SDavid Howells  * Copyright (c) 2004, Intel Corporation.
5af170c50SDavid Howells  *
6af170c50SDavid Howells  * This program is free software; you can redistribute it and/or modify it
7af170c50SDavid Howells  * under the terms and conditions of the GNU General Public License,
8af170c50SDavid Howells  * version 2, as published by the Free Software Foundation.
9af170c50SDavid Howells  *
10af170c50SDavid Howells  * This program is distributed in the hope it will be useful, but WITHOUT
11af170c50SDavid Howells  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12af170c50SDavid Howells  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13af170c50SDavid Howells  * more details.
14af170c50SDavid Howells  *
15af170c50SDavid Howells  * You should have received a copy of the GNU General Public License along with
16af170c50SDavid Howells  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
17af170c50SDavid Howells  * Place - Suite 330, Boston, MA 02111-1307 USA.
18af170c50SDavid Howells  *
19af170c50SDavid Howells  * A few random additions are:
20af170c50SDavid Howells  * Copyright (C) 2006 Qumranet
21af170c50SDavid Howells  *    Avi Kivity <avi@qumranet.com>
22af170c50SDavid Howells  *    Yaniv Kamay <yaniv@qumranet.com>
23af170c50SDavid Howells  *
24af170c50SDavid Howells  */
25af170c50SDavid Howells #ifndef _UAPIVMX_H
26af170c50SDavid Howells #define _UAPIVMX_H
27af170c50SDavid Howells 
28af170c50SDavid Howells 
29af170c50SDavid Howells #define VMX_EXIT_REASONS_FAILED_VMENTRY         0x80000000
303c0c2ad1SSean Christopherson #define VMX_EXIT_REASONS_SGX_ENCLAVE_MODE	0x08000000
31af170c50SDavid Howells 
32af170c50SDavid Howells #define EXIT_REASON_EXCEPTION_NMI       0
33af170c50SDavid Howells #define EXIT_REASON_EXTERNAL_INTERRUPT  1
34af170c50SDavid Howells #define EXIT_REASON_TRIPLE_FAULT        2
354a53d99dSLiran Alon #define EXIT_REASON_INIT_SIGNAL			3
36bf0cd88cSYadong Qi #define EXIT_REASON_SIPI_SIGNAL         4
37af170c50SDavid Howells 
389dadc2f9SXiaoyao Li #define EXIT_REASON_INTERRUPT_WINDOW    7
39af170c50SDavid Howells #define EXIT_REASON_NMI_WINDOW          8
40af170c50SDavid Howells #define EXIT_REASON_TASK_SWITCH         9
41af170c50SDavid Howells #define EXIT_REASON_CPUID               10
42af170c50SDavid Howells #define EXIT_REASON_HLT                 12
43af170c50SDavid Howells #define EXIT_REASON_INVD                13
44af170c50SDavid Howells #define EXIT_REASON_INVLPG              14
45af170c50SDavid Howells #define EXIT_REASON_RDPMC               15
46af170c50SDavid Howells #define EXIT_REASON_RDTSC               16
47af170c50SDavid Howells #define EXIT_REASON_VMCALL              18
48af170c50SDavid Howells #define EXIT_REASON_VMCLEAR             19
49af170c50SDavid Howells #define EXIT_REASON_VMLAUNCH            20
50af170c50SDavid Howells #define EXIT_REASON_VMPTRLD             21
51af170c50SDavid Howells #define EXIT_REASON_VMPTRST             22
52af170c50SDavid Howells #define EXIT_REASON_VMREAD              23
53af170c50SDavid Howells #define EXIT_REASON_VMRESUME            24
54af170c50SDavid Howells #define EXIT_REASON_VMWRITE             25
55af170c50SDavid Howells #define EXIT_REASON_VMOFF               26
56af170c50SDavid Howells #define EXIT_REASON_VMON                27
57af170c50SDavid Howells #define EXIT_REASON_CR_ACCESS           28
58af170c50SDavid Howells #define EXIT_REASON_DR_ACCESS           29
59af170c50SDavid Howells #define EXIT_REASON_IO_INSTRUCTION      30
60af170c50SDavid Howells #define EXIT_REASON_MSR_READ            31
61af170c50SDavid Howells #define EXIT_REASON_MSR_WRITE           32
62af170c50SDavid Howells #define EXIT_REASON_INVALID_STATE       33
63ff651cb6SWincy Van #define EXIT_REASON_MSR_LOAD_FAIL       34
64af170c50SDavid Howells #define EXIT_REASON_MWAIT_INSTRUCTION   36
655f3d45e7SMihai Donțu #define EXIT_REASON_MONITOR_TRAP_FLAG   37
66af170c50SDavid Howells #define EXIT_REASON_MONITOR_INSTRUCTION 39
67af170c50SDavid Howells #define EXIT_REASON_PAUSE_INSTRUCTION   40
68af170c50SDavid Howells #define EXIT_REASON_MCE_DURING_VMENTRY  41
69af170c50SDavid Howells #define EXIT_REASON_TPR_BELOW_THRESHOLD 43
70af170c50SDavid Howells #define EXIT_REASON_APIC_ACCESS         44
7189f88337SLinus Torvalds #define EXIT_REASON_EOI_INDUCED         45
721b07304cSPaolo Bonzini #define EXIT_REASON_GDTR_IDTR           46
731b07304cSPaolo Bonzini #define EXIT_REASON_LDTR_TR             47
74af170c50SDavid Howells #define EXIT_REASON_EPT_VIOLATION       48
75af170c50SDavid Howells #define EXIT_REASON_EPT_MISCONFIG       49
76bfd0a56bSNadav Har'El #define EXIT_REASON_INVEPT              50
77b3a2a907SJan Kiszka #define EXIT_REASON_RDTSCP              51
780238ea91SJan Kiszka #define EXIT_REASON_PREEMPTION_TIMER    52
79a642fc30SPetr Matousek #define EXIT_REASON_INVVPID             53
80af170c50SDavid Howells #define EXIT_REASON_WBINVD              54
81af170c50SDavid Howells #define EXIT_REASON_XSETBV              55
8289f88337SLinus Torvalds #define EXIT_REASON_APIC_WRITE          56
831f519992SPaolo Bonzini #define EXIT_REASON_RDRAND              57
84af170c50SDavid Howells #define EXIT_REASON_INVPCID             58
851f519992SPaolo Bonzini #define EXIT_REASON_VMFUNC              59
861f519992SPaolo Bonzini #define EXIT_REASON_ENCLS               60
871f519992SPaolo Bonzini #define EXIT_REASON_RDSEED              61
88843e4330SKai Huang #define EXIT_REASON_PML_FULL            62
89f53cd63cSWanpeng Li #define EXIT_REASON_XSAVES              63
90f53cd63cSWanpeng Li #define EXIT_REASON_XRSTORS             64
91bf653b78STao Xu #define EXIT_REASON_UMWAIT              67
92bf653b78STao Xu #define EXIT_REASON_TPAUSE              68
93fe6b6bc8SChenyi Qiang #define EXIT_REASON_BUS_LOCK            74
94*2f4073e0STao Xu #define EXIT_REASON_NOTIFY              75
95af170c50SDavid Howells 
96af170c50SDavid Howells #define VMX_EXIT_REASONS \
97af170c50SDavid Howells 	{ EXIT_REASON_EXCEPTION_NMI,         "EXCEPTION_NMI" }, \
98af170c50SDavid Howells 	{ EXIT_REASON_EXTERNAL_INTERRUPT,    "EXTERNAL_INTERRUPT" }, \
99af170c50SDavid Howells 	{ EXIT_REASON_TRIPLE_FAULT,          "TRIPLE_FAULT" }, \
1004a53d99dSLiran Alon 	{ EXIT_REASON_INIT_SIGNAL,           "INIT_SIGNAL" }, \
101bf0cd88cSYadong Qi 	{ EXIT_REASON_SIPI_SIGNAL,           "SIPI_SIGNAL" }, \
1029dadc2f9SXiaoyao Li 	{ EXIT_REASON_INTERRUPT_WINDOW,      "INTERRUPT_WINDOW" }, \
103af170c50SDavid Howells 	{ EXIT_REASON_NMI_WINDOW,            "NMI_WINDOW" }, \
104af170c50SDavid Howells 	{ EXIT_REASON_TASK_SWITCH,           "TASK_SWITCH" }, \
105af170c50SDavid Howells 	{ EXIT_REASON_CPUID,                 "CPUID" }, \
106af170c50SDavid Howells 	{ EXIT_REASON_HLT,                   "HLT" }, \
1071f519992SPaolo Bonzini 	{ EXIT_REASON_INVD,                  "INVD" }, \
108af170c50SDavid Howells 	{ EXIT_REASON_INVLPG,                "INVLPG" }, \
109af170c50SDavid Howells 	{ EXIT_REASON_RDPMC,                 "RDPMC" }, \
110af170c50SDavid Howells 	{ EXIT_REASON_RDTSC,                 "RDTSC" }, \
111af170c50SDavid Howells 	{ EXIT_REASON_VMCALL,                "VMCALL" }, \
112af170c50SDavid Howells 	{ EXIT_REASON_VMCLEAR,               "VMCLEAR" }, \
113af170c50SDavid Howells 	{ EXIT_REASON_VMLAUNCH,              "VMLAUNCH" }, \
114af170c50SDavid Howells 	{ EXIT_REASON_VMPTRLD,               "VMPTRLD" }, \
115af170c50SDavid Howells 	{ EXIT_REASON_VMPTRST,               "VMPTRST" }, \
116af170c50SDavid Howells 	{ EXIT_REASON_VMREAD,                "VMREAD" }, \
117af170c50SDavid Howells 	{ EXIT_REASON_VMRESUME,              "VMRESUME" }, \
118af170c50SDavid Howells 	{ EXIT_REASON_VMWRITE,               "VMWRITE" }, \
119af170c50SDavid Howells 	{ EXIT_REASON_VMOFF,                 "VMOFF" }, \
120af170c50SDavid Howells 	{ EXIT_REASON_VMON,                  "VMON" }, \
121af170c50SDavid Howells 	{ EXIT_REASON_CR_ACCESS,             "CR_ACCESS" }, \
122af170c50SDavid Howells 	{ EXIT_REASON_DR_ACCESS,             "DR_ACCESS" }, \
123af170c50SDavid Howells 	{ EXIT_REASON_IO_INSTRUCTION,        "IO_INSTRUCTION" }, \
124af170c50SDavid Howells 	{ EXIT_REASON_MSR_READ,              "MSR_READ" }, \
125af170c50SDavid Howells 	{ EXIT_REASON_MSR_WRITE,             "MSR_WRITE" }, \
1261f519992SPaolo Bonzini 	{ EXIT_REASON_INVALID_STATE,         "INVALID_STATE" }, \
1271f519992SPaolo Bonzini 	{ EXIT_REASON_MSR_LOAD_FAIL,         "MSR_LOAD_FAIL" }, \
128af170c50SDavid Howells 	{ EXIT_REASON_MWAIT_INSTRUCTION,     "MWAIT_INSTRUCTION" }, \
1295f3d45e7SMihai Donțu 	{ EXIT_REASON_MONITOR_TRAP_FLAG,     "MONITOR_TRAP_FLAG" }, \
130af170c50SDavid Howells 	{ EXIT_REASON_MONITOR_INSTRUCTION,   "MONITOR_INSTRUCTION" }, \
131af170c50SDavid Howells 	{ EXIT_REASON_PAUSE_INSTRUCTION,     "PAUSE_INSTRUCTION" }, \
132af170c50SDavid Howells 	{ EXIT_REASON_MCE_DURING_VMENTRY,    "MCE_DURING_VMENTRY" }, \
133af170c50SDavid Howells 	{ EXIT_REASON_TPR_BELOW_THRESHOLD,   "TPR_BELOW_THRESHOLD" }, \
134af170c50SDavid Howells 	{ EXIT_REASON_APIC_ACCESS,           "APIC_ACCESS" }, \
1351f519992SPaolo Bonzini 	{ EXIT_REASON_EOI_INDUCED,           "EOI_INDUCED" }, \
1361b07304cSPaolo Bonzini 	{ EXIT_REASON_GDTR_IDTR,             "GDTR_IDTR" }, \
1371b07304cSPaolo Bonzini 	{ EXIT_REASON_LDTR_TR,               "LDTR_TR" }, \
138af170c50SDavid Howells 	{ EXIT_REASON_EPT_VIOLATION,         "EPT_VIOLATION" }, \
139af170c50SDavid Howells 	{ EXIT_REASON_EPT_MISCONFIG,         "EPT_MISCONFIG" }, \
140cc2df20cSJan Kiszka 	{ EXIT_REASON_INVEPT,                "INVEPT" }, \
1411f519992SPaolo Bonzini 	{ EXIT_REASON_RDTSCP,                "RDTSCP" }, \
142cc2df20cSJan Kiszka 	{ EXIT_REASON_PREEMPTION_TIMER,      "PREEMPTION_TIMER" }, \
143a642fc30SPetr Matousek 	{ EXIT_REASON_INVVPID,               "INVVPID" }, \
1441f519992SPaolo Bonzini 	{ EXIT_REASON_WBINVD,                "WBINVD" }, \
1451f519992SPaolo Bonzini 	{ EXIT_REASON_XSETBV,                "XSETBV" }, \
1461f519992SPaolo Bonzini 	{ EXIT_REASON_APIC_WRITE,            "APIC_WRITE" }, \
1471f519992SPaolo Bonzini 	{ EXIT_REASON_RDRAND,                "RDRAND" }, \
148f53cd63cSWanpeng Li 	{ EXIT_REASON_INVPCID,               "INVPCID" }, \
1491f519992SPaolo Bonzini 	{ EXIT_REASON_VMFUNC,                "VMFUNC" }, \
1501f519992SPaolo Bonzini 	{ EXIT_REASON_ENCLS,                 "ENCLS" }, \
1511f519992SPaolo Bonzini 	{ EXIT_REASON_RDSEED,                "RDSEED" }, \
1521f519992SPaolo Bonzini 	{ EXIT_REASON_PML_FULL,              "PML_FULL" }, \
153f53cd63cSWanpeng Li 	{ EXIT_REASON_XSAVES,                "XSAVES" }, \
154bf653b78STao Xu 	{ EXIT_REASON_XRSTORS,               "XRSTORS" }, \
155bf653b78STao Xu 	{ EXIT_REASON_UMWAIT,                "UMWAIT" }, \
156fe6b6bc8SChenyi Qiang 	{ EXIT_REASON_TPAUSE,                "TPAUSE" }, \
157*2f4073e0STao Xu 	{ EXIT_REASON_BUS_LOCK,              "BUS_LOCK" }, \
158*2f4073e0STao Xu 	{ EXIT_REASON_NOTIFY,                "NOTIFY" }
159af170c50SDavid Howells 
1602c4c4132SSean Christopherson #define VMX_EXIT_REASON_FLAGS \
1612c4c4132SSean Christopherson 	{ VMX_EXIT_REASONS_FAILED_VMENTRY,	"FAILED_VMENTRY" }
1622c4c4132SSean Christopherson 
163ff651cb6SWincy Van #define VMX_ABORT_SAVE_GUEST_MSR_FAIL        1
1641dc35dacSLadi Prosek #define VMX_ABORT_LOAD_HOST_PDPTE_FAIL       2
165ff651cb6SWincy Van #define VMX_ABORT_LOAD_HOST_MSR_FAIL         4
166ff651cb6SWincy Van 
167af170c50SDavid Howells #endif /* _UAPIVMX_H */
168