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.
10 { 'include': 'common.json' }
15 # An enumeration of cpu types that enable additional information during
16 # @query-cpus and @query-cpus-fast.
24 { 'enum': 'CpuInfoArch',
25 'data': ['x86', 'sparc', 'ppc', 'mips', 'tricore', 's390', 'riscv', 'other' ] }
30 # Information about a virtual CPU
32 # @CPU: the index of the virtual CPU
34 # @current: this only exists for backwards compatibility and should be ignored
36 # @halted: true if the virtual CPU is in the halt state. Halt usually refers
37 # to a processor specific low power mode.
39 # @qom_path: path to the CPU object in the QOM tree (since 2.4)
41 # @thread_id: ID of the underlying host thread
43 # @props: properties describing to which node/socket/core/thread
44 # virtual CPU belongs to, provided if supported by board (since 2.10)
46 # @arch: architecture of the cpu, which determines which additional fields
47 # will be listed (since 2.6)
51 # Notes: @halted is a transient state that changes frequently. By the time the
52 # data is sent to the client, the guest may no longer be halted.
55 'base': {'CPU': 'int', 'current': 'bool', 'halted': 'bool',
56 'qom_path': 'str', 'thread_id': 'int',
57 '*props': 'CpuInstanceProperties', 'arch': 'CpuInfoArch' },
58 'discriminator': 'arch',
59 'data': { 'x86': 'CpuInfoX86',
60 'sparc': 'CpuInfoSPARC',
62 'mips': 'CpuInfoMIPS',
63 'tricore': 'CpuInfoTricore',
64 's390': 'CpuInfoS390',
65 'riscv': 'CpuInfoRISCV' } }
70 # Additional information about a virtual i386 or x86_64 CPU
72 # @pc: the 64-bit instruction pointer
76 { 'struct': 'CpuInfoX86', 'data': { 'pc': 'int' } }
81 # Additional information about a virtual SPARC CPU
83 # @pc: the PC component of the instruction pointer
85 # @npc: the NPC component of the instruction pointer
89 { 'struct': 'CpuInfoSPARC', 'data': { 'pc': 'int', 'npc': 'int' } }
94 # Additional information about a virtual PPC CPU
96 # @nip: the instruction pointer
100 { 'struct': 'CpuInfoPPC', 'data': { 'nip': 'int' } }
105 # Additional information about a virtual MIPS CPU
107 # @PC: the instruction pointer
111 { 'struct': 'CpuInfoMIPS', 'data': { 'PC': 'int' } }
116 # Additional information about a virtual Tricore CPU
118 # @PC: the instruction pointer
122 { 'struct': 'CpuInfoTricore', 'data': { 'PC': 'int' } }
127 # Additional information about a virtual RISCV CPU
129 # @pc: the instruction pointer
133 { 'struct': 'CpuInfoRISCV', 'data': { 'pc': 'int' } }
138 # An enumeration of cpu states that can be assumed by a virtual
143 { 'enum': 'CpuS390State',
144 'prefix': 'S390_CPU_STATE',
145 'data': [ 'uninitialized', 'stopped', 'check-stop', 'operating', 'load' ] }
150 # Additional information about a virtual S390 CPU
152 # @cpu-state: the virtual CPU's state
156 { 'struct': 'CpuInfoS390', 'data': { 'cpu-state': 'CpuS390State' } }
161 # Returns a list of information about each virtual CPU.
163 # This command causes vCPU threads to exit to userspace, which causes
164 # a small interruption to guest CPU execution. This will have a negative
165 # impact on realtime guests and other latency sensitive guest workloads.
166 # It is recommended to use @query-cpus-fast instead of this command to
167 # avoid the vCPU interruption.
169 # Returns: a list of @CpuInfo for each virtual CPU
175 # -> { "execute": "query-cpus" }
181 # "qom_path":"/machine/unattached/device[0]",
190 # "qom_path":"/machine/unattached/device[2]",
198 # Notes: This interface is deprecated (since 2.12.0), and it is strongly
199 # recommended that you avoid using it. Use @query-cpus-fast to
200 # obtain information about virtual CPUs.
203 { 'command': 'query-cpus', 'returns': ['CpuInfo'] }
208 # Information about a virtual CPU
210 # @cpu-index: index of the virtual CPU
212 # @qom-path: path to the CPU object in the QOM tree
214 # @thread-id: ID of the underlying host thread
216 # @props: properties describing to which node/socket/core/thread
217 # virtual CPU belongs to, provided if supported by board
219 # @arch: base architecture of the cpu; deprecated since 3.0.0 in favor
222 # @target: the QEMU system emulation target, which determines which
223 # additional fields will be listed (since 3.0)
228 { 'union' : 'CpuInfoFast',
229 'base' : { 'cpu-index' : 'int',
232 '*props' : 'CpuInstanceProperties',
233 'arch' : 'CpuInfoArch',
234 'target' : 'SysEmuTarget' },
235 'discriminator' : 'target',
236 'data' : { 's390x' : 'CpuInfoS390' } }
241 # Returns information about all virtual CPUs. This command does not
242 # incur a performance penalty and should be used in production
243 # instead of query-cpus.
245 # Returns: list of @CpuInfoFast
251 # -> { "execute": "query-cpus-fast" }
254 # "thread-id": 25627,
260 # "qom-path": "/machine/unattached/device[0]",
266 # "thread-id": 25628,
272 # "qom-path": "/machine/unattached/device[2]",
280 { 'command': 'query-cpus-fast', 'returns': [ 'CpuInfoFast' ] }
285 # Adds CPU with specified ID.
287 # @id: ID of CPU to be created, valid values [0..max_cpus)
289 # Returns: Nothing on success
293 # Note: This command is deprecated. The `device_add` command should be
294 # used instead. See the `query-hotpluggable-cpus` command for
299 # -> { "execute": "cpu-add", "arguments": { "id": 2 } }
300 # <- { "return": {} }
303 { 'command': 'cpu-add', 'data': {'id': 'int'} }
308 # Information describing a machine.
310 # @name: the name of the machine
312 # @alias: an alias for the machine name
314 # @is-default: whether the machine is default
316 # @cpu-max: maximum number of CPUs supported by the machine type
319 # @hotpluggable-cpus: cpu hotplug via -device is supported (since 2.7.0)
323 { 'struct': 'MachineInfo',
324 'data': { 'name': 'str', '*alias': 'str',
325 '*is-default': 'bool', 'cpu-max': 'int',
326 'hotpluggable-cpus': 'bool'} }
331 # Return a list of supported machines
333 # Returns: a list of MachineInfo
337 { 'command': 'query-machines', 'returns': ['MachineInfo'] }
340 # @CurrentMachineParams:
342 # Information describing the running machine parameters.
344 # @wakeup-suspend-support: true if the machine supports wake up from
349 { 'struct': 'CurrentMachineParams',
350 'data': { 'wakeup-suspend-support': 'bool'} }
353 # @query-current-machine:
355 # Return information on the current virtual machine.
357 # Returns: CurrentMachineParams
361 { 'command': 'query-current-machine', 'returns': 'CurrentMachineParams' }
366 # @node: NUMA nodes configuration
368 # @dist: NUMA distance configuration (since 2.10)
370 # @cpu: property based CPU(s) to node mapping (Since: 2.10)
374 { 'enum': 'NumaOptionsType',
375 'data': [ 'node', 'dist', 'cpu' ] }
380 # A discriminated record of NUMA options. (for OptsVisitor)
384 { 'union': 'NumaOptions',
385 'base': { 'type': 'NumaOptionsType' },
386 'discriminator': 'type',
388 'node': 'NumaNodeOptions',
389 'dist': 'NumaDistOptions',
390 'cpu': 'NumaCpuOptions' }}
395 # Create a guest NUMA node. (for OptsVisitor)
397 # @nodeid: NUMA node ID (increase by 1 from 0 if omitted)
399 # @cpus: VCPUs belonging to this node (assign VCPUS round-robin
402 # @mem: memory size of this node; mutually exclusive with @memdev.
403 # Equally divide total memory among nodes if both @mem and @memdev are
406 # @memdev: memory backend object. If specified for one node,
407 # it must be specified for all nodes.
411 { 'struct': 'NumaNodeOptions',
421 # Set the distance between 2 NUMA nodes.
423 # @src: source NUMA node.
425 # @dst: destination NUMA node.
427 # @val: NUMA distance from source node to destination node.
428 # When a node is unreachable from another node, set the distance
429 # between them to 255.
433 { 'struct': 'NumaDistOptions',
442 # A X86 32-bit register
446 { 'enum': 'X86CPURegister32',
447 'data': [ 'EAX', 'EBX', 'ECX', 'EDX', 'ESP', 'EBP', 'ESI', 'EDI' ] }
450 # @X86CPUFeatureWordInfo:
452 # Information about a X86 CPU feature word
454 # @cpuid-input-eax: Input EAX value for CPUID instruction for that feature word
456 # @cpuid-input-ecx: Input ECX value for CPUID instruction for that
459 # @cpuid-register: Output register containing the feature bits
461 # @features: value of output register, containing the feature bits
465 { 'struct': 'X86CPUFeatureWordInfo',
466 'data': { 'cpuid-input-eax': 'int',
467 '*cpuid-input-ecx': 'int',
468 'cpuid-register': 'X86CPURegister32',
469 'features': 'int' } }
474 # Not used by QMP; hack to let us use X86CPUFeatureWordInfoList internally
478 { 'struct': 'DummyForceArrays',
479 'data': { 'unused': ['X86CPUFeatureWordInfo'] } }
484 # Option "-numa cpu" overrides default cpu to node mapping.
485 # It accepts the same set of cpu properties as returned by
486 # query-hotpluggable-cpus[].props, where node-id could be used to
487 # override default node mapping.
491 { 'struct': 'NumaCpuOptions',
492 'base': 'CpuInstanceProperties',
498 # Host memory policy types
500 # @default: restore default policy, remove any nondefault policy
502 # @preferred: set the preferred host nodes for allocation
504 # @bind: a strict policy that restricts memory allocation to the
505 # host nodes specified
507 # @interleave: memory allocations are interleaved across the set
508 # of host nodes specified
512 { 'enum': 'HostMemPolicy',
513 'data': [ 'default', 'preferred', 'bind', 'interleave' ] }
518 # Information about memory backend
520 # @id: backend's ID if backend has 'id' property (since 2.9)
522 # @size: memory backend size
524 # @merge: enables or disables memory merge support
526 # @dump: includes memory backend's memory in a core dump or not
528 # @prealloc: enables or disables memory preallocation
530 # @host-nodes: host nodes for its memory policy
532 # @policy: memory policy of memory backend
536 { 'struct': 'Memdev',
543 'host-nodes': ['uint16'],
544 'policy': 'HostMemPolicy' }}
549 # Returns information for all memory backends.
551 # Returns: a list of @Memdev.
557 # -> { "execute": "query-memdev" }
565 # "host-nodes": [0, 1],
573 # "host-nodes": [2, 3],
574 # "policy": "preferred"
580 { 'command': 'query-memdev', 'returns': ['Memdev'], 'allow-preconfig': true }
583 # @CpuInstanceProperties:
585 # List of properties to be used for hotplugging a CPU instance,
586 # it should be passed by management with device_add command when
587 # a CPU is being hotplugged.
589 # @node-id: NUMA node ID the CPU belongs to
590 # @socket-id: socket number within node/board the CPU belongs to
591 # @core-id: core number within socket the CPU belongs to
592 # @thread-id: thread number within core the CPU belongs to
594 # Note: currently there are 4 properties that could be present
595 # but management should be prepared to pass through other
596 # properties with device_add command to allow for future
597 # interface extension. This also requires the filed names to be kept in
598 # sync with the properties passed to -device/device_add.
602 { 'struct': 'CpuInstanceProperties',
603 'data': { '*node-id': 'int',
613 # @type: CPU object type for usage with device_add command
614 # @props: list of properties to be used for hotplugging CPU
615 # @vcpus-count: number of logical VCPU threads @HotpluggableCPU provides
616 # @qom-path: link to existing CPU object if CPU is present or
617 # omitted if CPU is not present.
621 { 'struct': 'HotpluggableCPU',
622 'data': { 'type': 'str',
623 'vcpus-count': 'int',
624 'props': 'CpuInstanceProperties',
630 # @query-hotpluggable-cpus:
632 # TODO: Better documentation; currently there is none.
634 # Returns: a list of HotpluggableCPU objects.
640 # For pseries machine type started with -smp 2,cores=2,maxcpus=4 -cpu POWER8:
642 # -> { "execute": "query-hotpluggable-cpus" }
644 # { "props": { "core": 8 }, "type": "POWER8-spapr-cpu-core",
645 # "vcpus-count": 1 },
646 # { "props": { "core": 0 }, "type": "POWER8-spapr-cpu-core",
647 # "vcpus-count": 1, "qom-path": "/machine/unattached/device[0]"}
650 # For pc machine type started with -smp 1,maxcpus=2:
652 # -> { "execute": "query-hotpluggable-cpus" }
655 # "type": "qemu64-x86_64-cpu", "vcpus-count": 1,
656 # "props": {"core-id": 0, "socket-id": 1, "thread-id": 0}
659 # "qom-path": "/machine/unattached/device[0]",
660 # "type": "qemu64-x86_64-cpu", "vcpus-count": 1,
661 # "props": {"core-id": 0, "socket-id": 0, "thread-id": 0}
665 # For s390x-virtio-ccw machine type started with -smp 1,maxcpus=2 -cpu qemu
668 # -> { "execute": "query-hotpluggable-cpus" }
671 # "type": "qemu-s390x-cpu", "vcpus-count": 1,
672 # "props": { "core-id": 1 }
675 # "qom-path": "/machine/unattached/device[0]",
676 # "type": "qemu-s390x-cpu", "vcpus-count": 1,
677 # "props": { "core-id": 0 }
682 { 'command': 'query-hotpluggable-cpus', 'returns': ['HotpluggableCPU'],
683 'allow-preconfig': true }
688 # Runtime equivalent of '-numa' CLI option, available at
689 # preconfigure stage to configure numa mapping before initializing
694 { 'command': 'set-numa-node', 'boxed': true,
695 'data': 'NumaOptions',
696 'allow-preconfig': true