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