xref: /openbmc/qemu/qapi/misc.json (revision ea2fde5b)
1# -*- Mode: Python -*-
2# vim: filetype=python
3#
4
5##
6# = Miscellanea
7##
8
9{ 'include': 'common.json' }
10
11##
12# @add_client:
13#
14# Allow client connections for VNC, Spice and socket based character
15# devices to be passed in to QEMU via SCM_RIGHTS.
16#
17# If the FD associated with @fdname is not a socket, the command will
18# fail and the FD will be closed.
19#
20# @protocol: protocol name.  Valid names are "vnc", "spice",
21#     "@dbus-display" or the name of a character device (e.g. from
22#     -chardev id=XXXX)
23#
24# @fdname: file descriptor name previously passed via 'getfd' command
25#
26# @skipauth: whether to skip authentication.  Only applies to "vnc"
27#     and "spice" protocols
28#
29# @tls: whether to perform TLS. Only applies to the "spice" protocol
30#
31# Returns: nothing on success.
32#
33# Since: 0.14
34#
35# Example:
36#
37# -> { "execute": "add_client", "arguments": { "protocol": "vnc",
38#                                              "fdname": "myclient" } }
39# <- { "return": {} }
40##
41{ 'command': 'add_client',
42  'data': { 'protocol': 'str', 'fdname': 'str', '*skipauth': 'bool',
43            '*tls': 'bool' } }
44
45##
46# @NameInfo:
47#
48# Guest name information.
49#
50# @name: The name of the guest
51#
52# Since: 0.14
53##
54{ 'struct': 'NameInfo', 'data': {'*name': 'str'} }
55
56##
57# @query-name:
58#
59# Return the name information of a guest.
60#
61# Returns: @NameInfo of the guest
62#
63# Since: 0.14
64#
65# Example:
66#
67# -> { "execute": "query-name" }
68# <- { "return": { "name": "qemu-name" } }
69##
70{ 'command': 'query-name', 'returns': 'NameInfo', 'allow-preconfig': true }
71
72##
73# @IOThreadInfo:
74#
75# Information about an iothread
76#
77# @id: the identifier of the iothread
78#
79# @thread-id: ID of the underlying host thread
80#
81# @poll-max-ns: maximum polling time in ns, 0 means polling is
82#     disabled (since 2.9)
83#
84# @poll-grow: how many ns will be added to polling time, 0 means that
85#     it's not configured (since 2.9)
86#
87# @poll-shrink: how many ns will be removed from polling time, 0 means
88#     that it's not configured (since 2.9)
89#
90# @aio-max-batch: maximum number of requests in a batch for the AIO
91#     engine, 0 means that the engine will use its default (since 6.1)
92#
93# Since: 2.0
94##
95{ 'struct': 'IOThreadInfo',
96  'data': {'id': 'str',
97           'thread-id': 'int',
98           'poll-max-ns': 'int',
99           'poll-grow': 'int',
100           'poll-shrink': 'int',
101           'aio-max-batch': 'int' } }
102
103##
104# @query-iothreads:
105#
106# Returns a list of information about each iothread.
107#
108# Note: this list excludes the QEMU main loop thread, which is not
109#     declared using the -object iothread command-line option.  It is
110#     always the main thread of the process.
111#
112# Returns: a list of @IOThreadInfo for each iothread
113#
114# Since: 2.0
115#
116# Example:
117#
118# -> { "execute": "query-iothreads" }
119# <- { "return": [
120#          {
121#             "id":"iothread0",
122#             "thread-id":3134
123#          },
124#          {
125#             "id":"iothread1",
126#             "thread-id":3135
127#          }
128#       ]
129#    }
130##
131{ 'command': 'query-iothreads', 'returns': ['IOThreadInfo'],
132  'allow-preconfig': true }
133
134##
135# @stop:
136#
137# Stop guest VM execution.
138#
139# Since: 0.14
140#
141# Notes: This function will succeed even if the guest is already in
142#     the stopped state.  In "inmigrate" state, it will ensure that
143#     the guest remains paused once migration finishes, as if the -S
144#     option was passed on the command line.
145#
146#     In the "suspended" state, it will completely stop the VM and
147#     cause a transition to the "paused" state. (Since 9.0)
148#
149# Example:
150#
151# -> { "execute": "stop" }
152# <- { "return": {} }
153##
154{ 'command': 'stop' }
155
156##
157# @cont:
158#
159# Resume guest VM execution.
160#
161# Since: 0.14
162#
163# Returns: If successful, nothing
164#
165# Notes: This command will succeed if the guest is currently running.
166#     It will also succeed if the guest is in the "inmigrate" state;
167#     in this case, the effect of the command is to make sure the
168#     guest starts once migration finishes, removing the effect of the
169#     -S command line option if it was passed.
170#
171#     If the VM was previously suspended, and not been reset or woken,
172#     this command will transition back to the "suspended" state.
173#     (Since 9.0)
174#
175# Example:
176#
177# -> { "execute": "cont" }
178# <- { "return": {} }
179##
180{ 'command': 'cont' }
181
182##
183# @x-exit-preconfig:
184#
185# Exit from "preconfig" state
186#
187# This command makes QEMU exit the preconfig state and proceed with VM
188# initialization using configuration data provided on the command line
189# and via the QMP monitor during the preconfig state.  The command is
190# only available during the preconfig state (i.e. when the --preconfig
191# command line option was in use).
192#
193# Features:
194#
195# @unstable: This command is experimental.
196#
197# Since: 3.0
198#
199# Returns: nothing
200#
201# Example:
202#
203# -> { "execute": "x-exit-preconfig" }
204# <- { "return": {} }
205##
206{ 'command': 'x-exit-preconfig', 'allow-preconfig': true,
207  'features': [ 'unstable' ] }
208
209##
210# @human-monitor-command:
211#
212# Execute a command on the human monitor and return the output.
213#
214# @command-line: the command to execute in the human monitor
215#
216# @cpu-index: The CPU to use for commands that require an implicit CPU
217#
218# Features:
219#
220# @savevm-monitor-nodes: If present, HMP command savevm only snapshots
221#     monitor-owned nodes if they have no parents.  This allows the
222#     use of 'savevm' with -blockdev.  (since 4.2)
223#
224# Returns: the output of the command as a string
225#
226# Since: 0.14
227#
228# Notes: This command only exists as a stop-gap.  Its use is highly
229#     discouraged.  The semantics of this command are not guaranteed:
230#     this means that command names, arguments and responses can
231#     change or be removed at ANY time.  Applications that rely on
232#     long term stability guarantees should NOT use this command.
233#
234#     Known limitations:
235#
236#     * This command is stateless, this means that commands that
237#       depend on state information (such as getfd) might not work
238#
239#     * Commands that prompt the user for data don't currently work
240#
241# Example:
242#
243# -> { "execute": "human-monitor-command",
244#      "arguments": { "command-line": "info kvm" } }
245# <- { "return": "kvm support: enabled\r\n" }
246##
247{ 'command': 'human-monitor-command',
248  'data': {'command-line': 'str', '*cpu-index': 'int'},
249  'returns': 'str',
250  'features': [ 'savevm-monitor-nodes' ] }
251
252##
253# @getfd:
254#
255# Receive a file descriptor via SCM rights and assign it a name
256#
257# @fdname: file descriptor name
258#
259# Returns: Nothing on success
260#
261# Since: 0.14
262#
263# Notes: If @fdname already exists, the file descriptor assigned to it
264#     will be closed and replaced by the received file descriptor.
265#
266#     The 'closefd' command can be used to explicitly close the file
267#     descriptor when it is no longer needed.
268#
269# Example:
270#
271# -> { "execute": "getfd", "arguments": { "fdname": "fd1" } }
272# <- { "return": {} }
273##
274{ 'command': 'getfd', 'data': {'fdname': 'str'}, 'if': 'CONFIG_POSIX' }
275
276##
277# @get-win32-socket:
278#
279# Add a socket that was duplicated to QEMU process with
280# WSADuplicateSocketW() via WSASocket() & WSAPROTOCOL_INFOW structure
281# and assign it a name (the SOCKET is associated with a CRT file
282# descriptor)
283#
284# @info: the WSAPROTOCOL_INFOW structure (encoded in base64)
285#
286# @fdname: file descriptor name
287#
288# Returns: Nothing on success
289#
290# Since: 8.0
291#
292# Notes: If @fdname already exists, the file descriptor assigned to it
293#     will be closed and replaced by the received file descriptor.
294#
295#     The 'closefd' command can be used to explicitly close the file
296#     descriptor when it is no longer needed.
297#
298# Example:
299#
300# -> { "execute": "get-win32-socket", "arguments": { "info": "abcd123..", fdname": "skclient" } }
301# <- { "return": {} }
302##
303{ 'command': 'get-win32-socket', 'data': {'info': 'str', 'fdname': 'str'}, 'if': 'CONFIG_WIN32' }
304
305##
306# @closefd:
307#
308# Close a file descriptor previously passed via SCM rights
309#
310# @fdname: file descriptor name
311#
312# Returns: Nothing on success
313#
314# Since: 0.14
315#
316# Example:
317#
318# -> { "execute": "closefd", "arguments": { "fdname": "fd1" } }
319# <- { "return": {} }
320##
321{ 'command': 'closefd', 'data': {'fdname': 'str'} }
322
323##
324# @AddfdInfo:
325#
326# Information about a file descriptor that was added to an fd set.
327#
328# @fdset-id: The ID of the fd set that @fd was added to.
329#
330# @fd: The file descriptor that was received via SCM rights and added
331#     to the fd set.
332#
333# Since: 1.2
334##
335{ 'struct': 'AddfdInfo', 'data': {'fdset-id': 'int', 'fd': 'int'} }
336
337##
338# @add-fd:
339#
340# Add a file descriptor, that was passed via SCM rights, to an fd set.
341#
342# @fdset-id: The ID of the fd set to add the file descriptor to.
343#
344# @opaque: A free-form string that can be used to describe the fd.
345#
346# Returns:
347#     - @AddfdInfo on success
348#     - If file descriptor was not received, GenericError
349#     - If @fdset-id is a negative value, GenericError
350#
351# Notes:
352#     The list of fd sets is shared by all monitor connections.
353#
354#     If @fdset-id is not specified, a new fd set will be created.
355#
356# Since: 1.2
357#
358# Example:
359#
360# -> { "execute": "add-fd", "arguments": { "fdset-id": 1 } }
361# <- { "return": { "fdset-id": 1, "fd": 3 } }
362##
363{ 'command': 'add-fd',
364  'data': { '*fdset-id': 'int',
365            '*opaque': 'str' },
366  'returns': 'AddfdInfo' }
367
368##
369# @remove-fd:
370#
371# Remove a file descriptor from an fd set.
372#
373# @fdset-id: The ID of the fd set that the file descriptor belongs to.
374#
375# @fd: The file descriptor that is to be removed.
376#
377# Returns:
378#     - Nothing on success
379#     - If @fdset-id or @fd is not found, GenericError
380#
381# Since: 1.2
382#
383# Notes:
384#     The list of fd sets is shared by all monitor connections.
385#
386#     If @fd is not specified, all file descriptors in @fdset-id will
387#     be removed.
388#
389# Example:
390#
391# -> { "execute": "remove-fd", "arguments": { "fdset-id": 1, "fd": 3 } }
392# <- { "return": {} }
393##
394{ 'command': 'remove-fd', 'data': {'fdset-id': 'int', '*fd': 'int'} }
395
396##
397# @FdsetFdInfo:
398#
399# Information about a file descriptor that belongs to an fd set.
400#
401# @fd: The file descriptor value.
402#
403# @opaque: A free-form string that can be used to describe the fd.
404#
405# Since: 1.2
406##
407{ 'struct': 'FdsetFdInfo',
408  'data': {'fd': 'int', '*opaque': 'str'} }
409
410##
411# @FdsetInfo:
412#
413# Information about an fd set.
414#
415# @fdset-id: The ID of the fd set.
416#
417# @fds: A list of file descriptors that belong to this fd set.
418#
419# Since: 1.2
420##
421{ 'struct': 'FdsetInfo',
422  'data': {'fdset-id': 'int', 'fds': ['FdsetFdInfo']} }
423
424##
425# @query-fdsets:
426#
427# Return information describing all fd sets.
428#
429# Returns: A list of @FdsetInfo
430#
431# Since: 1.2
432#
433# Note: The list of fd sets is shared by all monitor connections.
434#
435# Example:
436#
437# -> { "execute": "query-fdsets" }
438# <- { "return": [
439#        {
440#          "fds": [
441#            {
442#              "fd": 30,
443#              "opaque": "rdonly:/path/to/file"
444#            },
445#            {
446#              "fd": 24,
447#              "opaque": "rdwr:/path/to/file"
448#            }
449#          ],
450#          "fdset-id": 1
451#        },
452#        {
453#          "fds": [
454#            {
455#              "fd": 28
456#            },
457#            {
458#              "fd": 29
459#            }
460#          ],
461#          "fdset-id": 0
462#        }
463#      ]
464#    }
465##
466{ 'command': 'query-fdsets', 'returns': ['FdsetInfo'] }
467
468##
469# @CommandLineParameterType:
470#
471# Possible types for an option parameter.
472#
473# @string: accepts a character string
474#
475# @boolean: accepts "on" or "off"
476#
477# @number: accepts a number
478#
479# @size: accepts a number followed by an optional suffix (K)ilo,
480#     (M)ega, (G)iga, (T)era
481#
482# Since: 1.5
483##
484{ 'enum': 'CommandLineParameterType',
485  'data': ['string', 'boolean', 'number', 'size'] }
486
487##
488# @CommandLineParameterInfo:
489#
490# Details about a single parameter of a command line option.
491#
492# @name: parameter name
493#
494# @type: parameter @CommandLineParameterType
495#
496# @help: human readable text string, not suitable for parsing.
497#
498# @default: default value string (since 2.1)
499#
500# Since: 1.5
501##
502{ 'struct': 'CommandLineParameterInfo',
503  'data': { 'name': 'str',
504            'type': 'CommandLineParameterType',
505            '*help': 'str',
506            '*default': 'str' } }
507
508##
509# @CommandLineOptionInfo:
510#
511# Details about a command line option, including its list of parameter
512# details
513#
514# @option: option name
515#
516# @parameters: an array of @CommandLineParameterInfo
517#
518# Since: 1.5
519##
520{ 'struct': 'CommandLineOptionInfo',
521  'data': { 'option': 'str', 'parameters': ['CommandLineParameterInfo'] } }
522
523##
524# @query-command-line-options:
525#
526# Query command line option schema.
527#
528# @option: option name
529#
530# Returns: list of @CommandLineOptionInfo for all options (or for the
531#     given @option).  Returns an error if the given @option doesn't
532#     exist.
533#
534# Since: 1.5
535#
536# Example:
537#
538# -> { "execute": "query-command-line-options",
539#      "arguments": { "option": "option-rom" } }
540# <- { "return": [
541#         {
542#             "parameters": [
543#                 {
544#                     "name": "romfile",
545#                     "type": "string"
546#                 },
547#                 {
548#                     "name": "bootindex",
549#                     "type": "number"
550#                 }
551#             ],
552#             "option": "option-rom"
553#         }
554#      ]
555#    }
556##
557{'command': 'query-command-line-options',
558 'data': {'*option': 'str'},
559 'returns': ['CommandLineOptionInfo'],
560 'allow-preconfig': true}
561
562##
563# @RTC_CHANGE:
564#
565# Emitted when the guest changes the RTC time.
566#
567# @offset: offset in seconds between base RTC clock (as specified by
568#     -rtc base), and new RTC clock value
569#
570# @qom-path: path to the RTC object in the QOM tree
571#
572# Note: This event is rate-limited.  It is not guaranteed that the RTC
573#     in the system implements this event, or even that the system has
574#     an RTC at all.
575#
576# Since: 0.13
577#
578# Example:
579#
580# <- { "event": "RTC_CHANGE",
581#      "data": { "offset": 78 },
582#      "timestamp": { "seconds": 1267020223, "microseconds": 435656 } }
583##
584{ 'event': 'RTC_CHANGE',
585  'data': { 'offset': 'int', 'qom-path': 'str' } }
586
587##
588# @VFU_CLIENT_HANGUP:
589#
590# Emitted when the client of a TYPE_VFIO_USER_SERVER closes the
591# communication channel
592#
593# @vfu-id: ID of the TYPE_VFIO_USER_SERVER object.  It is the last
594#     component of @vfu-qom-path referenced below
595#
596# @vfu-qom-path: path to the TYPE_VFIO_USER_SERVER object in the QOM
597#     tree
598#
599# @dev-id: ID of attached PCI device
600#
601# @dev-qom-path: path to attached PCI device in the QOM tree
602#
603# Since: 7.1
604#
605# Example:
606#
607# <- { "event": "VFU_CLIENT_HANGUP",
608#      "data": { "vfu-id": "vfu1",
609#                "vfu-qom-path": "/objects/vfu1",
610#                "dev-id": "sas1",
611#                "dev-qom-path": "/machine/peripheral/sas1" },
612#      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
613##
614{ 'event': 'VFU_CLIENT_HANGUP',
615  'data': { 'vfu-id': 'str', 'vfu-qom-path': 'str',
616            'dev-id': 'str', 'dev-qom-path': 'str' } }
617