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.
7 { 'include': 'authz.json' }
8 { 'include': 'block-core.json' }
9 { 'include': 'common.json' }
10 { 'include': 'crypto.json' }
13 # = QEMU Object Model (QOM)
17 # @ObjectPropertyInfo:
19 # @name: the name of the property
21 # @type: the type of the property. This will typically come in one of four
24 # 1) A primitive type such as 'u8', 'u16', 'bool', 'str', or 'double'.
25 # These types are mapped to the appropriate JSON type.
27 # 2) A child type in the form 'child<subtype>' where subtype is a qdev
28 # device type name. Child properties create the composition tree.
30 # 3) A link type in the form 'link<subtype>' where subtype is a qdev
31 # device type name. Link properties form the device model graph.
33 # @description: if specified, the description of the property.
35 # @default-value: the default value, if any (since 5.0)
39 { 'struct': 'ObjectPropertyInfo',
40 'data': { 'name': 'str',
42 '*description': 'str',
43 '*default-value': 'any' } }
48 # This command will list any properties of a object given a path in the object
51 # @path: the path within the object model. See @qom-get for a description of
54 # Returns: a list of @ObjectPropertyInfo that describe the properties of the
61 # -> { "execute": "qom-list",
62 # "arguments": { "path": "/chardevs" } }
63 # <- { "return": [ { "name": "type", "type": "string" },
64 # { "name": "parallel0", "type": "child<chardev-vc>" },
65 # { "name": "serial0", "type": "child<chardev-vc>" },
66 # { "name": "mon0", "type": "child<chardev-stdio>" } ] }
69 { 'command': 'qom-list',
70 'data': { 'path': 'str' },
71 'returns': [ 'ObjectPropertyInfo' ],
72 'allow-preconfig': true }
77 # This command will get a property from a object model path and return the
80 # @path: The path within the object model. There are two forms of supported
81 # paths--absolute and partial paths.
83 # Absolute paths are derived from the root object and can follow child<>
84 # or link<> properties. Since they can follow link<> properties, they
85 # can be arbitrarily long. Absolute paths look like absolute filenames
86 # and are prefixed with a leading slash.
88 # Partial paths look like relative filenames. They do not begin
89 # with a prefix. The matching rules for partial paths are subtle but
90 # designed to make specifying objects easy. At each level of the
91 # composition tree, the partial path is matched as an absolute path.
92 # The first match is not returned. At least two matches are searched
93 # for. A successful result is only returned if only one match is
94 # found. If more than one match is found, a flag is return to
95 # indicate that the match was ambiguous.
97 # @property: The property name to read
99 # Returns: The property value. The type depends on the property
100 # type. child<> and link<> properties are returned as #str
101 # pathnames. All integer property types (u8, u16, etc) are
108 # 1. Use absolute path
110 # -> { "execute": "qom-get",
111 # "arguments": { "path": "/machine/unattached/device[0]",
112 # "property": "hotplugged" } }
113 # <- { "return": false }
115 # 2. Use partial path
117 # -> { "execute": "qom-get",
118 # "arguments": { "path": "unattached/sysbus",
119 # "property": "type" } }
120 # <- { "return": "System" }
123 { 'command': 'qom-get',
124 'data': { 'path': 'str', 'property': 'str' },
126 'allow-preconfig': true }
131 # This command will set a property from a object model path.
133 # @path: see @qom-get for a description of this parameter
135 # @property: the property name to set
137 # @value: a value who's type is appropriate for the property type. See @qom-get
138 # for a description of type mapping.
144 # -> { "execute": "qom-set",
145 # "arguments": { "path": "/machine",
146 # "property": "graphics",
148 # <- { "return": {} }
151 { 'command': 'qom-set',
152 'data': { 'path': 'str', 'property': 'str', 'value': 'any' },
153 'allow-preconfig': true }
158 # This structure describes a search result from @qom-list-types
160 # @name: the type name found in the search
162 # @abstract: the type is abstract and can't be directly instantiated.
163 # Omitted if false. (since 2.10)
165 # @parent: Name of parent type, if any (since 2.10)
169 { 'struct': 'ObjectTypeInfo',
170 'data': { 'name': 'str', '*abstract': 'bool', '*parent': 'str' } }
175 # This command will return a list of types given search parameters
177 # @implements: if specified, only return types that implement this type name
179 # @abstract: if true, include abstract types in the results
181 # Returns: a list of @ObjectTypeInfo or an empty list if no results are found
185 { 'command': 'qom-list-types',
186 'data': { '*implements': 'str', '*abstract': 'bool' },
187 'returns': [ 'ObjectTypeInfo' ],
188 'allow-preconfig': true }
191 # @qom-list-properties:
193 # List properties associated with a QOM object.
195 # @typename: the type name of an object
197 # Note: objects can create properties at runtime, for example to describe
198 # links between different devices and/or objects. These properties
199 # are not included in the output of this command.
201 # Returns: a list of ObjectPropertyInfo describing object properties
205 { 'command': 'qom-list-properties',
206 'data': { 'typename': 'str'},
207 'returns': [ 'ObjectPropertyInfo' ],
208 'allow-preconfig': true }
211 # @CanHostSocketcanProperties:
213 # Properties for can-host-socketcan objects.
215 # @if: interface name of the host system CAN bus to connect to
217 # @canbus: object ID of the can-bus object to connect to the host interface
221 { 'struct': 'CanHostSocketcanProperties',
222 'data': { 'if': 'str',
226 # @ColoCompareProperties:
228 # Properties for colo-compare objects.
230 # @primary_in: name of the character device backend to use for the primary
231 # input (incoming packets are redirected to @outdev)
233 # @secondary_in: name of the character device backend to use for secondary
234 # input (incoming packets are only compared to the input on
235 # @primary_in and then dropped)
237 # @outdev: name of the character device backend to use for output
239 # @iothread: name of the iothread to run in
241 # @notify_dev: name of the character device backend to be used to communicate
242 # with the remote colo-frame (only for Xen COLO)
244 # @compare_timeout: the maximum time to hold a packet from @primary_in for
245 # comparison with an incoming packet on @secondary_in in
246 # milliseconds (default: 3000)
248 # @expired_scan_cycle: the interval at which colo-compare checks whether
249 # packets from @primary have timed out, in milliseconds
252 # @max_queue_size: the maximum number of packets to keep in the queue for
253 # comparing with incoming packets from @secondary_in. If the
254 # queue is full and addtional packets are received, the
255 # addtional packets are dropped. (default: 1024)
257 # @vnet_hdr_support: if true, vnet header support is enabled (default: false)
261 { 'struct': 'ColoCompareProperties',
262 'data': { 'primary_in': 'str',
263 'secondary_in': 'str',
266 '*notify_dev': 'str',
267 '*compare_timeout': 'uint64',
268 '*expired_scan_cycle': 'uint32',
269 '*max_queue_size': 'uint32',
270 '*vnet_hdr_support': 'bool' } }
273 # @CryptodevBackendProperties:
275 # Properties for cryptodev-backend and cryptodev-backend-builtin objects.
277 # @queues: the number of queues for the cryptodev backend. Ignored for
278 # cryptodev-backend and must be 1 for cryptodev-backend-builtin.
283 { 'struct': 'CryptodevBackendProperties',
284 'data': { '*queues': 'uint32' } }
287 # @CryptodevVhostUserProperties:
289 # Properties for cryptodev-vhost-user objects.
291 # @chardev: the name of a Unix domain socket character device that connects to
292 # the vhost-user server
296 { 'struct': 'CryptodevVhostUserProperties',
297 'base': 'CryptodevBackendProperties',
298 'data': { 'chardev': 'str' } }
301 # @DBusVMStateProperties:
303 # Properties for dbus-vmstate objects.
305 # @addr: the name of the DBus bus to connect to
307 # @id-list: a comma separated list of DBus IDs of helpers whose data should be
308 # included in the VM state on migration
312 { 'struct': 'DBusVMStateProperties',
313 'data': { 'addr': 'str' ,
314 '*id-list': 'str' } }
319 # Indicates where to insert a netfilter relative to a given other filter.
321 # @before: insert before the specified filter
323 # @behind: insert behind the specified filter
327 { 'enum': 'NetfilterInsert',
328 'data': [ 'before', 'behind' ] }
331 # @NetfilterProperties:
333 # Properties for objects of classes derived from netfilter.
335 # @netdev: id of the network device backend to filter
337 # @queue: indicates which queue(s) to filter (default: all)
339 # @status: indicates whether the filter is enabled ("on") or disabled ("off")
342 # @position: specifies where the filter should be inserted in the filter list.
343 # "head" means the filter is inserted at the head of the filter list,
344 # before any existing filters.
345 # "tail" means the filter is inserted at the tail of the filter list,
346 # behind any existing filters (default).
347 # "id=<id>" means the filter is inserted before or behind the filter
348 # specified by <id>, depending on the @insert property.
351 # @insert: where to insert the filter relative to the filter given in @position.
352 # Ignored if @position is "head" or "tail". (default: behind)
356 { 'struct': 'NetfilterProperties',
357 'data': { 'netdev': 'str',
358 '*queue': 'NetFilterDirection',
361 '*insert': 'NetfilterInsert' } }
364 # @FilterBufferProperties:
366 # Properties for filter-buffer objects.
368 # @interval: a non-zero interval in microseconds. All packets arriving in the
369 # given interval are delayed until the end of the interval.
373 { 'struct': 'FilterBufferProperties',
374 'base': 'NetfilterProperties',
375 'data': { 'interval': 'uint32' } }
378 # @FilterDumpProperties:
380 # Properties for filter-dump objects.
382 # @file: the filename where the dumped packets should be stored
384 # @maxlen: maximum number of bytes in a packet that are stored (default: 65536)
388 { 'struct': 'FilterDumpProperties',
389 'base': 'NetfilterProperties',
390 'data': { 'file': 'str',
391 '*maxlen': 'uint32' } }
394 # @FilterMirrorProperties:
396 # Properties for filter-mirror objects.
398 # @outdev: the name of a character device backend to which all incoming packets
401 # @vnet_hdr_support: if true, vnet header support is enabled (default: false)
405 { 'struct': 'FilterMirrorProperties',
406 'base': 'NetfilterProperties',
407 'data': { 'outdev': 'str',
408 '*vnet_hdr_support': 'bool' } }
411 # @FilterRedirectorProperties:
413 # Properties for filter-redirector objects.
415 # At least one of @indev or @outdev must be present. If both are present, they
416 # must not refer to the same character device backend.
418 # @indev: the name of a character device backend from which packets are
419 # received and redirected to the filtered network device
421 # @outdev: the name of a character device backend to which all incoming packets
424 # @vnet_hdr_support: if true, vnet header support is enabled (default: false)
428 { 'struct': 'FilterRedirectorProperties',
429 'base': 'NetfilterProperties',
430 'data': { '*indev': 'str',
432 '*vnet_hdr_support': 'bool' } }
435 # @FilterRewriterProperties:
437 # Properties for filter-rewriter objects.
439 # @vnet_hdr_support: if true, vnet header support is enabled (default: false)
443 { 'struct': 'FilterRewriterProperties',
444 'base': 'NetfilterProperties',
445 'data': { '*vnet_hdr_support': 'bool' } }
448 # @IothreadProperties:
450 # Properties for iothread objects.
452 # @poll-max-ns: the maximum number of nanoseconds to busy wait for events.
453 # 0 means polling is disabled (default: 32768 on POSIX hosts,
456 # @poll-grow: the multiplier used to increase the polling time when the
457 # algorithm detects it is missing events due to not polling long
458 # enough. 0 selects a default behaviour (default: 0)
460 # @poll-shrink: the divisor used to decrease the polling time when the
461 # algorithm detects it is spending too long polling without
462 # encountering events. 0 selects a default behaviour (default: 0)
466 { 'struct': 'IothreadProperties',
467 'data': { '*poll-max-ns': 'int',
469 '*poll-shrink': 'int' } }
472 # @MemoryBackendProperties:
474 # Properties for objects of classes derived from memory-backend.
476 # @merge: if true, mark the memory as mergeable (default depends on the machine
479 # @dump: if true, include the memory in core dumps (default depends on the
482 # @host-nodes: the list of NUMA host nodes to bind the memory to
484 # @policy: the NUMA policy (default: 'default')
486 # @prealloc: if true, preallocate memory (default: false)
488 # @prealloc-threads: number of CPU threads to use for prealloc (default: 1)
490 # @share: if false, the memory is private to QEMU; if true, it is shared
493 # @size: size of the memory region in bytes
495 # @x-use-canonical-path-for-ramblock-id: if true, the canoncial path is used
496 # for ramblock-id. Disable this for 4.0
497 # machine types or older to allow
498 # migration with newer QEMU versions.
499 # This option is considered stable
500 # despite the x- prefix. (default:
501 # false generally, but true for machine
506 { 'struct': 'MemoryBackendProperties',
507 'data': { '*dump': 'bool',
508 '*host-nodes': ['uint16'],
510 '*policy': 'HostMemPolicy',
512 '*prealloc-threads': 'uint32',
515 '*x-use-canonical-path-for-ramblock-id': 'bool' } }
518 # @MemoryBackendFileProperties:
520 # Properties for memory-backend-file objects.
522 # @align: the base address alignment when QEMU mmap(2)s @mem-path. Some
523 # backend stores specified by @mem-path require an alignment different
524 # than the default one used by QEMU, e.g. the device DAX /dev/dax0.0
525 # requires 2M alignment rather than 4K. In such cases, users can
526 # specify the required alignment via this option.
527 # 0 selects a default alignment (currently the page size). (default: 0)
529 # @discard-data: if true, the file contents can be destroyed when QEMU exits,
530 # to avoid unnecessarily flushing data to the backing file. Note
531 # that ``discard-data`` is only an optimization, and QEMU might
532 # not discard file contents if it aborts unexpectedly or is
533 # terminated using SIGKILL. (default: false)
535 # @mem-path: the path to either a shared memory or huge page filesystem mount
537 # @pmem: specifies whether the backing file specified by @mem-path is in
538 # host persistent memory that can be accessed using the SNIA NVM
539 # programming model (e.g. Intel NVDIMM).
541 # @readonly: if true, the backing file is opened read-only; if false, it is
542 # opened read-write. (default: false)
546 { 'struct': 'MemoryBackendFileProperties',
547 'base': 'MemoryBackendProperties',
548 'data': { '*align': 'size',
549 '*discard-data': 'bool',
551 '*pmem': { 'type': 'bool', 'if': 'defined(CONFIG_LIBPMEM)' },
552 '*readonly': 'bool' } }
555 # @MemoryBackendMemfdProperties:
557 # Properties for memory-backend-memfd objects.
559 # The @share boolean option is true by default with memfd.
561 # @hugetlb: if true, the file to be created resides in the hugetlbfs filesystem
564 # @hugetlbsize: the hugetlb page size on systems that support multiple hugetlb
565 # page sizes (it must be a power of 2 value supported by the
566 # system). 0 selects a default page size. This option is ignored
567 # if @hugetlb is false. (default: 0)
569 # @seal: if true, create a sealed-file, which will block further resizing of
570 # the memory (default: true)
574 { 'struct': 'MemoryBackendMemfdProperties',
575 'base': 'MemoryBackendProperties',
576 'data': { '*hugetlb': 'bool',
577 '*hugetlbsize': 'size',
583 # Properties for objects of classes derived from rng.
585 # @opened: if true, the device is opened immediately when applying this option
586 # and will probably fail when processing the next option. Don't use;
587 # only provided for compatibility. (default: false)
590 # @deprecated: Member @opened is deprecated. Setting true doesn't make sense,
591 # and false is already the default.
595 { 'struct': 'RngProperties',
596 'data': { '*opened': { 'type': 'bool', 'features': ['deprecated'] } } }
601 # Properties for rng-egd objects.
603 # @chardev: the name of a character device backend that provides the connection
608 { 'struct': 'RngEgdProperties',
609 'base': 'RngProperties',
610 'data': { 'chardev': 'str' } }
613 # @RngRandomProperties:
615 # Properties for rng-random objects.
617 # @filename: the filename of the device on the host to obtain entropy from
618 # (default: "/dev/urandom")
622 { 'struct': 'RngRandomProperties',
623 'base': 'RngProperties',
624 'data': { '*filename': 'str' } }
631 { 'enum': 'ObjectType',
638 'can-host-socketcan',
641 'cryptodev-backend-builtin',
642 { 'name': 'cryptodev-vhost-user',
643 'if': 'defined(CONFIG_VIRTIO_CRYPTO) && defined(CONFIG_VHOST_CRYPTO)' },
652 'memory-backend-file',
653 { 'name': 'memory-backend-memfd',
654 'if': 'defined(CONFIG_LINUX)' },
655 'memory-backend-ram',
671 # Describes the options of a user creatable QOM object.
673 # @qom-type: the class name for the object to be created
675 # @id: the name of the new object
679 { 'union': 'ObjectOptions',
680 'base': { 'qom-type': 'ObjectType',
682 'discriminator': 'qom-type',
684 'authz-list': 'AuthZListProperties',
685 'authz-listfile': 'AuthZListFileProperties',
686 'authz-pam': 'AuthZPAMProperties',
687 'authz-simple': 'AuthZSimpleProperties',
688 'can-host-socketcan': 'CanHostSocketcanProperties',
689 'colo-compare': 'ColoCompareProperties',
690 'cryptodev-backend': 'CryptodevBackendProperties',
691 'cryptodev-backend-builtin': 'CryptodevBackendProperties',
692 'cryptodev-vhost-user': { 'type': 'CryptodevVhostUserProperties',
693 'if': 'defined(CONFIG_VIRTIO_CRYPTO) && defined(CONFIG_VHOST_CRYPTO)' },
694 'dbus-vmstate': 'DBusVMStateProperties',
695 'filter-buffer': 'FilterBufferProperties',
696 'filter-dump': 'FilterDumpProperties',
697 'filter-mirror': 'FilterMirrorProperties',
698 'filter-redirector': 'FilterRedirectorProperties',
699 'filter-replay': 'NetfilterProperties',
700 'filter-rewriter': 'FilterRewriterProperties',
701 'iothread': 'IothreadProperties',
702 'memory-backend-file': 'MemoryBackendFileProperties',
703 'memory-backend-memfd': { 'type': 'MemoryBackendMemfdProperties',
704 'if': 'defined(CONFIG_LINUX)' },
705 'memory-backend-ram': 'MemoryBackendProperties',
706 'rng-builtin': 'RngProperties',
707 'rng-egd': 'RngEgdProperties',
708 'rng-random': 'RngRandomProperties',
709 'secret': 'SecretProperties',
710 'secret_keyring': 'SecretKeyringProperties',
711 'throttle-group': 'ThrottleGroupProperties',
712 'tls-creds-anon': 'TlsCredsAnonProperties',
713 'tls-creds-psk': 'TlsCredsPskProperties',
714 'tls-creds-x509': 'TlsCredsX509Properties',
715 'tls-cipher-suites': 'TlsCredsProperties'
721 # Create a QOM object.
723 # @qom-type: the class name for the object to be created
725 # @id: the name of the new object
727 # Additional arguments depend on qom-type and are passed to the backend
730 # Returns: Nothing on success
731 # Error if @qom-type is not a valid class name
737 # -> { "execute": "object-add",
738 # "arguments": { "qom-type": "rng-random", "id": "rng1",
739 # "filename": "/dev/hwrng" } }
740 # <- { "return": {} }
743 { 'command': 'object-add',
744 'data': {'qom-type': 'str', 'id': 'str'},
745 'gen': false } # so we can get the additional arguments
750 # Remove a QOM object.
752 # @id: the name of the QOM object to remove
754 # Returns: Nothing on success
755 # Error if @id is not a valid id for a QOM object
761 # -> { "execute": "object-del", "arguments": { "id": "rng1" } }
762 # <- { "return": {} }
765 { 'command': 'object-del', 'data': {'id': 'str'} }