xref: /openbmc/qemu/qapi/run-state.json (revision 7a5951f6)
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##
265{ 'event': 'SUSPEND_DISK' }
266
267##
268# @WAKEUP:
269#
270# Emitted when the guest has woken up from suspend state and is running
271#
272# Since: 1.1
273#
274# Example:
275#
276# <- { "event": "WAKEUP",
277#      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
278#
279##
280{ 'event': 'WAKEUP' }
281
282##
283# @WATCHDOG:
284#
285# Emitted when the watchdog device's timer is expired
286#
287# @action: action that has been taken
288#
289# Note: If action is "reset", "shutdown", or "pause" the WATCHDOG event is
290#       followed respectively by the RESET, SHUTDOWN, or STOP events
291#
292# Note: This event is rate-limited.
293#
294# Since: 0.13
295#
296# Example:
297#
298# <- { "event": "WATCHDOG",
299#      "data": { "action": "reset" },
300#      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
301#
302##
303{ 'event': 'WATCHDOG',
304  'data': { 'action': 'WatchdogAction' } }
305
306##
307# @WatchdogAction:
308#
309# An enumeration of the actions taken when the watchdog device's timer is
310# expired
311#
312# @reset: system resets
313#
314# @shutdown: system shutdown, note that it is similar to @powerdown, which
315#            tries to set to system status and notify guest
316#
317# @poweroff: system poweroff, the emulator program exits
318#
319# @pause: system pauses, similar to @stop
320#
321# @debug: system enters debug state
322#
323# @none: nothing is done
324#
325# @inject-nmi: a non-maskable interrupt is injected into the first VCPU (all
326#              VCPUS on x86) (since 2.4)
327#
328# Since: 2.1
329##
330{ 'enum': 'WatchdogAction',
331  'data': [ 'reset', 'shutdown', 'poweroff', 'pause', 'debug', 'none',
332            'inject-nmi' ] }
333
334##
335# @RebootAction:
336#
337# Possible QEMU actions upon guest reboot
338#
339# @reset: Reset the VM
340#
341# @shutdown: Shutdown the VM and exit, according to the shutdown action
342#
343# Since: 6.0
344##
345{ 'enum': 'RebootAction',
346  'data': [ 'reset', 'shutdown' ] }
347
348##
349# @ShutdownAction:
350#
351# Possible QEMU actions upon guest shutdown
352#
353# @poweroff: Shutdown the VM and exit
354#
355# @pause: pause the VM
356#
357# Since: 6.0
358##
359{ 'enum': 'ShutdownAction',
360  'data': [ 'poweroff', 'pause' ] }
361
362##
363# @PanicAction:
364#
365# @none: Continue VM execution
366#
367# @pause: Pause the VM
368#
369# @shutdown: Shutdown the VM and exit, according to the shutdown action
370#
371# @exit-failure: Shutdown the VM and exit with nonzero status
372#                (since 7.1)
373#
374# Since: 6.0
375##
376{ 'enum': 'PanicAction',
377  'data': [ 'pause', 'shutdown', 'exit-failure', 'none' ] }
378
379##
380# @watchdog-set-action:
381#
382# Set watchdog action
383#
384# Since: 2.11
385##
386{ 'command': 'watchdog-set-action', 'data' : {'action': 'WatchdogAction'} }
387
388##
389# @set-action:
390#
391# Set the actions that will be taken by the emulator in response to guest
392# events.
393#
394# @reboot: @RebootAction action taken on guest reboot.
395#
396# @shutdown: @ShutdownAction action taken on guest shutdown.
397#
398# @panic: @PanicAction action taken on guest panic.
399#
400# @watchdog: @WatchdogAction action taken when watchdog timer expires .
401#
402# Returns: Nothing on success.
403#
404# Since: 6.0
405#
406# Example:
407#
408# -> { "execute": "set-action",
409#      "arguments": { "reboot": "shutdown",
410#                     "shutdown" : "pause",
411#                     "panic": "pause",
412#                     "watchdog": "inject-nmi" } }
413# <- { "return": {} }
414##
415{ 'command': 'set-action',
416  'data': { '*reboot': 'RebootAction',
417            '*shutdown': 'ShutdownAction',
418            '*panic': 'PanicAction',
419            '*watchdog': 'WatchdogAction' },
420  'allow-preconfig': true }
421
422##
423# @GUEST_PANICKED:
424#
425# Emitted when guest OS panic is detected
426#
427# @action: action that has been taken, currently always "pause"
428#
429# @info: information about a panic (since 2.9)
430#
431# Since: 1.5
432#
433# Example:
434#
435# <- { "event": "GUEST_PANICKED",
436#      "data": { "action": "pause" },
437#      "timestamp": { "seconds": 1648245231, "microseconds": 900001 } }
438#
439##
440{ 'event': 'GUEST_PANICKED',
441  'data': { 'action': 'GuestPanicAction', '*info': 'GuestPanicInformation' } }
442
443##
444# @GUEST_CRASHLOADED:
445#
446# Emitted when guest OS crash loaded is detected
447#
448# @action: action that has been taken, currently always "run"
449#
450# @info: information about a panic
451#
452# Since: 5.0
453#
454# Example:
455#
456# <- { "event": "GUEST_CRASHLOADED",
457#      "data": { "action": "run" },
458#      "timestamp": { "seconds": 1648245259, "microseconds": 893771 } }
459#
460##
461{ 'event': 'GUEST_CRASHLOADED',
462  'data': { 'action': 'GuestPanicAction', '*info': 'GuestPanicInformation' } }
463
464##
465# @GuestPanicAction:
466#
467# An enumeration of the actions taken when guest OS panic is detected
468#
469# @pause: system pauses
470#
471# Since: 2.1 (poweroff since 2.8, run since 5.0)
472##
473{ 'enum': 'GuestPanicAction',
474  'data': [ 'pause', 'poweroff', 'run' ] }
475
476##
477# @GuestPanicInformationType:
478#
479# An enumeration of the guest panic information types
480#
481# @hyper-v: hyper-v guest panic information type
482#
483# @s390: s390 guest panic information type (Since: 2.12)
484#
485# Since: 2.9
486##
487{ 'enum': 'GuestPanicInformationType',
488  'data': [ 'hyper-v', 's390' ] }
489
490##
491# @GuestPanicInformation:
492#
493# Information about a guest panic
494#
495# @type: Crash type that defines the hypervisor specific information
496#
497# Since: 2.9
498##
499{'union': 'GuestPanicInformation',
500 'base': {'type': 'GuestPanicInformationType'},
501 'discriminator': 'type',
502 'data': { 'hyper-v': 'GuestPanicInformationHyperV',
503           's390': 'GuestPanicInformationS390' } }
504
505##
506# @GuestPanicInformationHyperV:
507#
508# Hyper-V specific guest panic information (HV crash MSRs)
509#
510# Since: 2.9
511##
512{'struct': 'GuestPanicInformationHyperV',
513 'data': { 'arg1': 'uint64',
514           'arg2': 'uint64',
515           'arg3': 'uint64',
516           'arg4': 'uint64',
517           'arg5': 'uint64' } }
518
519##
520# @S390CrashReason:
521#
522# Reason why the CPU is in a crashed state.
523#
524# @unknown: no crash reason was set
525#
526# @disabled-wait: the CPU has entered a disabled wait state
527#
528# @extint-loop: clock comparator or cpu timer interrupt with new PSW enabled
529#               for external interrupts
530#
531# @pgmint-loop: program interrupt with BAD new PSW
532#
533# @opint-loop: operation exception interrupt with invalid code at the program
534#              interrupt new PSW
535#
536# Since: 2.12
537##
538{ 'enum': 'S390CrashReason',
539  'data': [ 'unknown',
540            'disabled-wait',
541            'extint-loop',
542            'pgmint-loop',
543            'opint-loop' ] }
544
545##
546# @GuestPanicInformationS390:
547#
548# S390 specific guest panic information (PSW)
549#
550# @core: core id of the CPU that crashed
551# @psw-mask: control fields of guest PSW
552# @psw-addr: guest instruction address
553# @reason: guest crash reason
554#
555# Since: 2.12
556##
557{'struct': 'GuestPanicInformationS390',
558 'data': { 'core': 'uint32',
559           'psw-mask': 'uint64',
560           'psw-addr': 'uint64',
561           'reason': 'S390CrashReason' } }
562
563##
564# @MEMORY_FAILURE:
565#
566# Emitted when a memory failure occurs on host side.
567#
568# @recipient: recipient is defined as @MemoryFailureRecipient.
569#
570# @action: action that has been taken. action is defined as @MemoryFailureAction.
571#
572# @flags: flags for MemoryFailureAction. action is defined as @MemoryFailureFlags.
573#
574# Since: 5.2
575#
576# Example:
577#
578# <- { "event": "MEMORY_FAILURE",
579#      "data": { "recipient": "hypervisor",
580#                "action": "fatal",
581#                "flags": { "action-required": false,
582#                           "recursive": false } },
583#      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
584#
585##
586{ 'event': 'MEMORY_FAILURE',
587  'data': { 'recipient': 'MemoryFailureRecipient',
588            'action': 'MemoryFailureAction',
589            'flags': 'MemoryFailureFlags'} }
590
591##
592# @MemoryFailureRecipient:
593#
594# Hardware memory failure occurs, handled by recipient.
595#
596# @hypervisor: memory failure at QEMU process address space.
597#              (none guest memory, but used by QEMU itself).
598#
599# @guest: memory failure at guest memory,
600#
601# Since: 5.2
602##
603{ 'enum': 'MemoryFailureRecipient',
604  'data': [ 'hypervisor',
605            'guest' ] }
606
607##
608# @MemoryFailureAction:
609#
610# Actions taken by QEMU in response to a hardware memory failure.
611#
612# @ignore: the memory failure could be ignored.  This will only be the case
613#          for action-optional failures.
614#
615# @inject: memory failure occurred in guest memory, the guest enabled MCE
616#          handling mechanism, and QEMU could inject the MCE into the guest
617#          successfully.
618#
619# @fatal: the failure is unrecoverable.  This occurs for action-required
620#         failures if the recipient is the hypervisor; QEMU will exit.
621#
622# @reset: the failure is unrecoverable but confined to the guest.  This
623#         occurs if the recipient is a guest guest which is not ready
624#         to handle memory failures.
625#
626# Since: 5.2
627##
628{ 'enum': 'MemoryFailureAction',
629  'data': [ 'ignore',
630            'inject',
631            'fatal',
632            'reset' ] }
633
634##
635# @MemoryFailureFlags:
636#
637# Additional information on memory failures.
638#
639# @action-required: whether a memory failure event is action-required
640#                   or action-optional (e.g. a failure during memory scrub).
641#
642# @recursive: whether the failure occurred while the previous
643#             failure was still in progress.
644#
645# Since: 5.2
646##
647{ 'struct': 'MemoryFailureFlags',
648  'data': { 'action-required': 'bool',
649            'recursive': 'bool'} }
650
651##
652# @NotifyVmexitOption:
653#
654# An enumeration of the options specified when enabling notify VM exit
655#
656# @run: enable the feature, do nothing and continue if the notify VM exit happens.
657#
658# @internal-error: enable the feature, raise a internal error if the notify
659#                  VM exit happens.
660#
661# @disable: disable the feature.
662#
663# Since: 7.2
664##
665{ 'enum': 'NotifyVmexitOption',
666  'data': [ 'run', 'internal-error', 'disable' ] }