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