1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
|
# -*- Mode: Python -*-
# vim: filetype=python
#
# SPDX-License-Identifier: GPL-2.0-or-later
##
# @rtc-reset-reinjection:
#
# Reset the RTC interrupt reinjection backlog. Can be used if another
# mechanism to synchronize guest time is in effect, for example QEMU
# guest agent's `guest-set-time` command.
#
# Use of this command is only applicable for x86 machines with an RTC,
# and on other machines will silently return without performing any
# action.
#
# Since: 2.1
#
# .. qmp-example::
#
# -> { "execute": "rtc-reset-reinjection" }
# <- { "return": {} }
##
{ 'command': 'rtc-reset-reinjection' }
##
# @SevState:
#
# An enumeration of SEV state information used during `query-sev`.
#
# @uninit: The guest is uninitialized.
#
# @launch-update: The guest is currently being launched; plaintext
# data and register state is being imported.
#
# @launch-secret: The guest is currently being launched; ciphertext
# data is being imported.
#
# @running: The guest is fully launched or migrated in.
#
# @send-update: The guest is currently being migrated out to another
# machine.
#
# @receive-update: The guest is currently being migrated from another
# machine.
#
# Since: 2.12
##
{ 'enum': 'SevState',
'data': ['uninit', 'launch-update', 'launch-secret', 'running',
'send-update', 'receive-update' ] }
##
# @SevGuestType:
#
# An enumeration indicating the type of SEV guest being run.
#
# @sev: The guest is a legacy SEV or SEV-ES guest.
#
# @sev-snp: The guest is an SEV-SNP guest.
#
# Since: 6.2
##
{ 'enum': 'SevGuestType',
'data': [ 'sev', 'sev-snp' ] }
##
# @SevGuestInfo:
#
# Information specific to legacy SEV/SEV-ES guests.
#
# @policy: SEV policy value
#
# @handle: SEV firmware handle
#
# Since: 2.12
##
{ 'struct': 'SevGuestInfo',
'data': { 'policy': 'uint32',
'handle': 'uint32' } }
##
# @SevSnpGuestInfo:
#
# Information specific to SEV-SNP guests.
#
# @snp-policy: SEV-SNP policy value
#
# Since: 9.1
##
{ 'struct': 'SevSnpGuestInfo',
'data': { 'snp-policy': 'uint64' } }
##
# @SevInfo:
#
# Information about Secure Encrypted Virtualization (SEV) support
#
# @enabled: true if SEV is active
#
# @api-major: SEV API major version
#
# @api-minor: SEV API minor version
#
# @build-id: SEV FW build id
#
# @state: SEV guest state
#
# @sev-type: Type of SEV guest being run
#
# Since: 2.12
##
{ 'union': 'SevInfo',
'base': { 'enabled': 'bool',
'api-major': 'uint8',
'api-minor' : 'uint8',
'build-id' : 'uint8',
'state' : 'SevState',
'sev-type' : 'SevGuestType' },
'discriminator': 'sev-type',
'data': {
'sev': 'SevGuestInfo',
'sev-snp': 'SevSnpGuestInfo' } }
##
# @query-sev:
#
# Return information about SEV/SEV-ES/SEV-SNP.
#
# If unavailable due to an incompatible configuration the returned
# @enabled field is set to 'false' and the state of all other fields
# is unspecified.
#
# Since: 2.12
#
# .. qmp-example::
#
# -> { "execute": "query-sev" }
# <- { "return": { "enabled": true, "api-major" : 0, "api-minor" : 0,
# "build-id" : 0, "policy" : 0, "state" : "running",
# "handle" : 1 } }
##
{ 'command': 'query-sev', 'returns': 'SevInfo' }
##
# @SevLaunchMeasureInfo:
#
# SEV Guest Launch measurement information
#
# @data: the measurement value encoded in base64
#
# Since: 2.12
##
{ 'struct': 'SevLaunchMeasureInfo', 'data': {'data': 'str'} }
##
# @query-sev-launch-measure:
#
# Query the SEV/SEV-ES guest launch information.
#
# This is only valid on x86 machines configured with KVM and the
# 'sev-guest' confidential virtualization object. The launch
# measurement for SEV-SNP guests is only available within the guest.
#
# Returns: The guest's SEV guest launch measurement info
#
# Errors:
# - If the launch measurement is unavailable, either due to an
# invalid guest configuration or if the guest has not reached
# the required SEV state, GenericError
#
# Since: 2.12
#
# .. qmp-example::
#
# -> { "execute": "query-sev-launch-measure" }
# <- { "return": { "data": "4l8LXeNlSPUDlXPJG5966/8%YZ" } }
##
{ 'command': 'query-sev-launch-measure', 'returns': 'SevLaunchMeasureInfo' }
##
# @SevCapability:
#
# The struct describes capability for a Secure Encrypted
# Virtualization feature.
#
# @pdh: Platform Diffie-Hellman key (base64 encoded)
#
# @cert-chain: PDH certificate chain (base64 encoded)
#
# @cpu0-id: Unique ID of CPU0 (base64 encoded) (since 7.1)
#
# @cbitpos: C-bit location in page table entry
#
# @reduced-phys-bits: Number of physical address bit reduction when
# SEV is enabled
#
# Since: 2.12
##
{ 'struct': 'SevCapability',
'data': { 'pdh': 'str',
'cert-chain': 'str',
'cpu0-id': 'str',
'cbitpos': 'int',
'reduced-phys-bits': 'int'} }
##
# @query-sev-capabilities:
#
# Get SEV capabilities.
#
# This is only supported on AMD X86 platforms with KVM enabled.
#
# Errors:
# - If SEV is not available on the platform, GenericError
#
# Since: 2.12
#
# .. qmp-example::
#
# -> { "execute": "query-sev-capabilities" }
# <- { "return": { "pdh": "8CCDD8DDD", "cert-chain": "888CCCDDDEE",
# "cpu0-id": "2lvmGwo+...61iEinw==",
# "cbitpos": 47, "reduced-phys-bits": 1}}
##
{ 'command': 'query-sev-capabilities', 'returns': 'SevCapability' }
##
# @sev-inject-launch-secret:
#
# Inject a secret blob into a SEV/SEV-ES guest's memory.
#
# This is only valid on x86 machines configured with KVM and the
# 'sev-guest' confidential virtualization object. SEV-SNP guests do
# not support launch secret injection.
#
# @packet-header: the launch secret packet header encoded in base64
#
# @secret: the launch secret data to be injected encoded in base64
#
# @gpa: the guest physical address where secret will be injected.
#
# Errors:
# - If launch secret injection is not possible, either due to
# an invalid guest configuration, or if the guest has not
# reached the required SEV state, GenericError
#
# Since: 6.0
##
{ 'command': 'sev-inject-launch-secret',
'data': { 'packet-header': 'str', 'secret': 'str', '*gpa': 'uint64' } }
##
# @SevAttestationReport:
#
# The struct describes attestation report for a Secure Encrypted
# Virtualization feature.
#
# @data: guest attestation report (base64 encoded)
#
# Since: 6.1
##
{ 'struct': 'SevAttestationReport',
'data': { 'data': 'str'} }
##
# @query-sev-attestation-report:
#
# Get the SEV attestation report.
#
# This is only valid on x86 machines configured with KVM and the
# 'sev-guest' confidential virtualization object. The attestation
# report for SEV-SNP guests is only available within the guest.
#
# @mnonce: a random 16 bytes value encoded in base64 (it will be
# included in report)
#
# Errors:
# - If the attestation report is unavailable, either due to an
# invalid guest configuration or because the guest has not
# reached the required SEV state, GenericError
#
# Since: 6.1
#
# .. qmp-example::
#
# -> { "execute" : "query-sev-attestation-report",
# "arguments": { "mnonce": "aaaaaaa" } }
# <- { "return" : { "data": "aaaaaaaabbbddddd"} }
##
{ 'command': 'query-sev-attestation-report',
'data': { 'mnonce': 'str' },
'returns': 'SevAttestationReport' }
##
# @SgxEpcSection:
#
# Information about intel SGX EPC section
#
# @node: the numa node
#
# @size: the size of EPC section
#
# Since: 7.0
##
{ 'struct': 'SgxEpcSection',
'data': { 'node': 'int',
'size': 'uint64'}}
##
# @SgxInfo:
#
# Information about intel Safe Guard eXtension (SGX) support
#
# @sgx: true if SGX is supported
#
# @sgx1: true if SGX1 is supported
#
# @sgx2: true if SGX2 is supported
#
# @flc: true if FLC is supported
#
# @sections: The EPC sections information (Since: 7.0)
#
# Since: 6.2
##
{ 'struct': 'SgxInfo',
'data': { 'sgx': 'bool',
'sgx1': 'bool',
'sgx2': 'bool',
'flc': 'bool',
'sections': ['SgxEpcSection']} }
##
# @query-sgx:
#
# Return information about configured SGX capabilities of guest
#
# Since: 6.2
#
# .. qmp-example::
#
# -> { "execute": "query-sgx" }
# <- { "return": { "sgx": true, "sgx1" : true, "sgx2" : true,
# "flc": true,
# "sections": [{"node": 0, "size": 67108864},
# {"node": 1, "size": 29360128}]} }
##
{ 'command': 'query-sgx', 'returns': 'SgxInfo' }
##
# @query-sgx-capabilities:
#
# Return information about SGX capabilities of host
#
# Since: 6.2
#
# .. qmp-example::
#
# -> { "execute": "query-sgx-capabilities" }
# <- { "return": { "sgx": true, "sgx1" : true, "sgx2" : true,
# "flc": true,
# "section" : [{"node": 0, "size": 67108864},
# {"node": 1, "size": 29360128}]} }
##
{ 'command': 'query-sgx-capabilities', 'returns': 'SgxInfo' }
##
# @EvtchnPortType:
#
# An enumeration of Xen event channel port types.
#
# @closed: The port is unused.
#
# @unbound: The port is allocated and ready to be bound.
#
# @interdomain: The port is connected as an interdomain interrupt.
#
# @pirq: The port is bound to a physical IRQ (PIRQ).
#
# @virq: The port is bound to a virtual IRQ (VIRQ).
#
# @ipi: The post is an inter-processor interrupt (IPI).
#
# Since: 8.0
##
{ 'enum': 'EvtchnPortType',
'data': ['closed', 'unbound', 'interdomain', 'pirq', 'virq', 'ipi'] }
##
# @EvtchnInfo:
#
# Information about a Xen event channel port
#
# @port: the port number
#
# @vcpu: target vCPU for this port
#
# @type: the port type
#
# @remote-domain: remote domain for interdomain ports
#
# @target: remote port ID, or virq/pirq number
#
# @pending: port is currently active pending delivery
#
# @masked: port is masked
#
# Since: 8.0
##
{ 'struct': 'EvtchnInfo',
'data': {'port': 'uint16',
'vcpu': 'uint32',
'type': 'EvtchnPortType',
'remote-domain': 'str',
'target': 'uint16',
'pending': 'bool',
'masked': 'bool'} }
##
# @xen-event-list:
#
# Query the Xen event channels opened by the guest.
#
# Returns: list of open event channel ports.
#
# Since: 8.0
#
# .. qmp-example::
#
# -> { "execute": "xen-event-list" }
# <- { "return": [
# {
# "pending": false,
# "port": 1,
# "vcpu": 1,
# "remote-domain": "qemu",
# "masked": false,
# "type": "interdomain",
# "target": 1
# },
# {
# "pending": false,
# "port": 2,
# "vcpu": 0,
# "remote-domain": "",
# "masked": false,
# "type": "virq",
# "target": 0
# }
# ]
# }
##
{ 'command': 'xen-event-list',
'returns': ['EvtchnInfo'] }
##
# @xen-event-inject:
#
# Inject a Xen event channel port (interrupt) to the guest.
#
# @port: The port number
#
# Since: 8.0
#
# .. qmp-example::
#
# -> { "execute": "xen-event-inject", "arguments": { "port": 1 } }
# <- { "return": { } }
##
{ 'command': 'xen-event-inject',
'data': { 'port': 'uint32' } }
|