xref: /openbmc/qemu/qapi/qom.json (revision cad9aa6fbdccd95e56e10cfa57c354a20a333717)
1# -*- Mode: Python -*-
2# vim: filetype=python
3#
4# This work is licensed under the terms of the GNU GPL, version 2 or later.
5# See the COPYING file in the top-level directory.
6
7{ 'include': 'authz.json' }
8{ 'include': 'block-core.json' }
9{ 'include': 'common.json' }
10{ 'include': 'crypto.json' }
11
12##
13# ***********************
14# QEMU Object Model (QOM)
15# ***********************
16##
17
18##
19# @ObjectPropertyInfo:
20#
21# @name: the name of the property
22#
23# @type: the type of the property.  This will typically come in one of
24#     four forms:
25#
26#     1) A primitive type such as 'u8', 'u16', 'bool', 'str', or
27#        'double'.  These types are mapped to the appropriate JSON
28#        type.
29#
30#     2) A child type in the form 'child<subtype>' where subtype is a
31#        qdev device type name.  Child properties create the
32#        composition tree.
33#
34#     3) A link type in the form 'link<subtype>' where subtype is a
35#        qdev device type name.  Link properties form the device model
36#        graph.
37#
38# @description: if specified, the description of the property.
39#
40# @default-value: the default value, if any (since 5.0)
41#
42# Since: 1.2
43##
44{ 'struct': 'ObjectPropertyInfo',
45  'data': { 'name': 'str',
46            'type': 'str',
47            '*description': 'str',
48            '*default-value': 'any' } }
49
50##
51# @ObjectPropertyValue:
52#
53# @name: the name of the property.
54#
55# @type: the type of the property, as described in `ObjectPropertyInfo`.
56#
57# @value: the value of the property.  Absent when the property cannot
58#     be read.
59#
60# Since 10.1
61##
62{ 'struct': 'ObjectPropertyValue',
63  'data': { 'name': 'str',
64            'type': 'str',
65            '*value': 'any' } }
66
67##
68# @ObjectPropertiesValues:
69#
70# @properties: a list of properties.
71#
72# Since 10.1
73##
74{ 'struct': 'ObjectPropertiesValues',
75  'data': { 'properties': [ 'ObjectPropertyValue' ] }}
76
77
78##
79# @qom-list:
80#
81# List properties of a object given a path in the object model.
82#
83# @path: the path within the object model.  See `qom-get` for a
84#     description of this parameter.
85#
86# Returns: a list that describe the properties of the object.
87#
88# Since: 1.2
89#
90# .. qmp-example::
91#
92#     -> { "execute": "qom-list",
93#          "arguments": { "path": "/chardevs" } }
94#     <- { "return": [ { "name": "type", "type": "string" },
95#                      { "name": "parallel0", "type": "child<chardev-vc>" },
96#                      { "name": "serial0", "type": "child<chardev-vc>" },
97#                      { "name": "mon0", "type": "child<chardev-stdio>" } ] }
98##
99{ 'command': 'qom-list',
100  'data': { 'path': 'str' },
101  'returns': [ 'ObjectPropertyInfo' ],
102  'allow-preconfig': true }
103
104##
105# @qom-get:
106#
107# Get a property value.
108#
109# @path: The path within the object model.  There are two forms of
110#     supported paths--absolute and partial paths.
111#
112#     Absolute paths are derived from the root object and can follow
113#     child<> or link<> properties.  Since they can follow link<>
114#     properties, they can be arbitrarily long.  Absolute paths look
115#     like absolute filenames and are prefixed  with a leading slash.
116#
117#     Partial paths look like relative filenames.  They do not begin
118#     with a prefix.  The matching rules for partial paths are subtle
119#     but designed to make specifying objects easy.  At each level of
120#     the composition tree, the partial path is matched as an absolute
121#     path.  The first match is not returned.  At least two matches
122#     are searched for.  A successful result is only returned if only
123#     one match is found.  If more than one match is found, a flag is
124#     return to indicate that the match was ambiguous.
125#
126# @property: The property name to read
127#
128# Returns: The property value.  The type depends on the property type.
129#     child<> and link<> properties are returned as #str pathnames.
130#     All integer property types (u8, u16, etc) are returned as #int.
131#
132# Since: 1.2
133#
134# .. qmp-example::
135#    :title: Use absolute path
136#
137#     -> { "execute": "qom-get",
138#          "arguments": { "path": "/machine/unattached/device[0]",
139#                         "property": "hotplugged" } }
140#     <- { "return": false }
141#
142# .. qmp-example::
143#    :title: Use partial path
144#
145#     -> { "execute": "qom-get",
146#          "arguments": { "path": "unattached/sysbus",
147#                         "property": "type" } }
148#     <- { "return": "System" }
149##
150{ 'command': 'qom-get',
151  'data': { 'path': 'str', 'property': 'str' },
152  'returns': 'any',
153  'allow-preconfig': true }
154
155##
156# @qom-list-get:
157#
158# List properties and their values for each object path in the input
159# list.
160#
161# @paths: The absolute or partial path for each object, as described
162#     in `qom-get`.
163#
164# Errors:
165#     - If any path is not valid or is ambiguous
166#
167# Returns: A list where each element is the result for the
168#     corresponding element of @paths.
169#
170# Since 10.1
171##
172{ 'command': 'qom-list-get',
173  'data': { 'paths': [ 'str' ] },
174  'returns': [ 'ObjectPropertiesValues' ],
175  'allow-preconfig': true }
176
177##
178# @qom-set:
179#
180# Set a property value.
181#
182# @path: see `qom-get` for a description of this parameter
183#
184# @property: the property name to set
185#
186# @value: a value who's type is appropriate for the property type.
187#     See `qom-get` for a description of type mapping.
188#
189# Since: 1.2
190#
191# .. qmp-example::
192#
193#     -> { "execute": "qom-set",
194#          "arguments": { "path": "/machine",
195#                         "property": "graphics",
196#                         "value": false } }
197#     <- { "return": {} }
198##
199{ 'command': 'qom-set',
200  'data': { 'path': 'str', 'property': 'str', 'value': 'any' },
201  'allow-preconfig': true }
202
203##
204# @ObjectTypeInfo:
205#
206# This structure describes a search result from `qom-list-types`
207#
208# @name: the type name found in the search
209#
210# @abstract: the type is abstract and can't be directly instantiated.
211#     Omitted if false.  (since 2.10)
212#
213# @parent: Name of parent type, if any (since 2.10)
214#
215# Since: 1.1
216##
217{ 'struct': 'ObjectTypeInfo',
218  'data': { 'name': 'str', '*abstract': 'bool', '*parent': 'str' } }
219
220##
221# @qom-list-types:
222#
223# Return a list of types given search parameters.
224#
225# @implements: if specified, only return types that implement this
226#     type name
227#
228# @abstract: if true, include abstract types in the results
229#
230# Returns: a list of types, or an empty list if no results are found
231#
232# Since: 1.1
233##
234{ 'command': 'qom-list-types',
235  'data': { '*implements': 'str', '*abstract': 'bool' },
236  'returns': [ 'ObjectTypeInfo' ],
237  'allow-preconfig': true }
238
239##
240# @qom-list-properties:
241#
242# List properties associated with a QOM object.
243#
244# @typename: the type name of an object
245#
246#
247# .. note:: Objects can create properties at runtime, for example to
248#    describe links between different devices and/or objects.  These
249#    properties are not included in the output of this command.
250#
251# Returns: a list describing object properties
252#
253# Since: 2.12
254##
255{ 'command': 'qom-list-properties',
256  'data': { 'typename': 'str'},
257  'returns': [ 'ObjectPropertyInfo' ],
258  'allow-preconfig': true }
259
260##
261# @CanHostSocketcanProperties:
262#
263# Properties for can-host-socketcan objects.
264#
265# @if: interface name of the host system CAN bus to connect to
266#
267# @canbus: object ID of the can-bus object to connect to the host
268#     interface
269#
270# Since: 2.12
271##
272{ 'struct': 'CanHostSocketcanProperties',
273  'data': { 'if': 'str',
274            'canbus': 'str' },
275  'if': 'CONFIG_LINUX' }
276
277##
278# @ColoCompareProperties:
279#
280# Properties for colo-compare objects.
281#
282# @primary_in: name of the character device backend to use for the
283#     primary input (incoming packets are redirected to @outdev)
284#
285# @secondary_in: name of the character device backend to use for
286#     secondary input (incoming packets are only compared to the input
287#     on @primary_in and then dropped)
288#
289# @outdev: name of the character device backend to use for output
290#
291# @iothread: name of the iothread to run in
292#
293# @notify_dev: name of the character device backend to be used to
294#     communicate with the remote colo-frame (only for Xen COLO)
295#
296# @compare_timeout: the maximum time to hold a packet from @primary_in
297#     for comparison with an incoming packet on @secondary_in in
298#     milliseconds (default: 3000)
299#
300# @expired_scan_cycle: the interval at which colo-compare checks
301#     whether packets from @primary have timed out, in milliseconds
302#     (default: 3000)
303#
304# @max_queue_size: the maximum number of packets to keep in the queue
305#     for comparing with incoming packets from @secondary_in.  If the
306#     queue is full and additional packets are received, the
307#     additional packets are dropped.  (default: 1024)
308#
309# @vnet_hdr_support: if true, vnet header support is enabled
310#     (default: false)
311#
312# Since: 2.8
313##
314{ 'struct': 'ColoCompareProperties',
315  'data': { 'primary_in': 'str',
316            'secondary_in': 'str',
317            'outdev': 'str',
318            'iothread': 'str',
319            '*notify_dev': 'str',
320            '*compare_timeout': 'uint64',
321            '*expired_scan_cycle': 'uint32',
322            '*max_queue_size': 'uint32',
323            '*vnet_hdr_support': 'bool' } }
324
325##
326# @CryptodevBackendProperties:
327#
328# Properties for cryptodev-backend and cryptodev-backend-builtin
329# objects.
330#
331# @queues: the number of queues for the cryptodev backend.  Ignored
332#     for cryptodev-backend and must be 1 for
333#     cryptodev-backend-builtin.  (default: 1)
334#
335# @throttle-bps: limit total bytes per second (Since 8.0)
336#
337# @throttle-ops: limit total operations per second (Since 8.0)
338#
339# Since: 2.8
340##
341{ 'struct': 'CryptodevBackendProperties',
342  'data': { '*queues': 'uint32',
343            '*throttle-bps': 'uint64',
344            '*throttle-ops': 'uint64' } }
345
346##
347# @CryptodevVhostUserProperties:
348#
349# Properties for cryptodev-vhost-user objects.
350#
351# @chardev: the name of a Unix domain socket character device that
352#     connects to the vhost-user server
353#
354# Since: 2.12
355##
356{ 'struct': 'CryptodevVhostUserProperties',
357  'base': 'CryptodevBackendProperties',
358  'data': { 'chardev': 'str' },
359  'if': 'CONFIG_VHOST_CRYPTO' }
360
361##
362# @DBusVMStateProperties:
363#
364# Properties for dbus-vmstate objects.
365#
366# @addr: the name of the DBus bus to connect to
367#
368# @id-list: a comma separated list of DBus IDs of helpers whose data
369#     should be included in the VM state on migration
370#
371# Since: 5.0
372##
373{ 'struct': 'DBusVMStateProperties',
374  'data': { 'addr': 'str' ,
375            '*id-list': 'str' } }
376
377##
378# @NetfilterInsert:
379#
380# Indicates where to insert a netfilter relative to a given other
381# filter.
382#
383# @before: insert before the specified filter
384#
385# @behind: insert behind the specified filter
386#
387# Since: 5.0
388##
389{ 'enum': 'NetfilterInsert',
390  'data': [ 'before', 'behind' ] }
391
392##
393# @NetfilterProperties:
394#
395# Properties for objects of classes derived from netfilter.
396#
397# @netdev: id of the network device backend to filter
398#
399# @queue: indicates which queue(s) to filter (default: all)
400#
401# @status: indicates whether the filter is enabled ("on") or disabled
402#     ("off") (default: "on")
403#
404# @position: specifies where the filter should be inserted in the
405#     filter list.  "head" means the filter is inserted at the head of
406#     the filter list, before any existing filters.  "tail" means the
407#     filter is inserted at the tail of the filter list, behind any
408#     existing filters (default).  "id=<id>" means the filter is
409#     inserted before or behind the filter specified by <id>,
410#     depending on the @insert property.  (default: "tail")
411#
412# @insert: where to insert the filter relative to the filter given in
413#     @position.  Ignored if @position is "head" or "tail".
414#     (default: behind)
415#
416# Since: 2.5
417##
418{ 'struct': 'NetfilterProperties',
419  'data': { 'netdev': 'str',
420            '*queue': 'NetFilterDirection',
421            '*status': 'str',
422            '*position': 'str',
423            '*insert': 'NetfilterInsert' } }
424
425##
426# @FilterBufferProperties:
427#
428# Properties for filter-buffer objects.
429#
430# @interval: a non-zero interval in microseconds.  All packets
431#     arriving in the given interval are delayed until the end of the
432#     interval.
433#
434# Since: 2.5
435##
436{ 'struct': 'FilterBufferProperties',
437  'base': 'NetfilterProperties',
438  'data': { 'interval': 'uint32' } }
439
440##
441# @FilterDumpProperties:
442#
443# Properties for filter-dump objects.
444#
445# @file: the filename where the dumped packets should be stored
446#
447# @maxlen: maximum number of bytes in a packet that are stored
448#     (default: 65536)
449#
450# Since: 2.5
451##
452{ 'struct': 'FilterDumpProperties',
453  'base': 'NetfilterProperties',
454  'data': { 'file': 'str',
455            '*maxlen': 'uint32' } }
456
457##
458# @FilterMirrorProperties:
459#
460# Properties for filter-mirror objects.
461#
462# @outdev: the name of a character device backend to which all
463#     incoming packets are mirrored
464#
465# @vnet_hdr_support: if true, vnet header support is enabled
466#     (default: false)
467#
468# Since: 2.6
469##
470{ 'struct': 'FilterMirrorProperties',
471  'base': 'NetfilterProperties',
472  'data': { 'outdev': 'str',
473            '*vnet_hdr_support': 'bool' } }
474
475##
476# @FilterRedirectorProperties:
477#
478# Properties for filter-redirector objects.
479#
480# At least one of @indev or @outdev must be present.  If both are
481# present, they must not refer to the same character device backend.
482#
483# @indev: the name of a character device backend from which packets
484#     are received and redirected to the filtered network device
485#
486# @outdev: the name of a character device backend to which all
487#     incoming packets are redirected
488#
489# @vnet_hdr_support: if true, vnet header support is enabled
490#     (default: false)
491#
492# Since: 2.6
493##
494{ 'struct': 'FilterRedirectorProperties',
495  'base': 'NetfilterProperties',
496  'data': { '*indev': 'str',
497            '*outdev': 'str',
498            '*vnet_hdr_support': 'bool' } }
499
500##
501# @FilterRewriterProperties:
502#
503# Properties for filter-rewriter objects.
504#
505# @vnet_hdr_support: if true, vnet header support is enabled
506#     (default: false)
507#
508# Since: 2.8
509##
510{ 'struct': 'FilterRewriterProperties',
511  'base': 'NetfilterProperties',
512  'data': { '*vnet_hdr_support': 'bool' } }
513
514##
515# @InputBarrierProperties:
516#
517# Properties for input-barrier objects.
518#
519# @name: the screen name as declared in the screens section of
520#     barrier.conf
521#
522# @server: hostname of the Barrier server (default: "localhost")
523#
524# @port: TCP port of the Barrier server (default: "24800")
525#
526# @x-origin: x coordinate of the leftmost pixel on the guest screen
527#     (default: "0")
528#
529# @y-origin: y coordinate of the topmost pixel on the guest screen
530#     (default: "0")
531#
532# @width: the width of secondary screen in pixels (default: "1920")
533#
534# @height: the height of secondary screen in pixels (default: "1080")
535#
536# Since: 4.2
537##
538{ 'struct': 'InputBarrierProperties',
539  'data': { 'name': 'str',
540            '*server': 'str',
541            '*port': 'str',
542            '*x-origin': 'str',
543            '*y-origin': 'str',
544            '*width': 'str',
545            '*height': 'str' } }
546
547##
548# @InputLinuxProperties:
549#
550# Properties for input-linux objects.
551#
552# @evdev: the path of the host evdev device to use
553#
554# @grab_all: if true, grab is toggled for all devices (e.g. both
555#     keyboard and mouse) instead of just one device (default: false)
556#
557# @repeat: enables auto-repeat events (default: false)
558#
559# @grab-toggle: the key or key combination that toggles device grab
560#     (default: ctrl-ctrl)
561#
562# Since: 2.6
563##
564{ 'struct': 'InputLinuxProperties',
565  'data': { 'evdev': 'str',
566            '*grab_all': 'bool',
567            '*repeat': 'bool',
568            '*grab-toggle': 'GrabToggleKeys' },
569  'if': 'CONFIG_LINUX' }
570
571##
572# @EventLoopBaseProperties:
573#
574# Common properties for event loops
575#
576# @aio-max-batch: maximum number of requests in a batch for the AIO
577#     engine, 0 means that the engine will use its default.
578#     (default: 0)
579#
580# @thread-pool-min: minimum number of threads reserved in the thread
581#     pool (default:0)
582#
583# @thread-pool-max: maximum number of threads the thread pool can
584#     contain (default:64)
585#
586# Since: 7.1
587##
588{ 'struct': 'EventLoopBaseProperties',
589  'data': { '*aio-max-batch': 'int',
590            '*thread-pool-min': 'int',
591            '*thread-pool-max': 'int' } }
592
593##
594# @IothreadProperties:
595#
596# Properties for iothread objects.
597#
598# @poll-max-ns: the maximum number of nanoseconds to busy wait for
599#     events.  0 means polling is disabled (default: 32768 on POSIX
600#     hosts, 0 otherwise)
601#
602# @poll-grow: the multiplier used to increase the polling time when
603#     the algorithm detects it is missing events due to not polling
604#     long enough.  0 selects a default behaviour (default: 0)
605#
606# @poll-shrink: the divisor used to decrease the polling time when the
607#     algorithm detects it is spending too long polling without
608#     encountering events.  0 selects a default behaviour (default: 0)
609#
610# The @aio-max-batch option is available since 6.1.
611#
612# Since: 2.0
613##
614{ 'struct': 'IothreadProperties',
615  'base': 'EventLoopBaseProperties',
616  'data': { '*poll-max-ns': 'int',
617            '*poll-grow': 'int',
618            '*poll-shrink': 'int' } }
619
620##
621# @MainLoopProperties:
622#
623# Properties for the main-loop object.
624#
625# Since: 7.1
626##
627{ 'struct': 'MainLoopProperties',
628  'base': 'EventLoopBaseProperties',
629  'data': {} }
630
631##
632# @MemoryBackendProperties:
633#
634# Properties for objects of classes derived from memory-backend.
635#
636# @merge: if true, mark the memory as mergeable (default depends on
637#     the machine type)
638#
639# @dump: if true, include the memory in core dumps (default depends on
640#     the machine type)
641#
642# @host-nodes: the list of NUMA host nodes to bind the memory to
643#
644# @policy: the NUMA policy (default: 'default')
645#
646# @prealloc: if true, preallocate memory (default: false)
647#
648# @prealloc-threads: number of CPU threads to use for prealloc
649#     (default: 1)
650#
651# @prealloc-context: thread context to use for creation of
652#     preallocation threads (default: none) (since 7.2)
653#
654# @share: if false, the memory is private to QEMU; if true, it is
655#     shared (default false for backends memory-backend-file and
656#     memory-backend-ram, true for backends memory-backend-epc,
657#     memory-backend-memfd, and memory-backend-shm)
658#
659# @reserve: if true, reserve swap space (or huge pages) if applicable
660#     (default: true) (since 6.1)
661#
662# @size: size of the memory region in bytes
663#
664# @x-use-canonical-path-for-ramblock-id: if true, the canonical path
665#     is used for ramblock-id.  Disable this for 4.0 machine types or
666#     older to allow migration with newer QEMU versions.
667#     (default: false generally, but true for machine types <= 4.0)
668#
669# .. note:: prealloc=true and reserve=false cannot be set at the same
670#    time.  With reserve=true, the behavior depends on the operating
671#    system: for example, Linux will not reserve swap space for shared
672#    file mappings -- "not applicable".  In contrast, reserve=false
673#    will bail out if it cannot be configured accordingly.
674#
675# Since: 2.1
676##
677{ 'struct': 'MemoryBackendProperties',
678  'data': { '*dump': 'bool',
679            '*host-nodes': ['uint16'],
680            '*merge': 'bool',
681            '*policy': 'HostMemPolicy',
682            '*prealloc': 'bool',
683            '*prealloc-threads': 'uint32',
684            '*prealloc-context': 'str',
685            '*share': 'bool',
686            '*reserve': 'bool',
687            'size': 'size',
688            '*x-use-canonical-path-for-ramblock-id': 'bool' } }
689
690##
691# @MemoryBackendFileProperties:
692#
693# Properties for memory-backend-file objects.
694#
695# @align: the base address alignment when QEMU mmap(2)s @mem-path.
696#     Some backend stores specified by @mem-path require an alignment
697#     different than the default one used by QEMU, e.g. the device DAX
698#     /dev/dax0.0 requires 2M alignment rather than 4K.  In such
699#     cases, users can specify the required alignment via this option.
700#     0 selects a default alignment (currently the page size).
701#     (default: 0)
702#
703# @offset: the offset into the target file that the region starts at.
704#     You can use this option to back multiple regions with a single
705#     file.  Must be a multiple of the page size.
706#     (default: 0) (since 8.1)
707#
708# @discard-data: if true, the file contents can be destroyed when QEMU
709#     exits, to avoid unnecessarily flushing data to the backing file.
710#     Note that @discard-data is only an optimization, and QEMU might
711#     not discard file contents if it aborts unexpectedly or is
712#     terminated using SIGKILL.  (default: false)
713#
714# @mem-path: the path to either a shared memory or huge page
715#     filesystem mount
716#
717# @pmem: specifies whether the backing file specified by @mem-path is
718#     in host persistent memory that can be accessed using the SNIA
719#     NVM programming model (e.g. Intel NVDIMM).
720#
721# @readonly: if true, the backing file is opened read-only; if false,
722#     it is opened read-write.  (default: false)
723#
724# @rom: whether to create Read Only Memory (ROM) that cannot be
725#     modified by the VM.  Any write attempts to such ROM will be
726#     denied.  Most use cases want writable RAM instead of ROM.
727#     However, selected use cases, like R/O NVDIMMs, can benefit from
728#     ROM.  If set to 'on', create ROM; if set to 'off', create
729#     writable RAM; if set to 'auto', the value of the @readonly
730#     property is used.  This property is primarily helpful when we
731#     want to have proper RAM in configurations that would
732#     traditionally create ROM before this property was introduced: VM
733#     templating, where we want to open a file readonly (@readonly set
734#     to true) and mark the memory to be private for QEMU (@share set
735#     to false).  For this use case, we need writable RAM instead of
736#     ROM, and want to set this property to 'off'.  (default: auto,
737#     since 8.2)
738#
739# Since: 2.1
740##
741{ 'struct': 'MemoryBackendFileProperties',
742  'base': 'MemoryBackendProperties',
743  'data': { '*align': 'size',
744            '*offset': 'size',
745            '*discard-data': 'bool',
746            'mem-path': 'str',
747            '*pmem': { 'type': 'bool', 'if': 'CONFIG_LIBPMEM' },
748            '*readonly': 'bool',
749            '*rom': 'OnOffAuto' } }
750
751##
752# @MemoryBackendMemfdProperties:
753#
754# Properties for memory-backend-memfd objects.
755#
756# @hugetlb: if true, the file to be created resides in the hugetlbfs
757#     filesystem (default: false)
758#
759# @hugetlbsize: the hugetlb page size on systems that support multiple
760#     hugetlb page sizes (it must be a power of 2 value supported by
761#     the system).  0 selects a default page size.  This option is
762#     ignored if @hugetlb is false.  (default: 0)
763#
764# @seal: if true, create a sealed-file, which will block further
765#     resizing of the memory (default: true)
766#
767# Since: 2.12
768##
769{ 'struct': 'MemoryBackendMemfdProperties',
770  'base': 'MemoryBackendProperties',
771  'data': { '*hugetlb': 'bool',
772            '*hugetlbsize': 'size',
773            '*seal': 'bool' },
774  'if': 'CONFIG_LINUX' }
775
776##
777# @MemoryBackendShmProperties:
778#
779# Properties for memory-backend-shm objects.
780#
781# This memory backend supports only shared memory, which is the
782# default.
783#
784# Since: 9.1
785##
786{ 'struct': 'MemoryBackendShmProperties',
787  'base': 'MemoryBackendProperties',
788  'data': { },
789  'if': 'CONFIG_POSIX' }
790
791##
792# @MemoryBackendEpcProperties:
793#
794# Properties for memory-backend-epc objects.
795#
796# The @merge boolean option is false by default with epc
797#
798# The @dump boolean option is false by default with epc
799#
800# Since: 6.2
801##
802{ 'struct': 'MemoryBackendEpcProperties',
803  'base': 'MemoryBackendProperties',
804  'data': {},
805  'if': 'CONFIG_LINUX' }
806
807##
808# @PrManagerHelperProperties:
809#
810# Properties for pr-manager-helper objects.
811#
812# @path: the path to a Unix domain socket for connecting to the
813#     external helper
814#
815# Since: 2.11
816##
817{ 'struct': 'PrManagerHelperProperties',
818  'data': { 'path': 'str' },
819  'if': 'CONFIG_LINUX' }
820
821##
822# @QtestProperties:
823#
824# Properties for qtest objects.
825#
826# @chardev: the chardev to be used to receive qtest commands on.
827#
828# @log: the path to a log file
829#
830# Since: 6.0
831##
832{ 'struct': 'QtestProperties',
833        'data': { 'chardev': 'str',
834                  '*log': 'str' } }
835
836##
837# @RemoteObjectProperties:
838#
839# Properties for x-remote-object objects.
840#
841# @fd: file descriptor name previously passed via `getfd` command
842#
843# @devid: the id of the device to be associated with the file
844#     descriptor
845#
846# Since: 6.0
847##
848{ 'struct': 'RemoteObjectProperties',
849  'data': { 'fd': 'str', 'devid': 'str' } }
850
851##
852# @VfioUserServerProperties:
853#
854# Properties for x-vfio-user-server objects.
855#
856# @socket: socket to be used by the libvfio-user library
857#
858# @device: the ID of the device to be emulated at the server
859#
860# Since: 7.1
861##
862{ 'struct': 'VfioUserServerProperties',
863  'data': { 'socket': 'SocketAddress', 'device': 'str' } }
864
865##
866# @IOMMUFDProperties:
867#
868# Properties for iommufd objects.
869#
870# @fd: file descriptor name previously passed via `getfd` command,
871#     which represents a pre-opened /dev/iommu.  This allows the
872#     iommufd object to be shared across several subsystems (VFIO,
873#     VDPA, ...), and the file descriptor to be shared with other
874#     process, e.g. DPDK.  (default: QEMU opens /dev/iommu by itself)
875#
876# Since: 9.0
877##
878{ 'struct': 'IOMMUFDProperties',
879  'data': { '*fd': 'str' } }
880
881##
882# @AcpiGenericInitiatorProperties:
883#
884# Properties for acpi-generic-initiator objects.
885#
886# @pci-dev: PCI device ID to be associated with the node
887#
888# @node: NUMA node associated with the PCI device
889#
890# Since: 9.0
891##
892{ 'struct': 'AcpiGenericInitiatorProperties',
893  'data': { 'pci-dev': 'str',
894            'node': 'uint32' } }
895
896##
897# @AcpiGenericPortProperties:
898#
899# Properties for acpi-generic-port objects.
900#
901# @pci-bus: QOM path of the PCI bus of the hostbridge associated with
902#     this SRAT Generic Port Affinity Structure.  This is the same as
903#     the bus parameter for the root ports attached to this host
904#     bridge.  The resulting SRAT Generic Port Affinity Structure will
905#     refer to the ACPI object in DSDT that represents the host bridge
906#     (e.g.  ACPI0016 for CXL host bridges).  See ACPI 6.5 Section
907#     5.2.16.7 for more information.
908#
909# @node: Similar to a NUMA node ID, but instead of providing a
910#     reference point used for defining NUMA distances and access
911#     characteristics to memory or from an initiator (e.g. CPU), this
912#     node defines the boundary point between non-discoverable system
913#     buses which must be described by firmware, and a discoverable
914#     bus.  NUMA distances and access characteristics are defined to
915#     and from that point.  For system software to establish full
916#     initiator to target characteristics this information must be
917#     combined with information retrieved from the discoverable part
918#     of the path.  An example would use CDAT (see UEFI.org)
919#     information read from devices and switches in conjunction with
920#     link characteristics read from PCIe Configuration space.
921#     To get the full path latency from CPU to CXL attached DRAM
922#     CXL device: Add the latency from CPU to Generic Port (from
923#     HMAT indexed via the node ID in this SRAT structure) to
924#     that for CXL bus links, the latency across intermediate switches
925#     and from the EP port to the actual memory.  Bandwidth is more
926#     complex as there may be interleaving across multiple devices
927#     and shared links in the path.
928#
929# Since: 9.2
930##
931{ 'struct': 'AcpiGenericPortProperties',
932  'data': { 'pci-bus': 'str',
933            'node': 'uint32' } }
934
935##
936# @RngProperties:
937#
938# Properties for objects of classes derived from rng.
939#
940# @opened: if true, the device is opened immediately when applying
941#     this option and will probably fail when processing the next
942#     option.  Don't use; only provided for compatibility.
943#     (default: false)
944#
945# Features:
946#
947# @deprecated: Member @opened is deprecated.  Setting true doesn't
948#     make sense, and false is already the default.
949#
950# Since: 1.3
951##
952{ 'struct': 'RngProperties',
953  'data': { '*opened': { 'type': 'bool', 'features': ['deprecated'] } } }
954
955##
956# @RngEgdProperties:
957#
958# Properties for rng-egd objects.
959#
960# @chardev: the name of a character device backend that provides the
961#     connection to the RNG daemon
962#
963# Since: 1.3
964##
965{ 'struct': 'RngEgdProperties',
966  'base': 'RngProperties',
967  'data': { 'chardev': 'str' } }
968
969##
970# @RngRandomProperties:
971#
972# Properties for rng-random objects.
973#
974# @filename: the filename of the device on the host to obtain entropy
975#     from (default: "/dev/urandom")
976#
977# Since: 1.3
978##
979{ 'struct': 'RngRandomProperties',
980  'base': 'RngProperties',
981  'data': { '*filename': 'str' },
982  'if': 'CONFIG_POSIX' }
983
984##
985# @IgvmCfgProperties:
986#
987# Properties common to objects that handle IGVM files.
988#
989# @file: IGVM file to use to configure guest
990#
991# Since: 10.1
992##
993{ 'struct': 'IgvmCfgProperties',
994  'if': 'CONFIG_IGVM',
995  'data': { 'file': 'str' } }
996
997##
998# @SevCommonProperties:
999#
1000# Properties common to objects that are derivatives of sev-common.
1001#
1002# @sev-device: SEV device to use (default: "/dev/sev")
1003#
1004# @cbitpos: C-bit location in page table entry (default: 0)
1005#
1006# @reduced-phys-bits: number of bits in physical addresses that become
1007#     unavailable when SEV is enabled
1008#
1009# @kernel-hashes: if true, add hashes of kernel/initrd/cmdline to a
1010#     designated guest firmware page for measured boot with -kernel
1011#     (default: false) (since 6.2)
1012#
1013# Since: 9.1
1014##
1015{ 'struct': 'SevCommonProperties',
1016  'data': { '*sev-device': 'str',
1017            '*cbitpos': 'uint32',
1018            'reduced-phys-bits': 'uint32',
1019            '*kernel-hashes': 'bool' } }
1020
1021##
1022# @SevGuestProperties:
1023#
1024# Properties for sev-guest objects.
1025#
1026# @dh-cert-file: guest owners DH certificate (encoded with base64)
1027#
1028# @session-file: guest owners session parameters (encoded with base64)
1029#
1030# @policy: SEV policy value (default: 0x1)
1031#
1032# @handle: SEV firmware handle (default: 0)
1033#
1034# @legacy-vm-type: Use legacy KVM_SEV_INIT KVM interface for creating
1035#    the VM.  The newer KVM_SEV_INIT2 interface, from Linux >= 6.10,
1036#    syncs additional vCPU state when initializing the VMSA
1037#    structures, which will result in a different guest measurement.
1038#    Set this to 'on' to force compatibility with older QEMU or kernel
1039#    versions that rely on legacy KVM_SEV_INIT behavior.  'auto' will
1040#    behave identically to 'on', but will automatically switch to
1041#    using KVM_SEV_INIT2 if the user specifies any additional options
1042#    that require it.  If set to 'off', QEMU will require
1043#    KVM_SEV_INIT2 unconditionally.
1044#    (default: off) (since 9.1)
1045#
1046# Since: 2.12
1047##
1048{ 'struct': 'SevGuestProperties',
1049  'base': 'SevCommonProperties',
1050  'data': { '*dh-cert-file': 'str',
1051            '*session-file': 'str',
1052            '*policy': 'uint32',
1053            '*handle': 'uint32',
1054            '*legacy-vm-type': 'OnOffAuto' } }
1055
1056##
1057# @SevSnpGuestProperties:
1058#
1059# Properties for sev-snp-guest objects.  Most of these are direct
1060# arguments for the KVM_SNP_* interfaces documented in the Linux
1061# kernel source under
1062# Documentation/arch/x86/amd-memory-encryption.rst, which are in turn
1063# closely coupled with the SNP_INIT/SNP_LAUNCH_* firmware commands
1064# documented in the SEV-SNP Firmware ABI Specification (Rev 0.9).
1065#
1066# More usage information is also available in the QEMU source tree
1067# under docs/amd-memory-encryption.
1068#
1069# @policy: the 'POLICY' parameter to the SNP_LAUNCH_START command, as
1070#     defined in the SEV-SNP firmware ABI (default: 0x30000)
1071#
1072# @guest-visible-workarounds: 16-byte, base64-encoded blob to report
1073#     hypervisor-defined workarounds, corresponding to the 'GOSVW'
1074#     parameter of the SNP_LAUNCH_START command defined in the SEV-SNP
1075#     firmware ABI (default: all-zero)
1076#
1077# @id-block: 96-byte, base64-encoded blob to provide the 'ID Block'
1078#     structure for the SNP_LAUNCH_FINISH command defined in the
1079#     SEV-SNP firmware ABI (default: all-zero)
1080#
1081# @id-auth: 4096-byte, base64-encoded blob to provide the 'ID
1082#     Authentication Information Structure' for the SNP_LAUNCH_FINISH
1083#     command defined in the SEV-SNP firmware ABI (default: all-zero)
1084#
1085# @author-key-enabled: true if 'id-auth' blob contains the 'AUTHOR_KEY'
1086#     field defined SEV-SNP firmware ABI (default: false)
1087#
1088# @host-data: 32-byte, base64-encoded, user-defined blob to provide to
1089#     the guest, as documented for the 'HOST_DATA' parameter of the
1090#     SNP_LAUNCH_FINISH command in the SEV-SNP firmware ABI (default:
1091#     all-zero)
1092#
1093# @vcek-disabled: Guests are by default allowed to choose between VLEK
1094#     (Versioned Loaded Endorsement Key) or VCEK (Versioned Chip
1095#     Endorsement Key) when requesting attestation reports from
1096#     firmware.  Set this to true to disable the use of VCEK.
1097#     (default: false) (since: 9.1)
1098#
1099# Since: 9.1
1100##
1101{ 'struct': 'SevSnpGuestProperties',
1102  'base': 'SevCommonProperties',
1103  'data': {
1104            '*policy': 'uint64',
1105            '*guest-visible-workarounds': 'str',
1106            '*id-block': 'str',
1107            '*id-auth': 'str',
1108            '*author-key-enabled': 'bool',
1109            '*host-data': 'str',
1110            '*vcek-disabled': 'bool' } }
1111
1112##
1113# @TdxGuestProperties:
1114#
1115# Properties for tdx-guest objects.
1116#
1117# @attributes: The 'attributes' of a TD guest that is passed to
1118#     KVM_TDX_INIT_VM
1119#
1120# @sept-ve-disable: toggle bit 28 of TD attributes to control disabling
1121#     of EPT violation conversion to #VE on guest TD access of PENDING
1122#     pages.  Some guest OS (e.g., Linux TD guest) may require this to
1123#     be set, otherwise they refuse to boot.
1124#
1125# @mrconfigid: ID for non-owner-defined configuration of the guest TD,
1126#     e.g., run-time or OS configuration (base64 encoded SHA384 digest).
1127#     Defaults to all zeros.
1128#
1129# @mrowner: ID for the guest TDs owner (base64 encoded SHA384 digest).
1130#     Defaults to all zeros.
1131#
1132# @mrownerconfig: ID for owner-defined configuration of the guest TD,
1133#     e.g., specific to the workload rather than the run-time or OS
1134#     (base64 encoded SHA384 digest).  Defaults to all zeros.
1135#
1136# @quote-generation-socket: socket address for Quote Generation
1137#     Service (QGS).  QGS is a daemon running on the host.  Without
1138#     it, the guest will not be able to get a TD quote for
1139#     attestation.
1140#
1141# Since: 10.1
1142##
1143{ 'struct': 'TdxGuestProperties',
1144  'data': { '*attributes': 'uint64',
1145            '*sept-ve-disable': 'bool',
1146            '*mrconfigid': 'str',
1147            '*mrowner': 'str',
1148            '*mrownerconfig': 'str',
1149            '*quote-generation-socket': 'SocketAddress' } }
1150
1151##
1152# @ThreadContextProperties:
1153#
1154# Properties for thread context objects.
1155#
1156# @cpu-affinity: the list of host CPU numbers used as CPU affinity for
1157#     all threads created in the thread context (default: QEMU main
1158#     thread CPU affinity)
1159#
1160# @node-affinity: the list of host node numbers that will be resolved
1161#     to a list of host CPU numbers used as CPU affinity.  This is a
1162#     shortcut for specifying the list of host CPU numbers belonging
1163#     to the host nodes manually by setting @cpu-affinity.
1164#     (default: QEMU main thread affinity)
1165#
1166# Since: 7.2
1167##
1168{ 'struct': 'ThreadContextProperties',
1169  'data': { '*cpu-affinity': ['uint16'],
1170            '*node-affinity': ['uint16'] } }
1171
1172
1173##
1174# @ObjectType:
1175#
1176# Features:
1177#
1178# @unstable: Members @x-remote-object and @x-vfio-user-server are
1179#     experimental.
1180#
1181# Since: 6.0
1182##
1183{ 'enum': 'ObjectType',
1184  'data': [
1185    'acpi-generic-initiator',
1186    'acpi-generic-port',
1187    'authz-list',
1188    'authz-listfile',
1189    'authz-pam',
1190    'authz-simple',
1191    'can-bus',
1192    { 'name': 'can-host-socketcan',
1193      'if': 'CONFIG_LINUX' },
1194    'colo-compare',
1195    'cryptodev-backend',
1196    'cryptodev-backend-builtin',
1197    'cryptodev-backend-lkcf',
1198    { 'name': 'cryptodev-vhost-user',
1199      'if': 'CONFIG_VHOST_CRYPTO' },
1200    'dbus-vmstate',
1201    'filter-buffer',
1202    'filter-dump',
1203    'filter-mirror',
1204    'filter-redirector',
1205    'filter-replay',
1206    'filter-rewriter',
1207    { 'name': 'igvm-cfg',
1208      'if': 'CONFIG_IGVM' },
1209    'input-barrier',
1210    { 'name': 'input-linux',
1211      'if': 'CONFIG_LINUX' },
1212    'iommufd',
1213    'iothread',
1214    'main-loop',
1215    { 'name': 'memory-backend-epc',
1216      'if': 'CONFIG_LINUX' },
1217    'memory-backend-file',
1218    { 'name': 'memory-backend-memfd',
1219      'if': 'CONFIG_LINUX' },
1220    'memory-backend-ram',
1221    { 'name': 'memory-backend-shm',
1222      'if': 'CONFIG_POSIX' },
1223    'pef-guest',
1224    { 'name': 'pr-manager-helper',
1225      'if': 'CONFIG_LINUX' },
1226    'qtest',
1227    'rng-builtin',
1228    'rng-egd',
1229    { 'name': 'rng-random',
1230      'if': 'CONFIG_POSIX' },
1231    'secret',
1232    { 'name': 'secret_keyring',
1233      'if': 'CONFIG_SECRET_KEYRING' },
1234    'sev-guest',
1235    'sev-snp-guest',
1236    'thread-context',
1237    's390-pv-guest',
1238    'tdx-guest',
1239    'throttle-group',
1240    'tls-creds-anon',
1241    'tls-creds-psk',
1242    'tls-creds-x509',
1243    'tls-cipher-suites',
1244    { 'name': 'x-remote-object', 'features': [ 'unstable' ] },
1245    { 'name': 'x-vfio-user-server', 'features': [ 'unstable' ] }
1246  ] }
1247
1248##
1249# @ObjectOptions:
1250#
1251# Describes the options of a user creatable QOM object.
1252#
1253# @qom-type: the class name for the object to be created
1254#
1255# @id: the name of the new object
1256#
1257# Since: 6.0
1258##
1259{ 'union': 'ObjectOptions',
1260  'base': { 'qom-type': 'ObjectType',
1261            'id': 'str' },
1262  'discriminator': 'qom-type',
1263  'data': {
1264      'acpi-generic-initiator':     'AcpiGenericInitiatorProperties',
1265      'acpi-generic-port':          'AcpiGenericPortProperties',
1266      'authz-list':                 'AuthZListProperties',
1267      'authz-listfile':             'AuthZListFileProperties',
1268      'authz-pam':                  'AuthZPAMProperties',
1269      'authz-simple':               'AuthZSimpleProperties',
1270      'can-host-socketcan':         { 'type': 'CanHostSocketcanProperties',
1271                                      'if': 'CONFIG_LINUX' },
1272      'colo-compare':               'ColoCompareProperties',
1273      'cryptodev-backend':          'CryptodevBackendProperties',
1274      'cryptodev-backend-builtin':  'CryptodevBackendProperties',
1275      'cryptodev-backend-lkcf':     'CryptodevBackendProperties',
1276      'cryptodev-vhost-user':       { 'type': 'CryptodevVhostUserProperties',
1277                                      'if': 'CONFIG_VHOST_CRYPTO' },
1278      'dbus-vmstate':               'DBusVMStateProperties',
1279      'filter-buffer':              'FilterBufferProperties',
1280      'filter-dump':                'FilterDumpProperties',
1281      'filter-mirror':              'FilterMirrorProperties',
1282      'filter-redirector':          'FilterRedirectorProperties',
1283      'filter-replay':              'NetfilterProperties',
1284      'filter-rewriter':            'FilterRewriterProperties',
1285      'igvm-cfg':                   { 'type': 'IgvmCfgProperties',
1286                                      'if': 'CONFIG_IGVM' },
1287      'input-barrier':              'InputBarrierProperties',
1288      'input-linux':                { 'type': 'InputLinuxProperties',
1289                                      'if': 'CONFIG_LINUX' },
1290      'iommufd':                    'IOMMUFDProperties',
1291      'iothread':                   'IothreadProperties',
1292      'main-loop':                  'MainLoopProperties',
1293      'memory-backend-epc':         { 'type': 'MemoryBackendEpcProperties',
1294                                      'if': 'CONFIG_LINUX' },
1295      'memory-backend-file':        'MemoryBackendFileProperties',
1296      'memory-backend-memfd':       { 'type': 'MemoryBackendMemfdProperties',
1297                                      'if': 'CONFIG_LINUX' },
1298      'memory-backend-ram':         'MemoryBackendProperties',
1299      'memory-backend-shm':         { 'type': 'MemoryBackendShmProperties',
1300                                      'if': 'CONFIG_POSIX' },
1301      'pr-manager-helper':          { 'type': 'PrManagerHelperProperties',
1302                                      'if': 'CONFIG_LINUX' },
1303      'qtest':                      'QtestProperties',
1304      'rng-builtin':                'RngProperties',
1305      'rng-egd':                    'RngEgdProperties',
1306      'rng-random':                 { 'type': 'RngRandomProperties',
1307                                      'if': 'CONFIG_POSIX' },
1308      'secret':                     'SecretProperties',
1309      'secret_keyring':             { 'type': 'SecretKeyringProperties',
1310                                      'if': 'CONFIG_SECRET_KEYRING' },
1311      'sev-guest':                  'SevGuestProperties',
1312      'sev-snp-guest':              'SevSnpGuestProperties',
1313      'tdx-guest':                  'TdxGuestProperties',
1314      'thread-context':             'ThreadContextProperties',
1315      'throttle-group':             'ThrottleGroupProperties',
1316      'tls-creds-anon':             'TlsCredsAnonProperties',
1317      'tls-creds-psk':              'TlsCredsPskProperties',
1318      'tls-creds-x509':             'TlsCredsX509Properties',
1319      'tls-cipher-suites':          'TlsCredsProperties',
1320      'x-remote-object':            'RemoteObjectProperties',
1321      'x-vfio-user-server':         'VfioUserServerProperties'
1322  } }
1323
1324##
1325# @object-add:
1326#
1327# Create a QOM object.
1328#
1329# Errors:
1330#     - If @qom-type is not a valid class name
1331#
1332# Since: 2.0
1333#
1334# .. qmp-example::
1335#
1336#     -> { "execute": "object-add",
1337#          "arguments": { "qom-type": "rng-random", "id": "rng1",
1338#                         "filename": "/dev/hwrng" } }
1339#     <- { "return": {} }
1340##
1341{ 'command': 'object-add', 'data': 'ObjectOptions', 'boxed': true,
1342  'allow-preconfig': true }
1343
1344##
1345# @object-del:
1346#
1347# Remove a QOM object.
1348#
1349# @id: the name of the QOM object to remove
1350#
1351# Errors:
1352#     - If @id is not a valid id for a QOM object
1353#
1354# Since: 2.0
1355#
1356# .. qmp-example::
1357#
1358#     -> { "execute": "object-del", "arguments": { "id": "rng1" } }
1359#     <- { "return": {} }
1360##
1361{ 'command': 'object-del', 'data': {'id': 'str'},
1362  'allow-preconfig': true }
1363