xref: /openbmc/qemu/qapi/machine.json (revision aadfe320)
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##
8# = Machines
9##
10
11{ 'include': 'common.json' }
12
13##
14# @SysEmuTarget:
15#
16# The comprehensive enumeration of QEMU system emulation ("softmmu")
17# targets. Run "./configure --help" in the project root directory, and
18# look for the \*-softmmu targets near the "--target-list" option. The
19# individual target constants are not documented here, for the time
20# being.
21#
22# @rx: since 5.0
23# @avr: since 5.1
24#
25# Notes: The resulting QMP strings can be appended to the "qemu-system-"
26#        prefix to produce the corresponding QEMU executable name. This
27#        is true even for "qemu-system-x86_64".
28#
29# Since: 3.0
30##
31{ 'enum' : 'SysEmuTarget',
32  'data' : [ 'aarch64', 'alpha', 'arm', 'avr', 'cris', 'hppa', 'i386',
33             'm68k', 'microblaze', 'microblazeel', 'mips', 'mips64',
34             'mips64el', 'mipsel', 'nios2', 'or1k', 'ppc',
35             'ppc64', 'riscv32', 'riscv64', 'rx', 's390x', 'sh4',
36             'sh4eb', 'sparc', 'sparc64', 'tricore',
37             'x86_64', 'xtensa', 'xtensaeb' ] }
38
39##
40# @CpuS390State:
41#
42# An enumeration of cpu states that can be assumed by a virtual
43# S390 CPU
44#
45# Since: 2.12
46##
47{ 'enum': 'CpuS390State',
48  'prefix': 'S390_CPU_STATE',
49  'data': [ 'uninitialized', 'stopped', 'check-stop', 'operating', 'load' ] }
50
51##
52# @CpuInfoS390:
53#
54# Additional information about a virtual S390 CPU
55#
56# @cpu-state: the virtual CPU's state
57#
58# Since: 2.12
59##
60{ 'struct': 'CpuInfoS390', 'data': { 'cpu-state': 'CpuS390State' } }
61
62##
63# @CpuInfoFast:
64#
65# Information about a virtual CPU
66#
67# @cpu-index: index of the virtual CPU
68#
69# @qom-path: path to the CPU object in the QOM tree
70#
71# @thread-id: ID of the underlying host thread
72#
73# @props: properties describing to which node/socket/core/thread
74#         virtual CPU belongs to, provided if supported by board
75#
76# @target: the QEMU system emulation target, which determines which
77#          additional fields will be listed (since 3.0)
78#
79# Since: 2.12
80#
81##
82{ 'union'         : 'CpuInfoFast',
83  'base'          : { 'cpu-index'    : 'int',
84                      'qom-path'     : 'str',
85                      'thread-id'    : 'int',
86                      '*props'       : 'CpuInstanceProperties',
87                      'target'       : 'SysEmuTarget' },
88  'discriminator' : 'target',
89  'data'          : { 's390x'        : 'CpuInfoS390' } }
90
91##
92# @query-cpus-fast:
93#
94# Returns information about all virtual CPUs.
95#
96# Returns: list of @CpuInfoFast
97#
98# Since: 2.12
99#
100# Example:
101#
102# -> { "execute": "query-cpus-fast" }
103# <- { "return": [
104#         {
105#             "thread-id": 25627,
106#             "props": {
107#                 "core-id": 0,
108#                 "thread-id": 0,
109#                 "socket-id": 0
110#             },
111#             "qom-path": "/machine/unattached/device[0]",
112#             "target":"x86_64",
113#             "cpu-index": 0
114#         },
115#         {
116#             "thread-id": 25628,
117#             "props": {
118#                 "core-id": 0,
119#                 "thread-id": 0,
120#                 "socket-id": 1
121#             },
122#             "qom-path": "/machine/unattached/device[2]",
123#             "target":"x86_64",
124#             "cpu-index": 1
125#         }
126#     ]
127# }
128##
129{ 'command': 'query-cpus-fast', 'returns': [ 'CpuInfoFast' ] }
130
131##
132# @MachineInfo:
133#
134# Information describing a machine.
135#
136# @name: the name of the machine
137#
138# @alias: an alias for the machine name
139#
140# @is-default: whether the machine is default
141#
142# @cpu-max: maximum number of CPUs supported by the machine type
143#           (since 1.5)
144#
145# @hotpluggable-cpus: cpu hotplug via -device is supported (since 2.7)
146#
147# @numa-mem-supported: true if '-numa node,mem' option is supported by
148#                      the machine type and false otherwise (since 4.1)
149#
150# @deprecated: if true, the machine type is deprecated and may be removed
151#              in future versions of QEMU according to the QEMU deprecation
152#              policy (since 4.1)
153#
154# @default-cpu-type: default CPU model typename if none is requested via
155#                    the -cpu argument. (since 4.2)
156#
157# @default-ram-id: the default ID of initial RAM memory backend (since 5.2)
158#
159# Since: 1.2
160##
161{ 'struct': 'MachineInfo',
162  'data': { 'name': 'str', '*alias': 'str',
163            '*is-default': 'bool', 'cpu-max': 'int',
164            'hotpluggable-cpus': 'bool',  'numa-mem-supported': 'bool',
165            'deprecated': 'bool', '*default-cpu-type': 'str',
166            '*default-ram-id': 'str' } }
167
168##
169# @query-machines:
170#
171# Return a list of supported machines
172#
173# Returns: a list of MachineInfo
174#
175# Since: 1.2
176##
177{ 'command': 'query-machines', 'returns': ['MachineInfo'] }
178
179##
180# @CurrentMachineParams:
181#
182# Information describing the running machine parameters.
183#
184# @wakeup-suspend-support: true if the machine supports wake up from
185#                          suspend
186#
187# Since: 4.0
188##
189{ 'struct': 'CurrentMachineParams',
190  'data': { 'wakeup-suspend-support': 'bool'} }
191
192##
193# @query-current-machine:
194#
195# Return information on the current virtual machine.
196#
197# Returns: CurrentMachineParams
198#
199# Since: 4.0
200##
201{ 'command': 'query-current-machine', 'returns': 'CurrentMachineParams' }
202
203##
204# @TargetInfo:
205#
206# Information describing the QEMU target.
207#
208# @arch: the target architecture
209#
210# Since: 1.2
211##
212{ 'struct': 'TargetInfo',
213  'data': { 'arch': 'SysEmuTarget' } }
214
215##
216# @query-target:
217#
218# Return information about the target for this QEMU
219#
220# Returns: TargetInfo
221#
222# Since: 1.2
223##
224{ 'command': 'query-target', 'returns': 'TargetInfo' }
225
226##
227# @UuidInfo:
228#
229# Guest UUID information (Universally Unique Identifier).
230#
231# @UUID: the UUID of the guest
232#
233# Since: 0.14
234#
235# Notes: If no UUID was specified for the guest, a null UUID is returned.
236##
237{ 'struct': 'UuidInfo', 'data': {'UUID': 'str'} }
238
239##
240# @query-uuid:
241#
242# Query the guest UUID information.
243#
244# Returns: The @UuidInfo for the guest
245#
246# Since: 0.14
247#
248# Example:
249#
250# -> { "execute": "query-uuid" }
251# <- { "return": { "UUID": "550e8400-e29b-41d4-a716-446655440000" } }
252#
253##
254{ 'command': 'query-uuid', 'returns': 'UuidInfo', 'allow-preconfig': true }
255
256##
257# @GuidInfo:
258#
259# GUID information.
260#
261# @guid: the globally unique identifier
262#
263# Since: 2.9
264##
265{ 'struct': 'GuidInfo', 'data': {'guid': 'str'} }
266
267##
268# @query-vm-generation-id:
269#
270# Show Virtual Machine Generation ID
271#
272# Since: 2.9
273##
274{ 'command': 'query-vm-generation-id', 'returns': 'GuidInfo' }
275
276##
277# @system_reset:
278#
279# Performs a hard reset of a guest.
280#
281# Since: 0.14
282#
283# Example:
284#
285# -> { "execute": "system_reset" }
286# <- { "return": {} }
287#
288##
289{ 'command': 'system_reset' }
290
291##
292# @system_powerdown:
293#
294# Requests that a guest perform a powerdown operation.
295#
296# Since: 0.14
297#
298# Notes: A guest may or may not respond to this command.  This command
299#        returning does not indicate that a guest has accepted the request or
300#        that it has shut down.  Many guests will respond to this command by
301#        prompting the user in some way.
302# Example:
303#
304# -> { "execute": "system_powerdown" }
305# <- { "return": {} }
306#
307##
308{ 'command': 'system_powerdown' }
309
310##
311# @system_wakeup:
312#
313# Wake up guest from suspend. If the guest has wake-up from suspend
314# support enabled (wakeup-suspend-support flag from
315# query-current-machine), wake-up guest from suspend if the guest is
316# in SUSPENDED state. Return an error otherwise.
317#
318# Since:  1.1
319#
320# Returns:  nothing.
321#
322# Note: prior to 4.0, this command does nothing in case the guest
323#       isn't suspended.
324#
325# Example:
326#
327# -> { "execute": "system_wakeup" }
328# <- { "return": {} }
329#
330##
331{ 'command': 'system_wakeup' }
332
333##
334# @LostTickPolicy:
335#
336# Policy for handling lost ticks in timer devices.  Ticks end up getting
337# lost when, for example, the guest is paused.
338#
339# @discard: throw away the missed ticks and continue with future injection
340#           normally.  The guest OS will see the timer jump ahead by a
341#           potentially quite significant amount all at once, as if the
342#           intervening chunk of time had simply not existed; needless to
343#           say, such a sudden jump can easily confuse a guest OS which is
344#           not specifically prepared to deal with it.  Assuming the guest
345#           OS can deal correctly with the time jump, the time in the guest
346#           and in the host should now match.
347#
348# @delay: continue to deliver ticks at the normal rate.  The guest OS will
349#         not notice anything is amiss, as from its point of view time will
350#         have continued to flow normally.  The time in the guest should now
351#         be behind the time in the host by exactly the amount of time during
352#         which ticks have been missed.
353#
354# @slew: deliver ticks at a higher rate to catch up with the missed ticks.
355#        The guest OS will not notice anything is amiss, as from its point
356#        of view time will have continued to flow normally.  Once the timer
357#        has managed to catch up with all the missing ticks, the time in
358#        the guest and in the host should match.
359#
360# Since: 2.0
361##
362{ 'enum': 'LostTickPolicy',
363  'data': ['discard', 'delay', 'slew' ] }
364
365##
366# @inject-nmi:
367#
368# Injects a Non-Maskable Interrupt into the default CPU (x86/s390) or all CPUs (ppc64).
369# The command fails when the guest doesn't support injecting.
370#
371# Returns:  If successful, nothing
372#
373# Since:  0.14
374#
375# Note: prior to 2.1, this command was only supported for x86 and s390 VMs
376#
377# Example:
378#
379# -> { "execute": "inject-nmi" }
380# <- { "return": {} }
381#
382##
383{ 'command': 'inject-nmi' }
384
385##
386# @KvmInfo:
387#
388# Information about support for KVM acceleration
389#
390# @enabled: true if KVM acceleration is active
391#
392# @present: true if KVM acceleration is built into this executable
393#
394# Since: 0.14
395##
396{ 'struct': 'KvmInfo', 'data': {'enabled': 'bool', 'present': 'bool'} }
397
398##
399# @query-kvm:
400#
401# Returns information about KVM acceleration
402#
403# Returns: @KvmInfo
404#
405# Since: 0.14
406#
407# Example:
408#
409# -> { "execute": "query-kvm" }
410# <- { "return": { "enabled": true, "present": true } }
411#
412##
413{ 'command': 'query-kvm', 'returns': 'KvmInfo' }
414
415##
416# @NumaOptionsType:
417#
418# @node: NUMA nodes configuration
419#
420# @dist: NUMA distance configuration (since 2.10)
421#
422# @cpu: property based CPU(s) to node mapping (Since: 2.10)
423#
424# @hmat-lb: memory latency and bandwidth information (Since: 5.0)
425#
426# @hmat-cache: memory side cache information (Since: 5.0)
427#
428# Since: 2.1
429##
430{ 'enum': 'NumaOptionsType',
431  'data': [ 'node', 'dist', 'cpu', 'hmat-lb', 'hmat-cache' ] }
432
433##
434# @NumaOptions:
435#
436# A discriminated record of NUMA options. (for OptsVisitor)
437#
438# Since: 2.1
439##
440{ 'union': 'NumaOptions',
441  'base': { 'type': 'NumaOptionsType' },
442  'discriminator': 'type',
443  'data': {
444    'node': 'NumaNodeOptions',
445    'dist': 'NumaDistOptions',
446    'cpu': 'NumaCpuOptions',
447    'hmat-lb': 'NumaHmatLBOptions',
448    'hmat-cache': 'NumaHmatCacheOptions' }}
449
450##
451# @NumaNodeOptions:
452#
453# Create a guest NUMA node. (for OptsVisitor)
454#
455# @nodeid: NUMA node ID (increase by 1 from 0 if omitted)
456#
457# @cpus: VCPUs belonging to this node (assign VCPUS round-robin
458#         if omitted)
459#
460# @mem: memory size of this node; mutually exclusive with @memdev.
461#       Equally divide total memory among nodes if both @mem and @memdev are
462#       omitted.
463#
464# @memdev: memory backend object.  If specified for one node,
465#          it must be specified for all nodes.
466#
467# @initiator: defined in ACPI 6.3 Chapter 5.2.27.3 Table 5-145,
468#             points to the nodeid which has the memory controller
469#             responsible for this NUMA node. This field provides
470#             additional information as to the initiator node that
471#             is closest (as in directly attached) to this node, and
472#             therefore has the best performance (since 5.0)
473#
474# Since: 2.1
475##
476{ 'struct': 'NumaNodeOptions',
477  'data': {
478   '*nodeid': 'uint16',
479   '*cpus':   ['uint16'],
480   '*mem':    'size',
481   '*memdev': 'str',
482   '*initiator': 'uint16' }}
483
484##
485# @NumaDistOptions:
486#
487# Set the distance between 2 NUMA nodes.
488#
489# @src: source NUMA node.
490#
491# @dst: destination NUMA node.
492#
493# @val: NUMA distance from source node to destination node.
494#       When a node is unreachable from another node, set the distance
495#       between them to 255.
496#
497# Since: 2.10
498##
499{ 'struct': 'NumaDistOptions',
500  'data': {
501   'src': 'uint16',
502   'dst': 'uint16',
503   'val': 'uint8' }}
504
505##
506# @CXLFixedMemoryWindowOptions:
507#
508# Create a CXL Fixed Memory Window
509#
510# @size: Size of the Fixed Memory Window in bytes. Must be a multiple
511#        of 256MiB.
512# @interleave-granularity: Number of contiguous bytes for which
513#                          accesses will go to a given interleave target.
514#                          Accepted values [256, 512, 1k, 2k, 4k, 8k, 16k]
515# @targets: Target root bridge IDs from -device ...,id=<ID> for each root
516#           bridge.
517#
518# Since 7.1
519##
520{ 'struct': 'CXLFixedMemoryWindowOptions',
521  'data': {
522      'size': 'size',
523      '*interleave-granularity': 'size',
524      'targets': ['str'] }}
525
526##
527# @X86CPURegister32:
528#
529# A X86 32-bit register
530#
531# Since: 1.5
532##
533{ 'enum': 'X86CPURegister32',
534  'data': [ 'EAX', 'EBX', 'ECX', 'EDX', 'ESP', 'EBP', 'ESI', 'EDI' ] }
535
536##
537# @X86CPUFeatureWordInfo:
538#
539# Information about a X86 CPU feature word
540#
541# @cpuid-input-eax: Input EAX value for CPUID instruction for that feature word
542#
543# @cpuid-input-ecx: Input ECX value for CPUID instruction for that
544#                   feature word
545#
546# @cpuid-register: Output register containing the feature bits
547#
548# @features: value of output register, containing the feature bits
549#
550# Since: 1.5
551##
552{ 'struct': 'X86CPUFeatureWordInfo',
553  'data': { 'cpuid-input-eax': 'int',
554            '*cpuid-input-ecx': 'int',
555            'cpuid-register': 'X86CPURegister32',
556            'features': 'int' } }
557
558##
559# @DummyForceArrays:
560#
561# Not used by QMP; hack to let us use X86CPUFeatureWordInfoList internally
562#
563# Since: 2.5
564##
565{ 'struct': 'DummyForceArrays',
566  'data': { 'unused': ['X86CPUFeatureWordInfo'] } }
567
568##
569# @NumaCpuOptions:
570#
571# Option "-numa cpu" overrides default cpu to node mapping.
572# It accepts the same set of cpu properties as returned by
573# query-hotpluggable-cpus[].props, where node-id could be used to
574# override default node mapping.
575#
576# Since: 2.10
577##
578{ 'struct': 'NumaCpuOptions',
579   'base': 'CpuInstanceProperties',
580   'data' : {} }
581
582##
583# @HmatLBMemoryHierarchy:
584#
585# The memory hierarchy in the System Locality Latency and Bandwidth
586# Information Structure of HMAT (Heterogeneous Memory Attribute Table)
587#
588# For more information about @HmatLBMemoryHierarchy, see chapter
589# 5.2.27.4: Table 5-146: Field "Flags" of ACPI 6.3 spec.
590#
591# @memory: the structure represents the memory performance
592#
593# @first-level: first level of memory side cache
594#
595# @second-level: second level of memory side cache
596#
597# @third-level: third level of memory side cache
598#
599# Since: 5.0
600##
601{ 'enum': 'HmatLBMemoryHierarchy',
602  'data': [ 'memory', 'first-level', 'second-level', 'third-level' ] }
603
604##
605# @HmatLBDataType:
606#
607# Data type in the System Locality Latency and Bandwidth
608# Information Structure of HMAT (Heterogeneous Memory Attribute Table)
609#
610# For more information about @HmatLBDataType, see chapter
611# 5.2.27.4: Table 5-146:  Field "Data Type" of ACPI 6.3 spec.
612#
613# @access-latency: access latency (nanoseconds)
614#
615# @read-latency: read latency (nanoseconds)
616#
617# @write-latency: write latency (nanoseconds)
618#
619# @access-bandwidth: access bandwidth (Bytes per second)
620#
621# @read-bandwidth: read bandwidth (Bytes per second)
622#
623# @write-bandwidth: write bandwidth (Bytes per second)
624#
625# Since: 5.0
626##
627{ 'enum': 'HmatLBDataType',
628  'data': [ 'access-latency', 'read-latency', 'write-latency',
629            'access-bandwidth', 'read-bandwidth', 'write-bandwidth' ] }
630
631##
632# @NumaHmatLBOptions:
633#
634# Set the system locality latency and bandwidth information
635# between Initiator and Target proximity Domains.
636#
637# For more information about @NumaHmatLBOptions, see chapter
638# 5.2.27.4: Table 5-146 of ACPI 6.3 spec.
639#
640# @initiator: the Initiator Proximity Domain.
641#
642# @target: the Target Proximity Domain.
643#
644# @hierarchy: the Memory Hierarchy. Indicates the performance
645#             of memory or side cache.
646#
647# @data-type: presents the type of data, access/read/write
648#             latency or hit latency.
649#
650# @latency: the value of latency from @initiator to @target
651#           proximity domain, the latency unit is "ns(nanosecond)".
652#
653# @bandwidth: the value of bandwidth between @initiator and @target
654#             proximity domain, the bandwidth unit is
655#             "Bytes per second".
656#
657# Since: 5.0
658##
659{ 'struct': 'NumaHmatLBOptions',
660    'data': {
661    'initiator': 'uint16',
662    'target': 'uint16',
663    'hierarchy': 'HmatLBMemoryHierarchy',
664    'data-type': 'HmatLBDataType',
665    '*latency': 'uint64',
666    '*bandwidth': 'size' }}
667
668##
669# @HmatCacheAssociativity:
670#
671# Cache associativity in the Memory Side Cache Information Structure
672# of HMAT
673#
674# For more information of @HmatCacheAssociativity, see chapter
675# 5.2.27.5: Table 5-147 of ACPI 6.3 spec.
676#
677# @none: None (no memory side cache in this proximity domain,
678#              or cache associativity unknown)
679#
680# @direct: Direct Mapped
681#
682# @complex: Complex Cache Indexing (implementation specific)
683#
684# Since: 5.0
685##
686{ 'enum': 'HmatCacheAssociativity',
687  'data': [ 'none', 'direct', 'complex' ] }
688
689##
690# @HmatCacheWritePolicy:
691#
692# Cache write policy in the Memory Side Cache Information Structure
693# of HMAT
694#
695# For more information of @HmatCacheWritePolicy, see chapter
696# 5.2.27.5: Table 5-147: Field "Cache Attributes" of ACPI 6.3 spec.
697#
698# @none: None (no memory side cache in this proximity domain,
699#        or cache write policy unknown)
700#
701# @write-back: Write Back (WB)
702#
703# @write-through: Write Through (WT)
704#
705# Since: 5.0
706##
707{ 'enum': 'HmatCacheWritePolicy',
708  'data': [ 'none', 'write-back', 'write-through' ] }
709
710##
711# @NumaHmatCacheOptions:
712#
713# Set the memory side cache information for a given memory domain.
714#
715# For more information of @NumaHmatCacheOptions, see chapter
716# 5.2.27.5: Table 5-147: Field "Cache Attributes" of ACPI 6.3 spec.
717#
718# @node-id: the memory proximity domain to which the memory belongs.
719#
720# @size: the size of memory side cache in bytes.
721#
722# @level: the cache level described in this structure.
723#
724# @associativity: the cache associativity,
725#                 none/direct-mapped/complex(complex cache indexing).
726#
727# @policy: the write policy, none/write-back/write-through.
728#
729# @line: the cache Line size in bytes.
730#
731# Since: 5.0
732##
733{ 'struct': 'NumaHmatCacheOptions',
734  'data': {
735   'node-id': 'uint32',
736   'size': 'size',
737   'level': 'uint8',
738   'associativity': 'HmatCacheAssociativity',
739   'policy': 'HmatCacheWritePolicy',
740   'line': 'uint16' }}
741
742##
743# @memsave:
744#
745# Save a portion of guest memory to a file.
746#
747# @val: the virtual address of the guest to start from
748#
749# @size: the size of memory region to save
750#
751# @filename: the file to save the memory to as binary data
752#
753# @cpu-index: the index of the virtual CPU to use for translating the
754#             virtual address (defaults to CPU 0)
755#
756# Returns: Nothing on success
757#
758# Since: 0.14
759#
760# Notes: Errors were not reliably returned until 1.1
761#
762# Example:
763#
764# -> { "execute": "memsave",
765#      "arguments": { "val": 10,
766#                     "size": 100,
767#                     "filename": "/tmp/virtual-mem-dump" } }
768# <- { "return": {} }
769#
770##
771{ 'command': 'memsave',
772  'data': {'val': 'int', 'size': 'int', 'filename': 'str', '*cpu-index': 'int'} }
773
774##
775# @pmemsave:
776#
777# Save a portion of guest physical memory to a file.
778#
779# @val: the physical address of the guest to start from
780#
781# @size: the size of memory region to save
782#
783# @filename: the file to save the memory to as binary data
784#
785# Returns: Nothing on success
786#
787# Since: 0.14
788#
789# Notes: Errors were not reliably returned until 1.1
790#
791# Example:
792#
793# -> { "execute": "pmemsave",
794#      "arguments": { "val": 10,
795#                     "size": 100,
796#                     "filename": "/tmp/physical-mem-dump" } }
797# <- { "return": {} }
798#
799##
800{ 'command': 'pmemsave',
801  'data': {'val': 'int', 'size': 'int', 'filename': 'str'} }
802
803##
804# @Memdev:
805#
806# Information about memory backend
807#
808# @id: backend's ID if backend has 'id' property (since 2.9)
809#
810# @size: memory backend size
811#
812# @merge: whether memory merge support is enabled
813#
814# @dump: whether memory backend's memory is included in a core dump
815#
816# @prealloc: whether memory was preallocated
817#
818# @share: whether memory is private to QEMU or shared (since 6.1)
819#
820# @reserve: whether swap space (or huge pages) was reserved if applicable.
821#           This corresponds to the user configuration and not the actual
822#           behavior implemented in the OS to perform the reservation.
823#           For example, Linux will never reserve swap space for shared
824#           file mappings. (since 6.1)
825#
826# @host-nodes: host nodes for its memory policy
827#
828# @policy: memory policy of memory backend
829#
830# Since: 2.1
831##
832{ 'struct': 'Memdev',
833  'data': {
834    '*id':        'str',
835    'size':       'size',
836    'merge':      'bool',
837    'dump':       'bool',
838    'prealloc':   'bool',
839    'share':      'bool',
840    '*reserve':    'bool',
841    'host-nodes': ['uint16'],
842    'policy':     'HostMemPolicy' }}
843
844##
845# @query-memdev:
846#
847# Returns information for all memory backends.
848#
849# Returns: a list of @Memdev.
850#
851# Since: 2.1
852#
853# Example:
854#
855# -> { "execute": "query-memdev" }
856# <- { "return": [
857#        {
858#          "id": "mem1",
859#          "size": 536870912,
860#          "merge": false,
861#          "dump": true,
862#          "prealloc": false,
863#          "share": false,
864#          "host-nodes": [0, 1],
865#          "policy": "bind"
866#        },
867#        {
868#          "size": 536870912,
869#          "merge": false,
870#          "dump": true,
871#          "prealloc": true,
872#          "share": false,
873#          "host-nodes": [2, 3],
874#          "policy": "preferred"
875#        }
876#      ]
877#    }
878#
879##
880{ 'command': 'query-memdev', 'returns': ['Memdev'], 'allow-preconfig': true }
881
882##
883# @CpuInstanceProperties:
884#
885# List of properties to be used for hotplugging a CPU instance,
886# it should be passed by management with device_add command when
887# a CPU is being hotplugged.
888#
889# @node-id: NUMA node ID the CPU belongs to
890# @socket-id: socket number within node/board the CPU belongs to
891# @die-id: die number within socket the CPU belongs to (since 4.1)
892# @cluster-id: cluster number within die the CPU belongs to (since 7.1)
893# @core-id: core number within cluster the CPU belongs to
894# @thread-id: thread number within core the CPU belongs to
895#
896# Note: currently there are 6 properties that could be present
897#       but management should be prepared to pass through other
898#       properties with device_add command to allow for future
899#       interface extension. This also requires the filed names to be kept in
900#       sync with the properties passed to -device/device_add.
901#
902# Since: 2.7
903##
904{ 'struct': 'CpuInstanceProperties',
905  'data': { '*node-id': 'int',
906            '*socket-id': 'int',
907            '*die-id': 'int',
908            '*cluster-id': 'int',
909            '*core-id': 'int',
910            '*thread-id': 'int'
911  }
912}
913
914##
915# @HotpluggableCPU:
916#
917# @type: CPU object type for usage with device_add command
918# @props: list of properties to be used for hotplugging CPU
919# @vcpus-count: number of logical VCPU threads @HotpluggableCPU provides
920# @qom-path: link to existing CPU object if CPU is present or
921#            omitted if CPU is not present.
922#
923# Since: 2.7
924##
925{ 'struct': 'HotpluggableCPU',
926  'data': { 'type': 'str',
927            'vcpus-count': 'int',
928            'props': 'CpuInstanceProperties',
929            '*qom-path': 'str'
930          }
931}
932
933##
934# @query-hotpluggable-cpus:
935#
936# TODO: Better documentation; currently there is none.
937#
938# Returns: a list of HotpluggableCPU objects.
939#
940# Since: 2.7
941#
942# Example:
943#
944# For pseries machine type started with -smp 2,cores=2,maxcpus=4 -cpu POWER8:
945#
946# -> { "execute": "query-hotpluggable-cpus" }
947# <- {"return": [
948#      { "props": { "core": 8 }, "type": "POWER8-spapr-cpu-core",
949#        "vcpus-count": 1 },
950#      { "props": { "core": 0 }, "type": "POWER8-spapr-cpu-core",
951#        "vcpus-count": 1, "qom-path": "/machine/unattached/device[0]"}
952#    ]}'
953#
954# For pc machine type started with -smp 1,maxcpus=2:
955#
956# -> { "execute": "query-hotpluggable-cpus" }
957# <- {"return": [
958#      {
959#         "type": "qemu64-x86_64-cpu", "vcpus-count": 1,
960#         "props": {"core-id": 0, "socket-id": 1, "thread-id": 0}
961#      },
962#      {
963#         "qom-path": "/machine/unattached/device[0]",
964#         "type": "qemu64-x86_64-cpu", "vcpus-count": 1,
965#         "props": {"core-id": 0, "socket-id": 0, "thread-id": 0}
966#      }
967#    ]}
968#
969# For s390x-virtio-ccw machine type started with -smp 1,maxcpus=2 -cpu qemu
970# (Since: 2.11):
971#
972# -> { "execute": "query-hotpluggable-cpus" }
973# <- {"return": [
974#      {
975#         "type": "qemu-s390x-cpu", "vcpus-count": 1,
976#         "props": { "core-id": 1 }
977#      },
978#      {
979#         "qom-path": "/machine/unattached/device[0]",
980#         "type": "qemu-s390x-cpu", "vcpus-count": 1,
981#         "props": { "core-id": 0 }
982#      }
983#    ]}
984#
985##
986{ 'command': 'query-hotpluggable-cpus', 'returns': ['HotpluggableCPU'],
987             'allow-preconfig': true }
988
989##
990# @set-numa-node:
991#
992# Runtime equivalent of '-numa' CLI option, available at
993# preconfigure stage to configure numa mapping before initializing
994# machine.
995#
996# Since 3.0
997##
998{ 'command': 'set-numa-node', 'boxed': true,
999  'data': 'NumaOptions',
1000  'allow-preconfig': true
1001}
1002
1003##
1004# @balloon:
1005#
1006# Request the balloon driver to change its balloon size.
1007#
1008# @value: the target logical size of the VM in bytes.
1009#         We can deduce the size of the balloon using this formula:
1010#
1011#            logical_vm_size = vm_ram_size - balloon_size
1012#
1013#         From it we have: balloon_size = vm_ram_size - @value
1014#
1015# Returns: - Nothing on success
1016#          - If the balloon driver is enabled but not functional because the KVM
1017#            kernel module cannot support it, KvmMissingCap
1018#          - If no balloon device is present, DeviceNotActive
1019#
1020# Notes: This command just issues a request to the guest.  When it returns,
1021#        the balloon size may not have changed.  A guest can change the balloon
1022#        size independent of this command.
1023#
1024# Since: 0.14
1025#
1026# Example:
1027#
1028# -> { "execute": "balloon", "arguments": { "value": 536870912 } }
1029# <- { "return": {} }
1030#
1031# With a 2.5GiB guest this command inflated the ballon to 3GiB.
1032#
1033##
1034{ 'command': 'balloon', 'data': {'value': 'int'} }
1035
1036##
1037# @BalloonInfo:
1038#
1039# Information about the guest balloon device.
1040#
1041# @actual: the logical size of the VM in bytes
1042#          Formula used: logical_vm_size = vm_ram_size - balloon_size
1043#
1044# Since: 0.14
1045#
1046##
1047{ 'struct': 'BalloonInfo', 'data': {'actual': 'int' } }
1048
1049##
1050# @query-balloon:
1051#
1052# Return information about the balloon device.
1053#
1054# Returns: - @BalloonInfo on success
1055#          - If the balloon driver is enabled but not functional because the KVM
1056#            kernel module cannot support it, KvmMissingCap
1057#          - If no balloon device is present, DeviceNotActive
1058#
1059# Since: 0.14
1060#
1061# Example:
1062#
1063# -> { "execute": "query-balloon" }
1064# <- { "return": {
1065#          "actual": 1073741824,
1066#       }
1067#    }
1068#
1069##
1070{ 'command': 'query-balloon', 'returns': 'BalloonInfo' }
1071
1072##
1073# @BALLOON_CHANGE:
1074#
1075# Emitted when the guest changes the actual BALLOON level. This value is
1076# equivalent to the @actual field return by the 'query-balloon' command
1077#
1078# @actual: the logical size of the VM in bytes
1079#          Formula used: logical_vm_size = vm_ram_size - balloon_size
1080#
1081# Note: this event is rate-limited.
1082#
1083# Since: 1.2
1084#
1085# Example:
1086#
1087# <- { "event": "BALLOON_CHANGE",
1088#      "data": { "actual": 944766976 },
1089#      "timestamp": { "seconds": 1267020223, "microseconds": 435656 } }
1090#
1091##
1092{ 'event': 'BALLOON_CHANGE',
1093  'data': { 'actual': 'int' } }
1094
1095##
1096# @MemoryInfo:
1097#
1098# Actual memory information in bytes.
1099#
1100# @base-memory: size of "base" memory specified with command line
1101#               option -m.
1102#
1103# @plugged-memory: size of memory that can be hot-unplugged. This field
1104#                  is omitted if target doesn't support memory hotplug
1105#                  (i.e. CONFIG_MEM_DEVICE not defined at build time).
1106#
1107# Since: 2.11
1108##
1109{ 'struct': 'MemoryInfo',
1110  'data'  : { 'base-memory': 'size', '*plugged-memory': 'size' } }
1111
1112##
1113# @query-memory-size-summary:
1114#
1115# Return the amount of initially allocated and present hotpluggable (if
1116# enabled) memory in bytes.
1117#
1118# Example:
1119#
1120# -> { "execute": "query-memory-size-summary" }
1121# <- { "return": { "base-memory": 4294967296, "plugged-memory": 0 } }
1122#
1123# Since: 2.11
1124##
1125{ 'command': 'query-memory-size-summary', 'returns': 'MemoryInfo' }
1126
1127##
1128# @PCDIMMDeviceInfo:
1129#
1130# PCDIMMDevice state information
1131#
1132# @id: device's ID
1133#
1134# @addr: physical address, where device is mapped
1135#
1136# @size: size of memory that the device provides
1137#
1138# @slot: slot number at which device is plugged in
1139#
1140# @node: NUMA node number where device is plugged in
1141#
1142# @memdev: memory backend linked with device
1143#
1144# @hotplugged: true if device was hotplugged
1145#
1146# @hotpluggable: true if device if could be added/removed while machine is running
1147#
1148# Since: 2.1
1149##
1150{ 'struct': 'PCDIMMDeviceInfo',
1151  'data': { '*id': 'str',
1152            'addr': 'int',
1153            'size': 'int',
1154            'slot': 'int',
1155            'node': 'int',
1156            'memdev': 'str',
1157            'hotplugged': 'bool',
1158            'hotpluggable': 'bool'
1159          }
1160}
1161
1162##
1163# @VirtioPMEMDeviceInfo:
1164#
1165# VirtioPMEM state information
1166#
1167# @id: device's ID
1168#
1169# @memaddr: physical address in memory, where device is mapped
1170#
1171# @size: size of memory that the device provides
1172#
1173# @memdev: memory backend linked with device
1174#
1175# Since: 4.1
1176##
1177{ 'struct': 'VirtioPMEMDeviceInfo',
1178  'data': { '*id': 'str',
1179            'memaddr': 'size',
1180            'size': 'size',
1181            'memdev': 'str'
1182          }
1183}
1184
1185##
1186# @VirtioMEMDeviceInfo:
1187#
1188# VirtioMEMDevice state information
1189#
1190# @id: device's ID
1191#
1192# @memaddr: physical address in memory, where device is mapped
1193#
1194# @requested-size: the user requested size of the device
1195#
1196# @size: the (current) size of memory that the device provides
1197#
1198# @max-size: the maximum size of memory that the device can provide
1199#
1200# @block-size: the block size of memory that the device provides
1201#
1202# @node: NUMA node number where device is assigned to
1203#
1204# @memdev: memory backend linked with the region
1205#
1206# Since: 5.1
1207##
1208{ 'struct': 'VirtioMEMDeviceInfo',
1209  'data': { '*id': 'str',
1210            'memaddr': 'size',
1211            'requested-size': 'size',
1212            'size': 'size',
1213            'max-size': 'size',
1214            'block-size': 'size',
1215            'node': 'int',
1216            'memdev': 'str'
1217          }
1218}
1219
1220##
1221# @SgxEPCDeviceInfo:
1222#
1223# Sgx EPC state information
1224#
1225# @id: device's ID
1226#
1227# @memaddr: physical address in memory, where device is mapped
1228#
1229# @size: size of memory that the device provides
1230#
1231# @memdev: memory backend linked with device
1232#
1233# @node: the numa node (Since: 7.0)
1234#
1235# Since: 6.2
1236##
1237{ 'struct': 'SgxEPCDeviceInfo',
1238  'data': { '*id': 'str',
1239            'memaddr': 'size',
1240            'size': 'size',
1241            'node': 'int',
1242            'memdev': 'str'
1243          }
1244}
1245
1246##
1247# @MemoryDeviceInfoKind:
1248#
1249# Since: 2.1
1250##
1251{ 'enum': 'MemoryDeviceInfoKind',
1252  'data': [ 'dimm', 'nvdimm', 'virtio-pmem', 'virtio-mem', 'sgx-epc' ] }
1253
1254##
1255# @PCDIMMDeviceInfoWrapper:
1256#
1257# Since: 2.1
1258##
1259{ 'struct': 'PCDIMMDeviceInfoWrapper',
1260  'data': { 'data': 'PCDIMMDeviceInfo' } }
1261
1262##
1263# @VirtioPMEMDeviceInfoWrapper:
1264#
1265# Since: 2.1
1266##
1267{ 'struct': 'VirtioPMEMDeviceInfoWrapper',
1268  'data': { 'data': 'VirtioPMEMDeviceInfo' } }
1269
1270##
1271# @VirtioMEMDeviceInfoWrapper:
1272#
1273# Since: 2.1
1274##
1275{ 'struct': 'VirtioMEMDeviceInfoWrapper',
1276  'data': { 'data': 'VirtioMEMDeviceInfo' } }
1277
1278##
1279# @SgxEPCDeviceInfoWrapper:
1280#
1281# Since: 6.2
1282##
1283{ 'struct': 'SgxEPCDeviceInfoWrapper',
1284  'data': { 'data': 'SgxEPCDeviceInfo' } }
1285
1286##
1287# @MemoryDeviceInfo:
1288#
1289# Union containing information about a memory device
1290#
1291# nvdimm is included since 2.12. virtio-pmem is included since 4.1.
1292# virtio-mem is included since 5.1. sgx-epc is included since 6.2.
1293#
1294# Since: 2.1
1295##
1296{ 'union': 'MemoryDeviceInfo',
1297  'base': { 'type': 'MemoryDeviceInfoKind' },
1298  'discriminator': 'type',
1299  'data': { 'dimm': 'PCDIMMDeviceInfoWrapper',
1300            'nvdimm': 'PCDIMMDeviceInfoWrapper',
1301            'virtio-pmem': 'VirtioPMEMDeviceInfoWrapper',
1302            'virtio-mem': 'VirtioMEMDeviceInfoWrapper',
1303            'sgx-epc': 'SgxEPCDeviceInfoWrapper'
1304          }
1305}
1306
1307##
1308# @SgxEPC:
1309#
1310# Sgx EPC cmdline information
1311#
1312# @memdev: memory backend linked with device
1313#
1314# @node: the numa node (Since: 7.0)
1315#
1316# Since: 6.2
1317##
1318{ 'struct': 'SgxEPC',
1319  'data': { 'memdev': 'str',
1320            'node': 'int'
1321          }
1322}
1323
1324##
1325# @SgxEPCProperties:
1326#
1327# SGX properties of machine types.
1328#
1329# @sgx-epc: list of ids of memory-backend-epc objects.
1330#
1331# Since: 6.2
1332##
1333{ 'struct': 'SgxEPCProperties',
1334  'data': { 'sgx-epc': ['SgxEPC'] }
1335}
1336
1337##
1338# @query-memory-devices:
1339#
1340# Lists available memory devices and their state
1341#
1342# Since: 2.1
1343#
1344# Example:
1345#
1346# -> { "execute": "query-memory-devices" }
1347# <- { "return": [ { "data":
1348#                       { "addr": 5368709120,
1349#                         "hotpluggable": true,
1350#                         "hotplugged": true,
1351#                         "id": "d1",
1352#                         "memdev": "/objects/memX",
1353#                         "node": 0,
1354#                         "size": 1073741824,
1355#                         "slot": 0},
1356#                    "type": "dimm"
1357#                  } ] }
1358#
1359##
1360{ 'command': 'query-memory-devices', 'returns': ['MemoryDeviceInfo'] }
1361
1362##
1363# @MEMORY_DEVICE_SIZE_CHANGE:
1364#
1365# Emitted when the size of a memory device changes. Only emitted for memory
1366# devices that can actually change the size (e.g., virtio-mem due to guest
1367# action).
1368#
1369# @id: device's ID
1370#
1371# @size: the new size of memory that the device provides
1372#
1373# @qom-path: path to the device object in the QOM tree (since 6.2)
1374#
1375# Note: this event is rate-limited.
1376#
1377# Since: 5.1
1378#
1379# Example:
1380#
1381# <- { "event": "MEMORY_DEVICE_SIZE_CHANGE",
1382#      "data": { "id": "vm0", "size": 1073741824,
1383#                "qom-path": "/machine/unattached/device[2]" },
1384#      "timestamp": { "seconds": 1588168529, "microseconds": 201316 } }
1385#
1386##
1387{ 'event': 'MEMORY_DEVICE_SIZE_CHANGE',
1388  'data': { '*id': 'str', 'size': 'size', 'qom-path' : 'str'} }
1389
1390
1391##
1392# @MEM_UNPLUG_ERROR:
1393#
1394# Emitted when memory hot unplug error occurs.
1395#
1396# @device: device name
1397#
1398# @msg: Informative message
1399#
1400# Features:
1401# @deprecated: This event is deprecated. Use @DEVICE_UNPLUG_GUEST_ERROR
1402#              instead.
1403#
1404# Since: 2.4
1405#
1406# Example:
1407#
1408# <- { "event": "MEM_UNPLUG_ERROR"
1409#      "data": { "device": "dimm1",
1410#                "msg": "acpi: device unplug for unsupported device"
1411#      },
1412#      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
1413#
1414##
1415{ 'event': 'MEM_UNPLUG_ERROR',
1416  'data': { 'device': 'str', 'msg': 'str' },
1417  'features': ['deprecated'] }
1418
1419##
1420# @BootConfiguration:
1421#
1422# Schema for virtual machine boot configuration.
1423#
1424# @order: Boot order (a=floppy, c=hard disk, d=CD-ROM, n=network)
1425#
1426# @once: Boot order to apply on first boot
1427#
1428# @menu: Whether to show a boot menu
1429#
1430# @splash: The name of the file to be passed to the firmware as logo picture, if @menu is true.
1431#
1432# @splash-time: How long to show the logo picture, in milliseconds
1433#
1434# @reboot-timeout: Timeout before guest reboots after boot fails
1435#
1436# @strict: Whether to attempt booting from devices not included in the boot order
1437#
1438# Since: 7.1
1439##
1440{ 'struct': 'BootConfiguration', 'data': {
1441     '*order': 'str',
1442     '*once': 'str',
1443     '*menu': 'bool',
1444     '*splash': 'str',
1445     '*splash-time': 'int',
1446     '*reboot-timeout': 'int',
1447     '*strict': 'bool' } }
1448
1449##
1450# @SMPConfiguration:
1451#
1452# Schema for CPU topology configuration.  A missing value lets
1453# QEMU figure out a suitable value based on the ones that are provided.
1454#
1455# @cpus: number of virtual CPUs in the virtual machine
1456#
1457# @sockets: number of sockets in the CPU topology
1458#
1459# @dies: number of dies per socket in the CPU topology
1460#
1461# @clusters: number of clusters per die in the CPU topology (since 7.0)
1462#
1463# @cores: number of cores per cluster in the CPU topology
1464#
1465# @threads: number of threads per core in the CPU topology
1466#
1467# @maxcpus: maximum number of hotpluggable virtual CPUs in the virtual machine
1468#
1469# Since: 6.1
1470##
1471{ 'struct': 'SMPConfiguration', 'data': {
1472     '*cpus': 'int',
1473     '*sockets': 'int',
1474     '*dies': 'int',
1475     '*clusters': 'int',
1476     '*cores': 'int',
1477     '*threads': 'int',
1478     '*maxcpus': 'int' } }
1479
1480##
1481# @x-query-irq:
1482#
1483# Query interrupt statistics
1484#
1485# Features:
1486# @unstable: This command is meant for debugging.
1487#
1488# Returns: interrupt statistics
1489#
1490# Since: 6.2
1491##
1492{ 'command': 'x-query-irq',
1493  'returns': 'HumanReadableText',
1494  'features': [ 'unstable' ] }
1495
1496##
1497# @x-query-jit:
1498#
1499# Query TCG compiler statistics
1500#
1501# Features:
1502# @unstable: This command is meant for debugging.
1503#
1504# Returns: TCG compiler statistics
1505#
1506# Since: 6.2
1507##
1508{ 'command': 'x-query-jit',
1509  'returns': 'HumanReadableText',
1510  'if': 'CONFIG_TCG',
1511  'features': [ 'unstable' ] }
1512
1513##
1514# @x-query-numa:
1515#
1516# Query NUMA topology information
1517#
1518# Features:
1519# @unstable: This command is meant for debugging.
1520#
1521# Returns: topology information
1522#
1523# Since: 6.2
1524##
1525{ 'command': 'x-query-numa',
1526  'returns': 'HumanReadableText',
1527  'features': [ 'unstable' ] }
1528
1529##
1530# @x-query-opcount:
1531#
1532# Query TCG opcode counters
1533#
1534# Features:
1535# @unstable: This command is meant for debugging.
1536#
1537# Returns: TCG opcode counters
1538#
1539# Since: 6.2
1540##
1541{ 'command': 'x-query-opcount',
1542  'returns': 'HumanReadableText',
1543  'if': 'CONFIG_TCG',
1544  'features': [ 'unstable' ] }
1545
1546##
1547# @x-query-profile:
1548#
1549# Query TCG profiling information
1550#
1551# Features:
1552# @unstable: This command is meant for debugging.
1553#
1554# Returns: profile information
1555#
1556# Since: 6.2
1557##
1558{ 'command': 'x-query-profile',
1559  'returns': 'HumanReadableText',
1560  'if': 'CONFIG_TCG',
1561  'features': [ 'unstable' ] }
1562
1563##
1564# @x-query-ramblock:
1565#
1566# Query system ramblock information
1567#
1568# Features:
1569# @unstable: This command is meant for debugging.
1570#
1571# Returns: system ramblock information
1572#
1573# Since: 6.2
1574##
1575{ 'command': 'x-query-ramblock',
1576  'returns': 'HumanReadableText',
1577  'features': [ 'unstable' ] }
1578
1579##
1580# @x-query-rdma:
1581#
1582# Query RDMA state
1583#
1584# Features:
1585# @unstable: This command is meant for debugging.
1586#
1587# Returns: RDMA state
1588#
1589# Since: 6.2
1590##
1591{ 'command': 'x-query-rdma',
1592  'returns': 'HumanReadableText',
1593  'features': [ 'unstable' ] }
1594
1595##
1596# @x-query-roms:
1597#
1598# Query information on the registered ROMS
1599#
1600# Features:
1601# @unstable: This command is meant for debugging.
1602#
1603# Returns: registered ROMs
1604#
1605# Since: 6.2
1606##
1607{ 'command': 'x-query-roms',
1608  'returns': 'HumanReadableText',
1609  'features': [ 'unstable' ] }
1610
1611##
1612# @x-query-usb:
1613#
1614# Query information on the USB devices
1615#
1616# Features:
1617# @unstable: This command is meant for debugging.
1618#
1619# Returns: USB device information
1620#
1621# Since: 6.2
1622##
1623{ 'command': 'x-query-usb',
1624  'returns': 'HumanReadableText',
1625  'features': [ 'unstable' ] }
1626
1627##
1628# @SmbiosEntryPointType:
1629#
1630# @32: SMBIOS version 2.1 (32-bit) Entry Point
1631#
1632# @64: SMBIOS version 3.0 (64-bit) Entry Point
1633#
1634# Since: 7.0
1635##
1636{ 'enum': 'SmbiosEntryPointType',
1637  'data': [ '32', '64' ] }
1638
1639##
1640# @MemorySizeConfiguration:
1641#
1642# Schema for memory size configuration.
1643#
1644# @size: memory size in bytes
1645#
1646# @max-size: maximum hotpluggable memory size in bytes
1647#
1648# @slots: number of available memory slots for hotplug
1649#
1650# Since: 7.1
1651##
1652{ 'struct': 'MemorySizeConfiguration', 'data': {
1653     '*size': 'size',
1654     '*max-size': 'size',
1655     '*slots': 'uint64' } }
1656