1# -*- Mode: Python -*- 2# vim: filetype=python 3# 4 5## 6# = VM run state 7## 8 9## 10# @RunState: 11# 12# An enumeration of VM run states. 13# 14# @debug: QEMU is running on a debugger 15# 16# @finish-migrate: guest is paused to finish the migration process 17# 18# @inmigrate: guest is paused waiting for an incoming migration. Note 19# that this state does not tell whether the machine will start at 20# the end of the migration. This depends on the command-line -S 21# option and any invocation of 'stop' or 'cont' that has happened 22# since QEMU was started. 23# 24# @internal-error: An internal error that prevents further guest 25# execution has occurred 26# 27# @io-error: the last IOP has failed and the device is configured to 28# pause on I/O errors 29# 30# @paused: guest has been paused via the 'stop' command 31# 32# @postmigrate: guest is paused following a successful 'migrate' 33# 34# @prelaunch: QEMU was started with -S and guest has not started 35# 36# @restore-vm: guest is paused to restore VM state 37# 38# @running: guest is actively running 39# 40# @save-vm: guest is paused to save the VM state 41# 42# @shutdown: guest is shut down (and -no-shutdown is in use) 43# 44# @suspended: guest is suspended (ACPI S3) 45# 46# @watchdog: the watchdog action is configured to pause and has been 47# triggered 48# 49# @guest-panicked: guest has been panicked as a result of guest OS 50# panic 51# 52# @colo: guest is paused to save/restore VM state under colo 53# checkpoint, VM can not get into this state unless colo 54# capability is enabled for migration. (since 2.8) 55## 56{ 'enum': 'RunState', 57 'data': [ 'debug', 'inmigrate', 'internal-error', 'io-error', 'paused', 58 'postmigrate', 'prelaunch', 'finish-migrate', 'restore-vm', 59 'running', 'save-vm', 'shutdown', 'suspended', 'watchdog', 60 'guest-panicked', 'colo' ] } 61 62## 63# @ShutdownCause: 64# 65# An enumeration of reasons for a Shutdown. 66# 67# @none: No shutdown request pending 68# 69# @host-error: An error prevents further use of guest 70# 71# @host-qmp-quit: Reaction to the QMP command 'quit' 72# 73# @host-qmp-system-reset: Reaction to the QMP command 'system_reset' 74# 75# @host-signal: Reaction to a signal, such as SIGINT 76# 77# @host-ui: Reaction to a UI event, like window close 78# 79# @guest-shutdown: Guest shutdown/suspend request, via ACPI or other 80# hardware-specific means 81# 82# @guest-reset: Guest reset request, and command line turns that into 83# a shutdown 84# 85# @guest-panic: Guest panicked, and command line turns that into a 86# shutdown 87# 88# @subsystem-reset: Partial guest reset that does not trigger QMP 89# events and ignores --no-reboot. This is useful for sanitizing 90# hypercalls on s390 that are used during kexec/kdump/boot 91# 92# @snapshot-load: A snapshot is being loaded by the record & replay 93# subsystem. This value is used only within QEMU. It doesn't 94# occur in QMP. (since 7.2) 95## 96{ 'enum': 'ShutdownCause', 97 # Beware, shutdown_caused_by_guest() depends on enumeration order 98 'data': [ 'none', 'host-error', 'host-qmp-quit', 'host-qmp-system-reset', 99 'host-signal', 'host-ui', 'guest-shutdown', 'guest-reset', 100 'guest-panic', 'subsystem-reset', 'snapshot-load'] } 101 102## 103# @StatusInfo: 104# 105# Information about VM run state 106# 107# @running: true if all VCPUs are runnable, false if not runnable 108# 109# @status: the virtual machine @RunState 110# 111# Since: 0.14 112# 113## 114{ 'struct': 'StatusInfo', 115 'data': {'running': 'bool', 116 'status': 'RunState'} } 117 118## 119# @query-status: 120# 121# Query the run status of the VM 122# 123# Returns: @StatusInfo reflecting the VM 124# 125# Since: 0.14 126# 127# Example: 128# 129# -> { "execute": "query-status" } 130# <- { "return": { "running": true, 131# "status": "running" } } 132## 133{ 'command': 'query-status', 'returns': 'StatusInfo', 134 'allow-preconfig': true } 135 136## 137# @SHUTDOWN: 138# 139# Emitted when the virtual machine has shut down, indicating that qemu 140# is about to exit. 141# 142# @guest: If true, the shutdown was triggered by a guest request (such 143# as a guest-initiated ACPI shutdown request or other 144# hardware-specific action) rather than a host request (such as 145# sending qemu a SIGINT). (since 2.10) 146# 147# @reason: The @ShutdownCause which resulted in the SHUTDOWN. (since 148# 4.0) 149# 150# Note: If the command-line option "-no-shutdown" has been specified, 151# qemu will not exit, and a STOP event will eventually follow the 152# SHUTDOWN event 153# 154# Since: 0.12 155# 156# Example: 157# 158# <- { "event": "SHUTDOWN", 159# "data": { "guest": true, "reason": "guest-shutdown" }, 160# "timestamp": { "seconds": 1267040730, "microseconds": 682951 } } 161## 162{ 'event': 'SHUTDOWN', 'data': { 'guest': 'bool', 'reason': 'ShutdownCause' } } 163 164## 165# @POWERDOWN: 166# 167# Emitted when the virtual machine is powered down through the power 168# control system, such as via ACPI. 169# 170# Since: 0.12 171# 172# Example: 173# 174# <- { "event": "POWERDOWN", 175# "timestamp": { "seconds": 1267040730, "microseconds": 682951 } } 176## 177{ 'event': 'POWERDOWN' } 178 179## 180# @RESET: 181# 182# Emitted when the virtual machine is reset 183# 184# @guest: If true, the reset was triggered by a guest request (such as 185# a guest-initiated ACPI reboot request or other hardware-specific 186# action) rather than a host request (such as the QMP command 187# system_reset). (since 2.10) 188# 189# @reason: The @ShutdownCause of the RESET. (since 4.0) 190# 191# Since: 0.12 192# 193# Example: 194# 195# <- { "event": "RESET", 196# "data": { "guest": false, "reason": "guest-reset" }, 197# "timestamp": { "seconds": 1267041653, "microseconds": 9518 } } 198## 199{ 'event': 'RESET', 'data': { 'guest': 'bool', 'reason': 'ShutdownCause' } } 200 201## 202# @STOP: 203# 204# Emitted when the virtual machine is stopped 205# 206# Since: 0.12 207# 208# Example: 209# 210# <- { "event": "STOP", 211# "timestamp": { "seconds": 1267041730, "microseconds": 281295 } } 212## 213{ 'event': 'STOP' } 214 215## 216# @RESUME: 217# 218# Emitted when the virtual machine resumes execution 219# 220# Since: 0.12 221# 222# Example: 223# 224# <- { "event": "RESUME", 225# "timestamp": { "seconds": 1271770767, "microseconds": 582542 } } 226## 227{ 'event': 'RESUME' } 228 229## 230# @SUSPEND: 231# 232# Emitted when guest enters a hardware suspension state, for example, 233# S3 state, which is sometimes called standby state 234# 235# Since: 1.1 236# 237# Example: 238# 239# <- { "event": "SUSPEND", 240# "timestamp": { "seconds": 1344456160, "microseconds": 309119 } } 241## 242{ 'event': 'SUSPEND' } 243 244## 245# @SUSPEND_DISK: 246# 247# Emitted when guest enters a hardware suspension state with data 248# saved on disk, for example, S4 state, which is sometimes called 249# hibernate state 250# 251# Note: QEMU shuts down (similar to event @SHUTDOWN) when entering 252# this state 253# 254# Since: 1.2 255# 256# Example: 257# 258# <- { "event": "SUSPEND_DISK", 259# "timestamp": { "seconds": 1344456160, "microseconds": 309119 } } 260## 261{ 'event': 'SUSPEND_DISK' } 262 263## 264# @WAKEUP: 265# 266# Emitted when the guest has woken up from suspend state and is 267# running 268# 269# Since: 1.1 270# 271# Example: 272# 273# <- { "event": "WAKEUP", 274# "timestamp": { "seconds": 1344522075, "microseconds": 745528 } } 275## 276{ 'event': 'WAKEUP' } 277 278## 279# @WATCHDOG: 280# 281# Emitted when the watchdog device's timer is expired 282# 283# @action: action that has been taken 284# 285# Note: If action is "reset", "shutdown", or "pause" the WATCHDOG 286# event is followed respectively by the RESET, SHUTDOWN, or STOP 287# events 288# 289# Note: This event is rate-limited. 290# 291# Since: 0.13 292# 293# Example: 294# 295# <- { "event": "WATCHDOG", 296# "data": { "action": "reset" }, 297# "timestamp": { "seconds": 1267061043, "microseconds": 959568 } } 298## 299{ 'event': 'WATCHDOG', 300 'data': { 'action': 'WatchdogAction' } } 301 302## 303# @WatchdogAction: 304# 305# An enumeration of the actions taken when the watchdog device's timer 306# is expired 307# 308# @reset: system resets 309# 310# @shutdown: system shutdown, note that it is similar to @powerdown, 311# which tries to set to system status and notify guest 312# 313# @poweroff: system poweroff, the emulator program exits 314# 315# @pause: system pauses, similar to @stop 316# 317# @debug: system enters debug state 318# 319# @none: nothing is done 320# 321# @inject-nmi: a non-maskable interrupt is injected into the first 322# VCPU (all VCPUS on x86) (since 2.4) 323# 324# Since: 2.1 325## 326{ 'enum': 'WatchdogAction', 327 'data': [ 'reset', 'shutdown', 'poweroff', 'pause', 'debug', 'none', 328 'inject-nmi' ] } 329 330## 331# @RebootAction: 332# 333# Possible QEMU actions upon guest reboot 334# 335# @reset: Reset the VM 336# 337# @shutdown: Shutdown the VM and exit, according to the shutdown 338# action 339# 340# Since: 6.0 341## 342{ 'enum': 'RebootAction', 343 'data': [ 'reset', 'shutdown' ] } 344 345## 346# @ShutdownAction: 347# 348# Possible QEMU actions upon guest shutdown 349# 350# @poweroff: Shutdown the VM and exit 351# 352# @pause: pause the VM 353# 354# Since: 6.0 355## 356{ 'enum': 'ShutdownAction', 357 'data': [ 'poweroff', 'pause' ] } 358 359## 360# @PanicAction: 361# 362# @none: Continue VM execution 363# 364# @pause: Pause the VM 365# 366# @shutdown: Shutdown the VM and exit, according to the shutdown 367# action 368# 369# @exit-failure: Shutdown the VM and exit with nonzero status (since 370# 7.1) 371# 372# Since: 6.0 373## 374{ 'enum': 'PanicAction', 375 'data': [ 'pause', 'shutdown', 'exit-failure', 'none' ] } 376 377## 378# @watchdog-set-action: 379# 380# Set watchdog action 381# 382# Since: 2.11 383## 384{ 'command': 'watchdog-set-action', 'data' : {'action': 'WatchdogAction'} } 385 386## 387# @set-action: 388# 389# Set the actions that will be taken by the emulator in response to 390# guest events. 391# 392# @reboot: @RebootAction action taken on guest reboot. 393# 394# @shutdown: @ShutdownAction action taken on guest shutdown. 395# 396# @panic: @PanicAction action taken on guest panic. 397# 398# @watchdog: @WatchdogAction action taken when watchdog timer expires 399# . 400# 401# Returns: Nothing on success. 402# 403# Since: 6.0 404# 405# Example: 406# 407# -> { "execute": "set-action", 408# "arguments": { "reboot": "shutdown", 409# "shutdown" : "pause", 410# "panic": "pause", 411# "watchdog": "inject-nmi" } } 412# <- { "return": {} } 413## 414{ 'command': 'set-action', 415 'data': { '*reboot': 'RebootAction', 416 '*shutdown': 'ShutdownAction', 417 '*panic': 'PanicAction', 418 '*watchdog': 'WatchdogAction' }, 419 'allow-preconfig': true } 420 421## 422# @GUEST_PANICKED: 423# 424# Emitted when guest OS panic is detected 425# 426# @action: action that has been taken, currently always "pause" 427# 428# @info: information about a panic (since 2.9) 429# 430# Since: 1.5 431# 432# Example: 433# 434# <- { "event": "GUEST_PANICKED", 435# "data": { "action": "pause" }, 436# "timestamp": { "seconds": 1648245231, "microseconds": 900001 } } 437## 438{ 'event': 'GUEST_PANICKED', 439 'data': { 'action': 'GuestPanicAction', '*info': 'GuestPanicInformation' } } 440 441## 442# @GUEST_CRASHLOADED: 443# 444# Emitted when guest OS crash loaded is detected 445# 446# @action: action that has been taken, currently always "run" 447# 448# @info: information about a panic 449# 450# Since: 5.0 451# 452# Example: 453# 454# <- { "event": "GUEST_CRASHLOADED", 455# "data": { "action": "run" }, 456# "timestamp": { "seconds": 1648245259, "microseconds": 893771 } } 457## 458{ 'event': 'GUEST_CRASHLOADED', 459 'data': { 'action': 'GuestPanicAction', '*info': 'GuestPanicInformation' } } 460 461## 462# @GuestPanicAction: 463# 464# An enumeration of the actions taken when guest OS panic is detected 465# 466# @pause: system pauses 467# 468# @poweroff: system powers off (since 2.8) 469# 470# @run: system continues to run (since 5.0) 471# 472# Since: 2.1 473## 474{ 'enum': 'GuestPanicAction', 475 'data': [ 'pause', 'poweroff', 'run' ] } 476 477## 478# @GuestPanicInformationType: 479# 480# An enumeration of the guest panic information types 481# 482# @hyper-v: hyper-v guest panic information type 483# 484# @s390: s390 guest panic information type (Since: 2.12) 485# 486# Since: 2.9 487## 488{ 'enum': 'GuestPanicInformationType', 489 'data': [ 'hyper-v', 's390' ] } 490 491## 492# @GuestPanicInformation: 493# 494# Information about a guest panic 495# 496# @type: Crash type that defines the hypervisor specific information 497# 498# Since: 2.9 499## 500{'union': 'GuestPanicInformation', 501 'base': {'type': 'GuestPanicInformationType'}, 502 'discriminator': 'type', 503 'data': {'hyper-v': 'GuestPanicInformationHyperV', 504 's390': 'GuestPanicInformationS390'}} 505 506## 507# @GuestPanicInformationHyperV: 508# 509# Hyper-V specific guest panic information (HV crash MSRs) 510# 511# Since: 2.9 512## 513{'struct': 'GuestPanicInformationHyperV', 514 'data': {'arg1': 'uint64', 515 'arg2': 'uint64', 516 'arg3': 'uint64', 517 'arg4': 'uint64', 518 'arg5': 'uint64'}} 519 520## 521# @S390CrashReason: 522# 523# Reason why the CPU is in a crashed state. 524# 525# @unknown: no crash reason was set 526# 527# @disabled-wait: the CPU has entered a disabled wait state 528# 529# @extint-loop: clock comparator or cpu timer interrupt with new PSW 530# enabled for external interrupts 531# 532# @pgmint-loop: program interrupt with BAD new PSW 533# 534# @opint-loop: operation exception interrupt with invalid code at the 535# program interrupt new PSW 536# 537# Since: 2.12 538## 539{ 'enum': 'S390CrashReason', 540 'data': [ 'unknown', 541 'disabled-wait', 542 'extint-loop', 543 'pgmint-loop', 544 'opint-loop' ] } 545 546## 547# @GuestPanicInformationS390: 548# 549# S390 specific guest panic information (PSW) 550# 551# @core: core id of the CPU that crashed 552# 553# @psw-mask: control fields of guest PSW 554# 555# @psw-addr: guest instruction address 556# 557# @reason: guest crash reason 558# 559# Since: 2.12 560## 561{'struct': 'GuestPanicInformationS390', 562 'data': {'core': 'uint32', 563 'psw-mask': 'uint64', 564 'psw-addr': 'uint64', 565 'reason': 'S390CrashReason'}} 566 567## 568# @MEMORY_FAILURE: 569# 570# Emitted when a memory failure occurs on host side. 571# 572# @recipient: recipient is defined as @MemoryFailureRecipient. 573# 574# @action: action that has been taken. action is defined as 575# @MemoryFailureAction. 576# 577# @flags: flags for MemoryFailureAction. action is defined as 578# @MemoryFailureFlags. 579# 580# Since: 5.2 581# 582# Example: 583# 584# <- { "event": "MEMORY_FAILURE", 585# "data": { "recipient": "hypervisor", 586# "action": "fatal", 587# "flags": { "action-required": false, 588# "recursive": false } }, 589# "timestamp": { "seconds": 1267061043, "microseconds": 959568 } } 590## 591{ 'event': 'MEMORY_FAILURE', 592 'data': { 'recipient': 'MemoryFailureRecipient', 593 'action': 'MemoryFailureAction', 594 'flags': 'MemoryFailureFlags'} } 595 596## 597# @MemoryFailureRecipient: 598# 599# Hardware memory failure occurs, handled by recipient. 600# 601# @hypervisor: memory failure at QEMU process address space. (none 602# guest memory, but used by QEMU itself). 603# 604# @guest: memory failure at guest memory, 605# 606# Since: 5.2 607## 608{ 'enum': 'MemoryFailureRecipient', 609 'data': [ 'hypervisor', 610 'guest' ] } 611 612## 613# @MemoryFailureAction: 614# 615# Actions taken by QEMU in response to a hardware memory failure. 616# 617# @ignore: the memory failure could be ignored. This will only be the 618# case for action-optional failures. 619# 620# @inject: memory failure occurred in guest memory, the guest enabled 621# MCE handling mechanism, and QEMU could inject the MCE into the 622# guest successfully. 623# 624# @fatal: the failure is unrecoverable. This occurs for 625# action-required failures if the recipient is the hypervisor; 626# QEMU will exit. 627# 628# @reset: the failure is unrecoverable but confined to the guest. 629# This occurs if the recipient is a guest guest which is not ready 630# to handle memory failures. 631# 632# Since: 5.2 633## 634{ 'enum': 'MemoryFailureAction', 635 'data': [ 'ignore', 636 'inject', 637 'fatal', 638 'reset' ] } 639 640## 641# @MemoryFailureFlags: 642# 643# Additional information on memory failures. 644# 645# @action-required: whether a memory failure event is action-required 646# or action-optional (e.g. a failure during memory scrub). 647# 648# @recursive: whether the failure occurred while the previous failure 649# was still in progress. 650# 651# Since: 5.2 652## 653{ 'struct': 'MemoryFailureFlags', 654 'data': { 'action-required': 'bool', 655 'recursive': 'bool'} } 656 657## 658# @NotifyVmexitOption: 659# 660# An enumeration of the options specified when enabling notify VM exit 661# 662# @run: enable the feature, do nothing and continue if the notify VM 663# exit happens. 664# 665# @internal-error: enable the feature, raise a internal error if the 666# notify VM exit happens. 667# 668# @disable: disable the feature. 669# 670# Since: 7.2 671## 672{ 'enum': 'NotifyVmexitOption', 673 'data': [ 'run', 'internal-error', 'disable' ] } 674