TianoCore EDK2 master
Loading...
Searching...
No Matches
Tdx.h
Go to the documentation of this file.
1
12#ifndef MDE_PKG_TDX_H_
13#define MDE_PKG_TDX_H_
14
15#define EXIT_REASON_EXTERNAL_INTERRUPT 1
16#define EXIT_REASON_TRIPLE_FAULT 2
17
18#define EXIT_REASON_PENDING_INTERRUPT 7
19#define EXIT_REASON_NMI_WINDOW 8
20#define EXIT_REASON_TASK_SWITCH 9
21#define EXIT_REASON_CPUID 10
22#define EXIT_REASON_HLT 12
23#define EXIT_REASON_INVD 13
24#define EXIT_REASON_INVLPG 14
25#define EXIT_REASON_RDPMC 15
26#define EXIT_REASON_RDTSC 16
27#define EXIT_REASON_VMCALL 18
28#define EXIT_REASON_VMCLEAR 19
29#define EXIT_REASON_VMLAUNCH 20
30#define EXIT_REASON_VMPTRLD 21
31#define EXIT_REASON_VMPTRST 22
32#define EXIT_REASON_VMREAD 23
33#define EXIT_REASON_VMRESUME 24
34#define EXIT_REASON_VMWRITE 25
35#define EXIT_REASON_VMOFF 26
36#define EXIT_REASON_VMON 27
37#define EXIT_REASON_CR_ACCESS 28
38#define EXIT_REASON_DR_ACCESS 29
39#define EXIT_REASON_IO_INSTRUCTION 30
40#define EXIT_REASON_MSR_READ 31
41#define EXIT_REASON_MSR_WRITE 32
42#define EXIT_REASON_INVALID_STATE 33
43#define EXIT_REASON_MSR_LOAD_FAIL 34
44#define EXIT_REASON_MWAIT_INSTRUCTION 36
45#define EXIT_REASON_MONITOR_TRAP_FLAG 37
46#define EXIT_REASON_MONITOR_INSTRUCTION 39
47#define EXIT_REASON_PAUSE_INSTRUCTION 40
48#define EXIT_REASON_MCE_DURING_VMENTRY 41
49#define EXIT_REASON_TPR_BELOW_THRESHOLD 43
50#define EXIT_REASON_APIC_ACCESS 44
51#define EXIT_REASON_EOI_INDUCED 45
52#define EXIT_REASON_GDTR_IDTR 46
53#define EXIT_REASON_LDTR_TR 47
54#define EXIT_REASON_EPT_VIOLATION 48
55#define EXIT_REASON_EPT_MISCONFIG 49
56#define EXIT_REASON_INVEPT 50
57#define EXIT_REASON_RDTSCP 51
58#define EXIT_REASON_PREEMPTION_TIMER 52
59#define EXIT_REASON_INVVPID 53
60#define EXIT_REASON_WBINVD 54
61#define EXIT_REASON_XSETBV 55
62#define EXIT_REASON_APIC_WRITE 56
63#define EXIT_REASON_RDRAND 57
64#define EXIT_REASON_INVPCID 58
65#define EXIT_REASON_VMFUNC 59
66#define EXIT_REASON_ENCLS 60
67#define EXIT_REASON_RDSEED 61
68#define EXIT_REASON_PML_FULL 62
69#define EXIT_REASON_XSAVES 63
70#define EXIT_REASON_XRSTORS 64
71
72// TDCALL API Function Completion Status Codes
73#define TDX_EXIT_REASON_SUCCESS 0x0000000000000000
74#define TDX_EXIT_REASON_PAGE_ALREADY_ACCEPTED 0x00000B0A00000000
75#define TDX_EXIT_REASON_PAGE_SIZE_MISMATCH 0xC0000B0B00000000
76#define TDX_EXIT_REASON_OPERAND_INVALID 0xC000010000000000
77#define TDX_EXIT_REASON_OPERAND_BUSY 0x8000020000000000
78
79// TDCALL [TDG.MEM.PAGE.ACCEPT] page size
80#define TDCALL_ACCEPT_PAGE_SIZE_4K 0
81#define TDCALL_ACCEPT_PAGE_SIZE_2M 1
82#define TDCALL_ACCEPT_PAGE_SIZE_1G 2
83
84#define TDCALL_TDVMCALL 0
85#define TDCALL_TDINFO 1
86#define TDCALL_TDEXTENDRTMR 2
87#define TDCALL_TDGETVEINFO 3
88#define TDCALL_TDREPORT 4
89#define TDCALL_TDSETCPUIDVE 5
90#define TDCALL_TDACCEPTPAGE 6
91
92#define TDVMCALL_CPUID 0x0000a
93#define TDVMCALL_HALT 0x0000c
94#define TDVMCALL_IO 0x0001e
95#define TDVMCALL_RDMSR 0x0001f
96#define TDVMCALL_WRMSR 0x00020
97#define TDVMCALL_MMIO 0x00030
98#define TDVMCALL_PCONFIG 0x00041
99
100#define TDVMCALL_GET_TDVMCALL_INFO 0x10000
101#define TDVMCALL_MAPGPA 0x10001
102#define TDVMCALL_GET_QUOTE 0x10002
103#define TDVMCALL_REPORT_FATAL_ERR 0x10003
104#define TDVMCALL_SETUP_EVENT_NOTIFY 0x10004
105
106#define TDVMCALL_STATUS_RETRY 0x1
107
108#pragma pack(1)
109typedef struct {
110 UINT64 Data[6];
112
113typedef struct {
114 UINT64 Gpaw;
115 UINT64 Attributes;
116 UINT32 NumVcpus;
117 UINT32 MaxVcpus;
118 UINT64 Resv[3];
120
121typedef union {
122 UINT64 Val;
123 struct {
124 UINT32 Size : 3;
125 UINT32 Direction : 1;
126 UINT32 String : 1;
127 UINT32 Rep : 1;
128 UINT32 Encoding : 1;
129 UINT32 Resv : 9;
130 UINT32 Port : 16;
131 UINT32 Resv2;
132 } Io;
134
135typedef struct {
136 UINT32 ExitReason;
137 UINT32 Resv;
138 VMX_EXIT_QUALIFICATION ExitQualification;
139 UINT64 GuestLA;
140 UINT64 GuestPA;
141 UINT32 ExitInstructionLength;
142 UINT32 ExitInstructionInfo;
143 UINT32 Resv1;
145
146typedef union {
151
152/* data structure used in TDREPORT_STRUCT */
153typedef struct {
154 UINT8 Type;
155 UINT8 Subtype;
156 UINT8 Version;
157 UINT8 Rsvd;
159
160typedef struct {
161 TD_REPORT_TYPE ReportType;
162 UINT8 Rsvd1[12];
163 UINT8 CpuSvn[16];
164 UINT8 TeeTcbInfoHash[48];
165 UINT8 TeeInfoHash[48];
166 UINT8 ReportData[64];
167 UINT8 Rsvd2[32];
168 UINT8 Mac[32];
170
171typedef struct {
172 UINT8 Seam[2];
173 UINT8 Rsvd[14];
175
176typedef struct {
177 UINT8 Valid[8];
178 TEE_TCB_SVN TeeTcbSvn;
179 UINT8 Mrseam[48];
180 UINT8 Mrsignerseam[48];
181 UINT8 Attributes[8];
182 UINT8 Rsvd[111];
184
185typedef struct {
186 UINT8 Attributes[8];
187 UINT8 Xfam[8];
188 UINT8 Mrtd[48];
189 UINT8 Mrconfigid[48];
190 UINT8 Mrowner[48];
191 UINT8 Mrownerconfig[48];
192 UINT8 Rtmrs[4][48];
193 UINT8 Rsvd[112];
194} TDINFO;
195
196typedef struct {
197 REPORTMACSTRUCT ReportMacStruct;
198 TEE_TCB_INFO TeeTcbInfo;
199 UINT8 Rsvd[17];
200 TDINFO Tdinfo;
202
203#pragma pack()
204
205#endif
Definition: Tdx.h:185