xref: /openbmc/qemu/qapi/run-state.json (revision d884e272)
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# Since: 6.0
401#
402# Example:
403#
404#     -> { "execute": "set-action",
405#          "arguments": { "reboot": "shutdown",
406#                         "shutdown" : "pause",
407#                         "panic": "pause",
408#                         "watchdog": "inject-nmi" } }
409#     <- { "return": {} }
410##
411{ 'command': 'set-action',
412  'data': { '*reboot': 'RebootAction',
413            '*shutdown': 'ShutdownAction',
414            '*panic': 'PanicAction',
415            '*watchdog': 'WatchdogAction' },
416  'allow-preconfig': true }
417
418##
419# @GUEST_PANICKED:
420#
421# Emitted when guest OS panic is detected
422#
423# @action: action that has been taken, currently always "pause"
424#
425# @info: information about a panic (since 2.9)
426#
427# Since: 1.5
428#
429# Example:
430#
431#     <- { "event": "GUEST_PANICKED",
432#          "data": { "action": "pause" },
433#          "timestamp": { "seconds": 1648245231, "microseconds": 900001 } }
434##
435{ 'event': 'GUEST_PANICKED',
436  'data': { 'action': 'GuestPanicAction', '*info': 'GuestPanicInformation' } }
437
438##
439# @GUEST_CRASHLOADED:
440#
441# Emitted when guest OS crash loaded is detected
442#
443# @action: action that has been taken, currently always "run"
444#
445# @info: information about a panic
446#
447# Since: 5.0
448#
449# Example:
450#
451#     <- { "event": "GUEST_CRASHLOADED",
452#          "data": { "action": "run" },
453#          "timestamp": { "seconds": 1648245259, "microseconds": 893771 } }
454##
455{ 'event': 'GUEST_CRASHLOADED',
456  'data': { 'action': 'GuestPanicAction', '*info': 'GuestPanicInformation' } }
457
458##
459# @GuestPanicAction:
460#
461# An enumeration of the actions taken when guest OS panic is detected
462#
463# @pause: system pauses
464#
465# @poweroff: system powers off (since 2.8)
466#
467# @run: system continues to run (since 5.0)
468#
469# Since: 2.1
470##
471{ 'enum': 'GuestPanicAction',
472  'data': [ 'pause', 'poweroff', 'run' ] }
473
474##
475# @GuestPanicInformationType:
476#
477# An enumeration of the guest panic information types
478#
479# @hyper-v: hyper-v guest panic information type
480#
481# @s390: s390 guest panic information type (Since: 2.12)
482#
483# Since: 2.9
484##
485{ 'enum': 'GuestPanicInformationType',
486  'data': [ 'hyper-v', 's390' ] }
487
488##
489# @GuestPanicInformation:
490#
491# Information about a guest panic
492#
493# @type: Crash type that defines the hypervisor specific information
494#
495# Since: 2.9
496##
497{'union': 'GuestPanicInformation',
498 'base': {'type': 'GuestPanicInformationType'},
499 'discriminator': 'type',
500 'data': {'hyper-v': 'GuestPanicInformationHyperV',
501          's390': 'GuestPanicInformationS390'}}
502
503##
504# @GuestPanicInformationHyperV:
505#
506# Hyper-V specific guest panic information (HV crash MSRs)
507#
508# Since: 2.9
509##
510{'struct': 'GuestPanicInformationHyperV',
511 'data': {'arg1': 'uint64',
512          'arg2': 'uint64',
513          'arg3': 'uint64',
514          'arg4': 'uint64',
515          'arg5': 'uint64'}}
516
517##
518# @S390CrashReason:
519#
520# Reason why the CPU is in a crashed state.
521#
522# @unknown: no crash reason was set
523#
524# @disabled-wait: the CPU has entered a disabled wait state
525#
526# @extint-loop: clock comparator or cpu timer interrupt with new PSW
527#     enabled for external interrupts
528#
529# @pgmint-loop: program interrupt with BAD new PSW
530#
531# @opint-loop: operation exception interrupt with invalid code at the
532#     program interrupt new PSW
533#
534# Since: 2.12
535##
536{ 'enum': 'S390CrashReason',
537  'data': [ 'unknown',
538            'disabled-wait',
539            'extint-loop',
540            'pgmint-loop',
541            'opint-loop' ] }
542
543##
544# @GuestPanicInformationS390:
545#
546# S390 specific guest panic information (PSW)
547#
548# @core: core id of the CPU that crashed
549#
550# @psw-mask: control fields of guest PSW
551#
552# @psw-addr: guest instruction address
553#
554# @reason: guest crash reason
555#
556# Since: 2.12
557##
558{'struct': 'GuestPanicInformationS390',
559 'data': {'core': 'uint32',
560          'psw-mask': 'uint64',
561          'psw-addr': 'uint64',
562          'reason': 'S390CrashReason'}}
563
564##
565# @MEMORY_FAILURE:
566#
567# Emitted when a memory failure occurs on host side.
568#
569# @recipient: recipient is defined as @MemoryFailureRecipient.
570#
571# @action: action that has been taken.  action is defined as
572#     @MemoryFailureAction.
573#
574# @flags: flags for MemoryFailureAction.  action is defined as
575#     @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{ 'event': 'MEMORY_FAILURE',
589  'data': { 'recipient': 'MemoryFailureRecipient',
590            'action': 'MemoryFailureAction',
591            'flags': 'MemoryFailureFlags'} }
592
593##
594# @MemoryFailureRecipient:
595#
596# Hardware memory failure occurs, handled by recipient.
597#
598# @hypervisor: memory failure at QEMU process address space.  (none
599#     guest memory, but used by QEMU itself).
600#
601# @guest: memory failure at guest memory,
602#
603# Since: 5.2
604##
605{ 'enum': 'MemoryFailureRecipient',
606  'data': [ 'hypervisor',
607            'guest' ] }
608
609##
610# @MemoryFailureAction:
611#
612# Actions taken by QEMU in response to a hardware memory failure.
613#
614# @ignore: the memory failure could be ignored.  This will only be the
615#     case for action-optional failures.
616#
617# @inject: memory failure occurred in guest memory, the guest enabled
618#     MCE handling mechanism, and QEMU could inject the MCE into the
619#     guest successfully.
620#
621# @fatal: the failure is unrecoverable.  This occurs for
622#     action-required failures if the recipient is the hypervisor;
623#     QEMU will exit.
624#
625# @reset: the failure is unrecoverable but confined to the guest.
626#     This 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 failure
646#     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
660#     exit happens.
661#
662# @internal-error: enable the feature, raise a internal error if the
663#     notify VM exit happens.
664#
665# @disable: disable the feature.
666#
667# Since: 7.2
668##
669{ 'enum': 'NotifyVmexitOption',
670  'data': [ 'run', 'internal-error', 'disable' ] }
671