xref: /openbmc/qemu/qapi/virtio.json (revision 0d70c5aa1bbfb0f5099d53d6e084337a8246cc0c)
1# -*- Mode: Python -*-
2# vim: filetype=python
3#
4
5##
6# **************
7# Virtio devices
8# **************
9##
10
11##
12# @VirtioInfo:
13#
14# Basic information about a given VirtIODevice
15#
16# @path: The VirtIODevice's canonical QOM path
17#
18# @name: Name of the VirtIODevice
19#
20# Since: 7.2
21##
22{ 'struct': 'VirtioInfo',
23  'data': { 'path': 'str',
24            'name': 'str' } }
25
26##
27# @x-query-virtio:
28#
29# Return a list of all realized VirtIODevices
30#
31# Features:
32#
33# @unstable: This command is meant for debugging.
34#
35# Returns: List of gathered VirtIODevices
36#
37# Since: 7.2
38#
39# .. qmp-example::
40#
41#     -> { "execute": "x-query-virtio" }
42#     <- { "return": [
43#              {
44#                  "name": "virtio-input",
45#                  "path": "/machine/peripheral-anon/device[4]/virtio-backend"
46#              },
47#              {
48#                  "name": "virtio-crypto",
49#                  "path": "/machine/peripheral/crypto0/virtio-backend"
50#              },
51#              {
52#                  "name": "virtio-scsi",
53#                  "path": "/machine/peripheral-anon/device[2]/virtio-backend"
54#              },
55#              {
56#                  "name": "virtio-net",
57#                  "path": "/machine/peripheral-anon/device[1]/virtio-backend"
58#              },
59#              {
60#                  "name": "virtio-serial",
61#                  "path": "/machine/peripheral-anon/device[0]/virtio-backend"
62#              }
63#          ]
64#        }
65##
66{ 'command': 'x-query-virtio',
67  'returns': [ 'VirtioInfo' ],
68  'features': [ 'unstable' ] }
69
70##
71# @VhostStatus:
72#
73# Information about a vhost device.  This information will only be
74# displayed if the vhost device is active.
75#
76# @n-mem-sections: vhost_dev n_mem_sections
77#
78# @n-tmp-sections: vhost_dev n_tmp_sections
79#
80# @nvqs: vhost_dev nvqs (number of virtqueues being used)
81#
82# @vq-index: vhost_dev vq_index
83#
84# @features: vhost_dev features
85#
86# @acked-features: vhost_dev acked_features
87#
88# @backend-features: vhost_dev backend_features
89#
90# @protocol-features: vhost_dev protocol_features
91#
92# @max-queues: vhost_dev max_queues
93#
94# @backend-cap: vhost_dev backend_cap
95#
96# @log-enabled: vhost_dev log_enabled flag
97#
98# @log-size: vhost_dev log_size
99#
100# Since: 7.2
101##
102{ 'struct': 'VhostStatus',
103  'data': { 'n-mem-sections': 'int',
104            'n-tmp-sections': 'int',
105            'nvqs': 'uint32',
106            'vq-index': 'int',
107            'features': 'VirtioDeviceFeatures',
108            'acked-features': 'VirtioDeviceFeatures',
109            'backend-features': 'VirtioDeviceFeatures',
110            'protocol-features': 'VhostDeviceProtocols',
111            'max-queues': 'uint64',
112            'backend-cap': 'uint64',
113            'log-enabled': 'bool',
114            'log-size': 'uint64' } }
115
116##
117# @VirtioStatus:
118#
119# Full status of the virtio device with most VirtIODevice members.
120# Also includes the full status of the corresponding vhost device if
121# the vhost device is active.
122#
123# @name: VirtIODevice name
124#
125# @device-id: VirtIODevice ID
126#
127# @vhost-started: VirtIODevice vhost_started flag
128#
129# @guest-features: VirtIODevice guest_features
130#
131# @host-features: VirtIODevice host_features
132#
133# @backend-features: VirtIODevice backend_features
134#
135# @device-endian: VirtIODevice device_endian
136#
137# @num-vqs: VirtIODevice virtqueue count.  This is the number of
138#     active virtqueues being used by the VirtIODevice.
139#
140# @status: VirtIODevice configuration status (`VirtioDeviceStatus`)
141#
142# @isr: VirtIODevice ISR
143#
144# @queue-sel: VirtIODevice queue_sel
145#
146# @vm-running: VirtIODevice vm_running flag
147#
148# @broken: VirtIODevice broken flag
149#
150# @disabled: VirtIODevice disabled flag
151#
152# @use-started: VirtIODevice use_started flag
153#
154# @started: VirtIODevice started flag
155#
156# @start-on-kick: VirtIODevice start_on_kick flag
157#
158# @disable-legacy-check: VirtIODevice disabled_legacy_check flag
159#
160# @bus-name: VirtIODevice bus_name
161#
162# @use-guest-notifier-mask: VirtIODevice use_guest_notifier_mask flag
163#
164# @vhost-dev: Corresponding vhost device info for a given
165#     VirtIODevice.  Present if the given VirtIODevice has an active
166#     vhost device.
167#
168# Since: 7.2
169##
170{ 'struct': 'VirtioStatus',
171  'data': { 'name': 'str',
172            'device-id': 'uint16',
173            'vhost-started': 'bool',
174            'device-endian': 'str',
175            'guest-features': 'VirtioDeviceFeatures',
176            'host-features': 'VirtioDeviceFeatures',
177            'backend-features': 'VirtioDeviceFeatures',
178            'num-vqs': 'int',
179            'status': 'VirtioDeviceStatus',
180            'isr': 'uint8',
181            'queue-sel': 'uint16',
182            'vm-running': 'bool',
183            'broken': 'bool',
184            'disabled': 'bool',
185            'use-started': 'bool',
186            'started': 'bool',
187            'start-on-kick': 'bool',
188            'disable-legacy-check': 'bool',
189            'bus-name': 'str',
190            'use-guest-notifier-mask': 'bool',
191            '*vhost-dev': 'VhostStatus' } }
192
193##
194# @x-query-virtio-status:
195#
196# Poll for a comprehensive status of a given virtio device
197#
198# @path: Canonical QOM path of the VirtIODevice
199#
200# Features:
201#
202# @unstable: This command is meant for debugging.
203#
204# Returns: Status of the virtio device
205#
206# Since: 7.2
207#
208# .. qmp-example::
209#    :annotated:
210#
211#    Poll for the status of virtio-crypto (no vhost-crypto active)
212#    ::
213#
214#     -> { "execute": "x-query-virtio-status",
215#          "arguments": { "path": "/machine/peripheral/crypto0/virtio-backend" }
216#        }
217#     <- { "return": {
218#              "device-endian": "little",
219#              "bus-name": "",
220#              "disable-legacy-check": false,
221#              "name": "virtio-crypto",
222#              "started": true,
223#              "device-id": 20,
224#              "backend-features": {
225#                  "transports": [],
226#                  "dev-features": []
227#              },
228#              "start-on-kick": false,
229#              "isr": 1,
230#              "broken": false,
231#              "status": {
232#                  "statuses": [
233#                      "VIRTIO_CONFIG_S_ACKNOWLEDGE: Valid virtio device found",
234#                      "VIRTIO_CONFIG_S_DRIVER: Guest OS compatible with device",
235#                      "VIRTIO_CONFIG_S_FEATURES_OK: Feature negotiation complete",
236#                      "VIRTIO_CONFIG_S_DRIVER_OK: Driver setup and ready"
237#                  ]
238#              },
239#              "num-vqs": 2,
240#              "guest-features": {
241#                  "dev-features": [],
242#                  "transports": [
243#                      "VIRTIO_RING_F_EVENT_IDX: Used & avail. event fields enabled",
244#                      "VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptors supported",
245#                      "VIRTIO_F_VERSION_1: Device compliant for v1 spec (legacy)"
246#                  ]
247#              },
248#              "host-features": {
249#                  "unknown-dev-features": 1073741824,
250#                  "dev-features": [],
251#                  "transports": [
252#                      "VIRTIO_RING_F_EVENT_IDX: Used & avail. event fields enabled",
253#                      "VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptors supported",
254#                      "VIRTIO_F_VERSION_1: Device compliant for v1 spec (legacy)",
255#                      "VIRTIO_F_ANY_LAYOUT: Device accepts arbitrary desc. layouts",
256#                      "VIRTIO_F_NOTIFY_ON_EMPTY: Notify when device runs out of avail. descs. on VQ"
257#                  ]
258#              },
259#              "use-guest-notifier-mask": true,
260#              "vm-running": true,
261#              "queue-sel": 1,
262#              "disabled": false,
263#              "vhost-started": false,
264#              "use-started": true
265#          }
266#        }
267#
268# .. qmp-example::
269#    :annotated:
270#
271#    Poll for the status of virtio-net (vhost-net is active)
272#    ::
273#
274#     -> { "execute": "x-query-virtio-status",
275#          "arguments": { "path": "/machine/peripheral-anon/device[1]/virtio-backend" }
276#        }
277#     <- { "return": {
278#              "device-endian": "little",
279#              "bus-name": "",
280#              "disabled-legacy-check": false,
281#              "name": "virtio-net",
282#              "started": true,
283#              "device-id": 1,
284#              "vhost-dev": {
285#                  "n-tmp-sections": 4,
286#                  "n-mem-sections": 4,
287#                  "max-queues": 1,
288#                  "backend-cap": 2,
289#                  "log-size": 0,
290#                  "backend-features": {
291#                      "dev-features": [],
292#                      "transports": []
293#                  },
294#                  "nvqs": 2,
295#                  "protocol-features": {
296#                      "protocols": []
297#                  },
298#                  "vq-index": 0,
299#                  "log-enabled": false,
300#                  "acked-features": {
301#                      "dev-features": [
302#                          "VIRTIO_NET_F_MRG_RXBUF: Driver can merge receive buffers"
303#                      ],
304#                      "transports": [
305#                          "VIRTIO_RING_F_EVENT_IDX: Used & avail. event fields enabled",
306#                          "VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptors supported",
307#                          "VIRTIO_F_VERSION_1: Device compliant for v1 spec (legacy)"
308#                      ]
309#                  },
310#                  "features": {
311#                      "dev-features": [
312#                          "VHOST_F_LOG_ALL: Logging write descriptors supported",
313#                          "VIRTIO_NET_F_MRG_RXBUF: Driver can merge receive buffers"
314#                      ],
315#                      "transports": [
316#                          "VIRTIO_RING_F_EVENT_IDX: Used & avail. event fields enabled",
317#                          "VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptors supported",
318#                          "VIRTIO_F_IOMMU_PLATFORM: Device can be used on IOMMU platform",
319#                          "VIRTIO_F_VERSION_1: Device compliant for v1 spec (legacy)",
320#                          "VIRTIO_F_ANY_LAYOUT: Device accepts arbitrary desc. layouts",
321#                          "VIRTIO_F_NOTIFY_ON_EMPTY: Notify when device runs out of avail. descs. on VQ"
322#                      ]
323#                  }
324#              },
325#              "backend-features": {
326#                  "dev-features": [
327#                      "VHOST_USER_F_PROTOCOL_FEATURES: Vhost-user protocol features negotiation supported",
328#                      "VIRTIO_NET_F_GSO: Handling GSO-type packets supported",
329#                      "VIRTIO_NET_F_CTRL_MAC_ADDR: MAC address set through control channel",
330#                      "VIRTIO_NET_F_GUEST_ANNOUNCE: Driver sending gratuitous packets supported",
331#                      "VIRTIO_NET_F_CTRL_RX_EXTRA: Extra RX mode control supported",
332#                      "VIRTIO_NET_F_CTRL_VLAN: Control channel VLAN filtering supported",
333#                      "VIRTIO_NET_F_CTRL_RX: Control channel RX mode supported",
334#                      "VIRTIO_NET_F_CTRL_VQ: Control channel available",
335#                      "VIRTIO_NET_F_STATUS: Configuration status field available",
336#                      "VIRTIO_NET_F_MRG_RXBUF: Driver can merge receive buffers",
337#                      "VIRTIO_NET_F_HOST_UFO: Device can receive UFO",
338#                      "VIRTIO_NET_F_HOST_ECN: Device can receive TSO with ECN",
339#                      "VIRTIO_NET_F_HOST_TSO6: Device can receive TSOv6",
340#                      "VIRTIO_NET_F_HOST_TSO4: Device can receive TSOv4",
341#                      "VIRTIO_NET_F_GUEST_UFO: Driver can receive UFO",
342#                      "VIRTIO_NET_F_GUEST_ECN: Driver can receive TSO with ECN",
343#                      "VIRTIO_NET_F_GUEST_TSO6: Driver can receive TSOv6",
344#                      "VIRTIO_NET_F_GUEST_TSO4: Driver can receive TSOv4",
345#                      "VIRTIO_NET_F_MAC: Device has given MAC address",
346#                      "VIRTIO_NET_F_CTRL_GUEST_OFFLOADS: Control channel offloading reconfig. supported",
347#                      "VIRTIO_NET_F_GUEST_CSUM: Driver handling packets with partial checksum supported",
348#                      "VIRTIO_NET_F_CSUM: Device handling packets with partial checksum supported"
349#                  ],
350#                  "transports": [
351#                      "VIRTIO_RING_F_EVENT_IDX: Used & avail. event fields enabled",
352#                      "VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptors supported",
353#                      "VIRTIO_F_VERSION_1: Device compliant for v1 spec (legacy)",
354#                      "VIRTIO_F_ANY_LAYOUT: Device accepts arbitrary desc. layouts",
355#                      "VIRTIO_F_NOTIFY_ON_EMPTY: Notify when device runs out of avail. descs. on VQ"
356#                  ]
357#              },
358#              "start-on-kick": false,
359#              "isr": 1,
360#              "broken": false,
361#              "status": {
362#                  "statuses": [
363#                      "VIRTIO_CONFIG_S_ACKNOWLEDGE: Valid virtio device found",
364#                      "VIRTIO_CONFIG_S_DRIVER: Guest OS compatible with device",
365#                      "VIRTIO_CONFIG_S_FEATURES_OK: Feature negotiation complete",
366#                      "VIRTIO_CONFIG_S_DRIVER_OK: Driver setup and ready"
367#                  ]
368#              },
369#              "num-vqs": 3,
370#              "guest-features": {
371#                  "dev-features": [
372#                      "VIRTIO_NET_F_CTRL_MAC_ADDR: MAC address set through control channel",
373#                      "VIRTIO_NET_F_GUEST_ANNOUNCE: Driver sending gratuitous packets supported",
374#                      "VIRTIO_NET_F_CTRL_VLAN: Control channel VLAN filtering supported",
375#                      "VIRTIO_NET_F_CTRL_RX: Control channel RX mode supported",
376#                      "VIRTIO_NET_F_CTRL_VQ: Control channel available",
377#                      "VIRTIO_NET_F_STATUS: Configuration status field available",
378#                      "VIRTIO_NET_F_MRG_RXBUF: Driver can merge receive buffers",
379#                      "VIRTIO_NET_F_HOST_UFO: Device can receive UFO",
380#                      "VIRTIO_NET_F_HOST_ECN: Device can receive TSO with ECN",
381#                      "VIRTIO_NET_F_HOST_TSO6: Device can receive TSOv6",
382#                      "VIRTIO_NET_F_HOST_TSO4: Device can receive TSOv4",
383#                      "VIRTIO_NET_F_GUEST_UFO: Driver can receive UFO",
384#                      "VIRTIO_NET_F_GUEST_ECN: Driver can receive TSO with ECN",
385#                      "VIRTIO_NET_F_GUEST_TSO6: Driver can receive TSOv6",
386#                      "VIRTIO_NET_F_GUEST_TSO4: Driver can receive TSOv4",
387#                      "VIRTIO_NET_F_MAC: Device has given MAC address",
388#                      "VIRTIO_NET_F_CTRL_GUEST_OFFLOADS: Control channel offloading reconfig. supported",
389#                      "VIRTIO_NET_F_GUEST_CSUM: Driver handling packets with partial checksum supported",
390#                      "VIRTIO_NET_F_CSUM: Device handling packets with partial checksum supported"
391#                  ],
392#                  "transports": [
393#                      "VIRTIO_RING_F_EVENT_IDX: Used & avail. event fields enabled",
394#                      "VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptors supported",
395#                      "VIRTIO_F_VERSION_1: Device compliant for v1 spec (legacy)"
396#                 ]
397#              },
398#              "host-features": {
399#                  "dev-features": [
400#                      "VHOST_USER_F_PROTOCOL_FEATURES: Vhost-user protocol features negotiation supported",
401#                      "VIRTIO_NET_F_GSO: Handling GSO-type packets supported",
402#                      "VIRTIO_NET_F_CTRL_MAC_ADDR: MAC address set through control channel",
403#                      "VIRTIO_NET_F_GUEST_ANNOUNCE: Driver sending gratuitous packets supported",
404#                      "VIRTIO_NET_F_CTRL_RX_EXTRA: Extra RX mode control supported",
405#                      "VIRTIO_NET_F_CTRL_VLAN: Control channel VLAN filtering supported",
406#                      "VIRTIO_NET_F_CTRL_RX: Control channel RX mode supported",
407#                      "VIRTIO_NET_F_CTRL_VQ: Control channel available",
408#                      "VIRTIO_NET_F_STATUS: Configuration status field available",
409#                      "VIRTIO_NET_F_MRG_RXBUF: Driver can merge receive buffers",
410#                      "VIRTIO_NET_F_HOST_UFO: Device can receive UFO",
411#                      "VIRTIO_NET_F_HOST_ECN: Device can receive TSO with ECN",
412#                      "VIRTIO_NET_F_HOST_TSO6: Device can receive TSOv6",
413#                      "VIRTIO_NET_F_HOST_TSO4: Device can receive TSOv4",
414#                      "VIRTIO_NET_F_GUEST_UFO: Driver can receive UFO",
415#                      "VIRTIO_NET_F_GUEST_ECN: Driver can receive TSO with ECN",
416#                      "VIRTIO_NET_F_GUEST_TSO6: Driver can receive TSOv6",
417#                      "VIRTIO_NET_F_GUEST_TSO4: Driver can receive TSOv4",
418#                      "VIRTIO_NET_F_MAC: Device has given MAC address",
419#                      "VIRTIO_NET_F_CTRL_GUEST_OFFLOADS: Control channel offloading reconfig. supported",
420#                      "VIRTIO_NET_F_GUEST_CSUM: Driver handling packets with partial checksum supported",
421#                      "VIRTIO_NET_F_CSUM: Device handling packets with partial checksum supported"
422#                  ],
423#                  "transports": [
424#                      "VIRTIO_RING_F_EVENT_IDX: Used & avail. event fields enabled",
425#                      "VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptors supported",
426#                      "VIRTIO_F_VERSION_1: Device compliant for v1 spec (legacy)",
427#                      "VIRTIO_F_ANY_LAYOUT: Device accepts arbitrary desc. layouts",
428#                      "VIRTIO_F_NOTIFY_ON_EMPTY: Notify when device runs out of avail. descs. on VQ"
429#                 ]
430#              },
431#              "use-guest-notifier-mask": true,
432#              "vm-running": true,
433#              "queue-sel": 2,
434#              "disabled": false,
435#              "vhost-started": true,
436#              "use-started": true
437#          }
438#        }
439##
440{ 'command': 'x-query-virtio-status',
441  'data': { 'path': 'str' },
442  'returns': 'VirtioStatus',
443  'features': [ 'unstable' ] }
444
445##
446# @VirtioDeviceStatus:
447#
448# A structure defined to list the configuration statuses of a virtio
449# device
450#
451# @statuses: List of decoded configuration statuses of the virtio
452#     device
453#
454# @unknown-statuses: Virtio device statuses bitmap that have not been
455#     decoded
456#
457# Since: 7.2
458##
459{ 'struct': 'VirtioDeviceStatus',
460  'data': { 'statuses': [ 'str' ],
461            '*unknown-statuses': 'uint8' } }
462
463##
464# @VhostDeviceProtocols:
465#
466# A structure defined to list the vhost user protocol features of a
467# Vhost User device
468#
469# @protocols: List of decoded vhost user protocol features of a vhost
470#     user device
471#
472# @unknown-protocols: Vhost user device protocol features bitmap that
473#     have not been decoded
474#
475# Since: 7.2
476##
477{ 'struct': 'VhostDeviceProtocols',
478  'data': { 'protocols': [ 'str' ],
479            '*unknown-protocols': 'uint64' } }
480
481##
482# @VirtioDeviceFeatures:
483#
484# The common fields that apply to most Virtio devices.  Some devices
485# may not have their own device-specific features (e.g. virtio-rng).
486#
487# @transports: List of transport features of the virtio device
488#
489# @dev-features: List of device-specific features (if the device has
490#     unique features)
491#
492# @unknown-dev-features: Virtio device features bitmap that have not
493#     been decoded
494#
495# Since: 7.2
496##
497{ 'struct': 'VirtioDeviceFeatures',
498  'data': { 'transports': [ 'str' ],
499            '*dev-features': [ 'str' ],
500            '*unknown-dev-features': 'uint64' } }
501
502##
503# @VirtQueueStatus:
504#
505# Information of a VirtIODevice VirtQueue, including most members of
506# the VirtQueue data structure.
507#
508# @name: Name of the VirtIODevice that uses this VirtQueue
509#
510# @queue-index: VirtQueue queue_index
511#
512# @inuse: VirtQueue inuse
513#
514# @vring-num: VirtQueue vring.num
515#
516# @vring-num-default: VirtQueue vring.num_default
517#
518# @vring-align: VirtQueue vring.align
519#
520# @vring-desc: VirtQueue vring.desc (descriptor area)
521#
522# @vring-avail: VirtQueue vring.avail (driver area)
523#
524# @vring-used: VirtQueue vring.used (device area)
525#
526# @last-avail-idx: VirtQueue last_avail_idx or return of vhost_dev
527#     vhost_get_vring_base (if vhost active)
528#
529# @shadow-avail-idx: VirtQueue shadow_avail_idx
530#
531# @used-idx: VirtQueue used_idx
532#
533# @signalled-used: VirtQueue signalled_used
534#
535# @signalled-used-valid: VirtQueue signalled_used_valid flag
536#
537# Since: 7.2
538##
539{ 'struct': 'VirtQueueStatus',
540  'data': { 'name': 'str',
541            'queue-index': 'uint16',
542            'inuse': 'uint32',
543            'vring-num': 'uint32',
544            'vring-num-default': 'uint32',
545            'vring-align': 'uint32',
546            'vring-desc': 'uint64',
547            'vring-avail': 'uint64',
548            'vring-used': 'uint64',
549            '*last-avail-idx': 'uint16',
550            '*shadow-avail-idx': 'uint16',
551            'used-idx': 'uint16',
552            'signalled-used': 'uint16',
553            'signalled-used-valid': 'bool' } }
554
555##
556# @x-query-virtio-queue-status:
557#
558# Return the status of a given VirtIODevice's VirtQueue
559#
560# @path: VirtIODevice canonical QOM path
561#
562# @queue: VirtQueue index to examine
563#
564# Features:
565#
566# @unstable: This command is meant for debugging.
567#
568# Returns: Status of the queue
569#
570# .. note:: last_avail_idx will not be displayed in the case where the
571#    selected VirtIODevice has a running vhost device and the
572#    VirtIODevice VirtQueue index (queue) does not exist for the
573#    corresponding vhost device vhost_virtqueue.  Also,
574#    shadow_avail_idx will not be displayed in the case where the
575#    selected VirtIODevice has a running vhost device.
576#
577# Since: 7.2
578#
579# .. qmp-example::
580#    :annotated:
581#
582#    Get `VirtQueueStatus` for virtio-vsock (vhost-vsock running)
583#    ::
584#
585#     -> { "execute": "x-query-virtio-queue-status",
586#          "arguments": { "path": "/machine/peripheral/vsock0/virtio-backend",
587#                         "queue": 1 }
588#        }
589#     <- { "return": {
590#              "signalled-used": 0,
591#              "inuse": 0,
592#              "name": "vhost-vsock",
593#              "vring-align": 4096,
594#              "vring-desc": 5217370112,
595#              "signalled-used-valid": false,
596#              "vring-num-default": 128,
597#              "vring-avail": 5217372160,
598#              "queue-index": 1,
599#              "last-avail-idx": 0,
600#              "vring-used": 5217372480,
601#              "used-idx": 0,
602#              "vring-num": 128
603#          }
604#        }
605#
606# .. qmp-example::
607#    :annotated:
608#
609#    Get `VirtQueueStatus` for virtio-serial (no vhost)
610#    ::
611#
612#     -> { "execute": "x-query-virtio-queue-status",
613#          "arguments": { "path": "/machine/peripheral-anon/device[0]/virtio-backend",
614#                         "queue": 20 }
615#        }
616#     <- { "return": {
617#              "signalled-used": 0,
618#              "inuse": 0,
619#              "name": "virtio-serial",
620#              "vring-align": 4096,
621#              "vring-desc": 5182074880,
622#              "signalled-used-valid": false,
623#              "vring-num-default": 128,
624#              "vring-avail": 5182076928,
625#              "queue-index": 20,
626#              "last-avail-idx": 0,
627#              "vring-used": 5182077248,
628#              "used-idx": 0,
629#              "shadow-avail-idx": 0,
630#              "vring-num": 128
631#          }
632#        }
633##
634{ 'command': 'x-query-virtio-queue-status',
635  'data': { 'path': 'str', 'queue': 'uint16' },
636  'returns': 'VirtQueueStatus',
637  'features': [ 'unstable' ] }
638
639##
640# @VirtVhostQueueStatus:
641#
642# Information of a vhost device's vhost_virtqueue, including most
643# members of the vhost_dev vhost_virtqueue data structure.
644#
645# @name: Name of the VirtIODevice that uses this vhost_virtqueue
646#
647# @kick: vhost_virtqueue kick
648#
649# @call: vhost_virtqueue call
650#
651# @desc: vhost_virtqueue desc
652#
653# @avail: vhost_virtqueue avail
654#
655# @used: vhost_virtqueue used
656#
657# @num: vhost_virtqueue num
658#
659# @desc-phys: vhost_virtqueue desc_phys (descriptor area physical
660#     address)
661#
662# @desc-size: vhost_virtqueue desc_size
663#
664# @avail-phys: vhost_virtqueue avail_phys (driver area physical
665#     address)
666#
667# @avail-size: vhost_virtqueue avail_size
668#
669# @used-phys: vhost_virtqueue used_phys (device area physical address)
670#
671# @used-size: vhost_virtqueue used_size
672#
673# Since: 7.2
674##
675{ 'struct': 'VirtVhostQueueStatus',
676  'data': { 'name': 'str',
677            'kick': 'int',
678            'call': 'int',
679            'desc': 'uint64',
680            'avail': 'uint64',
681            'used': 'uint64',
682            'num': 'int',
683            'desc-phys': 'uint64',
684            'desc-size': 'uint32',
685            'avail-phys': 'uint64',
686            'avail-size': 'uint32',
687            'used-phys': 'uint64',
688            'used-size': 'uint32' } }
689
690##
691# @x-query-virtio-vhost-queue-status:
692#
693# Return information of a given vhost device's vhost_virtqueue
694#
695# @path: VirtIODevice canonical QOM path
696#
697# @queue: vhost_virtqueue index to examine
698#
699# Features:
700#
701# @unstable: This command is meant for debugging.
702#
703# Returns: Status of the vhost_virtqueue
704#
705# Since: 7.2
706#
707# .. qmp-example::
708#    :title: Get vhost_virtqueue status for vhost-crypto
709#
710#     -> { "execute": "x-query-virtio-vhost-queue-status",
711#          "arguments": { "path": "/machine/peripheral/crypto0/virtio-backend",
712#                         "queue": 0 }
713#        }
714#     <- { "return": {
715#              "avail-phys": 5216124928,
716#              "name": "virtio-crypto",
717#              "used-phys": 5216127040,
718#              "avail-size": 2054,
719#              "desc-size": 16384,
720#              "used-size": 8198,
721#              "desc": 140141447430144,
722#              "num": 1024,
723#              "call": 0,
724#              "avail": 140141447446528,
725#              "desc-phys": 5216108544,
726#              "used": 140141447448640,
727#              "kick": 0
728#          }
729#        }
730#
731# .. qmp-example::
732#    :title: Get vhost_virtqueue status for vhost-vsock
733#
734#     -> { "execute": "x-query-virtio-vhost-queue-status",
735#          "arguments": { "path": "/machine/peripheral/vsock0/virtio-backend",
736#                         "queue": 0 }
737#        }
738#     <- { "return": {
739#              "avail-phys": 5182261248,
740#              "name": "vhost-vsock",
741#              "used-phys": 5182261568,
742#              "avail-size": 262,
743#              "desc-size": 2048,
744#              "used-size": 1030,
745#              "desc": 140141413580800,
746#              "num": 128,
747#              "call": 0,
748#              "avail": 140141413582848,
749#              "desc-phys": 5182259200,
750#              "used": 140141413583168,
751#              "kick": 0
752#          }
753#        }
754##
755{ 'command': 'x-query-virtio-vhost-queue-status',
756  'data': { 'path': 'str', 'queue': 'uint16' },
757  'returns': 'VirtVhostQueueStatus',
758  'features': [ 'unstable' ] }
759
760##
761# @VirtioRingDesc:
762#
763# Information regarding the vring descriptor area
764#
765# @addr: Guest physical address of the descriptor area
766#
767# @len: Length of the descriptor area
768#
769# @flags: List of descriptor flags
770#
771# Since: 7.2
772##
773{ 'struct': 'VirtioRingDesc',
774  'data': { 'addr': 'uint64',
775            'len': 'uint32',
776            'flags': [ 'str' ] } }
777
778##
779# @VirtioRingAvail:
780#
781# Information regarding the avail vring (a.k.a. driver area)
782#
783# @flags: VRingAvail flags
784#
785# @idx: VRingAvail index
786#
787# @ring: VRingAvail ring[] entry at provided index
788#
789# Since: 7.2
790##
791{ 'struct': 'VirtioRingAvail',
792  'data': { 'flags': 'uint16',
793            'idx': 'uint16',
794            'ring': 'uint16' } }
795
796##
797# @VirtioRingUsed:
798#
799# Information regarding the used vring (a.k.a. device area)
800#
801# @flags: VRingUsed flags
802#
803# @idx: VRingUsed index
804#
805# Since: 7.2
806##
807{ 'struct': 'VirtioRingUsed',
808  'data': { 'flags': 'uint16',
809            'idx': 'uint16' } }
810
811##
812# @VirtioQueueElement:
813#
814# Information regarding a VirtQueue's VirtQueueElement including
815# descriptor, driver, and device areas
816#
817# @name: Name of the VirtIODevice that uses this VirtQueue
818#
819# @index: Index of the element in the queue
820#
821# @descs: List of descriptors (`VirtioRingDesc`)
822#
823# @avail: VRingAvail info
824#
825# @used: VRingUsed info
826#
827# Since: 7.2
828##
829{ 'struct': 'VirtioQueueElement',
830  'data': { 'name': 'str',
831            'index': 'uint32',
832            'descs': [ 'VirtioRingDesc' ],
833            'avail': 'VirtioRingAvail',
834            'used': 'VirtioRingUsed' } }
835
836##
837# @x-query-virtio-queue-element:
838#
839# Return the information about a VirtQueue's VirtQueueElement
840#
841# @path: VirtIODevice canonical QOM path
842#
843# @queue: VirtQueue index to examine
844#
845# @index: Index of the element in the queue (default: head of the
846#     queue)
847#
848# Features:
849#
850# @unstable: This command is meant for debugging.
851#
852# Since: 7.2
853#
854# .. qmp-example::
855#    :title: Introspect on virtio-net's VirtQueue 0 at index 5
856#
857#     -> { "execute": "x-query-virtio-queue-element",
858#          "arguments": { "path": "/machine/peripheral-anon/device[1]/virtio-backend",
859#                         "queue": 0,
860#                         "index": 5 }
861#        }
862#     <- { "return": {
863#              "index": 5,
864#              "name": "virtio-net",
865#              "descs": [
866#                  {
867#                      "flags": ["write"],
868#                      "len": 1536,
869#                      "addr": 5257305600
870#                  }
871#              ],
872#              "avail": {
873#                  "idx": 256,
874#                  "flags": 0,
875#                  "ring": 5
876#              },
877#              "used": {
878#                  "idx": 13,
879#                  "flags": 0
880#              }
881#          }
882#        }
883#
884# .. qmp-example::
885#    :title: Introspect on virtio-crypto's VirtQueue 1 at head
886#
887#     -> { "execute": "x-query-virtio-queue-element",
888#          "arguments": { "path": "/machine/peripheral/crypto0/virtio-backend",
889#                         "queue": 1 }
890#        }
891#     <- { "return": {
892#              "index": 0,
893#              "name": "virtio-crypto",
894#              "descs": [
895#                  {
896#                      "flags": [],
897#                      "len": 0,
898#                      "addr": 8080268923184214134
899#                  }
900#              ],
901#              "avail": {
902#                  "idx": 280,
903#                  "flags": 0,
904#                  "ring": 0
905#              },
906#              "used": {
907#                  "idx": 280,
908#                  "flags": 0
909#              }
910#          }
911#        }
912#
913# .. qmp-example::
914#    :title: Introspect on virtio-scsi's VirtQueue 2 at head
915#
916#     -> { "execute": "x-query-virtio-queue-element",
917#          "arguments": { "path": "/machine/peripheral-anon/device[2]/virtio-backend",
918#                         "queue": 2 }
919#        }
920#     <- { "return": {
921#              "index": 19,
922#              "name": "virtio-scsi",
923#              "descs": [
924#                  {
925#                      "flags": ["used", "indirect", "write"],
926#                      "len": 4099327944,
927#                      "addr": 12055409292258155293
928#                  }
929#              ],
930#              "avail": {
931#                  "idx": 1147,
932#                  "flags": 0,
933#                  "ring": 19
934#              },
935#              "used": {
936#                  "idx": 280,
937#                  "flags": 0
938#              }
939#          }
940#        }
941##
942{ 'command': 'x-query-virtio-queue-element',
943  'data': { 'path': 'str', 'queue': 'uint16', '*index': 'uint16' },
944  'returns': 'VirtioQueueElement',
945  'features': [ 'unstable' ] }
946
947##
948# @IOThreadVirtQueueMapping:
949#
950# Describes the subset of virtqueues assigned to an IOThread.
951#
952# @iothread: the id of IOThread object
953#
954# @vqs: an optional array of virtqueue indices that will be handled by
955#     this IOThread.  When absent, virtqueues are assigned round-robin
956#     across all IOThreadVirtQueueMappings provided.  Either all
957#     IOThreadVirtQueueMappings must have @vqs or none of them must
958#     have it.
959#
960# Since: 9.0
961##
962
963{ 'struct': 'IOThreadVirtQueueMapping',
964  'data': { 'iothread': 'str', '*vqs': ['uint16'] } }
965
966##
967# @VirtIOGPUOutput:
968#
969# Describes configuration of a VirtIO GPU output.
970#
971# @name: the name of the output
972#
973# Since: 10.1
974##
975
976{ 'struct': 'VirtIOGPUOutput',
977  'data': { 'name': 'str' } }
978
979##
980# @DummyVirtioForceArrays:
981#
982# Not used by QMP; hack to let us use IOThreadVirtQueueMappingList
983# and VirtIOGPUOutputList internally
984#
985# Since: 9.0
986##
987
988{ 'struct': 'DummyVirtioForceArrays',
989  'data': { 'unused-iothread-vq-mapping': ['IOThreadVirtQueueMapping'],
990            'unused-virtio-gpu-output': ['VirtIOGPUOutput'] } }
991
992##
993# @GranuleMode:
994#
995# @4k: granule page size of 4KiB
996#
997# @8k: granule page size of 8KiB
998#
999# @16k: granule page size of 16KiB
1000#
1001# @64k: granule page size of 64KiB
1002#
1003# @host: granule matches the host page size
1004#
1005# Since: 9.0
1006##
1007{ 'enum': 'GranuleMode',
1008  'data': [ '4k', '8k', '16k', '64k', 'host' ] }
1009
1010##
1011# @VMAppleVirtioBlkVariant:
1012#
1013# @unspecified: The default, not a valid setting.
1014#
1015# @root: Block device holding the root volume
1016#
1017# @aux: Block device holding auxiliary data required for boot
1018#
1019# Since: 9.2
1020##
1021{ 'enum': 'VMAppleVirtioBlkVariant',
1022  'data': [ 'unspecified', 'root', 'aux' ] }
1023