xref: /openbmc/qemu/qapi/run-state.json (revision e6dba048)
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", "data": { "guest": true },
154#      "timestamp": { "seconds": 1267040730, "microseconds": 682951 } }
155#
156##
157{ 'event': 'SHUTDOWN', 'data': { 'guest': 'bool', 'reason': 'ShutdownCause' } }
158
159##
160# @POWERDOWN:
161#
162# Emitted when the virtual machine is powered down through the power control
163# system, such as via ACPI.
164#
165# Since: 0.12
166#
167# Example:
168#
169# <- { "event": "POWERDOWN",
170#      "timestamp": { "seconds": 1267040730, "microseconds": 682951 } }
171#
172##
173{ 'event': 'POWERDOWN' }
174
175##
176# @RESET:
177#
178# Emitted when the virtual machine is reset
179#
180# @guest: If true, the reset was triggered by a guest request (such as
181#         a guest-initiated ACPI reboot request or other hardware-specific action)
182#         rather than a host request (such as the QMP command system_reset).
183#         (since 2.10)
184#
185# @reason: The @ShutdownCause of the RESET. (since 4.0)
186#
187# Since: 0.12
188#
189# Example:
190#
191# <- { "event": "RESET", "data": { "guest": false },
192#      "timestamp": { "seconds": 1267041653, "microseconds": 9518 } }
193#
194##
195{ 'event': 'RESET', 'data': { 'guest': 'bool', 'reason': 'ShutdownCause' } }
196
197##
198# @STOP:
199#
200# Emitted when the virtual machine is stopped
201#
202# Since: 0.12
203#
204# Example:
205#
206# <- { "event": "STOP",
207#      "timestamp": { "seconds": 1267041730, "microseconds": 281295 } }
208#
209##
210{ 'event': 'STOP' }
211
212##
213# @RESUME:
214#
215# Emitted when the virtual machine resumes execution
216#
217# Since: 0.12
218#
219# Example:
220#
221# <- { "event": "RESUME",
222#      "timestamp": { "seconds": 1271770767, "microseconds": 582542 } }
223#
224##
225{ 'event': 'RESUME' }
226
227##
228# @SUSPEND:
229#
230# Emitted when guest enters a hardware suspension state, for example, S3 state,
231# which is sometimes called standby state
232#
233# Since: 1.1
234#
235# Example:
236#
237# <- { "event": "SUSPEND",
238#      "timestamp": { "seconds": 1344456160, "microseconds": 309119 } }
239#
240##
241{ 'event': 'SUSPEND' }
242
243##
244# @SUSPEND_DISK:
245#
246# Emitted when guest enters a hardware suspension state with data saved on
247# disk, for example, S4 state, which is sometimes called hibernate state
248#
249# Note: QEMU shuts down (similar to event @SHUTDOWN) when entering this state
250#
251# Since: 1.2
252#
253# Example:
254#
255# <-   { "event": "SUSPEND_DISK",
256#        "timestamp": { "seconds": 1344456160, "microseconds": 309119 } }
257#
258##
259{ 'event': 'SUSPEND_DISK' }
260
261##
262# @WAKEUP:
263#
264# Emitted when the guest has woken up from suspend state and is running
265#
266# Since: 1.1
267#
268# Example:
269#
270# <- { "event": "WAKEUP",
271#      "timestamp": { "seconds": 1344522075, "microseconds": 745528 } }
272#
273##
274{ 'event': 'WAKEUP' }
275
276##
277# @WATCHDOG:
278#
279# Emitted when the watchdog device's timer is expired
280#
281# @action: action that has been taken
282#
283# Note: If action is "reset", "shutdown", or "pause" the WATCHDOG event is
284#       followed respectively by the RESET, SHUTDOWN, or STOP events
285#
286# Note: This event is rate-limited.
287#
288# Since: 0.13
289#
290# Example:
291#
292# <- { "event": "WATCHDOG",
293#      "data": { "action": "reset" },
294#      "timestamp": { "seconds": 1267061043, "microseconds": 959568 } }
295#
296##
297{ 'event': 'WATCHDOG',
298  'data': { 'action': 'WatchdogAction' } }
299
300##
301# @WatchdogAction:
302#
303# An enumeration of the actions taken when the watchdog device's timer is
304# expired
305#
306# @reset: system resets
307#
308# @shutdown: system shutdown, note that it is similar to @powerdown, which
309#            tries to set to system status and notify guest
310#
311# @poweroff: system poweroff, the emulator program exits
312#
313# @pause: system pauses, similar to @stop
314#
315# @debug: system enters debug state
316#
317# @none: nothing is done
318#
319# @inject-nmi: a non-maskable interrupt is injected into the first VCPU (all
320#              VCPUS on x86) (since 2.4)
321#
322# Since: 2.1
323##
324{ 'enum': 'WatchdogAction',
325  'data': [ 'reset', 'shutdown', 'poweroff', 'pause', 'debug', 'none',
326            'inject-nmi' ] }
327
328##
329# @RebootAction:
330#
331# Possible QEMU actions upon guest reboot
332#
333# @none: Reset the VM
334#
335# @shutdown: Shutdown the VM and exit
336#
337# Since: 6.0
338##
339{ 'enum': 'RebootAction',
340  'data': [ 'none', 'shutdown' ] }
341
342##
343# @ShutdownAction:
344#
345# Possible QEMU actions upon guest shutdown
346#
347# @poweroff: Shutdown the VM and exit
348#
349# @pause: pause the VM#
350#
351# Since: 6.0
352##
353{ 'enum': 'ShutdownAction',
354  'data': [ 'poweroff', 'pause' ] }
355
356##
357# @watchdog-set-action:
358#
359# Set watchdog action
360#
361# Since: 2.11
362##
363{ 'command': 'watchdog-set-action', 'data' : {'action': 'WatchdogAction'} }
364
365##
366# @set-action:
367#
368# Set the actions that will be taken by the emulator in response to guest
369# events.
370#
371# @reboot: @RebootAction action taken on guest reboot.
372#
373# @shutdown: @ShutdownAction action taken on guest shutdown.
374#
375# @watchdog: @WatchdogAction action taken when watchdog timer expires .
376#
377# Returns: Nothing on success.
378#
379# Since: 6.0
380#
381# Example:
382#
383# -> { "execute": "set-action",
384#      "arguments": { "reboot": "shutdown",
385#                     "shutdown" : "pause",
386#                     "watchdog": "inject-nmi" } }
387# <- { "return": {} }
388##
389{ 'command': 'set-action',
390  'data': { '*reboot': 'RebootAction',
391            '*shutdown': 'ShutdownAction',
392            '*watchdog': 'WatchdogAction' },
393  'allow-preconfig': true }
394
395##
396# @GUEST_PANICKED:
397#
398# Emitted when guest OS panic is detected
399#
400# @action: action that has been taken, currently always "pause"
401#
402# @info: information about a panic (since 2.9)
403#
404# Since: 1.5
405#
406# Example:
407#
408# <- { "event": "GUEST_PANICKED",
409#      "data": { "action": "pause" } }
410#
411##
412{ 'event': 'GUEST_PANICKED',
413  'data': { 'action': 'GuestPanicAction', '*info': 'GuestPanicInformation' } }
414
415##
416# @GUEST_CRASHLOADED:
417#
418# Emitted when guest OS crash loaded is detected
419#
420# @action: action that has been taken, currently always "run"
421#
422# @info: information about a panic
423#
424# Since: 5.0
425#
426# Example:
427#
428# <- { "event": "GUEST_CRASHLOADED",
429#      "data": { "action": "run" } }
430#
431##
432{ 'event': 'GUEST_CRASHLOADED',
433  'data': { 'action': 'GuestPanicAction', '*info': 'GuestPanicInformation' } }
434
435##
436# @GuestPanicAction:
437#
438# An enumeration of the actions taken when guest OS panic is detected
439#
440# @pause: system pauses
441#
442# Since: 2.1 (poweroff since 2.8, run since 5.0)
443##
444{ 'enum': 'GuestPanicAction',
445  'data': [ 'pause', 'poweroff', 'run' ] }
446
447##
448# @GuestPanicInformationType:
449#
450# An enumeration of the guest panic information types
451#
452# @hyper-v: hyper-v guest panic information type
453#
454# @s390: s390 guest panic information type (Since: 2.12)
455#
456# Since: 2.9
457##
458{ 'enum': 'GuestPanicInformationType',
459  'data': [ 'hyper-v', 's390' ] }
460
461##
462# @GuestPanicInformation:
463#
464# Information about a guest panic
465#
466# @type: Crash type that defines the hypervisor specific information
467#
468# Since: 2.9
469##
470{'union': 'GuestPanicInformation',
471 'base': {'type': 'GuestPanicInformationType'},
472 'discriminator': 'type',
473 'data': { 'hyper-v': 'GuestPanicInformationHyperV',
474           's390': 'GuestPanicInformationS390' } }
475
476##
477# @GuestPanicInformationHyperV:
478#
479# Hyper-V specific guest panic information (HV crash MSRs)
480#
481# Since: 2.9
482##
483{'struct': 'GuestPanicInformationHyperV',
484 'data': { 'arg1': 'uint64',
485           'arg2': 'uint64',
486           'arg3': 'uint64',
487           'arg4': 'uint64',
488           'arg5': 'uint64' } }
489
490##
491# @S390CrashReason:
492#
493# Reason why the CPU is in a crashed state.
494#
495# @unknown: no crash reason was set
496#
497# @disabled-wait: the CPU has entered a disabled wait state
498#
499# @extint-loop: clock comparator or cpu timer interrupt with new PSW enabled
500#               for external interrupts
501#
502# @pgmint-loop: program interrupt with BAD new PSW
503#
504# @opint-loop: operation exception interrupt with invalid code at the program
505#              interrupt new PSW
506#
507# Since: 2.12
508##
509{ 'enum': 'S390CrashReason',
510  'data': [ 'unknown',
511            'disabled-wait',
512            'extint-loop',
513            'pgmint-loop',
514            'opint-loop' ] }
515
516##
517# @GuestPanicInformationS390:
518#
519# S390 specific guest panic information (PSW)
520#
521# @core: core id of the CPU that crashed
522# @psw-mask: control fields of guest PSW
523# @psw-addr: guest instruction address
524# @reason: guest crash reason
525#
526# Since: 2.12
527##
528{'struct': 'GuestPanicInformationS390',
529 'data': { 'core': 'uint32',
530           'psw-mask': 'uint64',
531           'psw-addr': 'uint64',
532           'reason': 'S390CrashReason' } }
533
534##
535# @MEMORY_FAILURE:
536#
537# Emitted when a memory failure occurs on host side.
538#
539# @recipient: recipient is defined as @MemoryFailureRecipient.
540#
541# @action: action that has been taken. action is defined as @MemoryFailureAction.
542#
543# @flags: flags for MemoryFailureAction. action is defined as @MemoryFailureFlags.
544#
545# Since: 5.2
546#
547# Example:
548#
549# <- { "event": "MEMORY_FAILURE",
550#      "data": { "recipient": "hypervisor",
551#                "action": "fatal",
552#                "flags": { 'action-required': false } }
553#
554##
555{ 'event': 'MEMORY_FAILURE',
556  'data': { 'recipient': 'MemoryFailureRecipient',
557            'action': 'MemoryFailureAction',
558            'flags': 'MemoryFailureFlags'} }
559
560##
561# @MemoryFailureRecipient:
562#
563# Hardware memory failure occurs, handled by recipient.
564#
565# @hypervisor: memory failure at QEMU process address space.
566#              (none guest memory, but used by QEMU itself).
567#
568# @guest: memory failure at guest memory,
569#
570# Since: 5.2
571#
572##
573{ 'enum': 'MemoryFailureRecipient',
574  'data': [ 'hypervisor',
575            'guest' ] }
576
577
578##
579# @MemoryFailureAction:
580#
581# Actions taken by QEMU in response to a hardware memory failure.
582#
583# @ignore: the memory failure could be ignored.  This will only be the case
584#          for action-optional failures.
585#
586# @inject: memory failure occurred in guest memory, the guest enabled MCE
587#          handling mechanism, and QEMU could inject the MCE into the guest
588#          successfully.
589#
590# @fatal: the failure is unrecoverable.  This occurs for action-required
591#         failures if the recipient is the hypervisor; QEMU will exit.
592#
593# @reset: the failure is unrecoverable but confined to the guest.  This
594#         occurs if the recipient is a guest guest which is not ready
595#         to handle memory failures.
596#
597# Since: 5.2
598#
599##
600{ 'enum': 'MemoryFailureAction',
601  'data': [ 'ignore',
602            'inject',
603            'fatal',
604            'reset' ] }
605
606##
607# @MemoryFailureFlags:
608#
609# Additional information on memory failures.
610#
611# @action-required: whether a memory failure event is action-required
612#                   or action-optional (e.g. a failure during memory scrub).
613#
614# @recursive: whether the failure occurred while the previous
615#             failure was still in progress.
616#
617# Since: 5.2
618#
619##
620{ 'struct': 'MemoryFailureFlags',
621  'data': { 'action-required': 'bool',
622            'recursive': 'bool'} }
623