xref: /qemu/qapi/run-state.json (revision a976a99a)
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##
90{ 'enum': 'ShutdownCause',
91  # Beware, shutdown_caused_by_guest() depends on enumeration order
92  'data': [ 'none', 'host-error', 'host-qmp-quit', 'host-qmp-system-reset',
93            'host-signal', 'host-ui', 'guest-shutdown', 'guest-reset',
94            'guest-panic', 'subsystem-reset'] }
95
96##
97# @StatusInfo:
98#
99# Information about VCPU run state
100#
101# @running: true if all VCPUs are runnable, false if not runnable
102#
103# @singlestep: true if VCPUs are in single-step mode
104#
105# @status: the virtual machine @RunState
106#
107# Since: 0.14
108#
109# Notes: @singlestep is enabled through the GDB stub
110##
111{ 'struct': 'StatusInfo',
112  'data': {'running': 'bool', 'singlestep': 'bool', 'status': 'RunState'} }
113
114##
115# @query-status:
116#
117# Query the run status of all VCPUs
118#
119# Returns: @StatusInfo reflecting all VCPUs
120#
121# Since: 0.14
122#
123# Example:
124#
125# -> { "execute": "query-status" }
126# <- { "return": { "running": true,
127#                  "singlestep": false,
128#                  "status": "running" } }
129#
130##
131{ 'command': 'query-status', 'returns': 'StatusInfo',
132  'allow-preconfig': true }
133
134##
135# @SHUTDOWN:
136#
137# Emitted when the virtual machine has shut down, indicating that qemu is
138# about to exit.
139#
140# @guest: If true, the shutdown was triggered by a guest request (such as
141#         a guest-initiated ACPI shutdown request or other hardware-specific action)
142#         rather than a host request (such as sending qemu a SIGINT). (since 2.10)
143#
144# @reason: The @ShutdownCause which resulted in the SHUTDOWN. (since 4.0)
145#
146# Note: If the command-line option "-no-shutdown" has been specified, qemu will
147#       not exit, and a STOP event will eventually follow the SHUTDOWN event
148#
149# Since: 0.12
150#
151# Example:
152#
153# <- { "event": "SHUTDOWN",
154#      "data": { "guest": true, "reason": "guest-shutdown" },
155#      "timestamp": { "seconds": 1267040730, "microseconds": 682951 } }
156#
157##
158{ 'event': 'SHUTDOWN', 'data': { 'guest': 'bool', 'reason': 'ShutdownCause' } }
159
160##
161# @POWERDOWN:
162#
163# Emitted when the virtual machine is powered down through the power control
164# system, such as via ACPI.
165#
166# Since: 0.12
167#
168# Example:
169#
170# <- { "event": "POWERDOWN",
171#      "timestamp": { "seconds": 1267040730, "microseconds": 682951 } }
172#
173##
174{ 'event': 'POWERDOWN' }
175
176##
177# @RESET:
178#
179# Emitted when the virtual machine is reset
180#
181# @guest: If true, the reset was triggered by a guest request (such as
182#         a guest-initiated ACPI reboot request or other hardware-specific action)
183#         rather than a host request (such as the QMP command system_reset).
184#         (since 2.10)
185#
186# @reason: The @ShutdownCause of the RESET. (since 4.0)
187#
188# Since: 0.12
189#
190# Example:
191#
192# <- { "event": "RESET",
193#      "data": { "guest": false, "reason": "guest-reset" },
194#      "timestamp": { "seconds": 1267041653, "microseconds": 9518 } }
195#
196##
197{ 'event': 'RESET', 'data': { 'guest': 'bool', 'reason': 'ShutdownCause' } }
198
199##
200# @STOP:
201#
202# Emitted when the virtual machine is stopped
203#
204# Since: 0.12
205#
206# Example:
207#
208# <- { "event": "STOP",
209#      "timestamp": { "seconds": 1267041730, "microseconds": 281295 } }
210#
211##
212{ 'event': 'STOP' }
213
214##
215# @RESUME:
216#
217# Emitted when the virtual machine resumes execution
218#
219# Since: 0.12
220#
221# Example:
222#
223# <- { "event": "RESUME",
224#      "timestamp": { "seconds": 1271770767, "microseconds": 582542 } }
225#
226##
227{ 'event': 'RESUME' }
228
229##
230# @SUSPEND:
231#
232# Emitted when guest enters a hardware suspension state, for example, S3 state,
233# 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##
243{ 'event': 'SUSPEND' }
244
245##
246# @SUSPEND_DISK:
247#
248# Emitted when guest enters a hardware suspension state with data saved on
249# disk, for example, S4 state, which is sometimes called hibernate state
250#
251# Note: QEMU shuts down (similar to event @SHUTDOWN) when entering this state
252#
253# Since: 1.2
254#
255# Example:
256#
257# <-   { "event": "SUSPEND_DISK",
258#        "timestamp": { "seconds": 1344456160, "microseconds": 309119 } }
259#
260##
261{ 'event': 'SUSPEND_DISK' }
262
263##
264# @WAKEUP:
265#
266# Emitted when the guest has woken up from suspend state and is running
267#
268# Since: 1.1
269#
270# Example:
271#
272# <- { "event": "WAKEUP",
273#      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
274#
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 event is
286#       followed respectively by the RESET, SHUTDOWN, or STOP events
287#
288# Note: This event is rate-limited.
289#
290# Since: 0.13
291#
292# Example:
293#
294# <- { "event": "WATCHDOG",
295#      "data": { "action": "reset" },
296#      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
297#
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 is
306# expired
307#
308# @reset: system resets
309#
310# @shutdown: system shutdown, note that it is similar to @powerdown, which
311#            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 VCPU (all
322#              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 action
338#
339# Since: 6.0
340##
341{ 'enum': 'RebootAction',
342  'data': [ 'reset', 'shutdown' ] }
343
344##
345# @ShutdownAction:
346#
347# Possible QEMU actions upon guest shutdown
348#
349# @poweroff: Shutdown the VM and exit
350#
351# @pause: pause the VM
352#
353# Since: 6.0
354##
355{ 'enum': 'ShutdownAction',
356  'data': [ 'poweroff', 'pause' ] }
357
358##
359# @PanicAction:
360#
361# @none: Continue VM execution
362#
363# @pause: Pause the VM
364#
365# @shutdown: Shutdown the VM and exit, according to the shutdown action
366#
367# @exit-failure: Shutdown the VM and exit with nonzero status
368#                (since 7.1)
369#
370# Since: 6.0
371##
372{ 'enum': 'PanicAction',
373  'data': [ 'pause', 'shutdown', 'exit-failure', 'none' ] }
374
375##
376# @watchdog-set-action:
377#
378# Set watchdog action
379#
380# Since: 2.11
381##
382{ 'command': 'watchdog-set-action', 'data' : {'action': 'WatchdogAction'} }
383
384##
385# @set-action:
386#
387# Set the actions that will be taken by the emulator in response to guest
388# events.
389#
390# @reboot: @RebootAction action taken on guest reboot.
391#
392# @shutdown: @ShutdownAction action taken on guest shutdown.
393#
394# @panic: @PanicAction action taken on guest panic.
395#
396# @watchdog: @WatchdogAction action taken when watchdog timer expires .
397#
398# Returns: Nothing on success.
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##
436{ 'event': 'GUEST_PANICKED',
437  'data': { 'action': 'GuestPanicAction', '*info': 'GuestPanicInformation' } }
438
439##
440# @GUEST_CRASHLOADED:
441#
442# Emitted when guest OS crash loaded is detected
443#
444# @action: action that has been taken, currently always "run"
445#
446# @info: information about a panic
447#
448# Since: 5.0
449#
450# Example:
451#
452# <- { "event": "GUEST_CRASHLOADED",
453#      "data": { "action": "run" },
454#      "timestamp": { "seconds": 1648245259, "microseconds": 893771 } }
455#
456##
457{ 'event': 'GUEST_CRASHLOADED',
458  'data': { 'action': 'GuestPanicAction', '*info': 'GuestPanicInformation' } }
459
460##
461# @GuestPanicAction:
462#
463# An enumeration of the actions taken when guest OS panic is detected
464#
465# @pause: system pauses
466#
467# Since: 2.1 (poweroff since 2.8, run since 5.0)
468##
469{ 'enum': 'GuestPanicAction',
470  'data': [ 'pause', 'poweroff', 'run' ] }
471
472##
473# @GuestPanicInformationType:
474#
475# An enumeration of the guest panic information types
476#
477# @hyper-v: hyper-v guest panic information type
478#
479# @s390: s390 guest panic information type (Since: 2.12)
480#
481# Since: 2.9
482##
483{ 'enum': 'GuestPanicInformationType',
484  'data': [ 'hyper-v', 's390' ] }
485
486##
487# @GuestPanicInformation:
488#
489# Information about a guest panic
490#
491# @type: Crash type that defines the hypervisor specific information
492#
493# Since: 2.9
494##
495{'union': 'GuestPanicInformation',
496 'base': {'type': 'GuestPanicInformationType'},
497 'discriminator': 'type',
498 'data': { 'hyper-v': 'GuestPanicInformationHyperV',
499           's390': 'GuestPanicInformationS390' } }
500
501##
502# @GuestPanicInformationHyperV:
503#
504# Hyper-V specific guest panic information (HV crash MSRs)
505#
506# Since: 2.9
507##
508{'struct': 'GuestPanicInformationHyperV',
509 'data': { 'arg1': 'uint64',
510           'arg2': 'uint64',
511           'arg3': 'uint64',
512           'arg4': 'uint64',
513           'arg5': 'uint64' } }
514
515##
516# @S390CrashReason:
517#
518# Reason why the CPU is in a crashed state.
519#
520# @unknown: no crash reason was set
521#
522# @disabled-wait: the CPU has entered a disabled wait state
523#
524# @extint-loop: clock comparator or cpu timer interrupt with new PSW enabled
525#               for external interrupts
526#
527# @pgmint-loop: program interrupt with BAD new PSW
528#
529# @opint-loop: operation exception interrupt with invalid code at the program
530#              interrupt new PSW
531#
532# Since: 2.12
533##
534{ 'enum': 'S390CrashReason',
535  'data': [ 'unknown',
536            'disabled-wait',
537            'extint-loop',
538            'pgmint-loop',
539            'opint-loop' ] }
540
541##
542# @GuestPanicInformationS390:
543#
544# S390 specific guest panic information (PSW)
545#
546# @core: core id of the CPU that crashed
547# @psw-mask: control fields of guest PSW
548# @psw-addr: guest instruction address
549# @reason: guest crash reason
550#
551# Since: 2.12
552##
553{'struct': 'GuestPanicInformationS390',
554 'data': { 'core': 'uint32',
555           'psw-mask': 'uint64',
556           'psw-addr': 'uint64',
557           'reason': 'S390CrashReason' } }
558
559##
560# @MEMORY_FAILURE:
561#
562# Emitted when a memory failure occurs on host side.
563#
564# @recipient: recipient is defined as @MemoryFailureRecipient.
565#
566# @action: action that has been taken. action is defined as @MemoryFailureAction.
567#
568# @flags: flags for MemoryFailureAction. action is defined as @MemoryFailureFlags.
569#
570# Since: 5.2
571#
572# Example:
573#
574# <- { "event": "MEMORY_FAILURE",
575#      "data": { "recipient": "hypervisor",
576#                "action": "fatal",
577#                "flags": { "action-required": false,
578#                           "recursive": false } },
579#      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
580#
581##
582{ 'event': 'MEMORY_FAILURE',
583  'data': { 'recipient': 'MemoryFailureRecipient',
584            'action': 'MemoryFailureAction',
585            'flags': 'MemoryFailureFlags'} }
586
587##
588# @MemoryFailureRecipient:
589#
590# Hardware memory failure occurs, handled by recipient.
591#
592# @hypervisor: memory failure at QEMU process address space.
593#              (none guest memory, but used by QEMU itself).
594#
595# @guest: memory failure at guest memory,
596#
597# Since: 5.2
598##
599{ 'enum': 'MemoryFailureRecipient',
600  'data': [ 'hypervisor',
601            'guest' ] }
602
603##
604# @MemoryFailureAction:
605#
606# Actions taken by QEMU in response to a hardware memory failure.
607#
608# @ignore: the memory failure could be ignored.  This will only be the case
609#          for action-optional failures.
610#
611# @inject: memory failure occurred in guest memory, the guest enabled MCE
612#          handling mechanism, and QEMU could inject the MCE into the guest
613#          successfully.
614#
615# @fatal: the failure is unrecoverable.  This occurs for action-required
616#         failures if the recipient is the hypervisor; QEMU will exit.
617#
618# @reset: the failure is unrecoverable but confined to the guest.  This
619#         occurs if the recipient is a guest guest which is not ready
620#         to handle memory failures.
621#
622# Since: 5.2
623##
624{ 'enum': 'MemoryFailureAction',
625  'data': [ 'ignore',
626            'inject',
627            'fatal',
628            'reset' ] }
629
630##
631# @MemoryFailureFlags:
632#
633# Additional information on memory failures.
634#
635# @action-required: whether a memory failure event is action-required
636#                   or action-optional (e.g. a failure during memory scrub).
637#
638# @recursive: whether the failure occurred while the previous
639#             failure was still in progress.
640#
641# Since: 5.2
642##
643{ 'struct': 'MemoryFailureFlags',
644  'data': { 'action-required': 'bool',
645            'recursive': 'bool'} }
646