Greg Kroah-Hartman | 6f52b16 | 2017-11-01 15:08:43 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 2 | #ifndef _UAPI__SVM_H |
| 3 | #define _UAPI__SVM_H |
| 4 | |
| 5 | #define SVM_EXIT_READ_CR0 0x000 |
Jan Kiszka | 079d085 | 2016-05-23 08:43:31 +0200 | [diff] [blame] | 6 | #define SVM_EXIT_READ_CR2 0x002 |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 7 | #define SVM_EXIT_READ_CR3 0x003 |
| 8 | #define SVM_EXIT_READ_CR4 0x004 |
| 9 | #define SVM_EXIT_READ_CR8 0x008 |
| 10 | #define SVM_EXIT_WRITE_CR0 0x010 |
Jan Kiszka | 079d085 | 2016-05-23 08:43:31 +0200 | [diff] [blame] | 11 | #define SVM_EXIT_WRITE_CR2 0x012 |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 12 | #define SVM_EXIT_WRITE_CR3 0x013 |
| 13 | #define SVM_EXIT_WRITE_CR4 0x014 |
| 14 | #define SVM_EXIT_WRITE_CR8 0x018 |
| 15 | #define SVM_EXIT_READ_DR0 0x020 |
| 16 | #define SVM_EXIT_READ_DR1 0x021 |
| 17 | #define SVM_EXIT_READ_DR2 0x022 |
| 18 | #define SVM_EXIT_READ_DR3 0x023 |
| 19 | #define SVM_EXIT_READ_DR4 0x024 |
| 20 | #define SVM_EXIT_READ_DR5 0x025 |
| 21 | #define SVM_EXIT_READ_DR6 0x026 |
| 22 | #define SVM_EXIT_READ_DR7 0x027 |
| 23 | #define SVM_EXIT_WRITE_DR0 0x030 |
| 24 | #define SVM_EXIT_WRITE_DR1 0x031 |
| 25 | #define SVM_EXIT_WRITE_DR2 0x032 |
| 26 | #define SVM_EXIT_WRITE_DR3 0x033 |
| 27 | #define SVM_EXIT_WRITE_DR4 0x034 |
| 28 | #define SVM_EXIT_WRITE_DR5 0x035 |
| 29 | #define SVM_EXIT_WRITE_DR6 0x036 |
| 30 | #define SVM_EXIT_WRITE_DR7 0x037 |
| 31 | #define SVM_EXIT_EXCP_BASE 0x040 |
Joerg Roedel | 597cfe48 | 2020-09-07 15:15:24 +0200 | [diff] [blame] | 32 | #define SVM_EXIT_LAST_EXCP 0x05f |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 33 | #define SVM_EXIT_INTR 0x060 |
| 34 | #define SVM_EXIT_NMI 0x061 |
| 35 | #define SVM_EXIT_SMI 0x062 |
| 36 | #define SVM_EXIT_INIT 0x063 |
| 37 | #define SVM_EXIT_VINTR 0x064 |
| 38 | #define SVM_EXIT_CR0_SEL_WRITE 0x065 |
| 39 | #define SVM_EXIT_IDTR_READ 0x066 |
| 40 | #define SVM_EXIT_GDTR_READ 0x067 |
| 41 | #define SVM_EXIT_LDTR_READ 0x068 |
| 42 | #define SVM_EXIT_TR_READ 0x069 |
| 43 | #define SVM_EXIT_IDTR_WRITE 0x06a |
| 44 | #define SVM_EXIT_GDTR_WRITE 0x06b |
| 45 | #define SVM_EXIT_LDTR_WRITE 0x06c |
| 46 | #define SVM_EXIT_TR_WRITE 0x06d |
| 47 | #define SVM_EXIT_RDTSC 0x06e |
| 48 | #define SVM_EXIT_RDPMC 0x06f |
| 49 | #define SVM_EXIT_PUSHF 0x070 |
| 50 | #define SVM_EXIT_POPF 0x071 |
| 51 | #define SVM_EXIT_CPUID 0x072 |
| 52 | #define SVM_EXIT_RSM 0x073 |
| 53 | #define SVM_EXIT_IRET 0x074 |
| 54 | #define SVM_EXIT_SWINT 0x075 |
| 55 | #define SVM_EXIT_INVD 0x076 |
| 56 | #define SVM_EXIT_PAUSE 0x077 |
| 57 | #define SVM_EXIT_HLT 0x078 |
| 58 | #define SVM_EXIT_INVLPG 0x079 |
| 59 | #define SVM_EXIT_INVLPGA 0x07a |
| 60 | #define SVM_EXIT_IOIO 0x07b |
| 61 | #define SVM_EXIT_MSR 0x07c |
| 62 | #define SVM_EXIT_TASK_SWITCH 0x07d |
| 63 | #define SVM_EXIT_FERR_FREEZE 0x07e |
| 64 | #define SVM_EXIT_SHUTDOWN 0x07f |
| 65 | #define SVM_EXIT_VMRUN 0x080 |
| 66 | #define SVM_EXIT_VMMCALL 0x081 |
| 67 | #define SVM_EXIT_VMLOAD 0x082 |
| 68 | #define SVM_EXIT_VMSAVE 0x083 |
| 69 | #define SVM_EXIT_STGI 0x084 |
| 70 | #define SVM_EXIT_CLGI 0x085 |
| 71 | #define SVM_EXIT_SKINIT 0x086 |
| 72 | #define SVM_EXIT_RDTSCP 0x087 |
| 73 | #define SVM_EXIT_ICEBP 0x088 |
| 74 | #define SVM_EXIT_WBINVD 0x089 |
| 75 | #define SVM_EXIT_MONITOR 0x08a |
| 76 | #define SVM_EXIT_MWAIT 0x08b |
| 77 | #define SVM_EXIT_MWAIT_COND 0x08c |
| 78 | #define SVM_EXIT_XSETBV 0x08d |
Jim Mattson | 0cb8410 | 2019-09-19 15:59:17 -0700 | [diff] [blame] | 79 | #define SVM_EXIT_RDPRU 0x08e |
Tom Lendacky | 2985afb | 2020-12-10 11:09:55 -0600 | [diff] [blame] | 80 | #define SVM_EXIT_EFER_WRITE_TRAP 0x08f |
Tom Lendacky | f27ad38 | 2020-12-10 11:09:56 -0600 | [diff] [blame] | 81 | #define SVM_EXIT_CR0_WRITE_TRAP 0x090 |
| 82 | #define SVM_EXIT_CR1_WRITE_TRAP 0x091 |
| 83 | #define SVM_EXIT_CR2_WRITE_TRAP 0x092 |
| 84 | #define SVM_EXIT_CR3_WRITE_TRAP 0x093 |
| 85 | #define SVM_EXIT_CR4_WRITE_TRAP 0x094 |
| 86 | #define SVM_EXIT_CR5_WRITE_TRAP 0x095 |
| 87 | #define SVM_EXIT_CR6_WRITE_TRAP 0x096 |
| 88 | #define SVM_EXIT_CR7_WRITE_TRAP 0x097 |
| 89 | #define SVM_EXIT_CR8_WRITE_TRAP 0x098 |
| 90 | #define SVM_EXIT_CR9_WRITE_TRAP 0x099 |
| 91 | #define SVM_EXIT_CR10_WRITE_TRAP 0x09a |
| 92 | #define SVM_EXIT_CR11_WRITE_TRAP 0x09b |
| 93 | #define SVM_EXIT_CR12_WRITE_TRAP 0x09c |
| 94 | #define SVM_EXIT_CR13_WRITE_TRAP 0x09d |
| 95 | #define SVM_EXIT_CR14_WRITE_TRAP 0x09e |
| 96 | #define SVM_EXIT_CR15_WRITE_TRAP 0x09f |
Babu Moger | 4407a79 | 2020-09-11 14:29:19 -0500 | [diff] [blame] | 97 | #define SVM_EXIT_INVPCID 0x0a2 |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 98 | #define SVM_EXIT_NPF 0x400 |
Suravee Suthikulpanit | 18f40c5 | 2016-05-04 14:09:48 -0500 | [diff] [blame] | 99 | #define SVM_EXIT_AVIC_INCOMPLETE_IPI 0x401 |
| 100 | #define SVM_EXIT_AVIC_UNACCELERATED_ACCESS 0x402 |
Tom Lendacky | 291bd20 | 2020-12-10 11:09:47 -0600 | [diff] [blame] | 101 | #define SVM_EXIT_VMGEXIT 0x403 |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 102 | |
Tom Lendacky | 51ee7d6 | 2020-09-07 15:15:50 +0200 | [diff] [blame] | 103 | /* SEV-ES software-defined VMGEXIT events */ |
| 104 | #define SVM_VMGEXIT_MMIO_READ 0x80000001 |
| 105 | #define SVM_VMGEXIT_MMIO_WRITE 0x80000002 |
Joerg Roedel | 4ca68e0 | 2020-09-07 15:16:11 +0200 | [diff] [blame] | 106 | #define SVM_VMGEXIT_NMI_COMPLETE 0x80000003 |
Joerg Roedel | 094794f | 2020-09-07 15:16:10 +0200 | [diff] [blame] | 107 | #define SVM_VMGEXIT_AP_HLT_LOOP 0x80000004 |
Tom Lendacky | 8940ac9 | 2020-09-07 15:16:07 +0200 | [diff] [blame] | 108 | #define SVM_VMGEXIT_AP_JUMP_TABLE 0x80000005 |
| 109 | #define SVM_VMGEXIT_SET_AP_JUMP_TABLE 0 |
| 110 | #define SVM_VMGEXIT_GET_AP_JUMP_TABLE 1 |
Tom Lendacky | 51ee7d6 | 2020-09-07 15:15:50 +0200 | [diff] [blame] | 111 | #define SVM_VMGEXIT_UNSUPPORTED_EVENT 0x8000ffff |
| 112 | |
Vineeth Pillai | 59d21d6 | 2021-06-03 15:14:37 +0000 | [diff] [blame^] | 113 | /* Exit code reserved for hypervisor/software use */ |
| 114 | #define SVM_EXIT_SW 0xf0000000 |
| 115 | |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 116 | #define SVM_EXIT_ERR -1 |
| 117 | |
| 118 | #define SVM_EXIT_REASONS \ |
| 119 | { SVM_EXIT_READ_CR0, "read_cr0" }, \ |
Jan Kiszka | 079d085 | 2016-05-23 08:43:31 +0200 | [diff] [blame] | 120 | { SVM_EXIT_READ_CR2, "read_cr2" }, \ |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 121 | { SVM_EXIT_READ_CR3, "read_cr3" }, \ |
| 122 | { SVM_EXIT_READ_CR4, "read_cr4" }, \ |
| 123 | { SVM_EXIT_READ_CR8, "read_cr8" }, \ |
| 124 | { SVM_EXIT_WRITE_CR0, "write_cr0" }, \ |
Jan Kiszka | 079d085 | 2016-05-23 08:43:31 +0200 | [diff] [blame] | 125 | { SVM_EXIT_WRITE_CR2, "write_cr2" }, \ |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 126 | { SVM_EXIT_WRITE_CR3, "write_cr3" }, \ |
| 127 | { SVM_EXIT_WRITE_CR4, "write_cr4" }, \ |
| 128 | { SVM_EXIT_WRITE_CR8, "write_cr8" }, \ |
| 129 | { SVM_EXIT_READ_DR0, "read_dr0" }, \ |
| 130 | { SVM_EXIT_READ_DR1, "read_dr1" }, \ |
| 131 | { SVM_EXIT_READ_DR2, "read_dr2" }, \ |
| 132 | { SVM_EXIT_READ_DR3, "read_dr3" }, \ |
Jan Kiszka | 079d085 | 2016-05-23 08:43:31 +0200 | [diff] [blame] | 133 | { SVM_EXIT_READ_DR4, "read_dr4" }, \ |
| 134 | { SVM_EXIT_READ_DR5, "read_dr5" }, \ |
| 135 | { SVM_EXIT_READ_DR6, "read_dr6" }, \ |
| 136 | { SVM_EXIT_READ_DR7, "read_dr7" }, \ |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 137 | { SVM_EXIT_WRITE_DR0, "write_dr0" }, \ |
| 138 | { SVM_EXIT_WRITE_DR1, "write_dr1" }, \ |
| 139 | { SVM_EXIT_WRITE_DR2, "write_dr2" }, \ |
| 140 | { SVM_EXIT_WRITE_DR3, "write_dr3" }, \ |
Jan Kiszka | 079d085 | 2016-05-23 08:43:31 +0200 | [diff] [blame] | 141 | { SVM_EXIT_WRITE_DR4, "write_dr4" }, \ |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 142 | { SVM_EXIT_WRITE_DR5, "write_dr5" }, \ |
Jan Kiszka | 079d085 | 2016-05-23 08:43:31 +0200 | [diff] [blame] | 143 | { SVM_EXIT_WRITE_DR6, "write_dr6" }, \ |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 144 | { SVM_EXIT_WRITE_DR7, "write_dr7" }, \ |
Jan Kiszka | 079d085 | 2016-05-23 08:43:31 +0200 | [diff] [blame] | 145 | { SVM_EXIT_EXCP_BASE + DE_VECTOR, "DE excp" }, \ |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 146 | { SVM_EXIT_EXCP_BASE + DB_VECTOR, "DB excp" }, \ |
| 147 | { SVM_EXIT_EXCP_BASE + BP_VECTOR, "BP excp" }, \ |
Jan Kiszka | 079d085 | 2016-05-23 08:43:31 +0200 | [diff] [blame] | 148 | { SVM_EXIT_EXCP_BASE + OF_VECTOR, "OF excp" }, \ |
| 149 | { SVM_EXIT_EXCP_BASE + BR_VECTOR, "BR excp" }, \ |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 150 | { SVM_EXIT_EXCP_BASE + UD_VECTOR, "UD excp" }, \ |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 151 | { SVM_EXIT_EXCP_BASE + NM_VECTOR, "NM excp" }, \ |
Jan Kiszka | 079d085 | 2016-05-23 08:43:31 +0200 | [diff] [blame] | 152 | { SVM_EXIT_EXCP_BASE + DF_VECTOR, "DF excp" }, \ |
| 153 | { SVM_EXIT_EXCP_BASE + TS_VECTOR, "TS excp" }, \ |
| 154 | { SVM_EXIT_EXCP_BASE + NP_VECTOR, "NP excp" }, \ |
| 155 | { SVM_EXIT_EXCP_BASE + SS_VECTOR, "SS excp" }, \ |
| 156 | { SVM_EXIT_EXCP_BASE + GP_VECTOR, "GP excp" }, \ |
| 157 | { SVM_EXIT_EXCP_BASE + PF_VECTOR, "PF excp" }, \ |
| 158 | { SVM_EXIT_EXCP_BASE + MF_VECTOR, "MF excp" }, \ |
Eric Northup | 54a2055 | 2015-11-03 18:03:53 +0100 | [diff] [blame] | 159 | { SVM_EXIT_EXCP_BASE + AC_VECTOR, "AC excp" }, \ |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 160 | { SVM_EXIT_EXCP_BASE + MC_VECTOR, "MC excp" }, \ |
Jan Kiszka | 079d085 | 2016-05-23 08:43:31 +0200 | [diff] [blame] | 161 | { SVM_EXIT_EXCP_BASE + XM_VECTOR, "XF excp" }, \ |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 162 | { SVM_EXIT_INTR, "interrupt" }, \ |
| 163 | { SVM_EXIT_NMI, "nmi" }, \ |
| 164 | { SVM_EXIT_SMI, "smi" }, \ |
| 165 | { SVM_EXIT_INIT, "init" }, \ |
| 166 | { SVM_EXIT_VINTR, "vintr" }, \ |
Suravee Suthikulpanit | 18f40c5 | 2016-05-04 14:09:48 -0500 | [diff] [blame] | 167 | { SVM_EXIT_CR0_SEL_WRITE, "cr0_sel_write" }, \ |
Jan Kiszka | 079d085 | 2016-05-23 08:43:31 +0200 | [diff] [blame] | 168 | { SVM_EXIT_IDTR_READ, "read_idtr" }, \ |
| 169 | { SVM_EXIT_GDTR_READ, "read_gdtr" }, \ |
| 170 | { SVM_EXIT_LDTR_READ, "read_ldtr" }, \ |
| 171 | { SVM_EXIT_TR_READ, "read_rt" }, \ |
| 172 | { SVM_EXIT_IDTR_WRITE, "write_idtr" }, \ |
| 173 | { SVM_EXIT_GDTR_WRITE, "write_gdtr" }, \ |
| 174 | { SVM_EXIT_LDTR_WRITE, "write_ldtr" }, \ |
| 175 | { SVM_EXIT_TR_WRITE, "write_rt" }, \ |
| 176 | { SVM_EXIT_RDTSC, "rdtsc" }, \ |
| 177 | { SVM_EXIT_RDPMC, "rdpmc" }, \ |
| 178 | { SVM_EXIT_PUSHF, "pushf" }, \ |
| 179 | { SVM_EXIT_POPF, "popf" }, \ |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 180 | { SVM_EXIT_CPUID, "cpuid" }, \ |
Jan Kiszka | 079d085 | 2016-05-23 08:43:31 +0200 | [diff] [blame] | 181 | { SVM_EXIT_RSM, "rsm" }, \ |
| 182 | { SVM_EXIT_IRET, "iret" }, \ |
| 183 | { SVM_EXIT_SWINT, "swint" }, \ |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 184 | { SVM_EXIT_INVD, "invd" }, \ |
Suravee Suthikulpanit | 18f40c5 | 2016-05-04 14:09:48 -0500 | [diff] [blame] | 185 | { SVM_EXIT_PAUSE, "pause" }, \ |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 186 | { SVM_EXIT_HLT, "hlt" }, \ |
| 187 | { SVM_EXIT_INVLPG, "invlpg" }, \ |
| 188 | { SVM_EXIT_INVLPGA, "invlpga" }, \ |
| 189 | { SVM_EXIT_IOIO, "io" }, \ |
| 190 | { SVM_EXIT_MSR, "msr" }, \ |
| 191 | { SVM_EXIT_TASK_SWITCH, "task_switch" }, \ |
Jan Kiszka | 079d085 | 2016-05-23 08:43:31 +0200 | [diff] [blame] | 192 | { SVM_EXIT_FERR_FREEZE, "ferr_freeze" }, \ |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 193 | { SVM_EXIT_SHUTDOWN, "shutdown" }, \ |
| 194 | { SVM_EXIT_VMRUN, "vmrun" }, \ |
| 195 | { SVM_EXIT_VMMCALL, "hypercall" }, \ |
| 196 | { SVM_EXIT_VMLOAD, "vmload" }, \ |
| 197 | { SVM_EXIT_VMSAVE, "vmsave" }, \ |
| 198 | { SVM_EXIT_STGI, "stgi" }, \ |
| 199 | { SVM_EXIT_CLGI, "clgi" }, \ |
| 200 | { SVM_EXIT_SKINIT, "skinit" }, \ |
Jan Kiszka | 079d085 | 2016-05-23 08:43:31 +0200 | [diff] [blame] | 201 | { SVM_EXIT_RDTSCP, "rdtscp" }, \ |
| 202 | { SVM_EXIT_ICEBP, "icebp" }, \ |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 203 | { SVM_EXIT_WBINVD, "wbinvd" }, \ |
| 204 | { SVM_EXIT_MONITOR, "monitor" }, \ |
| 205 | { SVM_EXIT_MWAIT, "mwait" }, \ |
| 206 | { SVM_EXIT_XSETBV, "xsetbv" }, \ |
Tom Lendacky | 2985afb | 2020-12-10 11:09:55 -0600 | [diff] [blame] | 207 | { SVM_EXIT_EFER_WRITE_TRAP, "write_efer_trap" }, \ |
Tom Lendacky | f27ad38 | 2020-12-10 11:09:56 -0600 | [diff] [blame] | 208 | { SVM_EXIT_CR0_WRITE_TRAP, "write_cr0_trap" }, \ |
Tom Lendacky | 5b51cb1 | 2020-12-10 11:09:57 -0600 | [diff] [blame] | 209 | { SVM_EXIT_CR4_WRITE_TRAP, "write_cr4_trap" }, \ |
Tom Lendacky | d1949b9 | 2020-12-10 11:09:58 -0600 | [diff] [blame] | 210 | { SVM_EXIT_CR8_WRITE_TRAP, "write_cr8_trap" }, \ |
Babu Moger | 4407a79 | 2020-09-11 14:29:19 -0500 | [diff] [blame] | 211 | { SVM_EXIT_INVPCID, "invpcid" }, \ |
Suravee Suthikulpanit | 18f40c5 | 2016-05-04 14:09:48 -0500 | [diff] [blame] | 212 | { SVM_EXIT_NPF, "npf" }, \ |
Suravee Suthikulpanit | 18f40c5 | 2016-05-04 14:09:48 -0500 | [diff] [blame] | 213 | { SVM_EXIT_AVIC_INCOMPLETE_IPI, "avic_incomplete_ipi" }, \ |
Jan Kiszka | 079d085 | 2016-05-23 08:43:31 +0200 | [diff] [blame] | 214 | { SVM_EXIT_AVIC_UNACCELERATED_ACCESS, "avic_unaccelerated_access" }, \ |
Tom Lendacky | 291bd20 | 2020-12-10 11:09:47 -0600 | [diff] [blame] | 215 | { SVM_EXIT_VMGEXIT, "vmgexit" }, \ |
| 216 | { SVM_VMGEXIT_MMIO_READ, "vmgexit_mmio_read" }, \ |
| 217 | { SVM_VMGEXIT_MMIO_WRITE, "vmgexit_mmio_write" }, \ |
| 218 | { SVM_VMGEXIT_NMI_COMPLETE, "vmgexit_nmi_complete" }, \ |
| 219 | { SVM_VMGEXIT_AP_HLT_LOOP, "vmgexit_ap_hlt_loop" }, \ |
| 220 | { SVM_VMGEXIT_AP_JUMP_TABLE, "vmgexit_ap_jump_table" }, \ |
Jan Kiszka | 079d085 | 2016-05-23 08:43:31 +0200 | [diff] [blame] | 221 | { SVM_EXIT_ERR, "invalid_guest_state" } |
David Howells | af170c5 | 2012-12-14 22:37:13 +0000 | [diff] [blame] | 222 | |
| 223 | |
| 224 | #endif /* _UAPI__SVM_H */ |