162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 262306a36Sopenharmony_ci#ifndef _UAPI__SVM_H 362306a36Sopenharmony_ci#define _UAPI__SVM_H 462306a36Sopenharmony_ci 562306a36Sopenharmony_ci#define SVM_EXIT_READ_CR0 0x000 662306a36Sopenharmony_ci#define SVM_EXIT_READ_CR2 0x002 762306a36Sopenharmony_ci#define SVM_EXIT_READ_CR3 0x003 862306a36Sopenharmony_ci#define SVM_EXIT_READ_CR4 0x004 962306a36Sopenharmony_ci#define SVM_EXIT_READ_CR8 0x008 1062306a36Sopenharmony_ci#define SVM_EXIT_WRITE_CR0 0x010 1162306a36Sopenharmony_ci#define SVM_EXIT_WRITE_CR2 0x012 1262306a36Sopenharmony_ci#define SVM_EXIT_WRITE_CR3 0x013 1362306a36Sopenharmony_ci#define SVM_EXIT_WRITE_CR4 0x014 1462306a36Sopenharmony_ci#define SVM_EXIT_WRITE_CR8 0x018 1562306a36Sopenharmony_ci#define SVM_EXIT_READ_DR0 0x020 1662306a36Sopenharmony_ci#define SVM_EXIT_READ_DR1 0x021 1762306a36Sopenharmony_ci#define SVM_EXIT_READ_DR2 0x022 1862306a36Sopenharmony_ci#define SVM_EXIT_READ_DR3 0x023 1962306a36Sopenharmony_ci#define SVM_EXIT_READ_DR4 0x024 2062306a36Sopenharmony_ci#define SVM_EXIT_READ_DR5 0x025 2162306a36Sopenharmony_ci#define SVM_EXIT_READ_DR6 0x026 2262306a36Sopenharmony_ci#define SVM_EXIT_READ_DR7 0x027 2362306a36Sopenharmony_ci#define SVM_EXIT_WRITE_DR0 0x030 2462306a36Sopenharmony_ci#define SVM_EXIT_WRITE_DR1 0x031 2562306a36Sopenharmony_ci#define SVM_EXIT_WRITE_DR2 0x032 2662306a36Sopenharmony_ci#define SVM_EXIT_WRITE_DR3 0x033 2762306a36Sopenharmony_ci#define SVM_EXIT_WRITE_DR4 0x034 2862306a36Sopenharmony_ci#define SVM_EXIT_WRITE_DR5 0x035 2962306a36Sopenharmony_ci#define SVM_EXIT_WRITE_DR6 0x036 3062306a36Sopenharmony_ci#define SVM_EXIT_WRITE_DR7 0x037 3162306a36Sopenharmony_ci#define SVM_EXIT_EXCP_BASE 0x040 3262306a36Sopenharmony_ci#define SVM_EXIT_LAST_EXCP 0x05f 3362306a36Sopenharmony_ci#define SVM_EXIT_INTR 0x060 3462306a36Sopenharmony_ci#define SVM_EXIT_NMI 0x061 3562306a36Sopenharmony_ci#define SVM_EXIT_SMI 0x062 3662306a36Sopenharmony_ci#define SVM_EXIT_INIT 0x063 3762306a36Sopenharmony_ci#define SVM_EXIT_VINTR 0x064 3862306a36Sopenharmony_ci#define SVM_EXIT_CR0_SEL_WRITE 0x065 3962306a36Sopenharmony_ci#define SVM_EXIT_IDTR_READ 0x066 4062306a36Sopenharmony_ci#define SVM_EXIT_GDTR_READ 0x067 4162306a36Sopenharmony_ci#define SVM_EXIT_LDTR_READ 0x068 4262306a36Sopenharmony_ci#define SVM_EXIT_TR_READ 0x069 4362306a36Sopenharmony_ci#define SVM_EXIT_IDTR_WRITE 0x06a 4462306a36Sopenharmony_ci#define SVM_EXIT_GDTR_WRITE 0x06b 4562306a36Sopenharmony_ci#define SVM_EXIT_LDTR_WRITE 0x06c 4662306a36Sopenharmony_ci#define SVM_EXIT_TR_WRITE 0x06d 4762306a36Sopenharmony_ci#define SVM_EXIT_RDTSC 0x06e 4862306a36Sopenharmony_ci#define SVM_EXIT_RDPMC 0x06f 4962306a36Sopenharmony_ci#define SVM_EXIT_PUSHF 0x070 5062306a36Sopenharmony_ci#define SVM_EXIT_POPF 0x071 5162306a36Sopenharmony_ci#define SVM_EXIT_CPUID 0x072 5262306a36Sopenharmony_ci#define SVM_EXIT_RSM 0x073 5362306a36Sopenharmony_ci#define SVM_EXIT_IRET 0x074 5462306a36Sopenharmony_ci#define SVM_EXIT_SWINT 0x075 5562306a36Sopenharmony_ci#define SVM_EXIT_INVD 0x076 5662306a36Sopenharmony_ci#define SVM_EXIT_PAUSE 0x077 5762306a36Sopenharmony_ci#define SVM_EXIT_HLT 0x078 5862306a36Sopenharmony_ci#define SVM_EXIT_INVLPG 0x079 5962306a36Sopenharmony_ci#define SVM_EXIT_INVLPGA 0x07a 6062306a36Sopenharmony_ci#define SVM_EXIT_IOIO 0x07b 6162306a36Sopenharmony_ci#define SVM_EXIT_MSR 0x07c 6262306a36Sopenharmony_ci#define SVM_EXIT_TASK_SWITCH 0x07d 6362306a36Sopenharmony_ci#define SVM_EXIT_FERR_FREEZE 0x07e 6462306a36Sopenharmony_ci#define SVM_EXIT_SHUTDOWN 0x07f 6562306a36Sopenharmony_ci#define SVM_EXIT_VMRUN 0x080 6662306a36Sopenharmony_ci#define SVM_EXIT_VMMCALL 0x081 6762306a36Sopenharmony_ci#define SVM_EXIT_VMLOAD 0x082 6862306a36Sopenharmony_ci#define SVM_EXIT_VMSAVE 0x083 6962306a36Sopenharmony_ci#define SVM_EXIT_STGI 0x084 7062306a36Sopenharmony_ci#define SVM_EXIT_CLGI 0x085 7162306a36Sopenharmony_ci#define SVM_EXIT_SKINIT 0x086 7262306a36Sopenharmony_ci#define SVM_EXIT_RDTSCP 0x087 7362306a36Sopenharmony_ci#define SVM_EXIT_ICEBP 0x088 7462306a36Sopenharmony_ci#define SVM_EXIT_WBINVD 0x089 7562306a36Sopenharmony_ci#define SVM_EXIT_MONITOR 0x08a 7662306a36Sopenharmony_ci#define SVM_EXIT_MWAIT 0x08b 7762306a36Sopenharmony_ci#define SVM_EXIT_MWAIT_COND 0x08c 7862306a36Sopenharmony_ci#define SVM_EXIT_XSETBV 0x08d 7962306a36Sopenharmony_ci#define SVM_EXIT_RDPRU 0x08e 8062306a36Sopenharmony_ci#define SVM_EXIT_EFER_WRITE_TRAP 0x08f 8162306a36Sopenharmony_ci#define SVM_EXIT_CR0_WRITE_TRAP 0x090 8262306a36Sopenharmony_ci#define SVM_EXIT_CR1_WRITE_TRAP 0x091 8362306a36Sopenharmony_ci#define SVM_EXIT_CR2_WRITE_TRAP 0x092 8462306a36Sopenharmony_ci#define SVM_EXIT_CR3_WRITE_TRAP 0x093 8562306a36Sopenharmony_ci#define SVM_EXIT_CR4_WRITE_TRAP 0x094 8662306a36Sopenharmony_ci#define SVM_EXIT_CR5_WRITE_TRAP 0x095 8762306a36Sopenharmony_ci#define SVM_EXIT_CR6_WRITE_TRAP 0x096 8862306a36Sopenharmony_ci#define SVM_EXIT_CR7_WRITE_TRAP 0x097 8962306a36Sopenharmony_ci#define SVM_EXIT_CR8_WRITE_TRAP 0x098 9062306a36Sopenharmony_ci#define SVM_EXIT_CR9_WRITE_TRAP 0x099 9162306a36Sopenharmony_ci#define SVM_EXIT_CR10_WRITE_TRAP 0x09a 9262306a36Sopenharmony_ci#define SVM_EXIT_CR11_WRITE_TRAP 0x09b 9362306a36Sopenharmony_ci#define SVM_EXIT_CR12_WRITE_TRAP 0x09c 9462306a36Sopenharmony_ci#define SVM_EXIT_CR13_WRITE_TRAP 0x09d 9562306a36Sopenharmony_ci#define SVM_EXIT_CR14_WRITE_TRAP 0x09e 9662306a36Sopenharmony_ci#define SVM_EXIT_CR15_WRITE_TRAP 0x09f 9762306a36Sopenharmony_ci#define SVM_EXIT_INVPCID 0x0a2 9862306a36Sopenharmony_ci#define SVM_EXIT_NPF 0x400 9962306a36Sopenharmony_ci#define SVM_EXIT_AVIC_INCOMPLETE_IPI 0x401 10062306a36Sopenharmony_ci#define SVM_EXIT_AVIC_UNACCELERATED_ACCESS 0x402 10162306a36Sopenharmony_ci#define SVM_EXIT_VMGEXIT 0x403 10262306a36Sopenharmony_ci 10362306a36Sopenharmony_ci/* SEV-ES software-defined VMGEXIT events */ 10462306a36Sopenharmony_ci#define SVM_VMGEXIT_MMIO_READ 0x80000001 10562306a36Sopenharmony_ci#define SVM_VMGEXIT_MMIO_WRITE 0x80000002 10662306a36Sopenharmony_ci#define SVM_VMGEXIT_NMI_COMPLETE 0x80000003 10762306a36Sopenharmony_ci#define SVM_VMGEXIT_AP_HLT_LOOP 0x80000004 10862306a36Sopenharmony_ci#define SVM_VMGEXIT_AP_JUMP_TABLE 0x80000005 10962306a36Sopenharmony_ci#define SVM_VMGEXIT_SET_AP_JUMP_TABLE 0 11062306a36Sopenharmony_ci#define SVM_VMGEXIT_GET_AP_JUMP_TABLE 1 11162306a36Sopenharmony_ci#define SVM_VMGEXIT_PSC 0x80000010 11262306a36Sopenharmony_ci#define SVM_VMGEXIT_GUEST_REQUEST 0x80000011 11362306a36Sopenharmony_ci#define SVM_VMGEXIT_EXT_GUEST_REQUEST 0x80000012 11462306a36Sopenharmony_ci#define SVM_VMGEXIT_AP_CREATION 0x80000013 11562306a36Sopenharmony_ci#define SVM_VMGEXIT_AP_CREATE_ON_INIT 0 11662306a36Sopenharmony_ci#define SVM_VMGEXIT_AP_CREATE 1 11762306a36Sopenharmony_ci#define SVM_VMGEXIT_AP_DESTROY 2 11862306a36Sopenharmony_ci#define SVM_VMGEXIT_HV_FEATURES 0x8000fffd 11962306a36Sopenharmony_ci#define SVM_VMGEXIT_TERM_REQUEST 0x8000fffe 12062306a36Sopenharmony_ci#define SVM_VMGEXIT_TERM_REASON(reason_set, reason_code) \ 12162306a36Sopenharmony_ci /* SW_EXITINFO1[3:0] */ \ 12262306a36Sopenharmony_ci (((((u64)reason_set) & 0xf)) | \ 12362306a36Sopenharmony_ci /* SW_EXITINFO1[11:4] */ \ 12462306a36Sopenharmony_ci ((((u64)reason_code) & 0xff) << 4)) 12562306a36Sopenharmony_ci#define SVM_VMGEXIT_UNSUPPORTED_EVENT 0x8000ffff 12662306a36Sopenharmony_ci 12762306a36Sopenharmony_ci/* Exit code reserved for hypervisor/software use */ 12862306a36Sopenharmony_ci#define SVM_EXIT_SW 0xf0000000 12962306a36Sopenharmony_ci 13062306a36Sopenharmony_ci#define SVM_EXIT_ERR -1 13162306a36Sopenharmony_ci 13262306a36Sopenharmony_ci#define SVM_EXIT_REASONS \ 13362306a36Sopenharmony_ci { SVM_EXIT_READ_CR0, "read_cr0" }, \ 13462306a36Sopenharmony_ci { SVM_EXIT_READ_CR2, "read_cr2" }, \ 13562306a36Sopenharmony_ci { SVM_EXIT_READ_CR3, "read_cr3" }, \ 13662306a36Sopenharmony_ci { SVM_EXIT_READ_CR4, "read_cr4" }, \ 13762306a36Sopenharmony_ci { SVM_EXIT_READ_CR8, "read_cr8" }, \ 13862306a36Sopenharmony_ci { SVM_EXIT_WRITE_CR0, "write_cr0" }, \ 13962306a36Sopenharmony_ci { SVM_EXIT_WRITE_CR2, "write_cr2" }, \ 14062306a36Sopenharmony_ci { SVM_EXIT_WRITE_CR3, "write_cr3" }, \ 14162306a36Sopenharmony_ci { SVM_EXIT_WRITE_CR4, "write_cr4" }, \ 14262306a36Sopenharmony_ci { SVM_EXIT_WRITE_CR8, "write_cr8" }, \ 14362306a36Sopenharmony_ci { SVM_EXIT_READ_DR0, "read_dr0" }, \ 14462306a36Sopenharmony_ci { SVM_EXIT_READ_DR1, "read_dr1" }, \ 14562306a36Sopenharmony_ci { SVM_EXIT_READ_DR2, "read_dr2" }, \ 14662306a36Sopenharmony_ci { SVM_EXIT_READ_DR3, "read_dr3" }, \ 14762306a36Sopenharmony_ci { SVM_EXIT_READ_DR4, "read_dr4" }, \ 14862306a36Sopenharmony_ci { SVM_EXIT_READ_DR5, "read_dr5" }, \ 14962306a36Sopenharmony_ci { SVM_EXIT_READ_DR6, "read_dr6" }, \ 15062306a36Sopenharmony_ci { SVM_EXIT_READ_DR7, "read_dr7" }, \ 15162306a36Sopenharmony_ci { SVM_EXIT_WRITE_DR0, "write_dr0" }, \ 15262306a36Sopenharmony_ci { SVM_EXIT_WRITE_DR1, "write_dr1" }, \ 15362306a36Sopenharmony_ci { SVM_EXIT_WRITE_DR2, "write_dr2" }, \ 15462306a36Sopenharmony_ci { SVM_EXIT_WRITE_DR3, "write_dr3" }, \ 15562306a36Sopenharmony_ci { SVM_EXIT_WRITE_DR4, "write_dr4" }, \ 15662306a36Sopenharmony_ci { SVM_EXIT_WRITE_DR5, "write_dr5" }, \ 15762306a36Sopenharmony_ci { SVM_EXIT_WRITE_DR6, "write_dr6" }, \ 15862306a36Sopenharmony_ci { SVM_EXIT_WRITE_DR7, "write_dr7" }, \ 15962306a36Sopenharmony_ci { SVM_EXIT_EXCP_BASE + DE_VECTOR, "DE excp" }, \ 16062306a36Sopenharmony_ci { SVM_EXIT_EXCP_BASE + DB_VECTOR, "DB excp" }, \ 16162306a36Sopenharmony_ci { SVM_EXIT_EXCP_BASE + BP_VECTOR, "BP excp" }, \ 16262306a36Sopenharmony_ci { SVM_EXIT_EXCP_BASE + OF_VECTOR, "OF excp" }, \ 16362306a36Sopenharmony_ci { SVM_EXIT_EXCP_BASE + BR_VECTOR, "BR excp" }, \ 16462306a36Sopenharmony_ci { SVM_EXIT_EXCP_BASE + UD_VECTOR, "UD excp" }, \ 16562306a36Sopenharmony_ci { SVM_EXIT_EXCP_BASE + NM_VECTOR, "NM excp" }, \ 16662306a36Sopenharmony_ci { SVM_EXIT_EXCP_BASE + DF_VECTOR, "DF excp" }, \ 16762306a36Sopenharmony_ci { SVM_EXIT_EXCP_BASE + TS_VECTOR, "TS excp" }, \ 16862306a36Sopenharmony_ci { SVM_EXIT_EXCP_BASE + NP_VECTOR, "NP excp" }, \ 16962306a36Sopenharmony_ci { SVM_EXIT_EXCP_BASE + SS_VECTOR, "SS excp" }, \ 17062306a36Sopenharmony_ci { SVM_EXIT_EXCP_BASE + GP_VECTOR, "GP excp" }, \ 17162306a36Sopenharmony_ci { SVM_EXIT_EXCP_BASE + PF_VECTOR, "PF excp" }, \ 17262306a36Sopenharmony_ci { SVM_EXIT_EXCP_BASE + MF_VECTOR, "MF excp" }, \ 17362306a36Sopenharmony_ci { SVM_EXIT_EXCP_BASE + AC_VECTOR, "AC excp" }, \ 17462306a36Sopenharmony_ci { SVM_EXIT_EXCP_BASE + MC_VECTOR, "MC excp" }, \ 17562306a36Sopenharmony_ci { SVM_EXIT_EXCP_BASE + XM_VECTOR, "XF excp" }, \ 17662306a36Sopenharmony_ci { SVM_EXIT_INTR, "interrupt" }, \ 17762306a36Sopenharmony_ci { SVM_EXIT_NMI, "nmi" }, \ 17862306a36Sopenharmony_ci { SVM_EXIT_SMI, "smi" }, \ 17962306a36Sopenharmony_ci { SVM_EXIT_INIT, "init" }, \ 18062306a36Sopenharmony_ci { SVM_EXIT_VINTR, "vintr" }, \ 18162306a36Sopenharmony_ci { SVM_EXIT_CR0_SEL_WRITE, "cr0_sel_write" }, \ 18262306a36Sopenharmony_ci { SVM_EXIT_IDTR_READ, "read_idtr" }, \ 18362306a36Sopenharmony_ci { SVM_EXIT_GDTR_READ, "read_gdtr" }, \ 18462306a36Sopenharmony_ci { SVM_EXIT_LDTR_READ, "read_ldtr" }, \ 18562306a36Sopenharmony_ci { SVM_EXIT_TR_READ, "read_rt" }, \ 18662306a36Sopenharmony_ci { SVM_EXIT_IDTR_WRITE, "write_idtr" }, \ 18762306a36Sopenharmony_ci { SVM_EXIT_GDTR_WRITE, "write_gdtr" }, \ 18862306a36Sopenharmony_ci { SVM_EXIT_LDTR_WRITE, "write_ldtr" }, \ 18962306a36Sopenharmony_ci { SVM_EXIT_TR_WRITE, "write_rt" }, \ 19062306a36Sopenharmony_ci { SVM_EXIT_RDTSC, "rdtsc" }, \ 19162306a36Sopenharmony_ci { SVM_EXIT_RDPMC, "rdpmc" }, \ 19262306a36Sopenharmony_ci { SVM_EXIT_PUSHF, "pushf" }, \ 19362306a36Sopenharmony_ci { SVM_EXIT_POPF, "popf" }, \ 19462306a36Sopenharmony_ci { SVM_EXIT_CPUID, "cpuid" }, \ 19562306a36Sopenharmony_ci { SVM_EXIT_RSM, "rsm" }, \ 19662306a36Sopenharmony_ci { SVM_EXIT_IRET, "iret" }, \ 19762306a36Sopenharmony_ci { SVM_EXIT_SWINT, "swint" }, \ 19862306a36Sopenharmony_ci { SVM_EXIT_INVD, "invd" }, \ 19962306a36Sopenharmony_ci { SVM_EXIT_PAUSE, "pause" }, \ 20062306a36Sopenharmony_ci { SVM_EXIT_HLT, "hlt" }, \ 20162306a36Sopenharmony_ci { SVM_EXIT_INVLPG, "invlpg" }, \ 20262306a36Sopenharmony_ci { SVM_EXIT_INVLPGA, "invlpga" }, \ 20362306a36Sopenharmony_ci { SVM_EXIT_IOIO, "io" }, \ 20462306a36Sopenharmony_ci { SVM_EXIT_MSR, "msr" }, \ 20562306a36Sopenharmony_ci { SVM_EXIT_TASK_SWITCH, "task_switch" }, \ 20662306a36Sopenharmony_ci { SVM_EXIT_FERR_FREEZE, "ferr_freeze" }, \ 20762306a36Sopenharmony_ci { SVM_EXIT_SHUTDOWN, "shutdown" }, \ 20862306a36Sopenharmony_ci { SVM_EXIT_VMRUN, "vmrun" }, \ 20962306a36Sopenharmony_ci { SVM_EXIT_VMMCALL, "hypercall" }, \ 21062306a36Sopenharmony_ci { SVM_EXIT_VMLOAD, "vmload" }, \ 21162306a36Sopenharmony_ci { SVM_EXIT_VMSAVE, "vmsave" }, \ 21262306a36Sopenharmony_ci { SVM_EXIT_STGI, "stgi" }, \ 21362306a36Sopenharmony_ci { SVM_EXIT_CLGI, "clgi" }, \ 21462306a36Sopenharmony_ci { SVM_EXIT_SKINIT, "skinit" }, \ 21562306a36Sopenharmony_ci { SVM_EXIT_RDTSCP, "rdtscp" }, \ 21662306a36Sopenharmony_ci { SVM_EXIT_ICEBP, "icebp" }, \ 21762306a36Sopenharmony_ci { SVM_EXIT_WBINVD, "wbinvd" }, \ 21862306a36Sopenharmony_ci { SVM_EXIT_MONITOR, "monitor" }, \ 21962306a36Sopenharmony_ci { SVM_EXIT_MWAIT, "mwait" }, \ 22062306a36Sopenharmony_ci { SVM_EXIT_XSETBV, "xsetbv" }, \ 22162306a36Sopenharmony_ci { SVM_EXIT_EFER_WRITE_TRAP, "write_efer_trap" }, \ 22262306a36Sopenharmony_ci { SVM_EXIT_CR0_WRITE_TRAP, "write_cr0_trap" }, \ 22362306a36Sopenharmony_ci { SVM_EXIT_CR4_WRITE_TRAP, "write_cr4_trap" }, \ 22462306a36Sopenharmony_ci { SVM_EXIT_CR8_WRITE_TRAP, "write_cr8_trap" }, \ 22562306a36Sopenharmony_ci { SVM_EXIT_INVPCID, "invpcid" }, \ 22662306a36Sopenharmony_ci { SVM_EXIT_NPF, "npf" }, \ 22762306a36Sopenharmony_ci { SVM_EXIT_AVIC_INCOMPLETE_IPI, "avic_incomplete_ipi" }, \ 22862306a36Sopenharmony_ci { SVM_EXIT_AVIC_UNACCELERATED_ACCESS, "avic_unaccelerated_access" }, \ 22962306a36Sopenharmony_ci { SVM_EXIT_VMGEXIT, "vmgexit" }, \ 23062306a36Sopenharmony_ci { SVM_VMGEXIT_MMIO_READ, "vmgexit_mmio_read" }, \ 23162306a36Sopenharmony_ci { SVM_VMGEXIT_MMIO_WRITE, "vmgexit_mmio_write" }, \ 23262306a36Sopenharmony_ci { SVM_VMGEXIT_NMI_COMPLETE, "vmgexit_nmi_complete" }, \ 23362306a36Sopenharmony_ci { SVM_VMGEXIT_AP_HLT_LOOP, "vmgexit_ap_hlt_loop" }, \ 23462306a36Sopenharmony_ci { SVM_VMGEXIT_AP_JUMP_TABLE, "vmgexit_ap_jump_table" }, \ 23562306a36Sopenharmony_ci { SVM_VMGEXIT_PSC, "vmgexit_page_state_change" }, \ 23662306a36Sopenharmony_ci { SVM_VMGEXIT_GUEST_REQUEST, "vmgexit_guest_request" }, \ 23762306a36Sopenharmony_ci { SVM_VMGEXIT_EXT_GUEST_REQUEST, "vmgexit_ext_guest_request" }, \ 23862306a36Sopenharmony_ci { SVM_VMGEXIT_AP_CREATION, "vmgexit_ap_creation" }, \ 23962306a36Sopenharmony_ci { SVM_VMGEXIT_HV_FEATURES, "vmgexit_hypervisor_feature" }, \ 24062306a36Sopenharmony_ci { SVM_EXIT_ERR, "invalid_guest_state" } 24162306a36Sopenharmony_ci 24262306a36Sopenharmony_ci 24362306a36Sopenharmony_ci#endif /* _UAPI__SVM_H */ 244