1# -*- Mode: Python -*- 2# 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. 5 6## 7# = Machines 8## 9 10{ 'include': 'common.json' } 11 12## 13# @CpuInfoArch: 14# 15# An enumeration of cpu types that enable additional information during 16# @query-cpus and @query-cpus-fast. 17# 18# @s390: since 2.12 19# 20# @riscv: since 2.12 21# 22# Since: 2.6 23## 24{ 'enum': 'CpuInfoArch', 25 'data': ['x86', 'sparc', 'ppc', 'mips', 'tricore', 's390', 'riscv', 'other' ] } 26 27## 28# @CpuInfo: 29# 30# Information about a virtual CPU 31# 32# @CPU: the index of the virtual CPU 33# 34# @current: this only exists for backwards compatibility and should be ignored 35# 36# @halted: true if the virtual CPU is in the halt state. Halt usually refers 37# to a processor specific low power mode. 38# 39# @qom_path: path to the CPU object in the QOM tree (since 2.4) 40# 41# @thread_id: ID of the underlying host thread 42# 43# @props: properties describing to which node/socket/core/thread 44# virtual CPU belongs to, provided if supported by board (since 2.10) 45# 46# @arch: architecture of the cpu, which determines which additional fields 47# will be listed (since 2.6) 48# 49# Since: 0.14.0 50# 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. 53## 54{ 'union': 'CpuInfo', 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', 61 'ppc': 'CpuInfoPPC', 62 'mips': 'CpuInfoMIPS', 63 'tricore': 'CpuInfoTricore', 64 's390': 'CpuInfoS390', 65 'riscv': 'CpuInfoRISCV' } } 66 67## 68# @CpuInfoX86: 69# 70# Additional information about a virtual i386 or x86_64 CPU 71# 72# @pc: the 64-bit instruction pointer 73# 74# Since: 2.6 75## 76{ 'struct': 'CpuInfoX86', 'data': { 'pc': 'int' } } 77 78## 79# @CpuInfoSPARC: 80# 81# Additional information about a virtual SPARC CPU 82# 83# @pc: the PC component of the instruction pointer 84# 85# @npc: the NPC component of the instruction pointer 86# 87# Since: 2.6 88## 89{ 'struct': 'CpuInfoSPARC', 'data': { 'pc': 'int', 'npc': 'int' } } 90 91## 92# @CpuInfoPPC: 93# 94# Additional information about a virtual PPC CPU 95# 96# @nip: the instruction pointer 97# 98# Since: 2.6 99## 100{ 'struct': 'CpuInfoPPC', 'data': { 'nip': 'int' } } 101 102## 103# @CpuInfoMIPS: 104# 105# Additional information about a virtual MIPS CPU 106# 107# @PC: the instruction pointer 108# 109# Since: 2.6 110## 111{ 'struct': 'CpuInfoMIPS', 'data': { 'PC': 'int' } } 112 113## 114# @CpuInfoTricore: 115# 116# Additional information about a virtual Tricore CPU 117# 118# @PC: the instruction pointer 119# 120# Since: 2.6 121## 122{ 'struct': 'CpuInfoTricore', 'data': { 'PC': 'int' } } 123 124## 125# @CpuInfoRISCV: 126# 127# Additional information about a virtual RISCV CPU 128# 129# @pc: the instruction pointer 130# 131# Since 2.12 132## 133{ 'struct': 'CpuInfoRISCV', 'data': { 'pc': 'int' } } 134 135## 136# @CpuS390State: 137# 138# An enumeration of cpu states that can be assumed by a virtual 139# S390 CPU 140# 141# Since: 2.12 142## 143{ 'enum': 'CpuS390State', 144 'prefix': 'S390_CPU_STATE', 145 'data': [ 'uninitialized', 'stopped', 'check-stop', 'operating', 'load' ] } 146 147## 148# @CpuInfoS390: 149# 150# Additional information about a virtual S390 CPU 151# 152# @cpu-state: the virtual CPU's state 153# 154# Since: 2.12 155## 156{ 'struct': 'CpuInfoS390', 'data': { 'cpu-state': 'CpuS390State' } } 157 158## 159# @query-cpus: 160# 161# Returns a list of information about each virtual CPU. 162# 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. 168# 169# Returns: a list of @CpuInfo for each virtual CPU 170# 171# Since: 0.14.0 172# 173# Example: 174# 175# -> { "execute": "query-cpus" } 176# <- { "return": [ 177# { 178# "CPU":0, 179# "current":true, 180# "halted":false, 181# "qom_path":"/machine/unattached/device[0]", 182# "arch":"x86", 183# "pc":3227107138, 184# "thread_id":3134 185# }, 186# { 187# "CPU":1, 188# "current":false, 189# "halted":true, 190# "qom_path":"/machine/unattached/device[2]", 191# "arch":"x86", 192# "pc":7108165, 193# "thread_id":3135 194# } 195# ] 196# } 197# 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. 201# 202## 203{ 'command': 'query-cpus', 'returns': ['CpuInfo'] } 204 205## 206# @CpuInfoFast: 207# 208# Information about a virtual CPU 209# 210# @cpu-index: index of the virtual CPU 211# 212# @qom-path: path to the CPU object in the QOM tree 213# 214# @thread-id: ID of the underlying host thread 215# 216# @props: properties describing to which node/socket/core/thread 217# virtual CPU belongs to, provided if supported by board 218# 219# @arch: base architecture of the cpu; deprecated since 3.0.0 in favor 220# of @target 221# 222# @target: the QEMU system emulation target, which determines which 223# additional fields will be listed (since 3.0) 224# 225# Since: 2.12 226# 227## 228{ 'union' : 'CpuInfoFast', 229 'base' : { 'cpu-index' : 'int', 230 'qom-path' : 'str', 231 'thread-id' : 'int', 232 '*props' : 'CpuInstanceProperties', 233 'arch' : 'CpuInfoArch', 234 'target' : 'SysEmuTarget' }, 235 'discriminator' : 'target', 236 'data' : { 's390x' : 'CpuInfoS390' } } 237 238## 239# @query-cpus-fast: 240# 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. 244# 245# Returns: list of @CpuInfoFast 246# 247# Since: 2.12 248# 249# Example: 250# 251# -> { "execute": "query-cpus-fast" } 252# <- { "return": [ 253# { 254# "thread-id": 25627, 255# "props": { 256# "core-id": 0, 257# "thread-id": 0, 258# "socket-id": 0 259# }, 260# "qom-path": "/machine/unattached/device[0]", 261# "arch":"x86", 262# "target":"x86_64", 263# "cpu-index": 0 264# }, 265# { 266# "thread-id": 25628, 267# "props": { 268# "core-id": 0, 269# "thread-id": 0, 270# "socket-id": 1 271# }, 272# "qom-path": "/machine/unattached/device[2]", 273# "arch":"x86", 274# "target":"x86_64", 275# "cpu-index": 1 276# } 277# ] 278# } 279## 280{ 'command': 'query-cpus-fast', 'returns': [ 'CpuInfoFast' ] } 281 282## 283# @cpu-add: 284# 285# Adds CPU with specified ID. 286# 287# @id: ID of CPU to be created, valid values [0..max_cpus) 288# 289# Returns: Nothing on success 290# 291# Since: 1.5 292# 293# Note: This command is deprecated. The `device_add` command should be 294# used instead. See the `query-hotpluggable-cpus` command for 295# details. 296# 297# Example: 298# 299# -> { "execute": "cpu-add", "arguments": { "id": 2 } } 300# <- { "return": {} } 301# 302## 303{ 'command': 'cpu-add', 'data': {'id': 'int'} } 304 305## 306# @MachineInfo: 307# 308# Information describing a machine. 309# 310# @name: the name of the machine 311# 312# @alias: an alias for the machine name 313# 314# @is-default: whether the machine is default 315# 316# @cpu-max: maximum number of CPUs supported by the machine type 317# (since 1.5.0) 318# 319# @hotpluggable-cpus: cpu hotplug via -device is supported (since 2.7.0) 320# 321# @numa-mem-supported: true if '-numa node,mem' option is supported by 322# the machine type and false otherwise (since 4.1) 323# 324# Since: 1.2.0 325## 326{ 'struct': 'MachineInfo', 327 'data': { 'name': 'str', '*alias': 'str', 328 '*is-default': 'bool', 'cpu-max': 'int', 329 'hotpluggable-cpus': 'bool', 'numa-mem-supported': 'bool'} } 330 331## 332# @query-machines: 333# 334# Return a list of supported machines 335# 336# Returns: a list of MachineInfo 337# 338# Since: 1.2.0 339## 340{ 'command': 'query-machines', 'returns': ['MachineInfo'] } 341 342## 343# @CurrentMachineParams: 344# 345# Information describing the running machine parameters. 346# 347# @wakeup-suspend-support: true if the machine supports wake up from 348# suspend 349# 350# Since: 4.0 351## 352{ 'struct': 'CurrentMachineParams', 353 'data': { 'wakeup-suspend-support': 'bool'} } 354 355## 356# @query-current-machine: 357# 358# Return information on the current virtual machine. 359# 360# Returns: CurrentMachineParams 361# 362# Since: 4.0 363## 364{ 'command': 'query-current-machine', 'returns': 'CurrentMachineParams' } 365 366## 367# @NumaOptionsType: 368# 369# @node: NUMA nodes configuration 370# 371# @dist: NUMA distance configuration (since 2.10) 372# 373# @cpu: property based CPU(s) to node mapping (Since: 2.10) 374# 375# Since: 2.1 376## 377{ 'enum': 'NumaOptionsType', 378 'data': [ 'node', 'dist', 'cpu' ] } 379 380## 381# @NumaOptions: 382# 383# A discriminated record of NUMA options. (for OptsVisitor) 384# 385# Since: 2.1 386## 387{ 'union': 'NumaOptions', 388 'base': { 'type': 'NumaOptionsType' }, 389 'discriminator': 'type', 390 'data': { 391 'node': 'NumaNodeOptions', 392 'dist': 'NumaDistOptions', 393 'cpu': 'NumaCpuOptions' }} 394 395## 396# @NumaNodeOptions: 397# 398# Create a guest NUMA node. (for OptsVisitor) 399# 400# @nodeid: NUMA node ID (increase by 1 from 0 if omitted) 401# 402# @cpus: VCPUs belonging to this node (assign VCPUS round-robin 403# if omitted) 404# 405# @mem: memory size of this node; mutually exclusive with @memdev. 406# Equally divide total memory among nodes if both @mem and @memdev are 407# omitted. 408# 409# @memdev: memory backend object. If specified for one node, 410# it must be specified for all nodes. 411# 412# Since: 2.1 413## 414{ 'struct': 'NumaNodeOptions', 415 'data': { 416 '*nodeid': 'uint16', 417 '*cpus': ['uint16'], 418 '*mem': 'size', 419 '*memdev': 'str' }} 420 421## 422# @NumaDistOptions: 423# 424# Set the distance between 2 NUMA nodes. 425# 426# @src: source NUMA node. 427# 428# @dst: destination NUMA node. 429# 430# @val: NUMA distance from source node to destination node. 431# When a node is unreachable from another node, set the distance 432# between them to 255. 433# 434# Since: 2.10 435## 436{ 'struct': 'NumaDistOptions', 437 'data': { 438 'src': 'uint16', 439 'dst': 'uint16', 440 'val': 'uint8' }} 441 442## 443# @X86CPURegister32: 444# 445# A X86 32-bit register 446# 447# Since: 1.5 448## 449{ 'enum': 'X86CPURegister32', 450 'data': [ 'EAX', 'EBX', 'ECX', 'EDX', 'ESP', 'EBP', 'ESI', 'EDI' ] } 451 452## 453# @X86CPUFeatureWordInfo: 454# 455# Information about a X86 CPU feature word 456# 457# @cpuid-input-eax: Input EAX value for CPUID instruction for that feature word 458# 459# @cpuid-input-ecx: Input ECX value for CPUID instruction for that 460# feature word 461# 462# @cpuid-register: Output register containing the feature bits 463# 464# @features: value of output register, containing the feature bits 465# 466# Since: 1.5 467## 468{ 'struct': 'X86CPUFeatureWordInfo', 469 'data': { 'cpuid-input-eax': 'int', 470 '*cpuid-input-ecx': 'int', 471 'cpuid-register': 'X86CPURegister32', 472 'features': 'int' } } 473 474## 475# @DummyForceArrays: 476# 477# Not used by QMP; hack to let us use X86CPUFeatureWordInfoList internally 478# 479# Since: 2.5 480## 481{ 'struct': 'DummyForceArrays', 482 'data': { 'unused': ['X86CPUFeatureWordInfo'] } } 483 484## 485# @NumaCpuOptions: 486# 487# Option "-numa cpu" overrides default cpu to node mapping. 488# It accepts the same set of cpu properties as returned by 489# query-hotpluggable-cpus[].props, where node-id could be used to 490# override default node mapping. 491# 492# Since: 2.10 493## 494{ 'struct': 'NumaCpuOptions', 495 'base': 'CpuInstanceProperties', 496 'data' : {} } 497 498## 499# @HostMemPolicy: 500# 501# Host memory policy types 502# 503# @default: restore default policy, remove any nondefault policy 504# 505# @preferred: set the preferred host nodes for allocation 506# 507# @bind: a strict policy that restricts memory allocation to the 508# host nodes specified 509# 510# @interleave: memory allocations are interleaved across the set 511# of host nodes specified 512# 513# Since: 2.1 514## 515{ 'enum': 'HostMemPolicy', 516 'data': [ 'default', 'preferred', 'bind', 'interleave' ] } 517 518## 519# @Memdev: 520# 521# Information about memory backend 522# 523# @id: backend's ID if backend has 'id' property (since 2.9) 524# 525# @size: memory backend size 526# 527# @merge: enables or disables memory merge support 528# 529# @dump: includes memory backend's memory in a core dump or not 530# 531# @prealloc: enables or disables memory preallocation 532# 533# @host-nodes: host nodes for its memory policy 534# 535# @policy: memory policy of memory backend 536# 537# Since: 2.1 538## 539{ 'struct': 'Memdev', 540 'data': { 541 '*id': 'str', 542 'size': 'size', 543 'merge': 'bool', 544 'dump': 'bool', 545 'prealloc': 'bool', 546 'host-nodes': ['uint16'], 547 'policy': 'HostMemPolicy' }} 548 549## 550# @query-memdev: 551# 552# Returns information for all memory backends. 553# 554# Returns: a list of @Memdev. 555# 556# Since: 2.1 557# 558# Example: 559# 560# -> { "execute": "query-memdev" } 561# <- { "return": [ 562# { 563# "id": "mem1", 564# "size": 536870912, 565# "merge": false, 566# "dump": true, 567# "prealloc": false, 568# "host-nodes": [0, 1], 569# "policy": "bind" 570# }, 571# { 572# "size": 536870912, 573# "merge": false, 574# "dump": true, 575# "prealloc": true, 576# "host-nodes": [2, 3], 577# "policy": "preferred" 578# } 579# ] 580# } 581# 582## 583{ 'command': 'query-memdev', 'returns': ['Memdev'], 'allow-preconfig': true } 584 585## 586# @CpuInstanceProperties: 587# 588# List of properties to be used for hotplugging a CPU instance, 589# it should be passed by management with device_add command when 590# a CPU is being hotplugged. 591# 592# @node-id: NUMA node ID the CPU belongs to 593# @socket-id: socket number within node/board the CPU belongs to 594# @die-id: die number within node/board the CPU belongs to (Since 4.1) 595# @core-id: core number within die the CPU belongs to# @thread-id: thread number within core the CPU belongs to 596# 597# Note: currently there are 5 properties that could be present 598# but management should be prepared to pass through other 599# properties with device_add command to allow for future 600# interface extension. This also requires the filed names to be kept in 601# sync with the properties passed to -device/device_add. 602# 603# Since: 2.7 604## 605{ 'struct': 'CpuInstanceProperties', 606 'data': { '*node-id': 'int', 607 '*socket-id': 'int', 608 '*die-id': 'int', 609 '*core-id': 'int', 610 '*thread-id': 'int' 611 } 612} 613 614## 615# @HotpluggableCPU: 616# 617# @type: CPU object type for usage with device_add command 618# @props: list of properties to be used for hotplugging CPU 619# @vcpus-count: number of logical VCPU threads @HotpluggableCPU provides 620# @qom-path: link to existing CPU object if CPU is present or 621# omitted if CPU is not present. 622# 623# Since: 2.7 624## 625{ 'struct': 'HotpluggableCPU', 626 'data': { 'type': 'str', 627 'vcpus-count': 'int', 628 'props': 'CpuInstanceProperties', 629 '*qom-path': 'str' 630 } 631} 632 633## 634# @query-hotpluggable-cpus: 635# 636# TODO: Better documentation; currently there is none. 637# 638# Returns: a list of HotpluggableCPU objects. 639# 640# Since: 2.7 641# 642# Example: 643# 644# For pseries machine type started with -smp 2,cores=2,maxcpus=4 -cpu POWER8: 645# 646# -> { "execute": "query-hotpluggable-cpus" } 647# <- {"return": [ 648# { "props": { "core": 8 }, "type": "POWER8-spapr-cpu-core", 649# "vcpus-count": 1 }, 650# { "props": { "core": 0 }, "type": "POWER8-spapr-cpu-core", 651# "vcpus-count": 1, "qom-path": "/machine/unattached/device[0]"} 652# ]}' 653# 654# For pc machine type started with -smp 1,maxcpus=2: 655# 656# -> { "execute": "query-hotpluggable-cpus" } 657# <- {"return": [ 658# { 659# "type": "qemu64-x86_64-cpu", "vcpus-count": 1, 660# "props": {"core-id": 0, "socket-id": 1, "thread-id": 0} 661# }, 662# { 663# "qom-path": "/machine/unattached/device[0]", 664# "type": "qemu64-x86_64-cpu", "vcpus-count": 1, 665# "props": {"core-id": 0, "socket-id": 0, "thread-id": 0} 666# } 667# ]} 668# 669# For s390x-virtio-ccw machine type started with -smp 1,maxcpus=2 -cpu qemu 670# (Since: 2.11): 671# 672# -> { "execute": "query-hotpluggable-cpus" } 673# <- {"return": [ 674# { 675# "type": "qemu-s390x-cpu", "vcpus-count": 1, 676# "props": { "core-id": 1 } 677# }, 678# { 679# "qom-path": "/machine/unattached/device[0]", 680# "type": "qemu-s390x-cpu", "vcpus-count": 1, 681# "props": { "core-id": 0 } 682# } 683# ]} 684# 685## 686{ 'command': 'query-hotpluggable-cpus', 'returns': ['HotpluggableCPU'], 687 'allow-preconfig': true } 688 689## 690# @set-numa-node: 691# 692# Runtime equivalent of '-numa' CLI option, available at 693# preconfigure stage to configure numa mapping before initializing 694# machine. 695# 696# Since 3.0 697## 698{ 'command': 'set-numa-node', 'boxed': true, 699 'data': 'NumaOptions', 700 'allow-preconfig': true 701} 702