245 lines · c
1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */2#ifndef _UAPI__SVM_H3#define _UAPI__SVM_H4 5#define SVM_EXIT_READ_CR0 0x0006#define SVM_EXIT_READ_CR2 0x0027#define SVM_EXIT_READ_CR3 0x0038#define SVM_EXIT_READ_CR4 0x0049#define SVM_EXIT_READ_CR8 0x00810#define SVM_EXIT_WRITE_CR0 0x01011#define SVM_EXIT_WRITE_CR2 0x01212#define SVM_EXIT_WRITE_CR3 0x01313#define SVM_EXIT_WRITE_CR4 0x01414#define SVM_EXIT_WRITE_CR8 0x01815#define SVM_EXIT_READ_DR0 0x02016#define SVM_EXIT_READ_DR1 0x02117#define SVM_EXIT_READ_DR2 0x02218#define SVM_EXIT_READ_DR3 0x02319#define SVM_EXIT_READ_DR4 0x02420#define SVM_EXIT_READ_DR5 0x02521#define SVM_EXIT_READ_DR6 0x02622#define SVM_EXIT_READ_DR7 0x02723#define SVM_EXIT_WRITE_DR0 0x03024#define SVM_EXIT_WRITE_DR1 0x03125#define SVM_EXIT_WRITE_DR2 0x03226#define SVM_EXIT_WRITE_DR3 0x03327#define SVM_EXIT_WRITE_DR4 0x03428#define SVM_EXIT_WRITE_DR5 0x03529#define SVM_EXIT_WRITE_DR6 0x03630#define SVM_EXIT_WRITE_DR7 0x03731#define SVM_EXIT_EXCP_BASE 0x04032#define SVM_EXIT_LAST_EXCP 0x05f33#define SVM_EXIT_INTR 0x06034#define SVM_EXIT_NMI 0x06135#define SVM_EXIT_SMI 0x06236#define SVM_EXIT_INIT 0x06337#define SVM_EXIT_VINTR 0x06438#define SVM_EXIT_CR0_SEL_WRITE 0x06539#define SVM_EXIT_IDTR_READ 0x06640#define SVM_EXIT_GDTR_READ 0x06741#define SVM_EXIT_LDTR_READ 0x06842#define SVM_EXIT_TR_READ 0x06943#define SVM_EXIT_IDTR_WRITE 0x06a44#define SVM_EXIT_GDTR_WRITE 0x06b45#define SVM_EXIT_LDTR_WRITE 0x06c46#define SVM_EXIT_TR_WRITE 0x06d47#define SVM_EXIT_RDTSC 0x06e48#define SVM_EXIT_RDPMC 0x06f49#define SVM_EXIT_PUSHF 0x07050#define SVM_EXIT_POPF 0x07151#define SVM_EXIT_CPUID 0x07252#define SVM_EXIT_RSM 0x07353#define SVM_EXIT_IRET 0x07454#define SVM_EXIT_SWINT 0x07555#define SVM_EXIT_INVD 0x07656#define SVM_EXIT_PAUSE 0x07757#define SVM_EXIT_HLT 0x07858#define SVM_EXIT_INVLPG 0x07959#define SVM_EXIT_INVLPGA 0x07a60#define SVM_EXIT_IOIO 0x07b61#define SVM_EXIT_MSR 0x07c62#define SVM_EXIT_TASK_SWITCH 0x07d63#define SVM_EXIT_FERR_FREEZE 0x07e64#define SVM_EXIT_SHUTDOWN 0x07f65#define SVM_EXIT_VMRUN 0x08066#define SVM_EXIT_VMMCALL 0x08167#define SVM_EXIT_VMLOAD 0x08268#define SVM_EXIT_VMSAVE 0x08369#define SVM_EXIT_STGI 0x08470#define SVM_EXIT_CLGI 0x08571#define SVM_EXIT_SKINIT 0x08672#define SVM_EXIT_RDTSCP 0x08773#define SVM_EXIT_ICEBP 0x08874#define SVM_EXIT_WBINVD 0x08975#define SVM_EXIT_MONITOR 0x08a76#define SVM_EXIT_MWAIT 0x08b77#define SVM_EXIT_MWAIT_COND 0x08c78#define SVM_EXIT_XSETBV 0x08d79#define SVM_EXIT_RDPRU 0x08e80#define SVM_EXIT_EFER_WRITE_TRAP 0x08f81#define SVM_EXIT_CR0_WRITE_TRAP 0x09082#define SVM_EXIT_CR1_WRITE_TRAP 0x09183#define SVM_EXIT_CR2_WRITE_TRAP 0x09284#define SVM_EXIT_CR3_WRITE_TRAP 0x09385#define SVM_EXIT_CR4_WRITE_TRAP 0x09486#define SVM_EXIT_CR5_WRITE_TRAP 0x09587#define SVM_EXIT_CR6_WRITE_TRAP 0x09688#define SVM_EXIT_CR7_WRITE_TRAP 0x09789#define SVM_EXIT_CR8_WRITE_TRAP 0x09890#define SVM_EXIT_CR9_WRITE_TRAP 0x09991#define SVM_EXIT_CR10_WRITE_TRAP 0x09a92#define SVM_EXIT_CR11_WRITE_TRAP 0x09b93#define SVM_EXIT_CR12_WRITE_TRAP 0x09c94#define SVM_EXIT_CR13_WRITE_TRAP 0x09d95#define SVM_EXIT_CR14_WRITE_TRAP 0x09e96#define SVM_EXIT_CR15_WRITE_TRAP 0x09f97#define SVM_EXIT_INVPCID 0x0a298#define SVM_EXIT_NPF 0x40099#define SVM_EXIT_AVIC_INCOMPLETE_IPI 0x401100#define SVM_EXIT_AVIC_UNACCELERATED_ACCESS 0x402101#define SVM_EXIT_VMGEXIT 0x403102 103/* SEV-ES software-defined VMGEXIT events */104#define SVM_VMGEXIT_MMIO_READ 0x80000001105#define SVM_VMGEXIT_MMIO_WRITE 0x80000002106#define SVM_VMGEXIT_NMI_COMPLETE 0x80000003107#define SVM_VMGEXIT_AP_HLT_LOOP 0x80000004108#define SVM_VMGEXIT_AP_JUMP_TABLE 0x80000005109#define SVM_VMGEXIT_SET_AP_JUMP_TABLE 0110#define SVM_VMGEXIT_GET_AP_JUMP_TABLE 1111#define SVM_VMGEXIT_PSC 0x80000010112#define SVM_VMGEXIT_GUEST_REQUEST 0x80000011113#define SVM_VMGEXIT_EXT_GUEST_REQUEST 0x80000012114#define SVM_VMGEXIT_AP_CREATION 0x80000013115#define SVM_VMGEXIT_AP_CREATE_ON_INIT 0116#define SVM_VMGEXIT_AP_CREATE 1117#define SVM_VMGEXIT_AP_DESTROY 2118#define SVM_VMGEXIT_SNP_RUN_VMPL 0x80000018119#define SVM_VMGEXIT_HV_FEATURES 0x8000fffd120#define SVM_VMGEXIT_TERM_REQUEST 0x8000fffe121#define SVM_VMGEXIT_TERM_REASON(reason_set, reason_code) \122 /* SW_EXITINFO1[3:0] */ \123 (((((u64)reason_set) & 0xf)) | \124 /* SW_EXITINFO1[11:4] */ \125 ((((u64)reason_code) & 0xff) << 4))126#define SVM_VMGEXIT_UNSUPPORTED_EVENT 0x8000ffff127 128/* Exit code reserved for hypervisor/software use */129#define SVM_EXIT_SW 0xf0000000130 131#define SVM_EXIT_ERR -1132 133#define SVM_EXIT_REASONS \134 { SVM_EXIT_READ_CR0, "read_cr0" }, \135 { SVM_EXIT_READ_CR2, "read_cr2" }, \136 { SVM_EXIT_READ_CR3, "read_cr3" }, \137 { SVM_EXIT_READ_CR4, "read_cr4" }, \138 { SVM_EXIT_READ_CR8, "read_cr8" }, \139 { SVM_EXIT_WRITE_CR0, "write_cr0" }, \140 { SVM_EXIT_WRITE_CR2, "write_cr2" }, \141 { SVM_EXIT_WRITE_CR3, "write_cr3" }, \142 { SVM_EXIT_WRITE_CR4, "write_cr4" }, \143 { SVM_EXIT_WRITE_CR8, "write_cr8" }, \144 { SVM_EXIT_READ_DR0, "read_dr0" }, \145 { SVM_EXIT_READ_DR1, "read_dr1" }, \146 { SVM_EXIT_READ_DR2, "read_dr2" }, \147 { SVM_EXIT_READ_DR3, "read_dr3" }, \148 { SVM_EXIT_READ_DR4, "read_dr4" }, \149 { SVM_EXIT_READ_DR5, "read_dr5" }, \150 { SVM_EXIT_READ_DR6, "read_dr6" }, \151 { SVM_EXIT_READ_DR7, "read_dr7" }, \152 { SVM_EXIT_WRITE_DR0, "write_dr0" }, \153 { SVM_EXIT_WRITE_DR1, "write_dr1" }, \154 { SVM_EXIT_WRITE_DR2, "write_dr2" }, \155 { SVM_EXIT_WRITE_DR3, "write_dr3" }, \156 { SVM_EXIT_WRITE_DR4, "write_dr4" }, \157 { SVM_EXIT_WRITE_DR5, "write_dr5" }, \158 { SVM_EXIT_WRITE_DR6, "write_dr6" }, \159 { SVM_EXIT_WRITE_DR7, "write_dr7" }, \160 { SVM_EXIT_EXCP_BASE + DE_VECTOR, "DE excp" }, \161 { SVM_EXIT_EXCP_BASE + DB_VECTOR, "DB excp" }, \162 { SVM_EXIT_EXCP_BASE + BP_VECTOR, "BP excp" }, \163 { SVM_EXIT_EXCP_BASE + OF_VECTOR, "OF excp" }, \164 { SVM_EXIT_EXCP_BASE + BR_VECTOR, "BR excp" }, \165 { SVM_EXIT_EXCP_BASE + UD_VECTOR, "UD excp" }, \166 { SVM_EXIT_EXCP_BASE + NM_VECTOR, "NM excp" }, \167 { SVM_EXIT_EXCP_BASE + DF_VECTOR, "DF excp" }, \168 { SVM_EXIT_EXCP_BASE + TS_VECTOR, "TS excp" }, \169 { SVM_EXIT_EXCP_BASE + NP_VECTOR, "NP excp" }, \170 { SVM_EXIT_EXCP_BASE + SS_VECTOR, "SS excp" }, \171 { SVM_EXIT_EXCP_BASE + GP_VECTOR, "GP excp" }, \172 { SVM_EXIT_EXCP_BASE + PF_VECTOR, "PF excp" }, \173 { SVM_EXIT_EXCP_BASE + MF_VECTOR, "MF excp" }, \174 { SVM_EXIT_EXCP_BASE + AC_VECTOR, "AC excp" }, \175 { SVM_EXIT_EXCP_BASE + MC_VECTOR, "MC excp" }, \176 { SVM_EXIT_EXCP_BASE + XM_VECTOR, "XF excp" }, \177 { SVM_EXIT_INTR, "interrupt" }, \178 { SVM_EXIT_NMI, "nmi" }, \179 { SVM_EXIT_SMI, "smi" }, \180 { SVM_EXIT_INIT, "init" }, \181 { SVM_EXIT_VINTR, "vintr" }, \182 { SVM_EXIT_CR0_SEL_WRITE, "cr0_sel_write" }, \183 { SVM_EXIT_IDTR_READ, "read_idtr" }, \184 { SVM_EXIT_GDTR_READ, "read_gdtr" }, \185 { SVM_EXIT_LDTR_READ, "read_ldtr" }, \186 { SVM_EXIT_TR_READ, "read_rt" }, \187 { SVM_EXIT_IDTR_WRITE, "write_idtr" }, \188 { SVM_EXIT_GDTR_WRITE, "write_gdtr" }, \189 { SVM_EXIT_LDTR_WRITE, "write_ldtr" }, \190 { SVM_EXIT_TR_WRITE, "write_rt" }, \191 { SVM_EXIT_RDTSC, "rdtsc" }, \192 { SVM_EXIT_RDPMC, "rdpmc" }, \193 { SVM_EXIT_PUSHF, "pushf" }, \194 { SVM_EXIT_POPF, "popf" }, \195 { SVM_EXIT_CPUID, "cpuid" }, \196 { SVM_EXIT_RSM, "rsm" }, \197 { SVM_EXIT_IRET, "iret" }, \198 { SVM_EXIT_SWINT, "swint" }, \199 { SVM_EXIT_INVD, "invd" }, \200 { SVM_EXIT_PAUSE, "pause" }, \201 { SVM_EXIT_HLT, "hlt" }, \202 { SVM_EXIT_INVLPG, "invlpg" }, \203 { SVM_EXIT_INVLPGA, "invlpga" }, \204 { SVM_EXIT_IOIO, "io" }, \205 { SVM_EXIT_MSR, "msr" }, \206 { SVM_EXIT_TASK_SWITCH, "task_switch" }, \207 { SVM_EXIT_FERR_FREEZE, "ferr_freeze" }, \208 { SVM_EXIT_SHUTDOWN, "shutdown" }, \209 { SVM_EXIT_VMRUN, "vmrun" }, \210 { SVM_EXIT_VMMCALL, "hypercall" }, \211 { SVM_EXIT_VMLOAD, "vmload" }, \212 { SVM_EXIT_VMSAVE, "vmsave" }, \213 { SVM_EXIT_STGI, "stgi" }, \214 { SVM_EXIT_CLGI, "clgi" }, \215 { SVM_EXIT_SKINIT, "skinit" }, \216 { SVM_EXIT_RDTSCP, "rdtscp" }, \217 { SVM_EXIT_ICEBP, "icebp" }, \218 { SVM_EXIT_WBINVD, "wbinvd" }, \219 { SVM_EXIT_MONITOR, "monitor" }, \220 { SVM_EXIT_MWAIT, "mwait" }, \221 { SVM_EXIT_XSETBV, "xsetbv" }, \222 { SVM_EXIT_EFER_WRITE_TRAP, "write_efer_trap" }, \223 { SVM_EXIT_CR0_WRITE_TRAP, "write_cr0_trap" }, \224 { SVM_EXIT_CR4_WRITE_TRAP, "write_cr4_trap" }, \225 { SVM_EXIT_CR8_WRITE_TRAP, "write_cr8_trap" }, \226 { SVM_EXIT_INVPCID, "invpcid" }, \227 { SVM_EXIT_NPF, "npf" }, \228 { SVM_EXIT_AVIC_INCOMPLETE_IPI, "avic_incomplete_ipi" }, \229 { SVM_EXIT_AVIC_UNACCELERATED_ACCESS, "avic_unaccelerated_access" }, \230 { SVM_EXIT_VMGEXIT, "vmgexit" }, \231 { SVM_VMGEXIT_MMIO_READ, "vmgexit_mmio_read" }, \232 { SVM_VMGEXIT_MMIO_WRITE, "vmgexit_mmio_write" }, \233 { SVM_VMGEXIT_NMI_COMPLETE, "vmgexit_nmi_complete" }, \234 { SVM_VMGEXIT_AP_HLT_LOOP, "vmgexit_ap_hlt_loop" }, \235 { SVM_VMGEXIT_AP_JUMP_TABLE, "vmgexit_ap_jump_table" }, \236 { SVM_VMGEXIT_PSC, "vmgexit_page_state_change" }, \237 { SVM_VMGEXIT_GUEST_REQUEST, "vmgexit_guest_request" }, \238 { SVM_VMGEXIT_EXT_GUEST_REQUEST, "vmgexit_ext_guest_request" }, \239 { SVM_VMGEXIT_AP_CREATION, "vmgexit_ap_creation" }, \240 { SVM_VMGEXIT_HV_FEATURES, "vmgexit_hypervisor_feature" }, \241 { SVM_EXIT_ERR, "invalid_guest_state" }242 243 244#endif /* _UAPI__SVM_H */245