xref: /openbmc/qemu/qapi/machine.json (revision 6d9abb6d)
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##
12# @SysEmuTarget:
13#
14# The comprehensive enumeration of QEMU system emulation ("softmmu")
15# targets. Run "./configure --help" in the project root directory, and
16# look for the \*-softmmu targets near the "--target-list" option. The
17# individual target constants are not documented here, for the time
18# being.
19#
20# @rx: since 5.0
21# @avr: since 5.1
22#
23# Notes: The resulting QMP strings can be appended to the "qemu-system-"
24#        prefix to produce the corresponding QEMU executable name. This
25#        is true even for "qemu-system-x86_64".
26#
27# Since: 3.0
28##
29{ 'enum' : 'SysEmuTarget',
30  'data' : [ 'aarch64', 'alpha', 'arm', 'avr', 'cris', 'hppa', 'i386', 'lm32',
31             'm68k', 'microblaze', 'microblazeel', 'mips', 'mips64',
32             'mips64el', 'mipsel', 'moxie', 'nios2', 'or1k', 'ppc',
33             'ppc64', 'riscv32', 'riscv64', 'rx', 's390x', 'sh4',
34             'sh4eb', 'sparc', 'sparc64', 'tricore', 'unicore32',
35             'x86_64', 'xtensa', 'xtensaeb' ] }
36
37##
38# @CpuS390State:
39#
40# An enumeration of cpu states that can be assumed by a virtual
41# S390 CPU
42#
43# Since: 2.12
44##
45{ 'enum': 'CpuS390State',
46  'prefix': 'S390_CPU_STATE',
47  'data': [ 'uninitialized', 'stopped', 'check-stop', 'operating', 'load' ] }
48
49##
50# @CpuInfoS390:
51#
52# Additional information about a virtual S390 CPU
53#
54# @cpu-state: the virtual CPU's state
55#
56# Since: 2.12
57##
58{ 'struct': 'CpuInfoS390', 'data': { 'cpu-state': 'CpuS390State' } }
59
60##
61# @CpuInfoFast:
62#
63# Information about a virtual CPU
64#
65# @cpu-index: index of the virtual CPU
66#
67# @qom-path: path to the CPU object in the QOM tree
68#
69# @thread-id: ID of the underlying host thread
70#
71# @props: properties describing to which node/socket/core/thread
72#         virtual CPU belongs to, provided if supported by board
73#
74# @target: the QEMU system emulation target, which determines which
75#          additional fields will be listed (since 3.0)
76#
77# Since: 2.12
78#
79##
80{ 'union'         : 'CpuInfoFast',
81  'base'          : { 'cpu-index'    : 'int',
82                      'qom-path'     : 'str',
83                      'thread-id'    : 'int',
84                      '*props'       : 'CpuInstanceProperties',
85                      'target'       : 'SysEmuTarget' },
86  'discriminator' : 'target',
87  'data'          : { 's390x'        : 'CpuInfoS390' } }
88
89##
90# @query-cpus-fast:
91#
92# Returns information about all virtual CPUs.
93#
94# Returns: list of @CpuInfoFast
95#
96# Since: 2.12
97#
98# Example:
99#
100# -> { "execute": "query-cpus-fast" }
101# <- { "return": [
102#         {
103#             "thread-id": 25627,
104#             "props": {
105#                 "core-id": 0,
106#                 "thread-id": 0,
107#                 "socket-id": 0
108#             },
109#             "qom-path": "/machine/unattached/device[0]",
110#             "arch":"x86",
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#             "arch":"x86",
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# @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# @HostMemPolicy:
723#
724# Host memory policy types
725#
726# @default: restore default policy, remove any nondefault policy
727#
728# @preferred: set the preferred host nodes for allocation
729#
730# @bind: a strict policy that restricts memory allocation to the
731#        host nodes specified
732#
733# @interleave: memory allocations are interleaved across the set
734#              of host nodes specified
735#
736# Since: 2.1
737##
738{ 'enum': 'HostMemPolicy',
739  'data': [ 'default', 'preferred', 'bind', 'interleave' ] }
740
741##
742# @memsave:
743#
744# Save a portion of guest memory to a file.
745#
746# @val: the virtual address of the guest to start from
747#
748# @size: the size of memory region to save
749#
750# @filename: the file to save the memory to as binary data
751#
752# @cpu-index: the index of the virtual CPU to use for translating the
753#             virtual address (defaults to CPU 0)
754#
755# Returns: Nothing on success
756#
757# Since: 0.14
758#
759# Notes: Errors were not reliably returned until 1.1
760#
761# Example:
762#
763# -> { "execute": "memsave",
764#      "arguments": { "val": 10,
765#                     "size": 100,
766#                     "filename": "/tmp/virtual-mem-dump" } }
767# <- { "return": {} }
768#
769##
770{ 'command': 'memsave',
771  'data': {'val': 'int', 'size': 'int', 'filename': 'str', '*cpu-index': 'int'} }
772
773##
774# @pmemsave:
775#
776# Save a portion of guest physical memory to a file.
777#
778# @val: the physical address of the guest to start from
779#
780# @size: the size of memory region to save
781#
782# @filename: the file to save the memory to as binary data
783#
784# Returns: Nothing on success
785#
786# Since: 0.14
787#
788# Notes: Errors were not reliably returned until 1.1
789#
790# Example:
791#
792# -> { "execute": "pmemsave",
793#      "arguments": { "val": 10,
794#                     "size": 100,
795#                     "filename": "/tmp/physical-mem-dump" } }
796# <- { "return": {} }
797#
798##
799{ 'command': 'pmemsave',
800  'data': {'val': 'int', 'size': 'int', 'filename': 'str'} }
801
802##
803# @Memdev:
804#
805# Information about memory backend
806#
807# @id: backend's ID if backend has 'id' property (since 2.9)
808#
809# @size: memory backend size
810#
811# @merge: enables or disables memory merge support
812#
813# @dump: includes memory backend's memory in a core dump or not
814#
815# @prealloc: enables or disables memory preallocation
816#
817# @host-nodes: host nodes for its memory policy
818#
819# @policy: memory policy of memory backend
820#
821# Since: 2.1
822##
823{ 'struct': 'Memdev',
824  'data': {
825    '*id':        'str',
826    'size':       'size',
827    'merge':      'bool',
828    'dump':       'bool',
829    'prealloc':   'bool',
830    'host-nodes': ['uint16'],
831    'policy':     'HostMemPolicy' }}
832
833##
834# @query-memdev:
835#
836# Returns information for all memory backends.
837#
838# Returns: a list of @Memdev.
839#
840# Since: 2.1
841#
842# Example:
843#
844# -> { "execute": "query-memdev" }
845# <- { "return": [
846#        {
847#          "id": "mem1",
848#          "size": 536870912,
849#          "merge": false,
850#          "dump": true,
851#          "prealloc": false,
852#          "host-nodes": [0, 1],
853#          "policy": "bind"
854#        },
855#        {
856#          "size": 536870912,
857#          "merge": false,
858#          "dump": true,
859#          "prealloc": true,
860#          "host-nodes": [2, 3],
861#          "policy": "preferred"
862#        }
863#      ]
864#    }
865#
866##
867{ 'command': 'query-memdev', 'returns': ['Memdev'], 'allow-preconfig': true }
868
869##
870# @CpuInstanceProperties:
871#
872# List of properties to be used for hotplugging a CPU instance,
873# it should be passed by management with device_add command when
874# a CPU is being hotplugged.
875#
876# @node-id: NUMA node ID the CPU belongs to
877# @socket-id: socket number within node/board the CPU belongs to
878# @die-id: die number within node/board the CPU belongs to (Since 4.1)
879# @core-id: core number within die the CPU belongs to
880# @thread-id: thread number within core the CPU belongs to
881#
882# Note: currently there are 5 properties that could be present
883#       but management should be prepared to pass through other
884#       properties with device_add command to allow for future
885#       interface extension. This also requires the filed names to be kept in
886#       sync with the properties passed to -device/device_add.
887#
888# Since: 2.7
889##
890{ 'struct': 'CpuInstanceProperties',
891  'data': { '*node-id': 'int',
892            '*socket-id': 'int',
893            '*die-id': 'int',
894            '*core-id': 'int',
895            '*thread-id': 'int'
896  }
897}
898
899##
900# @HotpluggableCPU:
901#
902# @type: CPU object type for usage with device_add command
903# @props: list of properties to be used for hotplugging CPU
904# @vcpus-count: number of logical VCPU threads @HotpluggableCPU provides
905# @qom-path: link to existing CPU object if CPU is present or
906#            omitted if CPU is not present.
907#
908# Since: 2.7
909##
910{ 'struct': 'HotpluggableCPU',
911  'data': { 'type': 'str',
912            'vcpus-count': 'int',
913            'props': 'CpuInstanceProperties',
914            '*qom-path': 'str'
915          }
916}
917
918##
919# @query-hotpluggable-cpus:
920#
921# TODO: Better documentation; currently there is none.
922#
923# Returns: a list of HotpluggableCPU objects.
924#
925# Since: 2.7
926#
927# Example:
928#
929# For pseries machine type started with -smp 2,cores=2,maxcpus=4 -cpu POWER8:
930#
931# -> { "execute": "query-hotpluggable-cpus" }
932# <- {"return": [
933#      { "props": { "core": 8 }, "type": "POWER8-spapr-cpu-core",
934#        "vcpus-count": 1 },
935#      { "props": { "core": 0 }, "type": "POWER8-spapr-cpu-core",
936#        "vcpus-count": 1, "qom-path": "/machine/unattached/device[0]"}
937#    ]}'
938#
939# For pc machine type started with -smp 1,maxcpus=2:
940#
941# -> { "execute": "query-hotpluggable-cpus" }
942# <- {"return": [
943#      {
944#         "type": "qemu64-x86_64-cpu", "vcpus-count": 1,
945#         "props": {"core-id": 0, "socket-id": 1, "thread-id": 0}
946#      },
947#      {
948#         "qom-path": "/machine/unattached/device[0]",
949#         "type": "qemu64-x86_64-cpu", "vcpus-count": 1,
950#         "props": {"core-id": 0, "socket-id": 0, "thread-id": 0}
951#      }
952#    ]}
953#
954# For s390x-virtio-ccw machine type started with -smp 1,maxcpus=2 -cpu qemu
955# (Since: 2.11):
956#
957# -> { "execute": "query-hotpluggable-cpus" }
958# <- {"return": [
959#      {
960#         "type": "qemu-s390x-cpu", "vcpus-count": 1,
961#         "props": { "core-id": 1 }
962#      },
963#      {
964#         "qom-path": "/machine/unattached/device[0]",
965#         "type": "qemu-s390x-cpu", "vcpus-count": 1,
966#         "props": { "core-id": 0 }
967#      }
968#    ]}
969#
970##
971{ 'command': 'query-hotpluggable-cpus', 'returns': ['HotpluggableCPU'],
972             'allow-preconfig': true }
973
974##
975# @set-numa-node:
976#
977# Runtime equivalent of '-numa' CLI option, available at
978# preconfigure stage to configure numa mapping before initializing
979# machine.
980#
981# Since 3.0
982##
983{ 'command': 'set-numa-node', 'boxed': true,
984  'data': 'NumaOptions',
985  'allow-preconfig': true
986}
987
988##
989# @balloon:
990#
991# Request the balloon driver to change its balloon size.
992#
993# @value: the target logical size of the VM in bytes.
994#         We can deduce the size of the balloon using this formula:
995#
996#            logical_vm_size = vm_ram_size - balloon_size
997#
998#         From it we have: balloon_size = vm_ram_size - @value
999#
1000# Returns: - Nothing on success
1001#          - If the balloon driver is enabled but not functional because the KVM
1002#            kernel module cannot support it, KvmMissingCap
1003#          - If no balloon device is present, DeviceNotActive
1004#
1005# Notes: This command just issues a request to the guest.  When it returns,
1006#        the balloon size may not have changed.  A guest can change the balloon
1007#        size independent of this command.
1008#
1009# Since: 0.14
1010#
1011# Example:
1012#
1013# -> { "execute": "balloon", "arguments": { "value": 536870912 } }
1014# <- { "return": {} }
1015#
1016# With a 2.5GiB guest this command inflated the ballon to 3GiB.
1017#
1018##
1019{ 'command': 'balloon', 'data': {'value': 'int'} }
1020
1021##
1022# @BalloonInfo:
1023#
1024# Information about the guest balloon device.
1025#
1026# @actual: the logical size of the VM in bytes
1027#          Formula used: logical_vm_size = vm_ram_size - balloon_size
1028#
1029# Since: 0.14
1030#
1031##
1032{ 'struct': 'BalloonInfo', 'data': {'actual': 'int' } }
1033
1034##
1035# @query-balloon:
1036#
1037# Return information about the balloon device.
1038#
1039# Returns: - @BalloonInfo on success
1040#          - If the balloon driver is enabled but not functional because the KVM
1041#            kernel module cannot support it, KvmMissingCap
1042#          - If no balloon device is present, DeviceNotActive
1043#
1044# Since: 0.14
1045#
1046# Example:
1047#
1048# -> { "execute": "query-balloon" }
1049# <- { "return": {
1050#          "actual": 1073741824,
1051#       }
1052#    }
1053#
1054##
1055{ 'command': 'query-balloon', 'returns': 'BalloonInfo' }
1056
1057##
1058# @BALLOON_CHANGE:
1059#
1060# Emitted when the guest changes the actual BALLOON level. This value is
1061# equivalent to the @actual field return by the 'query-balloon' command
1062#
1063# @actual: the logical size of the VM in bytes
1064#          Formula used: logical_vm_size = vm_ram_size - balloon_size
1065#
1066# Note: this event is rate-limited.
1067#
1068# Since: 1.2
1069#
1070# Example:
1071#
1072# <- { "event": "BALLOON_CHANGE",
1073#      "data": { "actual": 944766976 },
1074#      "timestamp": { "seconds": 1267020223, "microseconds": 435656 } }
1075#
1076##
1077{ 'event': 'BALLOON_CHANGE',
1078  'data': { 'actual': 'int' } }
1079
1080##
1081# @MemoryInfo:
1082#
1083# Actual memory information in bytes.
1084#
1085# @base-memory: size of "base" memory specified with command line
1086#               option -m.
1087#
1088# @plugged-memory: size of memory that can be hot-unplugged. This field
1089#                  is omitted if target doesn't support memory hotplug
1090#                  (i.e. CONFIG_MEM_DEVICE not defined at build time).
1091#
1092# Since: 2.11
1093##
1094{ 'struct': 'MemoryInfo',
1095  'data'  : { 'base-memory': 'size', '*plugged-memory': 'size' } }
1096
1097##
1098# @query-memory-size-summary:
1099#
1100# Return the amount of initially allocated and present hotpluggable (if
1101# enabled) memory in bytes.
1102#
1103# Example:
1104#
1105# -> { "execute": "query-memory-size-summary" }
1106# <- { "return": { "base-memory": 4294967296, "plugged-memory": 0 } }
1107#
1108# Since: 2.11
1109##
1110{ 'command': 'query-memory-size-summary', 'returns': 'MemoryInfo' }
1111
1112##
1113# @PCDIMMDeviceInfo:
1114#
1115# PCDIMMDevice state information
1116#
1117# @id: device's ID
1118#
1119# @addr: physical address, where device is mapped
1120#
1121# @size: size of memory that the device provides
1122#
1123# @slot: slot number at which device is plugged in
1124#
1125# @node: NUMA node number where device is plugged in
1126#
1127# @memdev: memory backend linked with device
1128#
1129# @hotplugged: true if device was hotplugged
1130#
1131# @hotpluggable: true if device if could be added/removed while machine is running
1132#
1133# Since: 2.1
1134##
1135{ 'struct': 'PCDIMMDeviceInfo',
1136  'data': { '*id': 'str',
1137            'addr': 'int',
1138            'size': 'int',
1139            'slot': 'int',
1140            'node': 'int',
1141            'memdev': 'str',
1142            'hotplugged': 'bool',
1143            'hotpluggable': 'bool'
1144          }
1145}
1146
1147##
1148# @VirtioPMEMDeviceInfo:
1149#
1150# VirtioPMEM state information
1151#
1152# @id: device's ID
1153#
1154# @memaddr: physical address in memory, where device is mapped
1155#
1156# @size: size of memory that the device provides
1157#
1158# @memdev: memory backend linked with device
1159#
1160# Since: 4.1
1161##
1162{ 'struct': 'VirtioPMEMDeviceInfo',
1163  'data': { '*id': 'str',
1164            'memaddr': 'size',
1165            'size': 'size',
1166            'memdev': 'str'
1167          }
1168}
1169
1170##
1171# @VirtioMEMDeviceInfo:
1172#
1173# VirtioMEMDevice state information
1174#
1175# @id: device's ID
1176#
1177# @memaddr: physical address in memory, where device is mapped
1178#
1179# @requested-size: the user requested size of the device
1180#
1181# @size: the (current) size of memory that the device provides
1182#
1183# @max-size: the maximum size of memory that the device can provide
1184#
1185# @block-size: the block size of memory that the device provides
1186#
1187# @node: NUMA node number where device is assigned to
1188#
1189# @memdev: memory backend linked with the region
1190#
1191# Since: 5.1
1192##
1193{ 'struct': 'VirtioMEMDeviceInfo',
1194  'data': { '*id': 'str',
1195            'memaddr': 'size',
1196            'requested-size': 'size',
1197            'size': 'size',
1198            'max-size': 'size',
1199            'block-size': 'size',
1200            'node': 'int',
1201            'memdev': 'str'
1202          }
1203}
1204
1205##
1206# @MemoryDeviceInfo:
1207#
1208# Union containing information about a memory device
1209#
1210# nvdimm is included since 2.12. virtio-pmem is included since 4.1.
1211# virtio-mem is included since 5.1.
1212#
1213# Since: 2.1
1214##
1215{ 'union': 'MemoryDeviceInfo',
1216  'data': { 'dimm': 'PCDIMMDeviceInfo',
1217            'nvdimm': 'PCDIMMDeviceInfo',
1218            'virtio-pmem': 'VirtioPMEMDeviceInfo',
1219            'virtio-mem': 'VirtioMEMDeviceInfo'
1220          }
1221}
1222
1223##
1224# @query-memory-devices:
1225#
1226# Lists available memory devices and their state
1227#
1228# Since: 2.1
1229#
1230# Example:
1231#
1232# -> { "execute": "query-memory-devices" }
1233# <- { "return": [ { "data":
1234#                       { "addr": 5368709120,
1235#                         "hotpluggable": true,
1236#                         "hotplugged": true,
1237#                         "id": "d1",
1238#                         "memdev": "/objects/memX",
1239#                         "node": 0,
1240#                         "size": 1073741824,
1241#                         "slot": 0},
1242#                    "type": "dimm"
1243#                  } ] }
1244#
1245##
1246{ 'command': 'query-memory-devices', 'returns': ['MemoryDeviceInfo'] }
1247
1248##
1249# @MEMORY_DEVICE_SIZE_CHANGE:
1250#
1251# Emitted when the size of a memory device changes. Only emitted for memory
1252# devices that can actually change the size (e.g., virtio-mem due to guest
1253# action).
1254#
1255# @id: device's ID
1256# @size: the new size of memory that the device provides
1257#
1258# Note: this event is rate-limited.
1259#
1260# Since: 5.1
1261#
1262# Example:
1263#
1264# <- { "event": "MEMORY_DEVICE_SIZE_CHANGE",
1265#      "data": { "id": "vm0", "size": 1073741824},
1266#      "timestamp": { "seconds": 1588168529, "microseconds": 201316 } }
1267#
1268##
1269{ 'event': 'MEMORY_DEVICE_SIZE_CHANGE',
1270  'data': { '*id': 'str', 'size': 'size' } }
1271
1272
1273##
1274# @MEM_UNPLUG_ERROR:
1275#
1276# Emitted when memory hot unplug error occurs.
1277#
1278# @device: device name
1279#
1280# @msg: Informative message
1281#
1282# Since: 2.4
1283#
1284# Example:
1285#
1286# <- { "event": "MEM_UNPLUG_ERROR"
1287#      "data": { "device": "dimm1",
1288#                "msg": "acpi: device unplug for unsupported device"
1289#      },
1290#      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
1291#
1292##
1293{ 'event': 'MEM_UNPLUG_ERROR',
1294  'data': { 'device': 'str', 'msg': 'str' } }
1295