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