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