xref: /openbmc/qemu/qapi/run-state.json (revision c63ca4ff)
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# @PanicAction:
358#
359# @none: Continue VM execution
360#
361# @pause: Pause the VM
362#
363# Since: 6.0
364##
365{ 'enum': 'PanicAction',
366  'data': [ 'poweroff', 'pause', 'none' ] }
367
368##
369# @watchdog-set-action:
370#
371# Set watchdog action
372#
373# Since: 2.11
374##
375{ 'command': 'watchdog-set-action', 'data' : {'action': 'WatchdogAction'} }
376
377##
378# @set-action:
379#
380# Set the actions that will be taken by the emulator in response to guest
381# events.
382#
383# @reboot: @RebootAction action taken on guest reboot.
384#
385# @shutdown: @ShutdownAction action taken on guest shutdown.
386#
387# @panic: @PanicAction action taken on guest panic.
388#
389# @watchdog: @WatchdogAction action taken when watchdog timer expires .
390#
391# Returns: Nothing on success.
392#
393# Since: 6.0
394#
395# Example:
396#
397# -> { "execute": "set-action",
398#      "arguments": { "reboot": "shutdown",
399#                     "shutdown" : "pause",
400#                     "panic": "pause",
401#                     "watchdog": "inject-nmi" } }
402# <- { "return": {} }
403##
404{ 'command': 'set-action',
405  'data': { '*reboot': 'RebootAction',
406            '*shutdown': 'ShutdownAction',
407            '*panic': 'PanicAction',
408            '*watchdog': 'WatchdogAction' },
409  'allow-preconfig': true }
410
411##
412# @GUEST_PANICKED:
413#
414# Emitted when guest OS panic is detected
415#
416# @action: action that has been taken, currently always "pause"
417#
418# @info: information about a panic (since 2.9)
419#
420# Since: 1.5
421#
422# Example:
423#
424# <- { "event": "GUEST_PANICKED",
425#      "data": { "action": "pause" } }
426#
427##
428{ 'event': 'GUEST_PANICKED',
429  'data': { 'action': 'GuestPanicAction', '*info': 'GuestPanicInformation' } }
430
431##
432# @GUEST_CRASHLOADED:
433#
434# Emitted when guest OS crash loaded is detected
435#
436# @action: action that has been taken, currently always "run"
437#
438# @info: information about a panic
439#
440# Since: 5.0
441#
442# Example:
443#
444# <- { "event": "GUEST_CRASHLOADED",
445#      "data": { "action": "run" } }
446#
447##
448{ 'event': 'GUEST_CRASHLOADED',
449  'data': { 'action': 'GuestPanicAction', '*info': 'GuestPanicInformation' } }
450
451##
452# @GuestPanicAction:
453#
454# An enumeration of the actions taken when guest OS panic is detected
455#
456# @pause: system pauses
457#
458# Since: 2.1 (poweroff since 2.8, run since 5.0)
459##
460{ 'enum': 'GuestPanicAction',
461  'data': [ 'pause', 'poweroff', 'run' ] }
462
463##
464# @GuestPanicInformationType:
465#
466# An enumeration of the guest panic information types
467#
468# @hyper-v: hyper-v guest panic information type
469#
470# @s390: s390 guest panic information type (Since: 2.12)
471#
472# Since: 2.9
473##
474{ 'enum': 'GuestPanicInformationType',
475  'data': [ 'hyper-v', 's390' ] }
476
477##
478# @GuestPanicInformation:
479#
480# Information about a guest panic
481#
482# @type: Crash type that defines the hypervisor specific information
483#
484# Since: 2.9
485##
486{'union': 'GuestPanicInformation',
487 'base': {'type': 'GuestPanicInformationType'},
488 'discriminator': 'type',
489 'data': { 'hyper-v': 'GuestPanicInformationHyperV',
490           's390': 'GuestPanicInformationS390' } }
491
492##
493# @GuestPanicInformationHyperV:
494#
495# Hyper-V specific guest panic information (HV crash MSRs)
496#
497# Since: 2.9
498##
499{'struct': 'GuestPanicInformationHyperV',
500 'data': { 'arg1': 'uint64',
501           'arg2': 'uint64',
502           'arg3': 'uint64',
503           'arg4': 'uint64',
504           'arg5': 'uint64' } }
505
506##
507# @S390CrashReason:
508#
509# Reason why the CPU is in a crashed state.
510#
511# @unknown: no crash reason was set
512#
513# @disabled-wait: the CPU has entered a disabled wait state
514#
515# @extint-loop: clock comparator or cpu timer interrupt with new PSW enabled
516#               for external interrupts
517#
518# @pgmint-loop: program interrupt with BAD new PSW
519#
520# @opint-loop: operation exception interrupt with invalid code at the program
521#              interrupt new PSW
522#
523# Since: 2.12
524##
525{ 'enum': 'S390CrashReason',
526  'data': [ 'unknown',
527            'disabled-wait',
528            'extint-loop',
529            'pgmint-loop',
530            'opint-loop' ] }
531
532##
533# @GuestPanicInformationS390:
534#
535# S390 specific guest panic information (PSW)
536#
537# @core: core id of the CPU that crashed
538# @psw-mask: control fields of guest PSW
539# @psw-addr: guest instruction address
540# @reason: guest crash reason
541#
542# Since: 2.12
543##
544{'struct': 'GuestPanicInformationS390',
545 'data': { 'core': 'uint32',
546           'psw-mask': 'uint64',
547           'psw-addr': 'uint64',
548           'reason': 'S390CrashReason' } }
549
550##
551# @MEMORY_FAILURE:
552#
553# Emitted when a memory failure occurs on host side.
554#
555# @recipient: recipient is defined as @MemoryFailureRecipient.
556#
557# @action: action that has been taken. action is defined as @MemoryFailureAction.
558#
559# @flags: flags for MemoryFailureAction. action is defined as @MemoryFailureFlags.
560#
561# Since: 5.2
562#
563# Example:
564#
565# <- { "event": "MEMORY_FAILURE",
566#      "data": { "recipient": "hypervisor",
567#                "action": "fatal",
568#                "flags": { 'action-required': false } }
569#
570##
571{ 'event': 'MEMORY_FAILURE',
572  'data': { 'recipient': 'MemoryFailureRecipient',
573            'action': 'MemoryFailureAction',
574            'flags': 'MemoryFailureFlags'} }
575
576##
577# @MemoryFailureRecipient:
578#
579# Hardware memory failure occurs, handled by recipient.
580#
581# @hypervisor: memory failure at QEMU process address space.
582#              (none guest memory, but used by QEMU itself).
583#
584# @guest: memory failure at guest memory,
585#
586# Since: 5.2
587#
588##
589{ 'enum': 'MemoryFailureRecipient',
590  'data': [ 'hypervisor',
591            'guest' ] }
592
593
594##
595# @MemoryFailureAction:
596#
597# Actions taken by QEMU in response to a hardware memory failure.
598#
599# @ignore: the memory failure could be ignored.  This will only be the case
600#          for action-optional failures.
601#
602# @inject: memory failure occurred in guest memory, the guest enabled MCE
603#          handling mechanism, and QEMU could inject the MCE into the guest
604#          successfully.
605#
606# @fatal: the failure is unrecoverable.  This occurs for action-required
607#         failures if the recipient is the hypervisor; QEMU will exit.
608#
609# @reset: the failure is unrecoverable but confined to the guest.  This
610#         occurs if the recipient is a guest guest which is not ready
611#         to handle memory failures.
612#
613# Since: 5.2
614#
615##
616{ 'enum': 'MemoryFailureAction',
617  'data': [ 'ignore',
618            'inject',
619            'fatal',
620            'reset' ] }
621
622##
623# @MemoryFailureFlags:
624#
625# Additional information on memory failures.
626#
627# @action-required: whether a memory failure event is action-required
628#                   or action-optional (e.g. a failure during memory scrub).
629#
630# @recursive: whether the failure occurred while the previous
631#             failure was still in progress.
632#
633# Since: 5.2
634#
635##
636{ 'struct': 'MemoryFailureFlags',
637  'data': { 'action-required': 'bool',
638            'recursive': 'bool'} }
639