xref: /openbmc/qemu/qapi/run-state.json (revision 10df8ff1)
1# -*- Mode: Python -*-
2#
3
4##
5# = VM run state
6##
7
8##
9# @RunState:
10#
11# An enumeration of VM run states.
12#
13# @debug: QEMU is running on a debugger
14#
15# @finish-migrate: guest is paused to finish the migration process
16#
17# @inmigrate: guest is paused waiting for an incoming migration.  Note
18# that this state does not tell whether the machine will start at the
19# end of the migration.  This depends on the command-line -S option and
20# any invocation of 'stop' or 'cont' that has happened since QEMU was
21# started.
22#
23# @internal-error: An internal error that prevents further guest execution
24# has occurred
25#
26# @io-error: the last IOP has failed and the device is configured to pause
27# on I/O errors
28#
29# @paused: guest has been paused via the 'stop' command
30#
31# @postmigrate: guest is paused following a successful 'migrate'
32#
33# @prelaunch: QEMU was started with -S and guest has not started
34#
35# @restore-vm: guest is paused to restore VM state
36#
37# @running: guest is actively running
38#
39# @save-vm: guest is paused to save the VM state
40#
41# @shutdown: guest is shut down (and -no-shutdown is in use)
42#
43# @suspended: guest is suspended (ACPI S3)
44#
45# @watchdog: the watchdog action is configured to pause and has been triggered
46#
47# @guest-panicked: guest has been panicked as a result of guest OS panic
48#
49# @colo: guest is paused to save/restore VM state under colo checkpoint,
50#        VM can not get into this state unless colo capability is enabled
51#        for migration. (since 2.8)
52# @preconfig: QEMU is paused before board specific init callback is executed.
53#             The state is reachable only if the --preconfig CLI option is used.
54#             (Since 3.0)
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', 'preconfig' ] }
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 shutdown
86#
87# @subsystem-reset: Partial guest reset that does not trigger QMP events and
88#                  ignores --no-reboot. This is useful for sanitizing
89#                  hypercalls on s390 that are used during kexec/kdump/boot
90#
91##
92{ 'enum': 'ShutdownCause',
93  # Beware, shutdown_caused_by_guest() depends on enumeration order
94  'data': [ 'none', 'host-error', 'host-qmp-quit', 'host-qmp-system-reset',
95            'host-signal', 'host-ui', 'guest-shutdown', 'guest-reset',
96            'guest-panic', 'subsystem-reset'] }
97
98##
99# @StatusInfo:
100#
101# Information about VCPU run state
102#
103# @running: true if all VCPUs are runnable, false if not runnable
104#
105# @singlestep: true if VCPUs are in single-step mode
106#
107# @status: the virtual machine @RunState
108#
109# Since:  0.14.0
110#
111# Notes: @singlestep is enabled through the GDB stub
112##
113{ 'struct': 'StatusInfo',
114  'data': {'running': 'bool', 'singlestep': 'bool', 'status': 'RunState'} }
115
116##
117# @query-status:
118#
119# Query the run status of all VCPUs
120#
121# Returns: @StatusInfo reflecting all VCPUs
122#
123# Since:  0.14.0
124#
125# Example:
126#
127# -> { "execute": "query-status" }
128# <- { "return": { "running": true,
129#                  "singlestep": false,
130#                  "status": "running" } }
131#
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 is
140# about to exit.
141#
142# @guest: If true, the shutdown was triggered by a guest request (such as
143# a guest-initiated ACPI shutdown request or other hardware-specific action)
144# rather than a host request (such as sending qemu a SIGINT). (since 2.10)
145#
146# @reason: The @ShutdownCause which resulted in the SHUTDOWN. (since 4.0)
147#
148# Note: If the command-line option "-no-shutdown" has been specified, qemu will
149# not exit, and a STOP event will eventually follow the SHUTDOWN event
150#
151# Since: 0.12.0
152#
153# Example:
154#
155# <- { "event": "SHUTDOWN", "data": { "guest": true },
156#      "timestamp": { "seconds": 1267040730, "microseconds": 682951 } }
157#
158##
159{ 'event': 'SHUTDOWN', 'data': { 'guest': 'bool', 'reason': 'ShutdownCause' } }
160
161##
162# @POWERDOWN:
163#
164# Emitted when the virtual machine is powered down through the power control
165# system, such as via ACPI.
166#
167# Since: 0.12.0
168#
169# Example:
170#
171# <- { "event": "POWERDOWN",
172#      "timestamp": { "seconds": 1267040730, "microseconds": 682951 } }
173#
174##
175{ 'event': 'POWERDOWN' }
176
177##
178# @RESET:
179#
180# Emitted when the virtual machine is reset
181#
182# @guest: If true, the reset was triggered by a guest request (such as
183# a guest-initiated ACPI reboot request or other hardware-specific action)
184# rather than a host request (such as the QMP command system_reset).
185# (since 2.10)
186#
187# @reason: The @ShutdownCause of the RESET. (since 4.0)
188#
189# Since: 0.12.0
190#
191# Example:
192#
193# <- { "event": "RESET", "data": { "guest": false },
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.0
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.0
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.0
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# @watchdog-set-action:
332#
333# Set watchdog action
334#
335# Since: 2.11
336##
337{ 'command': 'watchdog-set-action', 'data' : {'action': 'WatchdogAction'} }
338
339##
340# @GUEST_PANICKED:
341#
342# Emitted when guest OS panic is detected
343#
344# @action: action that has been taken, currently always "pause"
345#
346# @info: information about a panic (since 2.9)
347#
348# Since: 1.5
349#
350# Example:
351#
352# <- { "event": "GUEST_PANICKED",
353#      "data": { "action": "pause" } }
354#
355##
356{ 'event': 'GUEST_PANICKED',
357  'data': { 'action': 'GuestPanicAction', '*info': 'GuestPanicInformation' } }
358
359##
360# @GuestPanicAction:
361#
362# An enumeration of the actions taken when guest OS panic is detected
363#
364# @pause: system pauses
365#
366# Since: 2.1 (poweroff since 2.8)
367##
368{ 'enum': 'GuestPanicAction',
369  'data': [ 'pause', 'poweroff' ] }
370
371##
372# @GuestPanicInformationType:
373#
374# An enumeration of the guest panic information types
375#
376# @hyper-v: hyper-v guest panic information type
377#
378# @s390: s390 guest panic information type (Since: 2.12)
379#
380# Since: 2.9
381##
382{ 'enum': 'GuestPanicInformationType',
383  'data': [ 'hyper-v', 's390' ] }
384
385##
386# @GuestPanicInformation:
387#
388# Information about a guest panic
389#
390# @type: Crash type that defines the hypervisor specific information
391#
392# Since: 2.9
393##
394{'union': 'GuestPanicInformation',
395 'base': {'type': 'GuestPanicInformationType'},
396 'discriminator': 'type',
397 'data': { 'hyper-v': 'GuestPanicInformationHyperV',
398           's390': 'GuestPanicInformationS390' } }
399
400##
401# @GuestPanicInformationHyperV:
402#
403# Hyper-V specific guest panic information (HV crash MSRs)
404#
405# Since: 2.9
406##
407{'struct': 'GuestPanicInformationHyperV',
408 'data': { 'arg1': 'uint64',
409           'arg2': 'uint64',
410           'arg3': 'uint64',
411           'arg4': 'uint64',
412           'arg5': 'uint64' } }
413
414##
415# @S390CrashReason:
416#
417# Reason why the CPU is in a crashed state.
418#
419# @unknown: no crash reason was set
420#
421# @disabled-wait: the CPU has entered a disabled wait state
422#
423# @extint-loop: clock comparator or cpu timer interrupt with new PSW enabled
424#              for external interrupts
425#
426# @pgmint-loop: program interrupt with BAD new PSW
427#
428# @opint-loop: operation exception interrupt with invalid code at the program
429#             interrupt new PSW
430#
431# Since: 2.12
432##
433{ 'enum': 'S390CrashReason',
434  'data': [ 'unknown',
435            'disabled-wait',
436            'extint-loop',
437            'pgmint-loop',
438            'opint-loop' ] }
439
440##
441# @GuestPanicInformationS390:
442#
443# S390 specific guest panic information (PSW)
444#
445# @core: core id of the CPU that crashed
446# @psw-mask: control fields of guest PSW
447# @psw-addr: guest instruction address
448# @reason: guest crash reason
449#
450# Since: 2.12
451##
452{'struct': 'GuestPanicInformationS390',
453 'data': { 'core': 'uint32',
454           'psw-mask': 'uint64',
455           'psw-addr': 'uint64',
456           'reason': 'S390CrashReason' } }
457