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