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', 'lm32',
33             'm68k', 'microblaze', 'microblazeel', 'mips', 'mips64',
34             'mips64el', 'mipsel', 'moxie', 'nios2', 'or1k', 'ppc',
35             'ppc64', 'riscv32', 'riscv64', 'rx', 's390x', 'sh4',
36             'sh4eb', 'sparc', 'sparc64', 'tricore', 'unicore32',
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#             "arch":"x86",
113#             "target":"x86_64",
114#             "cpu-index": 0
115#         },
116#         {
117#             "thread-id": 25628,
118#             "props": {
119#                 "core-id": 0,
120#                 "thread-id": 0,
121#                 "socket-id": 1
122#             },
123#             "qom-path": "/machine/unattached/device[2]",
124#             "arch":"x86",
125#             "target":"x86_64",
126#             "cpu-index": 1
127#         }
128#     ]
129# }
130##
131{ 'command': 'query-cpus-fast', 'returns': [ 'CpuInfoFast' ] }
132
133##
134# @MachineInfo:
135#
136# Information describing a machine.
137#
138# @name: the name of the machine
139#
140# @alias: an alias for the machine name
141#
142# @is-default: whether the machine is default
143#
144# @cpu-max: maximum number of CPUs supported by the machine type
145#           (since 1.5)
146#
147# @hotpluggable-cpus: cpu hotplug via -device is supported (since 2.7)
148#
149# @numa-mem-supported: true if '-numa node,mem' option is supported by
150#                      the machine type and false otherwise (since 4.1)
151#
152# @deprecated: if true, the machine type is deprecated and may be removed
153#              in future versions of QEMU according to the QEMU deprecation
154#              policy (since 4.1)
155#
156# @default-cpu-type: default CPU model typename if none is requested via
157#                    the -cpu argument. (since 4.2)
158#
159# @default-ram-id: the default ID of initial RAM memory backend (since 5.2)
160#
161# Since: 1.2
162##
163{ 'struct': 'MachineInfo',
164  'data': { 'name': 'str', '*alias': 'str',
165            '*is-default': 'bool', 'cpu-max': 'int',
166            'hotpluggable-cpus': 'bool',  'numa-mem-supported': 'bool',
167            'deprecated': 'bool', '*default-cpu-type': 'str',
168            '*default-ram-id': 'str' } }
169
170##
171# @query-machines:
172#
173# Return a list of supported machines
174#
175# Returns: a list of MachineInfo
176#
177# Since: 1.2
178##
179{ 'command': 'query-machines', 'returns': ['MachineInfo'] }
180
181##
182# @CurrentMachineParams:
183#
184# Information describing the running machine parameters.
185#
186# @wakeup-suspend-support: true if the machine supports wake up from
187#                          suspend
188#
189# Since: 4.0
190##
191{ 'struct': 'CurrentMachineParams',
192  'data': { 'wakeup-suspend-support': 'bool'} }
193
194##
195# @query-current-machine:
196#
197# Return information on the current virtual machine.
198#
199# Returns: CurrentMachineParams
200#
201# Since: 4.0
202##
203{ 'command': 'query-current-machine', 'returns': 'CurrentMachineParams' }
204
205##
206# @TargetInfo:
207#
208# Information describing the QEMU target.
209#
210# @arch: the target architecture
211#
212# Since: 1.2
213##
214{ 'struct': 'TargetInfo',
215  'data': { 'arch': 'SysEmuTarget' } }
216
217##
218# @query-target:
219#
220# Return information about the target for this QEMU
221#
222# Returns: TargetInfo
223#
224# Since: 1.2
225##
226{ 'command': 'query-target', 'returns': 'TargetInfo' }
227
228##
229# @UuidInfo:
230#
231# Guest UUID information (Universally Unique Identifier).
232#
233# @UUID: the UUID of the guest
234#
235# Since: 0.14
236#
237# Notes: If no UUID was specified for the guest, a null UUID is returned.
238##
239{ 'struct': 'UuidInfo', 'data': {'UUID': 'str'} }
240
241##
242# @query-uuid:
243#
244# Query the guest UUID information.
245#
246# Returns: The @UuidInfo for the guest
247#
248# Since: 0.14
249#
250# Example:
251#
252# -> { "execute": "query-uuid" }
253# <- { "return": { "UUID": "550e8400-e29b-41d4-a716-446655440000" } }
254#
255##
256{ 'command': 'query-uuid', 'returns': 'UuidInfo', 'allow-preconfig': true }
257
258##
259# @GuidInfo:
260#
261# GUID information.
262#
263# @guid: the globally unique identifier
264#
265# Since: 2.9
266##
267{ 'struct': 'GuidInfo', 'data': {'guid': 'str'} }
268
269##
270# @query-vm-generation-id:
271#
272# Show Virtual Machine Generation ID
273#
274# Since: 2.9
275##
276{ 'command': 'query-vm-generation-id', 'returns': 'GuidInfo' }
277
278##
279# @system_reset:
280#
281# Performs a hard reset of a guest.
282#
283# Since: 0.14
284#
285# Example:
286#
287# -> { "execute": "system_reset" }
288# <- { "return": {} }
289#
290##
291{ 'command': 'system_reset' }
292
293##
294# @system_powerdown:
295#
296# Requests that a guest perform a powerdown operation.
297#
298# Since: 0.14
299#
300# Notes: A guest may or may not respond to this command.  This command
301#        returning does not indicate that a guest has accepted the request or
302#        that it has shut down.  Many guests will respond to this command by
303#        prompting the user in some way.
304# Example:
305#
306# -> { "execute": "system_powerdown" }
307# <- { "return": {} }
308#
309##
310{ 'command': 'system_powerdown' }
311
312##
313# @system_wakeup:
314#
315# Wake up guest from suspend. If the guest has wake-up from suspend
316# support enabled (wakeup-suspend-support flag from
317# query-current-machine), wake-up guest from suspend if the guest is
318# in SUSPENDED state. Return an error otherwise.
319#
320# Since:  1.1
321#
322# Returns:  nothing.
323#
324# Note: prior to 4.0, this command does nothing in case the guest
325#       isn't suspended.
326#
327# Example:
328#
329# -> { "execute": "system_wakeup" }
330# <- { "return": {} }
331#
332##
333{ 'command': 'system_wakeup' }
334
335##
336# @LostTickPolicy:
337#
338# Policy for handling lost ticks in timer devices.  Ticks end up getting
339# lost when, for example, the guest is paused.
340#
341# @discard: throw away the missed ticks and continue with future injection
342#           normally.  The guest OS will see the timer jump ahead by a
343#           potentially quite significant amount all at once, as if the
344#           intervening chunk of time had simply not existed; needless to
345#           say, such a sudden jump can easily confuse a guest OS which is
346#           not specifically prepared to deal with it.  Assuming the guest
347#           OS can deal correctly with the time jump, the time in the guest
348#           and in the host should now match.
349#
350# @delay: continue to deliver ticks at the normal rate.  The guest OS will
351#         not notice anything is amiss, as from its point of view time will
352#         have continued to flow normally.  The time in the guest should now
353#         be behind the time in the host by exactly the amount of time during
354#         which ticks have been missed.
355#
356# @slew: deliver ticks at a higher rate to catch up with the missed ticks.
357#        The guest OS will not notice anything is amiss, as from its point
358#        of view time will have continued to flow normally.  Once the timer
359#        has managed to catch up with all the missing ticks, the time in
360#        the guest and in the host should match.
361#
362# Since: 2.0
363##
364{ 'enum': 'LostTickPolicy',
365  'data': ['discard', 'delay', 'slew' ] }
366
367##
368# @inject-nmi:
369#
370# Injects a Non-Maskable Interrupt into the default CPU (x86/s390) or all CPUs (ppc64).
371# The command fails when the guest doesn't support injecting.
372#
373# Returns:  If successful, nothing
374#
375# Since:  0.14
376#
377# Note: prior to 2.1, this command was only supported for x86 and s390 VMs
378#
379# Example:
380#
381# -> { "execute": "inject-nmi" }
382# <- { "return": {} }
383#
384##
385{ 'command': 'inject-nmi' }
386
387##
388# @KvmInfo:
389#
390# Information about support for KVM acceleration
391#
392# @enabled: true if KVM acceleration is active
393#
394# @present: true if KVM acceleration is built into this executable
395#
396# Since: 0.14
397##
398{ 'struct': 'KvmInfo', 'data': {'enabled': 'bool', 'present': 'bool'} }
399
400##
401# @query-kvm:
402#
403# Returns information about KVM acceleration
404#
405# Returns: @KvmInfo
406#
407# Since: 0.14
408#
409# Example:
410#
411# -> { "execute": "query-kvm" }
412# <- { "return": { "enabled": true, "present": true } }
413#
414##
415{ 'command': 'query-kvm', 'returns': 'KvmInfo' }
416
417##
418# @NvmmInfo:
419#
420# Information about support for NVMM acceleration
421#
422# @enabled: true if NVMM acceleration is active
423#
424# @present: true if NVMM acceleration is built into this executable
425#
426# Since: 6.x
427##
428{ 'struct': 'NvmmInfo', 'data': {'enabled': 'bool', 'present': 'bool'} }
429
430##
431# @query-nvmm:
432#
433# Returns information about NVMM acceleration
434#
435# Returns: @NvmmInfo
436#
437# Since: 6.x
438#
439# Example:
440#
441# -> { "execute": "query-nvmm" }
442# <- { "return": { "enabled": true, "present": true } }
443#
444##
445{ 'command': 'query-nvmm', 'returns': 'NvmmInfo' }
446
447##
448# @NumaOptionsType:
449#
450# @node: NUMA nodes configuration
451#
452# @dist: NUMA distance configuration (since 2.10)
453#
454# @cpu: property based CPU(s) to node mapping (Since: 2.10)
455#
456# @hmat-lb: memory latency and bandwidth information (Since: 5.0)
457#
458# @hmat-cache: memory side cache information (Since: 5.0)
459#
460# Since: 2.1
461##
462{ 'enum': 'NumaOptionsType',
463  'data': [ 'node', 'dist', 'cpu', 'hmat-lb', 'hmat-cache' ] }
464
465##
466# @NumaOptions:
467#
468# A discriminated record of NUMA options. (for OptsVisitor)
469#
470# Since: 2.1
471##
472{ 'union': 'NumaOptions',
473  'base': { 'type': 'NumaOptionsType' },
474  'discriminator': 'type',
475  'data': {
476    'node': 'NumaNodeOptions',
477    'dist': 'NumaDistOptions',
478    'cpu': 'NumaCpuOptions',
479    'hmat-lb': 'NumaHmatLBOptions',
480    'hmat-cache': 'NumaHmatCacheOptions' }}
481
482##
483# @NumaNodeOptions:
484#
485# Create a guest NUMA node. (for OptsVisitor)
486#
487# @nodeid: NUMA node ID (increase by 1 from 0 if omitted)
488#
489# @cpus: VCPUs belonging to this node (assign VCPUS round-robin
490#         if omitted)
491#
492# @mem: memory size of this node; mutually exclusive with @memdev.
493#       Equally divide total memory among nodes if both @mem and @memdev are
494#       omitted.
495#
496# @memdev: memory backend object.  If specified for one node,
497#          it must be specified for all nodes.
498#
499# @initiator: defined in ACPI 6.3 Chapter 5.2.27.3 Table 5-145,
500#             points to the nodeid which has the memory controller
501#             responsible for this NUMA node. This field provides
502#             additional information as to the initiator node that
503#             is closest (as in directly attached) to this node, and
504#             therefore has the best performance (since 5.0)
505#
506# Since: 2.1
507##
508{ 'struct': 'NumaNodeOptions',
509  'data': {
510   '*nodeid': 'uint16',
511   '*cpus':   ['uint16'],
512   '*mem':    'size',
513   '*memdev': 'str',
514   '*initiator': 'uint16' }}
515
516##
517# @NumaDistOptions:
518#
519# Set the distance between 2 NUMA nodes.
520#
521# @src: source NUMA node.
522#
523# @dst: destination NUMA node.
524#
525# @val: NUMA distance from source node to destination node.
526#       When a node is unreachable from another node, set the distance
527#       between them to 255.
528#
529# Since: 2.10
530##
531{ 'struct': 'NumaDistOptions',
532  'data': {
533   'src': 'uint16',
534   'dst': 'uint16',
535   'val': 'uint8' }}
536
537##
538# @X86CPURegister32:
539#
540# A X86 32-bit register
541#
542# Since: 1.5
543##
544{ 'enum': 'X86CPURegister32',
545  'data': [ 'EAX', 'EBX', 'ECX', 'EDX', 'ESP', 'EBP', 'ESI', 'EDI' ] }
546
547##
548# @X86CPUFeatureWordInfo:
549#
550# Information about a X86 CPU feature word
551#
552# @cpuid-input-eax: Input EAX value for CPUID instruction for that feature word
553#
554# @cpuid-input-ecx: Input ECX value for CPUID instruction for that
555#                   feature word
556#
557# @cpuid-register: Output register containing the feature bits
558#
559# @features: value of output register, containing the feature bits
560#
561# Since: 1.5
562##
563{ 'struct': 'X86CPUFeatureWordInfo',
564  'data': { 'cpuid-input-eax': 'int',
565            '*cpuid-input-ecx': 'int',
566            'cpuid-register': 'X86CPURegister32',
567            'features': 'int' } }
568
569##
570# @DummyForceArrays:
571#
572# Not used by QMP; hack to let us use X86CPUFeatureWordInfoList internally
573#
574# Since: 2.5
575##
576{ 'struct': 'DummyForceArrays',
577  'data': { 'unused': ['X86CPUFeatureWordInfo'] } }
578
579##
580# @NumaCpuOptions:
581#
582# Option "-numa cpu" overrides default cpu to node mapping.
583# It accepts the same set of cpu properties as returned by
584# query-hotpluggable-cpus[].props, where node-id could be used to
585# override default node mapping.
586#
587# Since: 2.10
588##
589{ 'struct': 'NumaCpuOptions',
590   'base': 'CpuInstanceProperties',
591   'data' : {} }
592
593##
594# @HmatLBMemoryHierarchy:
595#
596# The memory hierarchy in the System Locality Latency and Bandwidth
597# Information Structure of HMAT (Heterogeneous Memory Attribute Table)
598#
599# For more information about @HmatLBMemoryHierarchy, see chapter
600# 5.2.27.4: Table 5-146: Field "Flags" of ACPI 6.3 spec.
601#
602# @memory: the structure represents the memory performance
603#
604# @first-level: first level of memory side cache
605#
606# @second-level: second level of memory side cache
607#
608# @third-level: third level of memory side cache
609#
610# Since: 5.0
611##
612{ 'enum': 'HmatLBMemoryHierarchy',
613  'data': [ 'memory', 'first-level', 'second-level', 'third-level' ] }
614
615##
616# @HmatLBDataType:
617#
618# Data type in the System Locality Latency and Bandwidth
619# Information Structure of HMAT (Heterogeneous Memory Attribute Table)
620#
621# For more information about @HmatLBDataType, see chapter
622# 5.2.27.4: Table 5-146:  Field "Data Type" of ACPI 6.3 spec.
623#
624# @access-latency: access latency (nanoseconds)
625#
626# @read-latency: read latency (nanoseconds)
627#
628# @write-latency: write latency (nanoseconds)
629#
630# @access-bandwidth: access bandwidth (Bytes per second)
631#
632# @read-bandwidth: read bandwidth (Bytes per second)
633#
634# @write-bandwidth: write bandwidth (Bytes per second)
635#
636# Since: 5.0
637##
638{ 'enum': 'HmatLBDataType',
639  'data': [ 'access-latency', 'read-latency', 'write-latency',
640            'access-bandwidth', 'read-bandwidth', 'write-bandwidth' ] }
641
642##
643# @NumaHmatLBOptions:
644#
645# Set the system locality latency and bandwidth information
646# between Initiator and Target proximity Domains.
647#
648# For more information about @NumaHmatLBOptions, see chapter
649# 5.2.27.4: Table 5-146 of ACPI 6.3 spec.
650#
651# @initiator: the Initiator Proximity Domain.
652#
653# @target: the Target Proximity Domain.
654#
655# @hierarchy: the Memory Hierarchy. Indicates the performance
656#             of memory or side cache.
657#
658# @data-type: presents the type of data, access/read/write
659#             latency or hit latency.
660#
661# @latency: the value of latency from @initiator to @target
662#           proximity domain, the latency unit is "ns(nanosecond)".
663#
664# @bandwidth: the value of bandwidth between @initiator and @target
665#             proximity domain, the bandwidth unit is
666#             "Bytes per second".
667#
668# Since: 5.0
669##
670{ 'struct': 'NumaHmatLBOptions',
671    'data': {
672    'initiator': 'uint16',
673    'target': 'uint16',
674    'hierarchy': 'HmatLBMemoryHierarchy',
675    'data-type': 'HmatLBDataType',
676    '*latency': 'uint64',
677    '*bandwidth': 'size' }}
678
679##
680# @HmatCacheAssociativity:
681#
682# Cache associativity in the Memory Side Cache Information Structure
683# of HMAT
684#
685# For more information of @HmatCacheAssociativity, see chapter
686# 5.2.27.5: Table 5-147 of ACPI 6.3 spec.
687#
688# @none: None (no memory side cache in this proximity domain,
689#              or cache associativity unknown)
690#
691# @direct: Direct Mapped
692#
693# @complex: Complex Cache Indexing (implementation specific)
694#
695# Since: 5.0
696##
697{ 'enum': 'HmatCacheAssociativity',
698  'data': [ 'none', 'direct', 'complex' ] }
699
700##
701# @HmatCacheWritePolicy:
702#
703# Cache write policy in the Memory Side Cache Information Structure
704# of HMAT
705#
706# For more information of @HmatCacheWritePolicy, see chapter
707# 5.2.27.5: Table 5-147: Field "Cache Attributes" of ACPI 6.3 spec.
708#
709# @none: None (no memory side cache in this proximity domain,
710#        or cache write policy unknown)
711#
712# @write-back: Write Back (WB)
713#
714# @write-through: Write Through (WT)
715#
716# Since: 5.0
717##
718{ 'enum': 'HmatCacheWritePolicy',
719  'data': [ 'none', 'write-back', 'write-through' ] }
720
721##
722# @NumaHmatCacheOptions:
723#
724# Set the memory side cache information for a given memory domain.
725#
726# For more information of @NumaHmatCacheOptions, see chapter
727# 5.2.27.5: Table 5-147: Field "Cache Attributes" of ACPI 6.3 spec.
728#
729# @node-id: the memory proximity domain to which the memory belongs.
730#
731# @size: the size of memory side cache in bytes.
732#
733# @level: the cache level described in this structure.
734#
735# @associativity: the cache associativity,
736#                 none/direct-mapped/complex(complex cache indexing).
737#
738# @policy: the write policy, none/write-back/write-through.
739#
740# @line: the cache Line size in bytes.
741#
742# Since: 5.0
743##
744{ 'struct': 'NumaHmatCacheOptions',
745  'data': {
746   'node-id': 'uint32',
747   'size': 'size',
748   'level': 'uint8',
749   'associativity': 'HmatCacheAssociativity',
750   'policy': 'HmatCacheWritePolicy',
751   'line': 'uint16' }}
752
753##
754# @memsave:
755#
756# Save a portion of guest memory to a file.
757#
758# @val: the virtual 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# @cpu-index: the index of the virtual CPU to use for translating the
765#             virtual address (defaults to CPU 0)
766#
767# Returns: Nothing on success
768#
769# Since: 0.14
770#
771# Notes: Errors were not reliably returned until 1.1
772#
773# Example:
774#
775# -> { "execute": "memsave",
776#      "arguments": { "val": 10,
777#                     "size": 100,
778#                     "filename": "/tmp/virtual-mem-dump" } }
779# <- { "return": {} }
780#
781##
782{ 'command': 'memsave',
783  'data': {'val': 'int', 'size': 'int', 'filename': 'str', '*cpu-index': 'int'} }
784
785##
786# @pmemsave:
787#
788# Save a portion of guest physical memory to a file.
789#
790# @val: the physical address of the guest to start from
791#
792# @size: the size of memory region to save
793#
794# @filename: the file to save the memory to as binary data
795#
796# Returns: Nothing on success
797#
798# Since: 0.14
799#
800# Notes: Errors were not reliably returned until 1.1
801#
802# Example:
803#
804# -> { "execute": "pmemsave",
805#      "arguments": { "val": 10,
806#                     "size": 100,
807#                     "filename": "/tmp/physical-mem-dump" } }
808# <- { "return": {} }
809#
810##
811{ 'command': 'pmemsave',
812  'data': {'val': 'int', 'size': 'int', 'filename': 'str'} }
813
814##
815# @Memdev:
816#
817# Information about memory backend
818#
819# @id: backend's ID if backend has 'id' property (since 2.9)
820#
821# @size: memory backend size
822#
823# @merge: enables or disables memory merge support
824#
825# @dump: includes memory backend's memory in a core dump or not
826#
827# @prealloc: enables or disables memory preallocation
828#
829# @host-nodes: host nodes for its memory policy
830#
831# @policy: memory policy of memory backend
832#
833# Since: 2.1
834##
835{ 'struct': 'Memdev',
836  'data': {
837    '*id':        'str',
838    'size':       'size',
839    'merge':      'bool',
840    'dump':       'bool',
841    'prealloc':   'bool',
842    'host-nodes': ['uint16'],
843    'policy':     'HostMemPolicy' }}
844
845##
846# @query-memdev:
847#
848# Returns information for all memory backends.
849#
850# Returns: a list of @Memdev.
851#
852# Since: 2.1
853#
854# Example:
855#
856# -> { "execute": "query-memdev" }
857# <- { "return": [
858#        {
859#          "id": "mem1",
860#          "size": 536870912,
861#          "merge": false,
862#          "dump": true,
863#          "prealloc": false,
864#          "host-nodes": [0, 1],
865#          "policy": "bind"
866#        },
867#        {
868#          "size": 536870912,
869#          "merge": false,
870#          "dump": true,
871#          "prealloc": true,
872#          "host-nodes": [2, 3],
873#          "policy": "preferred"
874#        }
875#      ]
876#    }
877#
878##
879{ 'command': 'query-memdev', 'returns': ['Memdev'], 'allow-preconfig': true }
880
881##
882# @CpuInstanceProperties:
883#
884# List of properties to be used for hotplugging a CPU instance,
885# it should be passed by management with device_add command when
886# a CPU is being hotplugged.
887#
888# @node-id: NUMA node ID the CPU belongs to
889# @socket-id: socket number within node/board the CPU belongs to
890# @die-id: die number within node/board the CPU belongs to (Since 4.1)
891# @core-id: core number within die the CPU belongs to
892# @thread-id: thread number within core the CPU belongs to
893#
894# Note: currently there are 5 properties that could be present
895#       but management should be prepared to pass through other
896#       properties with device_add command to allow for future
897#       interface extension. This also requires the filed names to be kept in
898#       sync with the properties passed to -device/device_add.
899#
900# Since: 2.7
901##
902{ 'struct': 'CpuInstanceProperties',
903  'data': { '*node-id': 'int',
904            '*socket-id': 'int',
905            '*die-id': 'int',
906            '*core-id': 'int',
907            '*thread-id': 'int'
908  }
909}
910
911##
912# @HotpluggableCPU:
913#
914# @type: CPU object type for usage with device_add command
915# @props: list of properties to be used for hotplugging CPU
916# @vcpus-count: number of logical VCPU threads @HotpluggableCPU provides
917# @qom-path: link to existing CPU object if CPU is present or
918#            omitted if CPU is not present.
919#
920# Since: 2.7
921##
922{ 'struct': 'HotpluggableCPU',
923  'data': { 'type': 'str',
924            'vcpus-count': 'int',
925            'props': 'CpuInstanceProperties',
926            '*qom-path': 'str'
927          }
928}
929
930##
931# @query-hotpluggable-cpus:
932#
933# TODO: Better documentation; currently there is none.
934#
935# Returns: a list of HotpluggableCPU objects.
936#
937# Since: 2.7
938#
939# Example:
940#
941# For pseries machine type started with -smp 2,cores=2,maxcpus=4 -cpu POWER8:
942#
943# -> { "execute": "query-hotpluggable-cpus" }
944# <- {"return": [
945#      { "props": { "core": 8 }, "type": "POWER8-spapr-cpu-core",
946#        "vcpus-count": 1 },
947#      { "props": { "core": 0 }, "type": "POWER8-spapr-cpu-core",
948#        "vcpus-count": 1, "qom-path": "/machine/unattached/device[0]"}
949#    ]}'
950#
951# For pc machine type started with -smp 1,maxcpus=2:
952#
953# -> { "execute": "query-hotpluggable-cpus" }
954# <- {"return": [
955#      {
956#         "type": "qemu64-x86_64-cpu", "vcpus-count": 1,
957#         "props": {"core-id": 0, "socket-id": 1, "thread-id": 0}
958#      },
959#      {
960#         "qom-path": "/machine/unattached/device[0]",
961#         "type": "qemu64-x86_64-cpu", "vcpus-count": 1,
962#         "props": {"core-id": 0, "socket-id": 0, "thread-id": 0}
963#      }
964#    ]}
965#
966# For s390x-virtio-ccw machine type started with -smp 1,maxcpus=2 -cpu qemu
967# (Since: 2.11):
968#
969# -> { "execute": "query-hotpluggable-cpus" }
970# <- {"return": [
971#      {
972#         "type": "qemu-s390x-cpu", "vcpus-count": 1,
973#         "props": { "core-id": 1 }
974#      },
975#      {
976#         "qom-path": "/machine/unattached/device[0]",
977#         "type": "qemu-s390x-cpu", "vcpus-count": 1,
978#         "props": { "core-id": 0 }
979#      }
980#    ]}
981#
982##
983{ 'command': 'query-hotpluggable-cpus', 'returns': ['HotpluggableCPU'],
984             'allow-preconfig': true }
985
986##
987# @set-numa-node:
988#
989# Runtime equivalent of '-numa' CLI option, available at
990# preconfigure stage to configure numa mapping before initializing
991# machine.
992#
993# Since 3.0
994##
995{ 'command': 'set-numa-node', 'boxed': true,
996  'data': 'NumaOptions',
997  'allow-preconfig': true
998}
999
1000##
1001# @balloon:
1002#
1003# Request the balloon driver to change its balloon size.
1004#
1005# @value: the target logical size of the VM in bytes.
1006#         We can deduce the size of the balloon using this formula:
1007#
1008#            logical_vm_size = vm_ram_size - balloon_size
1009#
1010#         From it we have: balloon_size = vm_ram_size - @value
1011#
1012# Returns: - Nothing on success
1013#          - If the balloon driver is enabled but not functional because the KVM
1014#            kernel module cannot support it, KvmMissingCap
1015#          - If no balloon device is present, DeviceNotActive
1016#
1017# Notes: This command just issues a request to the guest.  When it returns,
1018#        the balloon size may not have changed.  A guest can change the balloon
1019#        size independent of this command.
1020#
1021# Since: 0.14
1022#
1023# Example:
1024#
1025# -> { "execute": "balloon", "arguments": { "value": 536870912 } }
1026# <- { "return": {} }
1027#
1028# With a 2.5GiB guest this command inflated the ballon to 3GiB.
1029#
1030##
1031{ 'command': 'balloon', 'data': {'value': 'int'} }
1032
1033##
1034# @BalloonInfo:
1035#
1036# Information about the guest balloon device.
1037#
1038# @actual: the logical size of the VM in bytes
1039#          Formula used: logical_vm_size = vm_ram_size - balloon_size
1040#
1041# Since: 0.14
1042#
1043##
1044{ 'struct': 'BalloonInfo', 'data': {'actual': 'int' } }
1045
1046##
1047# @query-balloon:
1048#
1049# Return information about the balloon device.
1050#
1051# Returns: - @BalloonInfo on success
1052#          - If the balloon driver is enabled but not functional because the KVM
1053#            kernel module cannot support it, KvmMissingCap
1054#          - If no balloon device is present, DeviceNotActive
1055#
1056# Since: 0.14
1057#
1058# Example:
1059#
1060# -> { "execute": "query-balloon" }
1061# <- { "return": {
1062#          "actual": 1073741824,
1063#       }
1064#    }
1065#
1066##
1067{ 'command': 'query-balloon', 'returns': 'BalloonInfo' }
1068
1069##
1070# @BALLOON_CHANGE:
1071#
1072# Emitted when the guest changes the actual BALLOON level. This value is
1073# equivalent to the @actual field return by the 'query-balloon' command
1074#
1075# @actual: the logical size of the VM in bytes
1076#          Formula used: logical_vm_size = vm_ram_size - balloon_size
1077#
1078# Note: this event is rate-limited.
1079#
1080# Since: 1.2
1081#
1082# Example:
1083#
1084# <- { "event": "BALLOON_CHANGE",
1085#      "data": { "actual": 944766976 },
1086#      "timestamp": { "seconds": 1267020223, "microseconds": 435656 } }
1087#
1088##
1089{ 'event': 'BALLOON_CHANGE',
1090  'data': { 'actual': 'int' } }
1091
1092##
1093# @MemoryInfo:
1094#
1095# Actual memory information in bytes.
1096#
1097# @base-memory: size of "base" memory specified with command line
1098#               option -m.
1099#
1100# @plugged-memory: size of memory that can be hot-unplugged. This field
1101#                  is omitted if target doesn't support memory hotplug
1102#                  (i.e. CONFIG_MEM_DEVICE not defined at build time).
1103#
1104# Since: 2.11
1105##
1106{ 'struct': 'MemoryInfo',
1107  'data'  : { 'base-memory': 'size', '*plugged-memory': 'size' } }
1108
1109##
1110# @query-memory-size-summary:
1111#
1112# Return the amount of initially allocated and present hotpluggable (if
1113# enabled) memory in bytes.
1114#
1115# Example:
1116#
1117# -> { "execute": "query-memory-size-summary" }
1118# <- { "return": { "base-memory": 4294967296, "plugged-memory": 0 } }
1119#
1120# Since: 2.11
1121##
1122{ 'command': 'query-memory-size-summary', 'returns': 'MemoryInfo' }
1123
1124##
1125# @PCDIMMDeviceInfo:
1126#
1127# PCDIMMDevice state information
1128#
1129# @id: device's ID
1130#
1131# @addr: physical address, where device is mapped
1132#
1133# @size: size of memory that the device provides
1134#
1135# @slot: slot number at which device is plugged in
1136#
1137# @node: NUMA node number where device is plugged in
1138#
1139# @memdev: memory backend linked with device
1140#
1141# @hotplugged: true if device was hotplugged
1142#
1143# @hotpluggable: true if device if could be added/removed while machine is running
1144#
1145# Since: 2.1
1146##
1147{ 'struct': 'PCDIMMDeviceInfo',
1148  'data': { '*id': 'str',
1149            'addr': 'int',
1150            'size': 'int',
1151            'slot': 'int',
1152            'node': 'int',
1153            'memdev': 'str',
1154            'hotplugged': 'bool',
1155            'hotpluggable': 'bool'
1156          }
1157}
1158
1159##
1160# @VirtioPMEMDeviceInfo:
1161#
1162# VirtioPMEM state information
1163#
1164# @id: device's ID
1165#
1166# @memaddr: physical address in memory, where device is mapped
1167#
1168# @size: size of memory that the device provides
1169#
1170# @memdev: memory backend linked with device
1171#
1172# Since: 4.1
1173##
1174{ 'struct': 'VirtioPMEMDeviceInfo',
1175  'data': { '*id': 'str',
1176            'memaddr': 'size',
1177            'size': 'size',
1178            'memdev': 'str'
1179          }
1180}
1181
1182##
1183# @VirtioMEMDeviceInfo:
1184#
1185# VirtioMEMDevice state information
1186#
1187# @id: device's ID
1188#
1189# @memaddr: physical address in memory, where device is mapped
1190#
1191# @requested-size: the user requested size of the device
1192#
1193# @size: the (current) size of memory that the device provides
1194#
1195# @max-size: the maximum size of memory that the device can provide
1196#
1197# @block-size: the block size of memory that the device provides
1198#
1199# @node: NUMA node number where device is assigned to
1200#
1201# @memdev: memory backend linked with the region
1202#
1203# Since: 5.1
1204##
1205{ 'struct': 'VirtioMEMDeviceInfo',
1206  'data': { '*id': 'str',
1207            'memaddr': 'size',
1208            'requested-size': 'size',
1209            'size': 'size',
1210            'max-size': 'size',
1211            'block-size': 'size',
1212            'node': 'int',
1213            'memdev': 'str'
1214          }
1215}
1216
1217##
1218# @MemoryDeviceInfo:
1219#
1220# Union containing information about a memory device
1221#
1222# nvdimm is included since 2.12. virtio-pmem is included since 4.1.
1223# virtio-mem is included since 5.1.
1224#
1225# Since: 2.1
1226##
1227{ 'union': 'MemoryDeviceInfo',
1228  'data': { 'dimm': 'PCDIMMDeviceInfo',
1229            'nvdimm': 'PCDIMMDeviceInfo',
1230            'virtio-pmem': 'VirtioPMEMDeviceInfo',
1231            'virtio-mem': 'VirtioMEMDeviceInfo'
1232          }
1233}
1234
1235##
1236# @query-memory-devices:
1237#
1238# Lists available memory devices and their state
1239#
1240# Since: 2.1
1241#
1242# Example:
1243#
1244# -> { "execute": "query-memory-devices" }
1245# <- { "return": [ { "data":
1246#                       { "addr": 5368709120,
1247#                         "hotpluggable": true,
1248#                         "hotplugged": true,
1249#                         "id": "d1",
1250#                         "memdev": "/objects/memX",
1251#                         "node": 0,
1252#                         "size": 1073741824,
1253#                         "slot": 0},
1254#                    "type": "dimm"
1255#                  } ] }
1256#
1257##
1258{ 'command': 'query-memory-devices', 'returns': ['MemoryDeviceInfo'] }
1259
1260##
1261# @MEMORY_DEVICE_SIZE_CHANGE:
1262#
1263# Emitted when the size of a memory device changes. Only emitted for memory
1264# devices that can actually change the size (e.g., virtio-mem due to guest
1265# action).
1266#
1267# @id: device's ID
1268# @size: the new size of memory that the device provides
1269#
1270# Note: this event is rate-limited.
1271#
1272# Since: 5.1
1273#
1274# Example:
1275#
1276# <- { "event": "MEMORY_DEVICE_SIZE_CHANGE",
1277#      "data": { "id": "vm0", "size": 1073741824},
1278#      "timestamp": { "seconds": 1588168529, "microseconds": 201316 } }
1279#
1280##
1281{ 'event': 'MEMORY_DEVICE_SIZE_CHANGE',
1282  'data': { '*id': 'str', 'size': 'size' } }
1283
1284
1285##
1286# @MEM_UNPLUG_ERROR:
1287#
1288# Emitted when memory hot unplug error occurs.
1289#
1290# @device: device name
1291#
1292# @msg: Informative message
1293#
1294# Since: 2.4
1295#
1296# Example:
1297#
1298# <- { "event": "MEM_UNPLUG_ERROR"
1299#      "data": { "device": "dimm1",
1300#                "msg": "acpi: device unplug for unsupported device"
1301#      },
1302#      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
1303#
1304##
1305{ 'event': 'MEM_UNPLUG_ERROR',
1306  'data': { 'device': 'str', 'msg': 'str' } }
1307