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