]> git.proxmox.com Git - mirror_qemu.git/blame - qapi/qom.json
qapi/qom: Add ObjectOptions for memory-backend-*
[mirror_qemu.git] / qapi / qom.json
CommitLineData
c577ff62 1# -*- Mode: Python -*-
f7160f32 2# vim: filetype=python
c577ff62
MA
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
8825587b 7{ 'include': 'authz.json' }
913d9063 8{ 'include': 'common.json' }
8825587b 9
c577ff62
MA
10##
11# = QEMU Object Model (QOM)
12##
13
14##
15# @ObjectPropertyInfo:
16#
17# @name: the name of the property
18#
19# @type: the type of the property. This will typically come in one of four
20# forms:
21#
22# 1) A primitive type such as 'u8', 'u16', 'bool', 'str', or 'double'.
23# These types are mapped to the appropriate JSON type.
24#
25# 2) A child type in the form 'child<subtype>' where subtype is a qdev
26# device type name. Child properties create the composition tree.
27#
28# 3) A link type in the form 'link<subtype>' where subtype is a qdev
29# device type name. Link properties form the device model graph.
30#
31# @description: if specified, the description of the property.
32#
1bb3d7d9
MAL
33# @default-value: the default value, if any (since 5.0)
34#
c577ff62
MA
35# Since: 1.2
36##
37{ 'struct': 'ObjectPropertyInfo',
1bb3d7d9
MAL
38 'data': { 'name': 'str',
39 'type': 'str',
40 '*description': 'str',
41 '*default-value': 'any' } }
c577ff62
MA
42
43##
44# @qom-list:
45#
46# This command will list any properties of a object given a path in the object
47# model.
48#
49# @path: the path within the object model. See @qom-get for a description of
50# this parameter.
51#
52# Returns: a list of @ObjectPropertyInfo that describe the properties of the
53# object.
54#
55# Since: 1.2
56#
57# Example:
58#
59# -> { "execute": "qom-list",
60# "arguments": { "path": "/chardevs" } }
61# <- { "return": [ { "name": "type", "type": "string" },
62# { "name": "parallel0", "type": "child<chardev-vc>" },
63# { "name": "serial0", "type": "child<chardev-vc>" },
64# { "name": "mon0", "type": "child<chardev-stdio>" } ] }
65#
66##
67{ 'command': 'qom-list',
68 'data': { 'path': 'str' },
69 'returns': [ 'ObjectPropertyInfo' ],
70 'allow-preconfig': true }
71
72##
73# @qom-get:
74#
75# This command will get a property from a object model path and return the
76# value.
77#
78# @path: The path within the object model. There are two forms of supported
79# paths--absolute and partial paths.
80#
81# Absolute paths are derived from the root object and can follow child<>
82# or link<> properties. Since they can follow link<> properties, they
83# can be arbitrarily long. Absolute paths look like absolute filenames
84# and are prefixed with a leading slash.
85#
86# Partial paths look like relative filenames. They do not begin
87# with a prefix. The matching rules for partial paths are subtle but
88# designed to make specifying objects easy. At each level of the
89# composition tree, the partial path is matched as an absolute path.
90# The first match is not returned. At least two matches are searched
91# for. A successful result is only returned if only one match is
92# found. If more than one match is found, a flag is return to
93# indicate that the match was ambiguous.
94#
95# @property: The property name to read
96#
97# Returns: The property value. The type depends on the property
98# type. child<> and link<> properties are returned as #str
99# pathnames. All integer property types (u8, u16, etc) are
100# returned as #int.
101#
102# Since: 1.2
103#
104# Example:
105#
106# 1. Use absolute path
107#
108# -> { "execute": "qom-get",
109# "arguments": { "path": "/machine/unattached/device[0]",
110# "property": "hotplugged" } }
111# <- { "return": false }
112#
113# 2. Use partial path
114#
115# -> { "execute": "qom-get",
116# "arguments": { "path": "unattached/sysbus",
117# "property": "type" } }
118# <- { "return": "System" }
119#
120##
121{ 'command': 'qom-get',
122 'data': { 'path': 'str', 'property': 'str' },
123 'returns': 'any',
124 'allow-preconfig': true }
125
126##
127# @qom-set:
128#
129# This command will set a property from a object model path.
130#
131# @path: see @qom-get for a description of this parameter
132#
133# @property: the property name to set
134#
135# @value: a value who's type is appropriate for the property type. See @qom-get
136# for a description of type mapping.
137#
138# Since: 1.2
139#
140# Example:
141#
142# -> { "execute": "qom-set",
143# "arguments": { "path": "/machine",
144# "property": "graphics",
145# "value": false } }
146# <- { "return": {} }
147#
148##
149{ 'command': 'qom-set',
150 'data': { 'path': 'str', 'property': 'str', 'value': 'any' },
151 'allow-preconfig': true }
152
153##
154# @ObjectTypeInfo:
155#
156# This structure describes a search result from @qom-list-types
157#
158# @name: the type name found in the search
159#
160# @abstract: the type is abstract and can't be directly instantiated.
161# Omitted if false. (since 2.10)
162#
163# @parent: Name of parent type, if any (since 2.10)
164#
165# Since: 1.1
166##
167{ 'struct': 'ObjectTypeInfo',
168 'data': { 'name': 'str', '*abstract': 'bool', '*parent': 'str' } }
169
170##
171# @qom-list-types:
172#
173# This command will return a list of types given search parameters
174#
175# @implements: if specified, only return types that implement this type name
176#
177# @abstract: if true, include abstract types in the results
178#
179# Returns: a list of @ObjectTypeInfo or an empty list if no results are found
180#
181# Since: 1.1
182##
183{ 'command': 'qom-list-types',
184 'data': { '*implements': 'str', '*abstract': 'bool' },
185 'returns': [ 'ObjectTypeInfo' ],
186 'allow-preconfig': true }
187
188##
189# @qom-list-properties:
190#
191# List properties associated with a QOM object.
192#
193# @typename: the type name of an object
194#
195# Note: objects can create properties at runtime, for example to describe
26ec4e53
PM
196# links between different devices and/or objects. These properties
197# are not included in the output of this command.
c577ff62
MA
198#
199# Returns: a list of ObjectPropertyInfo describing object properties
200#
201# Since: 2.12
202##
203{ 'command': 'qom-list-properties',
204 'data': { 'typename': 'str'},
205 'returns': [ 'ObjectPropertyInfo' ],
206 'allow-preconfig': true }
207
a68d909e
KW
208##
209# @CryptodevBackendProperties:
210#
211# Properties for cryptodev-backend and cryptodev-backend-builtin objects.
212#
213# @queues: the number of queues for the cryptodev backend. Ignored for
214# cryptodev-backend and must be 1 for cryptodev-backend-builtin.
215# (default: 1)
216#
217# Since: 2.8
218##
219{ 'struct': 'CryptodevBackendProperties',
220 'data': { '*queues': 'uint32' } }
221
222##
223# @CryptodevVhostUserProperties:
224#
225# Properties for cryptodev-vhost-user objects.
226#
227# @chardev: the name of a Unix domain socket character device that connects to
228# the vhost-user server
229#
230# Since: 2.12
231##
232{ 'struct': 'CryptodevVhostUserProperties',
233 'base': 'CryptodevBackendProperties',
234 'data': { 'chardev': 'str' } }
235
d7ef29c4
KW
236##
237# @DBusVMStateProperties:
238#
239# Properties for dbus-vmstate objects.
240#
241# @addr: the name of the DBus bus to connect to
242#
243# @id-list: a comma separated list of DBus IDs of helpers whose data should be
244# included in the VM state on migration
245#
246# Since: 5.0
247##
248{ 'struct': 'DBusVMStateProperties',
249 'data': { 'addr': 'str' ,
250 '*id-list': 'str' } }
251
2273b241
KW
252##
253# @IothreadProperties:
254#
255# Properties for iothread objects.
256#
257# @poll-max-ns: the maximum number of nanoseconds to busy wait for events.
258# 0 means polling is disabled (default: 32768 on POSIX hosts,
259# 0 otherwise)
260#
261# @poll-grow: the multiplier used to increase the polling time when the
262# algorithm detects it is missing events due to not polling long
263# enough. 0 selects a default behaviour (default: 0)
264#
265# @poll-shrink: the divisor used to decrease the polling time when the
266# algorithm detects it is spending too long polling without
267# encountering events. 0 selects a default behaviour (default: 0)
268#
269# Since: 2.0
270##
271{ 'struct': 'IothreadProperties',
272 'data': { '*poll-max-ns': 'int',
273 '*poll-grow': 'int',
274 '*poll-shrink': 'int' } }
275
913d9063
KW
276##
277# @MemoryBackendProperties:
278#
279# Properties for objects of classes derived from memory-backend.
280#
281# @merge: if true, mark the memory as mergeable (default depends on the machine
282# type)
283#
284# @dump: if true, include the memory in core dumps (default depends on the
285# machine type)
286#
287# @host-nodes: the list of NUMA host nodes to bind the memory to
288#
289# @policy: the NUMA policy (default: 'default')
290#
291# @prealloc: if true, preallocate memory (default: false)
292#
293# @prealloc-threads: number of CPU threads to use for prealloc (default: 1)
294#
295# @share: if false, the memory is private to QEMU; if true, it is shared
296# (default: false)
297#
298# @size: size of the memory region in bytes
299#
300# @x-use-canonical-path-for-ramblock-id: if true, the canoncial path is used
301# for ramblock-id. Disable this for 4.0
302# machine types or older to allow
303# migration with newer QEMU versions.
304# This option is considered stable
305# despite the x- prefix. (default:
306# false generally, but true for machine
307# types <= 4.0)
308#
309# Since: 2.1
310##
311{ 'struct': 'MemoryBackendProperties',
312 'data': { '*dump': 'bool',
313 '*host-nodes': ['uint16'],
314 '*merge': 'bool',
315 '*policy': 'HostMemPolicy',
316 '*prealloc': 'bool',
317 '*prealloc-threads': 'uint32',
318 '*share': 'bool',
319 'size': 'size',
320 '*x-use-canonical-path-for-ramblock-id': 'bool' } }
321
322##
323# @MemoryBackendFileProperties:
324#
325# Properties for memory-backend-file objects.
326#
327# @align: the base address alignment when QEMU mmap(2)s @mem-path. Some
328# backend stores specified by @mem-path require an alignment different
329# than the default one used by QEMU, e.g. the device DAX /dev/dax0.0
330# requires 2M alignment rather than 4K. In such cases, users can
331# specify the required alignment via this option.
332# 0 selects a default alignment (currently the page size). (default: 0)
333#
334# @discard-data: if true, the file contents can be destroyed when QEMU exits,
335# to avoid unnecessarily flushing data to the backing file. Note
336# that ``discard-data`` is only an optimization, and QEMU might
337# not discard file contents if it aborts unexpectedly or is
338# terminated using SIGKILL. (default: false)
339#
340# @mem-path: the path to either a shared memory or huge page filesystem mount
341#
342# @pmem: specifies whether the backing file specified by @mem-path is in
343# host persistent memory that can be accessed using the SNIA NVM
344# programming model (e.g. Intel NVDIMM).
345#
346# @readonly: if true, the backing file is opened read-only; if false, it is
347# opened read-write. (default: false)
348#
349# Since: 2.1
350##
351{ 'struct': 'MemoryBackendFileProperties',
352 'base': 'MemoryBackendProperties',
353 'data': { '*align': 'size',
354 '*discard-data': 'bool',
355 'mem-path': 'str',
356 '*pmem': { 'type': 'bool', 'if': 'defined(CONFIG_LIBPMEM)' },
357 '*readonly': 'bool' } }
358
359##
360# @MemoryBackendMemfdProperties:
361#
362# Properties for memory-backend-memfd objects.
363#
364# The @share boolean option is true by default with memfd.
365#
366# @hugetlb: if true, the file to be created resides in the hugetlbfs filesystem
367# (default: false)
368#
369# @hugetlbsize: the hugetlb page size on systems that support multiple hugetlb
370# page sizes (it must be a power of 2 value supported by the
371# system). 0 selects a default page size. This option is ignored
372# if @hugetlb is false. (default: 0)
373#
374# @seal: if true, create a sealed-file, which will block further resizing of
375# the memory (default: true)
376#
377# Since: 2.12
378##
379{ 'struct': 'MemoryBackendMemfdProperties',
380 'base': 'MemoryBackendProperties',
381 'data': { '*hugetlb': 'bool',
382 '*hugetlbsize': 'size',
383 '*seal': 'bool' } }
384
2273b241
KW
385##
386# @ObjectType:
387#
388# Since: 6.0
389##
390{ 'enum': 'ObjectType',
391 'data': [
8825587b
KW
392 'authz-list',
393 'authz-listfile',
394 'authz-pam',
395 'authz-simple',
a68d909e
KW
396 'cryptodev-backend',
397 'cryptodev-backend-builtin',
398 { 'name': 'cryptodev-vhost-user',
399 'if': 'defined(CONFIG_VIRTIO_CRYPTO) && defined(CONFIG_VHOST_CRYPTO)' },
d7ef29c4 400 'dbus-vmstate',
913d9063
KW
401 'iothread',
402 'memory-backend-file',
403 { 'name': 'memory-backend-memfd',
404 'if': 'defined(CONFIG_LINUX)' },
405 'memory-backend-ram'
2273b241
KW
406 ] }
407
408##
409# @ObjectOptions:
410#
411# Describes the options of a user creatable QOM object.
412#
413# @qom-type: the class name for the object to be created
414#
415# @id: the name of the new object
416#
417# Since: 6.0
418##
419{ 'union': 'ObjectOptions',
420 'base': { 'qom-type': 'ObjectType',
421 'id': 'str' },
422 'discriminator': 'qom-type',
423 'data': {
8825587b
KW
424 'authz-list': 'AuthZListProperties',
425 'authz-listfile': 'AuthZListFileProperties',
426 'authz-pam': 'AuthZPAMProperties',
427 'authz-simple': 'AuthZSimpleProperties',
a68d909e
KW
428 'cryptodev-backend': 'CryptodevBackendProperties',
429 'cryptodev-backend-builtin': 'CryptodevBackendProperties',
430 'cryptodev-vhost-user': { 'type': 'CryptodevVhostUserProperties',
431 'if': 'defined(CONFIG_VIRTIO_CRYPTO) && defined(CONFIG_VHOST_CRYPTO)' },
d7ef29c4 432 'dbus-vmstate': 'DBusVMStateProperties',
913d9063
KW
433 'iothread': 'IothreadProperties',
434 'memory-backend-file': 'MemoryBackendFileProperties',
435 'memory-backend-memfd': { 'type': 'MemoryBackendMemfdProperties',
436 'if': 'defined(CONFIG_LINUX)' },
437 'memory-backend-ram': 'MemoryBackendProperties'
2273b241
KW
438 } }
439
c577ff62
MA
440##
441# @object-add:
442#
443# Create a QOM object.
444#
445# @qom-type: the class name for the object to be created
446#
447# @id: the name of the new object
448#
5f07c4d6
KW
449# Additional arguments depend on qom-type and are passed to the backend
450# unchanged.
c577ff62
MA
451#
452# Returns: Nothing on success
453# Error if @qom-type is not a valid class name
454#
455# Since: 2.0
456#
457# Example:
458#
459# -> { "execute": "object-add",
460# "arguments": { "qom-type": "rng-random", "id": "rng1",
5f07c4d6 461# "filename": "/dev/hwrng" } }
c577ff62
MA
462# <- { "return": {} }
463#
464##
465{ 'command': 'object-add',
50243407 466 'data': {'qom-type': 'str', 'id': 'str'},
5f07c4d6 467 'gen': false } # so we can get the additional arguments
c577ff62
MA
468
469##
470# @object-del:
471#
472# Remove a QOM object.
473#
474# @id: the name of the QOM object to remove
475#
476# Returns: Nothing on success
477# Error if @id is not a valid id for a QOM object
478#
479# Since: 2.0
480#
481# Example:
482#
483# -> { "execute": "object-del", "arguments": { "id": "rng1" } }
484# <- { "return": {} }
485#
486##
487{ 'command': 'object-del', 'data': {'id': 'str'} }