target/ppc: use Vsr macros in BCD helpers
[qemu/ar7.git] / qapi / machine.json
blobca26779f1a3623e86befc00ee8d834092d409774
1 # -*- Mode: Python -*-
3 # This work is licensed under the terms of the GNU GPL, version 2 or later.
4 # See the COPYING file in the top-level directory.
6 ##
7 # = Machines
8 ##
11 # @SysEmuTarget:
13 # The comprehensive enumeration of QEMU system emulation ("softmmu")
14 # targets. Run "./configure --help" in the project root directory, and
15 # look for the *-softmmu targets near the "--target-list" option. The
16 # individual target constants are not documented here, for the time
17 # being.
19 # Notes: The resulting QMP strings can be appended to the "qemu-system-"
20 #        prefix to produce the corresponding QEMU executable name. This
21 #        is true even for "qemu-system-x86_64".
23 # ppcemb: dropped in 3.1
25 # Since: 3.0
27 { 'enum' : 'SysEmuTarget',
28   'data' : [ 'aarch64', 'alpha', 'arm', 'cris', 'hppa', 'i386', 'lm32',
29              'm68k', 'microblaze', 'microblazeel', 'mips', 'mips64',
30              'mips64el', 'mipsel', 'moxie', 'nios2', 'or1k', 'ppc',
31              'ppc64', 'riscv32', 'riscv64', 's390x', 'sh4',
32              'sh4eb', 'sparc', 'sparc64', 'tricore', 'unicore32',
33              'x86_64', 'xtensa', 'xtensaeb' ] }
36 # @CpuInfoArch:
38 # An enumeration of cpu types that enable additional information during
39 # @query-cpus and @query-cpus-fast.
41 # @s390: since 2.12
43 # @riscv: since 2.12
45 # Since: 2.6
47 { 'enum': 'CpuInfoArch',
48   'data': ['x86', 'sparc', 'ppc', 'mips', 'tricore', 's390', 'riscv', 'other' ] }
51 # @CpuInfo:
53 # Information about a virtual CPU
55 # @CPU: the index of the virtual CPU
57 # @current: this only exists for backwards compatibility and should be ignored
59 # @halted: true if the virtual CPU is in the halt state.  Halt usually refers
60 #          to a processor specific low power mode.
62 # @qom_path: path to the CPU object in the QOM tree (since 2.4)
64 # @thread_id: ID of the underlying host thread
66 # @props: properties describing to which node/socket/core/thread
67 #         virtual CPU belongs to, provided if supported by board (since 2.10)
69 # @arch: architecture of the cpu, which determines which additional fields
70 #        will be listed (since 2.6)
72 # Since: 0.14.0
74 # Notes: @halted is a transient state that changes frequently.  By the time the
75 #        data is sent to the client, the guest may no longer be halted.
77 { 'union': 'CpuInfo',
78   'base': {'CPU': 'int', 'current': 'bool', 'halted': 'bool',
79            'qom_path': 'str', 'thread_id': 'int',
80            '*props': 'CpuInstanceProperties', 'arch': 'CpuInfoArch' },
81   'discriminator': 'arch',
82   'data': { 'x86': 'CpuInfoX86',
83             'sparc': 'CpuInfoSPARC',
84             'ppc': 'CpuInfoPPC',
85             'mips': 'CpuInfoMIPS',
86             'tricore': 'CpuInfoTricore',
87             's390': 'CpuInfoS390',
88             'riscv': 'CpuInfoRISCV' } }
91 # @CpuInfoX86:
93 # Additional information about a virtual i386 or x86_64 CPU
95 # @pc: the 64-bit instruction pointer
97 # Since: 2.6
99 { 'struct': 'CpuInfoX86', 'data': { 'pc': 'int' } }
102 # @CpuInfoSPARC:
104 # Additional information about a virtual SPARC CPU
106 # @pc: the PC component of the instruction pointer
108 # @npc: the NPC component of the instruction pointer
110 # Since: 2.6
112 { 'struct': 'CpuInfoSPARC', 'data': { 'pc': 'int', 'npc': 'int' } }
115 # @CpuInfoPPC:
117 # Additional information about a virtual PPC CPU
119 # @nip: the instruction pointer
121 # Since: 2.6
123 { 'struct': 'CpuInfoPPC', 'data': { 'nip': 'int' } }
126 # @CpuInfoMIPS:
128 # Additional information about a virtual MIPS CPU
130 # @PC: the instruction pointer
132 # Since: 2.6
134 { 'struct': 'CpuInfoMIPS', 'data': { 'PC': 'int' } }
137 # @CpuInfoTricore:
139 # Additional information about a virtual Tricore CPU
141 # @PC: the instruction pointer
143 # Since: 2.6
145 { 'struct': 'CpuInfoTricore', 'data': { 'PC': 'int' } }
148 # @CpuInfoRISCV:
150 # Additional information about a virtual RISCV CPU
152 # @pc: the instruction pointer
154 # Since 2.12
156 { 'struct': 'CpuInfoRISCV', 'data': { 'pc': 'int' } }
159 # @CpuS390State:
161 # An enumeration of cpu states that can be assumed by a virtual
162 # S390 CPU
164 # Since: 2.12
166 { 'enum': 'CpuS390State',
167   'prefix': 'S390_CPU_STATE',
168   'data': [ 'uninitialized', 'stopped', 'check-stop', 'operating', 'load' ] }
171 # @CpuInfoS390:
173 # Additional information about a virtual S390 CPU
175 # @cpu-state: the virtual CPU's state
177 # Since: 2.12
179 { 'struct': 'CpuInfoS390', 'data': { 'cpu-state': 'CpuS390State' } }
182 # @query-cpus:
184 # Returns a list of information about each virtual CPU.
186 # This command causes vCPU threads to exit to userspace, which causes
187 # a small interruption to guest CPU execution. This will have a negative
188 # impact on realtime guests and other latency sensitive guest workloads.
189 # It is recommended to use @query-cpus-fast instead of this command to
190 # avoid the vCPU interruption.
192 # Returns: a list of @CpuInfo for each virtual CPU
194 # Since: 0.14.0
196 # Example:
198 # -> { "execute": "query-cpus" }
199 # <- { "return": [
200 #          {
201 #             "CPU":0,
202 #             "current":true,
203 #             "halted":false,
204 #             "qom_path":"/machine/unattached/device[0]",
205 #             "arch":"x86",
206 #             "pc":3227107138,
207 #             "thread_id":3134
208 #          },
209 #          {
210 #             "CPU":1,
211 #             "current":false,
212 #             "halted":true,
213 #             "qom_path":"/machine/unattached/device[2]",
214 #             "arch":"x86",
215 #             "pc":7108165,
216 #             "thread_id":3135
217 #          }
218 #       ]
219 #    }
221 # Notes: This interface is deprecated (since 2.12.0), and it is strongly
222 #        recommended that you avoid using it. Use @query-cpus-fast to
223 #        obtain information about virtual CPUs.
226 { 'command': 'query-cpus', 'returns': ['CpuInfo'] }
229 # @CpuInfoFast:
231 # Information about a virtual CPU
233 # @cpu-index: index of the virtual CPU
235 # @qom-path: path to the CPU object in the QOM tree
237 # @thread-id: ID of the underlying host thread
239 # @props: properties describing to which node/socket/core/thread
240 #         virtual CPU belongs to, provided if supported by board
242 # @arch: base architecture of the cpu; deprecated since 3.0.0 in favor
243 #        of @target
245 # @target: the QEMU system emulation target, which determines which
246 #          additional fields will be listed (since 3.0)
248 # Since: 2.12
251 { 'union'         : 'CpuInfoFast',
252   'base'          : { 'cpu-index'    : 'int',
253                       'qom-path'     : 'str',
254                       'thread-id'    : 'int',
255                       '*props'       : 'CpuInstanceProperties',
256                       'arch'         : 'CpuInfoArch',
257                       'target'       : 'SysEmuTarget' },
258   'discriminator' : 'target',
259   'data'          : { 's390x'        : 'CpuInfoS390' } }
262 # @query-cpus-fast:
264 # Returns information about all virtual CPUs. This command does not
265 # incur a performance penalty and should be used in production
266 # instead of query-cpus.
268 # Returns: list of @CpuInfoFast
270 # Since: 2.12
272 # Example:
274 # -> { "execute": "query-cpus-fast" }
275 # <- { "return": [
276 #         {
277 #             "thread-id": 25627,
278 #             "props": {
279 #                 "core-id": 0,
280 #                 "thread-id": 0,
281 #                 "socket-id": 0
282 #             },
283 #             "qom-path": "/machine/unattached/device[0]",
284 #             "arch":"x86",
285 #             "target":"x86_64",
286 #             "cpu-index": 0
287 #         },
288 #         {
289 #             "thread-id": 25628,
290 #             "props": {
291 #                 "core-id": 0,
292 #                 "thread-id": 0,
293 #                 "socket-id": 1
294 #             },
295 #             "qom-path": "/machine/unattached/device[2]",
296 #             "arch":"x86",
297 #             "target":"x86_64",
298 #             "cpu-index": 1
299 #         }
300 #     ]
301 # }
303 { 'command': 'query-cpus-fast', 'returns': [ 'CpuInfoFast' ] }
306 # @cpu-add:
308 # Adds CPU with specified ID.
310 # @id: ID of CPU to be created, valid values [0..max_cpus)
312 # Returns: Nothing on success
314 # Since: 1.5
316 # Note: This command is deprecated.  The `device_add` command should be
317 #       used instead.  See the `query-hotpluggable-cpus` command for
318 #       details.
320 # Example:
322 # -> { "execute": "cpu-add", "arguments": { "id": 2 } }
323 # <- { "return": {} }
326 { 'command': 'cpu-add', 'data': {'id': 'int'} }
329 # @MachineInfo:
331 # Information describing a machine.
333 # @name: the name of the machine
335 # @alias: an alias for the machine name
337 # @is-default: whether the machine is default
339 # @cpu-max: maximum number of CPUs supported by the machine type
340 #           (since 1.5.0)
342 # @hotpluggable-cpus: cpu hotplug via -device is supported (since 2.7.0)
344 # @numa-mem-supported: true if '-numa node,mem' option is supported by
345 #                      the machine type and false otherwise (since 4.1)
347 # @deprecated: if true, the machine type is deprecated and may be removed
348 #              in future versions of QEMU according to the QEMU deprecation
349 #              policy (since 4.1.0)
351 # @default-cpu-type: default CPU model typename if none is requested via
352 #                    the -cpu argument. (since 4.2)
354 # Since: 1.2.0
356 { 'struct': 'MachineInfo',
357   'data': { 'name': 'str', '*alias': 'str',
358             '*is-default': 'bool', 'cpu-max': 'int',
359             'hotpluggable-cpus': 'bool',  'numa-mem-supported': 'bool',
360             'deprecated': 'bool', '*default-cpu-type': 'str' } }
363 # @query-machines:
365 # Return a list of supported machines
367 # Returns: a list of MachineInfo
369 # Since: 1.2.0
371 { 'command': 'query-machines', 'returns': ['MachineInfo'] }
374 # @CurrentMachineParams:
376 # Information describing the running machine parameters.
378 # @wakeup-suspend-support: true if the machine supports wake up from
379 #                          suspend
381 # Since: 4.0
383 { 'struct': 'CurrentMachineParams',
384   'data': { 'wakeup-suspend-support': 'bool'} }
387 # @query-current-machine:
389 # Return information on the current virtual machine.
391 # Returns: CurrentMachineParams
393 # Since: 4.0
395 { 'command': 'query-current-machine', 'returns': 'CurrentMachineParams' }
398 # @TargetInfo:
400 # Information describing the QEMU target.
402 # @arch: the target architecture
404 # Since: 1.2.0
406 { 'struct': 'TargetInfo',
407   'data': { 'arch': 'SysEmuTarget' } }
410 # @query-target:
412 # Return information about the target for this QEMU
414 # Returns: TargetInfo
416 # Since: 1.2.0
418 { 'command': 'query-target', 'returns': 'TargetInfo' }
421 # @NumaOptionsType:
423 # @node: NUMA nodes configuration
425 # @dist: NUMA distance configuration (since 2.10)
427 # @cpu: property based CPU(s) to node mapping (Since: 2.10)
429 # Since: 2.1
431 { 'enum': 'NumaOptionsType',
432   'data': [ 'node', 'dist', 'cpu' ] }
435 # @NumaOptions:
437 # A discriminated record of NUMA options. (for OptsVisitor)
439 # Since: 2.1
441 { 'union': 'NumaOptions',
442   'base': { 'type': 'NumaOptionsType' },
443   'discriminator': 'type',
444   'data': {
445     'node': 'NumaNodeOptions',
446     'dist': 'NumaDistOptions',
447     'cpu': 'NumaCpuOptions' }}
450 # @NumaNodeOptions:
452 # Create a guest NUMA node. (for OptsVisitor)
454 # @nodeid: NUMA node ID (increase by 1 from 0 if omitted)
456 # @cpus: VCPUs belonging to this node (assign VCPUS round-robin
457 #         if omitted)
459 # @mem: memory size of this node; mutually exclusive with @memdev.
460 #       Equally divide total memory among nodes if both @mem and @memdev are
461 #       omitted.
463 # @memdev: memory backend object.  If specified for one node,
464 #          it must be specified for all nodes.
466 # Since: 2.1
468 { 'struct': 'NumaNodeOptions',
469   'data': {
470    '*nodeid': 'uint16',
471    '*cpus':   ['uint16'],
472    '*mem':    'size',
473    '*memdev': 'str' }}
476 # @NumaDistOptions:
478 # Set the distance between 2 NUMA nodes.
480 # @src: source NUMA node.
482 # @dst: destination NUMA node.
484 # @val: NUMA distance from source node to destination node.
485 #       When a node is unreachable from another node, set the distance
486 #       between them to 255.
488 # Since: 2.10
490 { 'struct': 'NumaDistOptions',
491   'data': {
492    'src': 'uint16',
493    'dst': 'uint16',
494    'val': 'uint8' }}
497 # @X86CPURegister32:
499 # A X86 32-bit register
501 # Since: 1.5
503 { 'enum': 'X86CPURegister32',
504   'data': [ 'EAX', 'EBX', 'ECX', 'EDX', 'ESP', 'EBP', 'ESI', 'EDI' ] }
507 # @X86CPUFeatureWordInfo:
509 # Information about a X86 CPU feature word
511 # @cpuid-input-eax: Input EAX value for CPUID instruction for that feature word
513 # @cpuid-input-ecx: Input ECX value for CPUID instruction for that
514 #                   feature word
516 # @cpuid-register: Output register containing the feature bits
518 # @features: value of output register, containing the feature bits
520 # Since: 1.5
522 { 'struct': 'X86CPUFeatureWordInfo',
523   'data': { 'cpuid-input-eax': 'int',
524             '*cpuid-input-ecx': 'int',
525             'cpuid-register': 'X86CPURegister32',
526             'features': 'int' } }
529 # @DummyForceArrays:
531 # Not used by QMP; hack to let us use X86CPUFeatureWordInfoList internally
533 # Since: 2.5
535 { 'struct': 'DummyForceArrays',
536   'data': { 'unused': ['X86CPUFeatureWordInfo'] } }
539 # @NumaCpuOptions:
541 # Option "-numa cpu" overrides default cpu to node mapping.
542 # It accepts the same set of cpu properties as returned by
543 # query-hotpluggable-cpus[].props, where node-id could be used to
544 # override default node mapping.
546 # Since: 2.10
548 { 'struct': 'NumaCpuOptions',
549    'base': 'CpuInstanceProperties',
550    'data' : {} }
553 # @HostMemPolicy:
555 # Host memory policy types
557 # @default: restore default policy, remove any nondefault policy
559 # @preferred: set the preferred host nodes for allocation
561 # @bind: a strict policy that restricts memory allocation to the
562 #        host nodes specified
564 # @interleave: memory allocations are interleaved across the set
565 #              of host nodes specified
567 # Since: 2.1
569 { 'enum': 'HostMemPolicy',
570   'data': [ 'default', 'preferred', 'bind', 'interleave' ] }
573 # @Memdev:
575 # Information about memory backend
577 # @id: backend's ID if backend has 'id' property (since 2.9)
579 # @size: memory backend size
581 # @merge: enables or disables memory merge support
583 # @dump: includes memory backend's memory in a core dump or not
585 # @prealloc: enables or disables memory preallocation
587 # @host-nodes: host nodes for its memory policy
589 # @policy: memory policy of memory backend
591 # Since: 2.1
593 { 'struct': 'Memdev',
594   'data': {
595     '*id':        'str',
596     'size':       'size',
597     'merge':      'bool',
598     'dump':       'bool',
599     'prealloc':   'bool',
600     'host-nodes': ['uint16'],
601     'policy':     'HostMemPolicy' }}
604 # @query-memdev:
606 # Returns information for all memory backends.
608 # Returns: a list of @Memdev.
610 # Since: 2.1
612 # Example:
614 # -> { "execute": "query-memdev" }
615 # <- { "return": [
616 #        {
617 #          "id": "mem1",
618 #          "size": 536870912,
619 #          "merge": false,
620 #          "dump": true,
621 #          "prealloc": false,
622 #          "host-nodes": [0, 1],
623 #          "policy": "bind"
624 #        },
625 #        {
626 #          "size": 536870912,
627 #          "merge": false,
628 #          "dump": true,
629 #          "prealloc": true,
630 #          "host-nodes": [2, 3],
631 #          "policy": "preferred"
632 #        }
633 #      ]
634 #    }
637 { 'command': 'query-memdev', 'returns': ['Memdev'], 'allow-preconfig': true }
640 # @CpuInstanceProperties:
642 # List of properties to be used for hotplugging a CPU instance,
643 # it should be passed by management with device_add command when
644 # a CPU is being hotplugged.
646 # @node-id: NUMA node ID the CPU belongs to
647 # @socket-id: socket number within node/board the CPU belongs to
648 # @die-id: die number within node/board the CPU belongs to (Since 4.1)
649 # @core-id: core number within die the CPU belongs to# @thread-id: thread number within core the CPU belongs to
651 # Note: currently there are 5 properties that could be present
652 # but management should be prepared to pass through other
653 # properties with device_add command to allow for future
654 # interface extension. This also requires the filed names to be kept in
655 # sync with the properties passed to -device/device_add.
657 # Since: 2.7
659 { 'struct': 'CpuInstanceProperties',
660   'data': { '*node-id': 'int',
661             '*socket-id': 'int',
662             '*die-id': 'int',
663             '*core-id': 'int',
664             '*thread-id': 'int'
665   }
669 # @HotpluggableCPU:
671 # @type: CPU object type for usage with device_add command
672 # @props: list of properties to be used for hotplugging CPU
673 # @vcpus-count: number of logical VCPU threads @HotpluggableCPU provides
674 # @qom-path: link to existing CPU object if CPU is present or
675 #            omitted if CPU is not present.
677 # Since: 2.7
679 { 'struct': 'HotpluggableCPU',
680   'data': { 'type': 'str',
681             'vcpus-count': 'int',
682             'props': 'CpuInstanceProperties',
683             '*qom-path': 'str'
684           }
688 # @query-hotpluggable-cpus:
690 # TODO: Better documentation; currently there is none.
692 # Returns: a list of HotpluggableCPU objects.
694 # Since: 2.7
696 # Example:
698 # For pseries machine type started with -smp 2,cores=2,maxcpus=4 -cpu POWER8:
700 # -> { "execute": "query-hotpluggable-cpus" }
701 # <- {"return": [
702 #      { "props": { "core": 8 }, "type": "POWER8-spapr-cpu-core",
703 #        "vcpus-count": 1 },
704 #      { "props": { "core": 0 }, "type": "POWER8-spapr-cpu-core",
705 #        "vcpus-count": 1, "qom-path": "/machine/unattached/device[0]"}
706 #    ]}'
708 # For pc machine type started with -smp 1,maxcpus=2:
710 # -> { "execute": "query-hotpluggable-cpus" }
711 # <- {"return": [
712 #      {
713 #         "type": "qemu64-x86_64-cpu", "vcpus-count": 1,
714 #         "props": {"core-id": 0, "socket-id": 1, "thread-id": 0}
715 #      },
716 #      {
717 #         "qom-path": "/machine/unattached/device[0]",
718 #         "type": "qemu64-x86_64-cpu", "vcpus-count": 1,
719 #         "props": {"core-id": 0, "socket-id": 0, "thread-id": 0}
720 #      }
721 #    ]}
723 # For s390x-virtio-ccw machine type started with -smp 1,maxcpus=2 -cpu qemu
724 # (Since: 2.11):
726 # -> { "execute": "query-hotpluggable-cpus" }
727 # <- {"return": [
728 #      {
729 #         "type": "qemu-s390x-cpu", "vcpus-count": 1,
730 #         "props": { "core-id": 1 }
731 #      },
732 #      {
733 #         "qom-path": "/machine/unattached/device[0]",
734 #         "type": "qemu-s390x-cpu", "vcpus-count": 1,
735 #         "props": { "core-id": 0 }
736 #      }
737 #    ]}
740 { 'command': 'query-hotpluggable-cpus', 'returns': ['HotpluggableCPU'],
741              'allow-preconfig': true }
744 # @set-numa-node:
746 # Runtime equivalent of '-numa' CLI option, available at
747 # preconfigure stage to configure numa mapping before initializing
748 # machine.
750 # Since 3.0
752 { 'command': 'set-numa-node', 'boxed': true,
753   'data': 'NumaOptions',
754   'allow-preconfig': true