18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * vmx.h: VMX Architecture related definitions
48c2ecf20Sopenharmony_ci * Copyright (c) 2004, Intel Corporation.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify it
78c2ecf20Sopenharmony_ci * under the terms and conditions of the GNU General Public License,
88c2ecf20Sopenharmony_ci * version 2, as published by the Free Software Foundation.
98c2ecf20Sopenharmony_ci *
108c2ecf20Sopenharmony_ci * This program is distributed in the hope it will be useful, but WITHOUT
118c2ecf20Sopenharmony_ci * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
128c2ecf20Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
138c2ecf20Sopenharmony_ci * more details.
148c2ecf20Sopenharmony_ci *
158c2ecf20Sopenharmony_ci * You should have received a copy of the GNU General Public License along with
168c2ecf20Sopenharmony_ci * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
178c2ecf20Sopenharmony_ci * Place - Suite 330, Boston, MA 02111-1307 USA.
188c2ecf20Sopenharmony_ci *
198c2ecf20Sopenharmony_ci * A few random additions are:
208c2ecf20Sopenharmony_ci * Copyright (C) 2006 Qumranet
218c2ecf20Sopenharmony_ci *    Avi Kivity <avi@qumranet.com>
228c2ecf20Sopenharmony_ci *    Yaniv Kamay <yaniv@qumranet.com>
238c2ecf20Sopenharmony_ci *
248c2ecf20Sopenharmony_ci */
258c2ecf20Sopenharmony_ci#ifndef _UAPIVMX_H
268c2ecf20Sopenharmony_ci#define _UAPIVMX_H
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci#define VMX_EXIT_REASONS_FAILED_VMENTRY         0x80000000
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci#define EXIT_REASON_EXCEPTION_NMI       0
328c2ecf20Sopenharmony_ci#define EXIT_REASON_EXTERNAL_INTERRUPT  1
338c2ecf20Sopenharmony_ci#define EXIT_REASON_TRIPLE_FAULT        2
348c2ecf20Sopenharmony_ci#define EXIT_REASON_INIT_SIGNAL			3
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci#define EXIT_REASON_INTERRUPT_WINDOW    7
378c2ecf20Sopenharmony_ci#define EXIT_REASON_NMI_WINDOW          8
388c2ecf20Sopenharmony_ci#define EXIT_REASON_TASK_SWITCH         9
398c2ecf20Sopenharmony_ci#define EXIT_REASON_CPUID               10
408c2ecf20Sopenharmony_ci#define EXIT_REASON_HLT                 12
418c2ecf20Sopenharmony_ci#define EXIT_REASON_INVD                13
428c2ecf20Sopenharmony_ci#define EXIT_REASON_INVLPG              14
438c2ecf20Sopenharmony_ci#define EXIT_REASON_RDPMC               15
448c2ecf20Sopenharmony_ci#define EXIT_REASON_RDTSC               16
458c2ecf20Sopenharmony_ci#define EXIT_REASON_VMCALL              18
468c2ecf20Sopenharmony_ci#define EXIT_REASON_VMCLEAR             19
478c2ecf20Sopenharmony_ci#define EXIT_REASON_VMLAUNCH            20
488c2ecf20Sopenharmony_ci#define EXIT_REASON_VMPTRLD             21
498c2ecf20Sopenharmony_ci#define EXIT_REASON_VMPTRST             22
508c2ecf20Sopenharmony_ci#define EXIT_REASON_VMREAD              23
518c2ecf20Sopenharmony_ci#define EXIT_REASON_VMRESUME            24
528c2ecf20Sopenharmony_ci#define EXIT_REASON_VMWRITE             25
538c2ecf20Sopenharmony_ci#define EXIT_REASON_VMOFF               26
548c2ecf20Sopenharmony_ci#define EXIT_REASON_VMON                27
558c2ecf20Sopenharmony_ci#define EXIT_REASON_CR_ACCESS           28
568c2ecf20Sopenharmony_ci#define EXIT_REASON_DR_ACCESS           29
578c2ecf20Sopenharmony_ci#define EXIT_REASON_IO_INSTRUCTION      30
588c2ecf20Sopenharmony_ci#define EXIT_REASON_MSR_READ            31
598c2ecf20Sopenharmony_ci#define EXIT_REASON_MSR_WRITE           32
608c2ecf20Sopenharmony_ci#define EXIT_REASON_INVALID_STATE       33
618c2ecf20Sopenharmony_ci#define EXIT_REASON_MSR_LOAD_FAIL       34
628c2ecf20Sopenharmony_ci#define EXIT_REASON_MWAIT_INSTRUCTION   36
638c2ecf20Sopenharmony_ci#define EXIT_REASON_MONITOR_TRAP_FLAG   37
648c2ecf20Sopenharmony_ci#define EXIT_REASON_MONITOR_INSTRUCTION 39
658c2ecf20Sopenharmony_ci#define EXIT_REASON_PAUSE_INSTRUCTION   40
668c2ecf20Sopenharmony_ci#define EXIT_REASON_MCE_DURING_VMENTRY  41
678c2ecf20Sopenharmony_ci#define EXIT_REASON_TPR_BELOW_THRESHOLD 43
688c2ecf20Sopenharmony_ci#define EXIT_REASON_APIC_ACCESS         44
698c2ecf20Sopenharmony_ci#define EXIT_REASON_EOI_INDUCED         45
708c2ecf20Sopenharmony_ci#define EXIT_REASON_GDTR_IDTR           46
718c2ecf20Sopenharmony_ci#define EXIT_REASON_LDTR_TR             47
728c2ecf20Sopenharmony_ci#define EXIT_REASON_EPT_VIOLATION       48
738c2ecf20Sopenharmony_ci#define EXIT_REASON_EPT_MISCONFIG       49
748c2ecf20Sopenharmony_ci#define EXIT_REASON_INVEPT              50
758c2ecf20Sopenharmony_ci#define EXIT_REASON_RDTSCP              51
768c2ecf20Sopenharmony_ci#define EXIT_REASON_PREEMPTION_TIMER    52
778c2ecf20Sopenharmony_ci#define EXIT_REASON_INVVPID             53
788c2ecf20Sopenharmony_ci#define EXIT_REASON_WBINVD              54
798c2ecf20Sopenharmony_ci#define EXIT_REASON_XSETBV              55
808c2ecf20Sopenharmony_ci#define EXIT_REASON_APIC_WRITE          56
818c2ecf20Sopenharmony_ci#define EXIT_REASON_RDRAND              57
828c2ecf20Sopenharmony_ci#define EXIT_REASON_INVPCID             58
838c2ecf20Sopenharmony_ci#define EXIT_REASON_VMFUNC              59
848c2ecf20Sopenharmony_ci#define EXIT_REASON_ENCLS               60
858c2ecf20Sopenharmony_ci#define EXIT_REASON_RDSEED              61
868c2ecf20Sopenharmony_ci#define EXIT_REASON_PML_FULL            62
878c2ecf20Sopenharmony_ci#define EXIT_REASON_XSAVES              63
888c2ecf20Sopenharmony_ci#define EXIT_REASON_XRSTORS             64
898c2ecf20Sopenharmony_ci#define EXIT_REASON_UMWAIT              67
908c2ecf20Sopenharmony_ci#define EXIT_REASON_TPAUSE              68
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci#define VMX_EXIT_REASONS \
938c2ecf20Sopenharmony_ci	{ EXIT_REASON_EXCEPTION_NMI,         "EXCEPTION_NMI" }, \
948c2ecf20Sopenharmony_ci	{ EXIT_REASON_EXTERNAL_INTERRUPT,    "EXTERNAL_INTERRUPT" }, \
958c2ecf20Sopenharmony_ci	{ EXIT_REASON_TRIPLE_FAULT,          "TRIPLE_FAULT" }, \
968c2ecf20Sopenharmony_ci	{ EXIT_REASON_INIT_SIGNAL,           "INIT_SIGNAL" }, \
978c2ecf20Sopenharmony_ci	{ EXIT_REASON_INTERRUPT_WINDOW,      "INTERRUPT_WINDOW" }, \
988c2ecf20Sopenharmony_ci	{ EXIT_REASON_NMI_WINDOW,            "NMI_WINDOW" }, \
998c2ecf20Sopenharmony_ci	{ EXIT_REASON_TASK_SWITCH,           "TASK_SWITCH" }, \
1008c2ecf20Sopenharmony_ci	{ EXIT_REASON_CPUID,                 "CPUID" }, \
1018c2ecf20Sopenharmony_ci	{ EXIT_REASON_HLT,                   "HLT" }, \
1028c2ecf20Sopenharmony_ci	{ EXIT_REASON_INVD,                  "INVD" }, \
1038c2ecf20Sopenharmony_ci	{ EXIT_REASON_INVLPG,                "INVLPG" }, \
1048c2ecf20Sopenharmony_ci	{ EXIT_REASON_RDPMC,                 "RDPMC" }, \
1058c2ecf20Sopenharmony_ci	{ EXIT_REASON_RDTSC,                 "RDTSC" }, \
1068c2ecf20Sopenharmony_ci	{ EXIT_REASON_VMCALL,                "VMCALL" }, \
1078c2ecf20Sopenharmony_ci	{ EXIT_REASON_VMCLEAR,               "VMCLEAR" }, \
1088c2ecf20Sopenharmony_ci	{ EXIT_REASON_VMLAUNCH,              "VMLAUNCH" }, \
1098c2ecf20Sopenharmony_ci	{ EXIT_REASON_VMPTRLD,               "VMPTRLD" }, \
1108c2ecf20Sopenharmony_ci	{ EXIT_REASON_VMPTRST,               "VMPTRST" }, \
1118c2ecf20Sopenharmony_ci	{ EXIT_REASON_VMREAD,                "VMREAD" }, \
1128c2ecf20Sopenharmony_ci	{ EXIT_REASON_VMRESUME,              "VMRESUME" }, \
1138c2ecf20Sopenharmony_ci	{ EXIT_REASON_VMWRITE,               "VMWRITE" }, \
1148c2ecf20Sopenharmony_ci	{ EXIT_REASON_VMOFF,                 "VMOFF" }, \
1158c2ecf20Sopenharmony_ci	{ EXIT_REASON_VMON,                  "VMON" }, \
1168c2ecf20Sopenharmony_ci	{ EXIT_REASON_CR_ACCESS,             "CR_ACCESS" }, \
1178c2ecf20Sopenharmony_ci	{ EXIT_REASON_DR_ACCESS,             "DR_ACCESS" }, \
1188c2ecf20Sopenharmony_ci	{ EXIT_REASON_IO_INSTRUCTION,        "IO_INSTRUCTION" }, \
1198c2ecf20Sopenharmony_ci	{ EXIT_REASON_MSR_READ,              "MSR_READ" }, \
1208c2ecf20Sopenharmony_ci	{ EXIT_REASON_MSR_WRITE,             "MSR_WRITE" }, \
1218c2ecf20Sopenharmony_ci	{ EXIT_REASON_INVALID_STATE,         "INVALID_STATE" }, \
1228c2ecf20Sopenharmony_ci	{ EXIT_REASON_MSR_LOAD_FAIL,         "MSR_LOAD_FAIL" }, \
1238c2ecf20Sopenharmony_ci	{ EXIT_REASON_MWAIT_INSTRUCTION,     "MWAIT_INSTRUCTION" }, \
1248c2ecf20Sopenharmony_ci	{ EXIT_REASON_MONITOR_TRAP_FLAG,     "MONITOR_TRAP_FLAG" }, \
1258c2ecf20Sopenharmony_ci	{ EXIT_REASON_MONITOR_INSTRUCTION,   "MONITOR_INSTRUCTION" }, \
1268c2ecf20Sopenharmony_ci	{ EXIT_REASON_PAUSE_INSTRUCTION,     "PAUSE_INSTRUCTION" }, \
1278c2ecf20Sopenharmony_ci	{ EXIT_REASON_MCE_DURING_VMENTRY,    "MCE_DURING_VMENTRY" }, \
1288c2ecf20Sopenharmony_ci	{ EXIT_REASON_TPR_BELOW_THRESHOLD,   "TPR_BELOW_THRESHOLD" }, \
1298c2ecf20Sopenharmony_ci	{ EXIT_REASON_APIC_ACCESS,           "APIC_ACCESS" }, \
1308c2ecf20Sopenharmony_ci	{ EXIT_REASON_EOI_INDUCED,           "EOI_INDUCED" }, \
1318c2ecf20Sopenharmony_ci	{ EXIT_REASON_GDTR_IDTR,             "GDTR_IDTR" }, \
1328c2ecf20Sopenharmony_ci	{ EXIT_REASON_LDTR_TR,               "LDTR_TR" }, \
1338c2ecf20Sopenharmony_ci	{ EXIT_REASON_EPT_VIOLATION,         "EPT_VIOLATION" }, \
1348c2ecf20Sopenharmony_ci	{ EXIT_REASON_EPT_MISCONFIG,         "EPT_MISCONFIG" }, \
1358c2ecf20Sopenharmony_ci	{ EXIT_REASON_INVEPT,                "INVEPT" }, \
1368c2ecf20Sopenharmony_ci	{ EXIT_REASON_RDTSCP,                "RDTSCP" }, \
1378c2ecf20Sopenharmony_ci	{ EXIT_REASON_PREEMPTION_TIMER,      "PREEMPTION_TIMER" }, \
1388c2ecf20Sopenharmony_ci	{ EXIT_REASON_INVVPID,               "INVVPID" }, \
1398c2ecf20Sopenharmony_ci	{ EXIT_REASON_WBINVD,                "WBINVD" }, \
1408c2ecf20Sopenharmony_ci	{ EXIT_REASON_XSETBV,                "XSETBV" }, \
1418c2ecf20Sopenharmony_ci	{ EXIT_REASON_APIC_WRITE,            "APIC_WRITE" }, \
1428c2ecf20Sopenharmony_ci	{ EXIT_REASON_RDRAND,                "RDRAND" }, \
1438c2ecf20Sopenharmony_ci	{ EXIT_REASON_INVPCID,               "INVPCID" }, \
1448c2ecf20Sopenharmony_ci	{ EXIT_REASON_VMFUNC,                "VMFUNC" }, \
1458c2ecf20Sopenharmony_ci	{ EXIT_REASON_ENCLS,                 "ENCLS" }, \
1468c2ecf20Sopenharmony_ci	{ EXIT_REASON_RDSEED,                "RDSEED" }, \
1478c2ecf20Sopenharmony_ci	{ EXIT_REASON_PML_FULL,              "PML_FULL" }, \
1488c2ecf20Sopenharmony_ci	{ EXIT_REASON_XSAVES,                "XSAVES" }, \
1498c2ecf20Sopenharmony_ci	{ EXIT_REASON_XRSTORS,               "XRSTORS" }, \
1508c2ecf20Sopenharmony_ci	{ EXIT_REASON_UMWAIT,                "UMWAIT" }, \
1518c2ecf20Sopenharmony_ci	{ EXIT_REASON_TPAUSE,                "TPAUSE" }
1528c2ecf20Sopenharmony_ci
1538c2ecf20Sopenharmony_ci#define VMX_EXIT_REASON_FLAGS \
1548c2ecf20Sopenharmony_ci	{ VMX_EXIT_REASONS_FAILED_VMENTRY,	"FAILED_VMENTRY" }
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_ci#define VMX_ABORT_SAVE_GUEST_MSR_FAIL        1
1578c2ecf20Sopenharmony_ci#define VMX_ABORT_LOAD_HOST_PDPTE_FAIL       2
1588c2ecf20Sopenharmony_ci#define VMX_ABORT_LOAD_HOST_MSR_FAIL         4
1598c2ecf20Sopenharmony_ci
1608c2ecf20Sopenharmony_ci#endif /* _UAPIVMX_H */
161