xref: /openbmc/qemu/qapi/misc.json (revision 1141159c)
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 (eg. 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 all guest VCPU 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# Example:
147#
148# -> { "execute": "stop" }
149# <- { "return": {} }
150##
151{ 'command': 'stop' }
152
153##
154# @cont:
155#
156# Resume guest VCPU execution.
157#
158# Since: 0.14
159#
160# Returns: If successful, nothing
161#
162# Notes: This command will succeed if the guest is currently running.
163#     It will also succeed if the guest is in the "inmigrate" state;
164#     in this case, the effect of the command is to make sure the
165#     guest starts once migration finishes, removing the effect of the
166#     -S command line option if it was passed.
167#
168# Example:
169#
170# -> { "execute": "cont" }
171# <- { "return": {} }
172##
173{ 'command': 'cont' }
174
175##
176# @x-exit-preconfig:
177#
178# Exit from "preconfig" state
179#
180# This command makes QEMU exit the preconfig state and proceed with VM
181# initialization using configuration data provided on the command line
182# and via the QMP monitor during the preconfig state.  The command is
183# only available during the preconfig state (i.e. when the --preconfig
184# command line option was in use).
185#
186# Features:
187#
188# @unstable: This command is experimental.
189#
190# Since: 3.0
191#
192# Returns: nothing
193#
194# Example:
195#
196# -> { "execute": "x-exit-preconfig" }
197# <- { "return": {} }
198##
199{ 'command': 'x-exit-preconfig', 'allow-preconfig': true,
200  'features': [ 'unstable' ] }
201
202##
203# @human-monitor-command:
204#
205# Execute a command on the human monitor and return the output.
206#
207# @command-line: the command to execute in the human monitor
208#
209# @cpu-index: The CPU to use for commands that require an implicit CPU
210#
211# Features:
212#
213# @savevm-monitor-nodes: If present, HMP command savevm only snapshots
214#     monitor-owned nodes if they have no parents.  This allows the
215#     use of 'savevm' with -blockdev.  (since 4.2)
216#
217# Returns: the output of the command as a string
218#
219# Since: 0.14
220#
221# Notes: This command only exists as a stop-gap.  Its use is highly
222#     discouraged.  The semantics of this command are not guaranteed:
223#     this means that command names, arguments and responses can
224#     change or be removed at ANY time.  Applications that rely on
225#     long term stability guarantees should NOT use this command.
226#
227#     Known limitations:
228#
229#     * This command is stateless, this means that commands that
230#       depend on state information (such as getfd) might not work
231#
232#     * Commands that prompt the user for data don't currently work
233#
234# Example:
235#
236# -> { "execute": "human-monitor-command",
237#      "arguments": { "command-line": "info kvm" } }
238# <- { "return": "kvm support: enabled\r\n" }
239##
240{ 'command': 'human-monitor-command',
241  'data': {'command-line': 'str', '*cpu-index': 'int'},
242  'returns': 'str',
243  'features': [ 'savevm-monitor-nodes' ] }
244
245##
246# @getfd:
247#
248# Receive a file descriptor via SCM rights and assign it a name
249#
250# @fdname: file descriptor name
251#
252# Returns: Nothing on success
253#
254# Since: 0.14
255#
256# Notes: If @fdname already exists, the file descriptor assigned to it
257#     will be closed and replaced by the received file descriptor.
258#
259#     The 'closefd' command can be used to explicitly close the file
260#     descriptor when it is no longer needed.
261#
262# Example:
263#
264# -> { "execute": "getfd", "arguments": { "fdname": "fd1" } }
265# <- { "return": {} }
266##
267{ 'command': 'getfd', 'data': {'fdname': 'str'}, 'if': 'CONFIG_POSIX' }
268
269##
270# @get-win32-socket:
271#
272# Add a socket that was duplicated to QEMU process with
273# WSADuplicateSocketW() via WSASocket() & WSAPROTOCOL_INFOW structure
274# and assign it a name (the SOCKET is associated with a CRT file
275# descriptor)
276#
277# @info: the WSAPROTOCOL_INFOW structure (encoded in base64)
278#
279# @fdname: file descriptor name
280#
281# Returns: Nothing on success
282#
283# Since: 8.0
284#
285# Notes: If @fdname already exists, the file descriptor assigned to it
286#     will be closed and replaced by the received file descriptor.
287#
288#     The 'closefd' command can be used to explicitly close the file
289#     descriptor when it is no longer needed.
290#
291# Example:
292#
293# -> { "execute": "get-win32-socket", "arguments": { "info": "abcd123..", fdname": "skclient" } }
294# <- { "return": {} }
295##
296{ 'command': 'get-win32-socket', 'data': {'info': 'str', 'fdname': 'str'}, 'if': 'CONFIG_WIN32' }
297
298##
299# @closefd:
300#
301# Close a file descriptor previously passed via SCM rights
302#
303# @fdname: file descriptor name
304#
305# Returns: Nothing on success
306#
307# Since: 0.14
308#
309# Example:
310#
311# -> { "execute": "closefd", "arguments": { "fdname": "fd1" } }
312# <- { "return": {} }
313##
314{ 'command': 'closefd', 'data': {'fdname': 'str'} }
315
316##
317# @AddfdInfo:
318#
319# Information about a file descriptor that was added to an fd set.
320#
321# @fdset-id: The ID of the fd set that @fd was added to.
322#
323# @fd: The file descriptor that was received via SCM rights and added
324#     to the fd set.
325#
326# Since: 1.2
327##
328{ 'struct': 'AddfdInfo', 'data': {'fdset-id': 'int', 'fd': 'int'} }
329
330##
331# @add-fd:
332#
333# Add a file descriptor, that was passed via SCM rights, to an fd set.
334#
335# @fdset-id: The ID of the fd set to add the file descriptor to.
336#
337# @opaque: A free-form string that can be used to describe the fd.
338#
339# Returns:
340# - @AddfdInfo on success
341# - If file descriptor was not received, GenericError
342# - If @fdset-id is a negative value, GenericError
343#
344# Notes: The list of fd sets is shared by all monitor connections.
345#
346# If @fdset-id is not specified, a new fd set will be created.
347#
348# Since: 1.2
349#
350# Example:
351#
352# -> { "execute": "add-fd", "arguments": { "fdset-id": 1 } }
353# <- { "return": { "fdset-id": 1, "fd": 3 } }
354##
355{ 'command': 'add-fd',
356  'data': { '*fdset-id': 'int',
357            '*opaque': 'str' },
358  'returns': 'AddfdInfo' }
359
360##
361# @remove-fd:
362#
363# Remove a file descriptor from an fd set.
364#
365# @fdset-id: The ID of the fd set that the file descriptor belongs to.
366#
367# @fd: The file descriptor that is to be removed.
368#
369# Returns:
370# - Nothing on success
371# - If @fdset-id or @fd is not found, GenericError
372#
373# Since: 1.2
374#
375# Notes: The list of fd sets is shared by all monitor connections.
376#
377# If @fd is not specified, all file descriptors in @fdset-id will be
378# removed.
379#
380# Example:
381#
382# -> { "execute": "remove-fd", "arguments": { "fdset-id": 1, "fd": 3 } }
383# <- { "return": {} }
384##
385{ 'command': 'remove-fd', 'data': {'fdset-id': 'int', '*fd': 'int'} }
386
387##
388# @FdsetFdInfo:
389#
390# Information about a file descriptor that belongs to an fd set.
391#
392# @fd: The file descriptor value.
393#
394# @opaque: A free-form string that can be used to describe the fd.
395#
396# Since: 1.2
397##
398{ 'struct': 'FdsetFdInfo',
399  'data': {'fd': 'int', '*opaque': 'str'} }
400
401##
402# @FdsetInfo:
403#
404# Information about an fd set.
405#
406# @fdset-id: The ID of the fd set.
407#
408# @fds: A list of file descriptors that belong to this fd set.
409#
410# Since: 1.2
411##
412{ 'struct': 'FdsetInfo',
413  'data': {'fdset-id': 'int', 'fds': ['FdsetFdInfo']} }
414
415##
416# @query-fdsets:
417#
418# Return information describing all fd sets.
419#
420# Returns: A list of @FdsetInfo
421#
422# Since: 1.2
423#
424# Note: The list of fd sets is shared by all monitor connections.
425#
426# Example:
427#
428# -> { "execute": "query-fdsets" }
429# <- { "return": [
430#        {
431#          "fds": [
432#            {
433#              "fd": 30,
434#              "opaque": "rdonly:/path/to/file"
435#            },
436#            {
437#              "fd": 24,
438#              "opaque": "rdwr:/path/to/file"
439#            }
440#          ],
441#          "fdset-id": 1
442#        },
443#        {
444#          "fds": [
445#            {
446#              "fd": 28
447#            },
448#            {
449#              "fd": 29
450#            }
451#          ],
452#          "fdset-id": 0
453#        }
454#      ]
455#    }
456##
457{ 'command': 'query-fdsets', 'returns': ['FdsetInfo'] }
458
459##
460# @CommandLineParameterType:
461#
462# Possible types for an option parameter.
463#
464# @string: accepts a character string
465#
466# @boolean: accepts "on" or "off"
467#
468# @number: accepts a number
469#
470# @size: accepts a number followed by an optional suffix (K)ilo,
471#     (M)ega, (G)iga, (T)era
472#
473# Since: 1.5
474##
475{ 'enum': 'CommandLineParameterType',
476  'data': ['string', 'boolean', 'number', 'size'] }
477
478##
479# @CommandLineParameterInfo:
480#
481# Details about a single parameter of a command line option.
482#
483# @name: parameter name
484#
485# @type: parameter @CommandLineParameterType
486#
487# @help: human readable text string, not suitable for parsing.
488#
489# @default: default value string (since 2.1)
490#
491# Since: 1.5
492##
493{ 'struct': 'CommandLineParameterInfo',
494  'data': { 'name': 'str',
495            'type': 'CommandLineParameterType',
496            '*help': 'str',
497            '*default': 'str' } }
498
499##
500# @CommandLineOptionInfo:
501#
502# Details about a command line option, including its list of parameter
503# details
504#
505# @option: option name
506#
507# @parameters: an array of @CommandLineParameterInfo
508#
509# Since: 1.5
510##
511{ 'struct': 'CommandLineOptionInfo',
512  'data': { 'option': 'str', 'parameters': ['CommandLineParameterInfo'] } }
513
514##
515# @query-command-line-options:
516#
517# Query command line option schema.
518#
519# @option: option name
520#
521# Returns: list of @CommandLineOptionInfo for all options (or for the
522#     given @option).  Returns an error if the given @option doesn't
523#     exist.
524#
525# Since: 1.5
526#
527# Example:
528#
529# -> { "execute": "query-command-line-options",
530#      "arguments": { "option": "option-rom" } }
531# <- { "return": [
532#         {
533#             "parameters": [
534#                 {
535#                     "name": "romfile",
536#                     "type": "string"
537#                 },
538#                 {
539#                     "name": "bootindex",
540#                     "type": "number"
541#                 }
542#             ],
543#             "option": "option-rom"
544#         }
545#      ]
546#    }
547##
548{'command': 'query-command-line-options',
549 'data': {'*option': 'str'},
550 'returns': ['CommandLineOptionInfo'],
551 'allow-preconfig': true}
552
553##
554# @RTC_CHANGE:
555#
556# Emitted when the guest changes the RTC time.
557#
558# @offset: offset in seconds between base RTC clock (as specified by
559#     -rtc base), and new RTC clock value
560#
561# @qom-path: path to the RTC object in the QOM tree
562#
563# Note: This event is rate-limited.  It is not guaranteed that the RTC
564#     in the system implements this event, or even that the system has
565#     an RTC at all.
566#
567# Since: 0.13
568#
569# Example:
570#
571# <- { "event": "RTC_CHANGE",
572#      "data": { "offset": 78 },
573#      "timestamp": { "seconds": 1267020223, "microseconds": 435656 } }
574##
575{ 'event': 'RTC_CHANGE',
576  'data': { 'offset': 'int', 'qom-path': 'str' } }
577
578##
579# @VFU_CLIENT_HANGUP:
580#
581# Emitted when the client of a TYPE_VFIO_USER_SERVER closes the
582# communication channel
583#
584# @vfu-id: ID of the TYPE_VFIO_USER_SERVER object.  It is the last
585#     component of @vfu-qom-path referenced below
586#
587# @vfu-qom-path: path to the TYPE_VFIO_USER_SERVER object in the QOM
588#     tree
589#
590# @dev-id: ID of attached PCI device
591#
592# @dev-qom-path: path to attached PCI device in the QOM tree
593#
594# Since: 7.1
595#
596# Example:
597#
598# <- { "event": "VFU_CLIENT_HANGUP",
599#      "data": { "vfu-id": "vfu1",
600#                "vfu-qom-path": "/objects/vfu1",
601#                "dev-id": "sas1",
602#                "dev-qom-path": "/machine/peripheral/sas1" },
603#      "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
604##
605{ 'event': 'VFU_CLIENT_HANGUP',
606  'data': { 'vfu-id': 'str', 'vfu-qom-path': 'str',
607            'dev-id': 'str', 'dev-qom-path': 'str' } }
608