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' }
12 # = QEMU Object Model (QOM)
16 # @ObjectPropertyInfo:
18 # @name: the name of the property
20 # @type: the type of the property. This will typically come in one of four
23 # 1) A primitive type such as 'u8', 'u16', 'bool', 'str', or 'double'.
24 # These types are mapped to the appropriate JSON type.
26 # 2) A child type in the form 'child<subtype>' where subtype is a qdev
27 # device type name. Child properties create the composition tree.
29 # 3) A link type in the form 'link<subtype>' where subtype is a qdev
30 # device type name. Link properties form the device model graph.
32 # @description: if specified, the description of the property.
34 # @default-value: the default value, if any (since 5.0)
38 { 'struct': 'ObjectPropertyInfo',
39 'data': { 'name': 'str',
41 '*description': 'str',
42 '*default-value': 'any' } }
47 # This command will list any properties of a object given a path in the object
50 # @path: the path within the object model. See @qom-get for a description of
53 # Returns: a list of @ObjectPropertyInfo that describe the properties of the
60 # -> { "execute": "qom-list",
61 # "arguments": { "path": "/chardevs" } }
62 # <- { "return": [ { "name": "type", "type": "string" },
63 # { "name": "parallel0", "type": "child<chardev-vc>" },
64 # { "name": "serial0", "type": "child<chardev-vc>" },
65 # { "name": "mon0", "type": "child<chardev-stdio>" } ] }
68 { 'command': 'qom-list',
69 'data': { 'path': 'str' },
70 'returns': [ 'ObjectPropertyInfo' ],
71 'allow-preconfig': true }
76 # This command will get a property from a object model path and return the
79 # @path: The path within the object model. There are two forms of supported
80 # paths--absolute and partial paths.
82 # Absolute paths are derived from the root object and can follow child<>
83 # or link<> properties. Since they can follow link<> properties, they
84 # can be arbitrarily long. Absolute paths look like absolute filenames
85 # and are prefixed with a leading slash.
87 # Partial paths look like relative filenames. They do not begin
88 # with a prefix. The matching rules for partial paths are subtle but
89 # designed to make specifying objects easy. At each level of the
90 # composition tree, the partial path is matched as an absolute path.
91 # The first match is not returned. At least two matches are searched
92 # for. A successful result is only returned if only one match is
93 # found. If more than one match is found, a flag is return to
94 # indicate that the match was ambiguous.
96 # @property: The property name to read
98 # Returns: The property value. The type depends on the property
99 # type. child<> and link<> properties are returned as #str
100 # pathnames. All integer property types (u8, u16, etc) are
107 # 1. Use absolute path
109 # -> { "execute": "qom-get",
110 # "arguments": { "path": "/machine/unattached/device[0]",
111 # "property": "hotplugged" } }
112 # <- { "return": false }
114 # 2. Use partial path
116 # -> { "execute": "qom-get",
117 # "arguments": { "path": "unattached/sysbus",
118 # "property": "type" } }
119 # <- { "return": "System" }
122 { 'command': 'qom-get',
123 'data': { 'path': 'str', 'property': 'str' },
125 'allow-preconfig': true }
130 # This command will set a property from a object model path.
132 # @path: see @qom-get for a description of this parameter
134 # @property: the property name to set
136 # @value: a value who's type is appropriate for the property type. See @qom-get
137 # for a description of type mapping.
143 # -> { "execute": "qom-set",
144 # "arguments": { "path": "/machine",
145 # "property": "graphics",
147 # <- { "return": {} }
150 { 'command': 'qom-set',
151 'data': { 'path': 'str', 'property': 'str', 'value': 'any' },
152 'allow-preconfig': true }
157 # This structure describes a search result from @qom-list-types
159 # @name: the type name found in the search
161 # @abstract: the type is abstract and can't be directly instantiated.
162 # Omitted if false. (since 2.10)
164 # @parent: Name of parent type, if any (since 2.10)
168 { 'struct': 'ObjectTypeInfo',
169 'data': { 'name': 'str', '*abstract': 'bool', '*parent': 'str' } }
174 # This command will return a list of types given search parameters
176 # @implements: if specified, only return types that implement this type name
178 # @abstract: if true, include abstract types in the results
180 # Returns: a list of @ObjectTypeInfo or an empty list if no results are found
184 { 'command': 'qom-list-types',
185 'data': { '*implements': 'str', '*abstract': 'bool' },
186 'returns': [ 'ObjectTypeInfo' ],
187 'allow-preconfig': true }
190 # @qom-list-properties:
192 # List properties associated with a QOM object.
194 # @typename: the type name of an object
196 # Note: objects can create properties at runtime, for example to describe
197 # links between different devices and/or objects. These properties
198 # are not included in the output of this command.
200 # Returns: a list of ObjectPropertyInfo describing object properties
204 { 'command': 'qom-list-properties',
205 'data': { 'typename': 'str'},
206 'returns': [ 'ObjectPropertyInfo' ],
207 'allow-preconfig': true }
210 # @CryptodevBackendProperties:
212 # Properties for cryptodev-backend and cryptodev-backend-builtin objects.
214 # @queues: the number of queues for the cryptodev backend. Ignored for
215 # cryptodev-backend and must be 1 for cryptodev-backend-builtin.
220 { 'struct': 'CryptodevBackendProperties',
221 'data': { '*queues': 'uint32' } }
224 # @CryptodevVhostUserProperties:
226 # Properties for cryptodev-vhost-user objects.
228 # @chardev: the name of a Unix domain socket character device that connects to
229 # the vhost-user server
233 { 'struct': 'CryptodevVhostUserProperties',
234 'base': 'CryptodevBackendProperties',
235 'data': { 'chardev': 'str' } }
238 # @DBusVMStateProperties:
240 # Properties for dbus-vmstate objects.
242 # @addr: the name of the DBus bus to connect to
244 # @id-list: a comma separated list of DBus IDs of helpers whose data should be
245 # included in the VM state on migration
249 { 'struct': 'DBusVMStateProperties',
250 'data': { 'addr': 'str' ,
251 '*id-list': 'str' } }
254 # @IothreadProperties:
256 # Properties for iothread objects.
258 # @poll-max-ns: the maximum number of nanoseconds to busy wait for events.
259 # 0 means polling is disabled (default: 32768 on POSIX hosts,
262 # @poll-grow: the multiplier used to increase the polling time when the
263 # algorithm detects it is missing events due to not polling long
264 # enough. 0 selects a default behaviour (default: 0)
266 # @poll-shrink: the divisor used to decrease the polling time when the
267 # algorithm detects it is spending too long polling without
268 # encountering events. 0 selects a default behaviour (default: 0)
272 { 'struct': 'IothreadProperties',
273 'data': { '*poll-max-ns': 'int',
275 '*poll-shrink': 'int' } }
278 # @MemoryBackendProperties:
280 # Properties for objects of classes derived from memory-backend.
282 # @merge: if true, mark the memory as mergeable (default depends on the machine
285 # @dump: if true, include the memory in core dumps (default depends on the
288 # @host-nodes: the list of NUMA host nodes to bind the memory to
290 # @policy: the NUMA policy (default: 'default')
292 # @prealloc: if true, preallocate memory (default: false)
294 # @prealloc-threads: number of CPU threads to use for prealloc (default: 1)
296 # @share: if false, the memory is private to QEMU; if true, it is shared
299 # @size: size of the memory region in bytes
301 # @x-use-canonical-path-for-ramblock-id: if true, the canoncial path is used
302 # for ramblock-id. Disable this for 4.0
303 # machine types or older to allow
304 # migration with newer QEMU versions.
305 # This option is considered stable
306 # despite the x- prefix. (default:
307 # false generally, but true for machine
312 { 'struct': 'MemoryBackendProperties',
313 'data': { '*dump': 'bool',
314 '*host-nodes': ['uint16'],
316 '*policy': 'HostMemPolicy',
318 '*prealloc-threads': 'uint32',
321 '*x-use-canonical-path-for-ramblock-id': 'bool' } }
324 # @MemoryBackendFileProperties:
326 # Properties for memory-backend-file objects.
328 # @align: the base address alignment when QEMU mmap(2)s @mem-path. Some
329 # backend stores specified by @mem-path require an alignment different
330 # than the default one used by QEMU, e.g. the device DAX /dev/dax0.0
331 # requires 2M alignment rather than 4K. In such cases, users can
332 # specify the required alignment via this option.
333 # 0 selects a default alignment (currently the page size). (default: 0)
335 # @discard-data: if true, the file contents can be destroyed when QEMU exits,
336 # to avoid unnecessarily flushing data to the backing file. Note
337 # that ``discard-data`` is only an optimization, and QEMU might
338 # not discard file contents if it aborts unexpectedly or is
339 # terminated using SIGKILL. (default: false)
341 # @mem-path: the path to either a shared memory or huge page filesystem mount
343 # @pmem: specifies whether the backing file specified by @mem-path is in
344 # host persistent memory that can be accessed using the SNIA NVM
345 # programming model (e.g. Intel NVDIMM).
347 # @readonly: if true, the backing file is opened read-only; if false, it is
348 # opened read-write. (default: false)
352 { 'struct': 'MemoryBackendFileProperties',
353 'base': 'MemoryBackendProperties',
354 'data': { '*align': 'size',
355 '*discard-data': 'bool',
357 '*pmem': { 'type': 'bool', 'if': 'defined(CONFIG_LIBPMEM)' },
358 '*readonly': 'bool' } }
361 # @MemoryBackendMemfdProperties:
363 # Properties for memory-backend-memfd objects.
365 # The @share boolean option is true by default with memfd.
367 # @hugetlb: if true, the file to be created resides in the hugetlbfs filesystem
370 # @hugetlbsize: the hugetlb page size on systems that support multiple hugetlb
371 # page sizes (it must be a power of 2 value supported by the
372 # system). 0 selects a default page size. This option is ignored
373 # if @hugetlb is false. (default: 0)
375 # @seal: if true, create a sealed-file, which will block further resizing of
376 # the memory (default: true)
380 { 'struct': 'MemoryBackendMemfdProperties',
381 'base': 'MemoryBackendProperties',
382 'data': { '*hugetlb': 'bool',
383 '*hugetlbsize': 'size',
389 # Properties for objects of classes derived from rng.
391 # @opened: if true, the device is opened immediately when applying this option
392 # and will probably fail when processing the next option. Don't use;
393 # only provided for compatibility. (default: false)
396 # @deprecated: Member @opened is deprecated. Setting true doesn't make sense,
397 # and false is already the default.
401 { 'struct': 'RngProperties',
402 'data': { '*opened': { 'type': 'bool', 'features': ['deprecated'] } } }
407 # Properties for rng-egd objects.
409 # @chardev: the name of a character device backend that provides the connection
414 { 'struct': 'RngEgdProperties',
415 'base': 'RngProperties',
416 'data': { 'chardev': 'str' } }
419 # @RngRandomProperties:
421 # Properties for rng-random objects.
423 # @filename: the filename of the device on the host to obtain entropy from
424 # (default: "/dev/urandom")
428 { 'struct': 'RngRandomProperties',
429 'base': 'RngProperties',
430 'data': { '*filename': 'str' } }
437 { 'enum': 'ObjectType',
444 'cryptodev-backend-builtin',
445 { 'name': 'cryptodev-vhost-user',
446 'if': 'defined(CONFIG_VIRTIO_CRYPTO) && defined(CONFIG_VHOST_CRYPTO)' },
449 'memory-backend-file',
450 { 'name': 'memory-backend-memfd',
451 'if': 'defined(CONFIG_LINUX)' },
452 'memory-backend-ram',
462 # Describes the options of a user creatable QOM object.
464 # @qom-type: the class name for the object to be created
466 # @id: the name of the new object
470 { 'union': 'ObjectOptions',
471 'base': { 'qom-type': 'ObjectType',
473 'discriminator': 'qom-type',
475 'authz-list': 'AuthZListProperties',
476 'authz-listfile': 'AuthZListFileProperties',
477 'authz-pam': 'AuthZPAMProperties',
478 'authz-simple': 'AuthZSimpleProperties',
479 'cryptodev-backend': 'CryptodevBackendProperties',
480 'cryptodev-backend-builtin': 'CryptodevBackendProperties',
481 'cryptodev-vhost-user': { 'type': 'CryptodevVhostUserProperties',
482 'if': 'defined(CONFIG_VIRTIO_CRYPTO) && defined(CONFIG_VHOST_CRYPTO)' },
483 'dbus-vmstate': 'DBusVMStateProperties',
484 'iothread': 'IothreadProperties',
485 'memory-backend-file': 'MemoryBackendFileProperties',
486 'memory-backend-memfd': { 'type': 'MemoryBackendMemfdProperties',
487 'if': 'defined(CONFIG_LINUX)' },
488 'memory-backend-ram': 'MemoryBackendProperties',
489 'rng-builtin': 'RngProperties',
490 'rng-egd': 'RngEgdProperties',
491 'rng-random': 'RngRandomProperties',
492 'throttle-group': 'ThrottleGroupProperties'
498 # Create a QOM object.
500 # @qom-type: the class name for the object to be created
502 # @id: the name of the new object
504 # Additional arguments depend on qom-type and are passed to the backend
507 # Returns: Nothing on success
508 # Error if @qom-type is not a valid class name
514 # -> { "execute": "object-add",
515 # "arguments": { "qom-type": "rng-random", "id": "rng1",
516 # "filename": "/dev/hwrng" } }
517 # <- { "return": {} }
520 { 'command': 'object-add',
521 'data': {'qom-type': 'str', 'id': 'str'},
522 'gen': false } # so we can get the additional arguments
527 # Remove a QOM object.
529 # @id: the name of the QOM object to remove
531 # Returns: Nothing on success
532 # Error if @id is not a valid id for a QOM object
538 # -> { "execute": "object-del", "arguments": { "id": "rng1" } }
539 # <- { "return": {} }
542 { 'command': 'object-del', 'data': {'id': 'str'} }