xref: /openbmc/qemu/qapi/misc.json (revision 6c10778826a873b9012d95e63298a6f879debcaa)
1# -*- Mode: Python -*-
2# vim: filetype=python
3#
4
5##
6# ***********
7# Miscellanea
8# ***********
9##
10
11{ 'include': 'common.json' }
12
13##
14# @add_client:
15#
16# Allow client connections for VNC, Spice and socket based character
17# devices to be passed in to QEMU via SCM_RIGHTS.
18#
19# If the FD associated with @fdname is not a socket, the command will
20# fail and the FD will be closed.
21#
22# @protocol: protocol name.  Valid names are "vnc", "spice",
23#     "@dbus-display" or the name of a character device (e.g. from
24#     -chardev id=XXXX)
25#
26# @fdname: file descriptor name previously passed via 'getfd' command
27#
28# @skipauth: whether to skip authentication.  Only applies to "vnc"
29#     and "spice" protocols
30#
31# @tls: whether to perform TLS.  Only applies to the "spice" protocol
32#
33# Since: 0.14
34#
35# .. qmp-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# .. qmp-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# Return 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
110#    is always the main thread of the process.
111#
112# Returns: a list of @IOThreadInfo for each iothread
113#
114# Since: 2.0
115#
116# .. qmp-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# .. note:: This function will succeed even if the guest is already in
142#    the stopped state.  In "inmigrate" state, it will ensure that the
143#    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# .. qmp-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# .. note:: This command will succeed if the guest is currently
164#    running.  It will also succeed if the guest is in the "inmigrate"
165#    state; in this case, the effect of the command is to make sure
166#    the guest starts once migration finishes, removing the effect of
167#    the ``-S`` command line option if it was passed.
168#
169#    If the VM was previously suspended, and not been reset or woken,
170#    this command will transition back to the "suspended" state.
171#    (Since 9.0)
172#
173# .. qmp-example::
174#
175#     -> { "execute": "cont" }
176#     <- { "return": {} }
177##
178{ 'command': 'cont' }
179
180##
181# @x-exit-preconfig:
182#
183# Exit from "preconfig" state
184#
185# This command makes QEMU exit the preconfig state and proceed with VM
186# initialization using configuration data provided on the command line
187# and via the QMP monitor during the preconfig state.  The command is
188# only available during the preconfig state (i.e. when the --preconfig
189# command line option was in use).
190#
191# Features:
192#
193# @unstable: This command is experimental.
194#
195# Since: 3.0
196#
197# .. qmp-example::
198#
199#     -> { "execute": "x-exit-preconfig" }
200#     <- { "return": {} }
201##
202{ 'command': 'x-exit-preconfig', 'allow-preconfig': true,
203  'features': [ 'unstable' ] }
204
205##
206# @human-monitor-command:
207#
208# Execute a command on the human monitor and return the output.
209#
210# @command-line: the command to execute in the human monitor
211#
212# @cpu-index: The CPU to use for commands that require an implicit CPU
213#
214# Features:
215#
216# @savevm-monitor-nodes: If present, HMP command savevm only snapshots
217#     monitor-owned nodes if they have no parents.  This allows the
218#     use of 'savevm' with -blockdev.  (since 4.2)
219#
220# Returns: the output of the command as a string
221#
222# Since: 0.14
223#
224# .. note:: This command only exists as a stop-gap.  Its use is highly
225#    discouraged.  The semantics of this command are not guaranteed:
226#    this means that command names, arguments and responses can change
227#    or be removed at **any** time.  Applications that rely on long
228#    term stability guarantees should **not** use this command.
229#
230#    Known limitations:
231#
232#    * This command is stateless, this means that commands that depend
233#      on state information (such as getfd) might not work.
234#
235#    * Commands that prompt the user for data don't currently work.
236#
237# .. qmp-example::
238#
239#     -> { "execute": "human-monitor-command",
240#          "arguments": { "command-line": "info kvm" } }
241#     <- { "return": "kvm support: enabled\r\n" }
242##
243{ 'command': 'human-monitor-command',
244  'data': {'command-line': 'str', '*cpu-index': 'int'},
245  'returns': 'str',
246  'features': [ 'savevm-monitor-nodes' ] }
247
248##
249# @getfd:
250#
251# Receive a file descriptor via SCM rights and assign it a name
252#
253# @fdname: file descriptor name
254#
255# Since: 0.14
256#
257# .. note:: If @fdname already exists, the file descriptor assigned to
258#    it will be closed and replaced by the received file descriptor.
259#
260#    The 'closefd' command can be used to explicitly close the file
261#    descriptor when it is no longer needed.
262#
263# .. qmp-example::
264#
265#     -> { "execute": "getfd", "arguments": { "fdname": "fd1" } }
266#     <- { "return": {} }
267##
268{ 'command': 'getfd', 'data': {'fdname': 'str'}, 'if': 'CONFIG_POSIX' }
269
270##
271# @get-win32-socket:
272#
273# Add a socket that was duplicated to QEMU process with
274# WSADuplicateSocketW() via WSASocket() & WSAPROTOCOL_INFOW structure
275# and assign it a name (the SOCKET is associated with a CRT file
276# descriptor)
277#
278# @info: the WSAPROTOCOL_INFOW structure (encoded in base64)
279#
280# @fdname: file descriptor name
281#
282# Since: 8.0
283#
284# .. note:: If @fdname already exists, the file descriptor assigned to
285#    it will be closed and replaced by the received file descriptor.
286#
287#    The 'closefd' command can be used to explicitly close the file
288#    descriptor when it is no longer needed.
289#
290# .. qmp-example::
291#
292#     -> { "execute": "get-win32-socket",
293#          "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# Since: 0.14
306#
307# .. qmp-example::
308#
309#     -> { "execute": "closefd", "arguments": { "fdname": "fd1" } }
310#     <- { "return": {} }
311##
312{ 'command': 'closefd', 'data': {'fdname': 'str'} }
313
314##
315# @AddfdInfo:
316#
317# Information about a file descriptor that was added to an fd set.
318#
319# @fdset-id: The ID of the fd set that @fd was added to.
320#
321# @fd: The file descriptor that was received via SCM rights and added
322#     to the fd set.
323#
324# Since: 1.2
325##
326{ 'struct': 'AddfdInfo', 'data': {'fdset-id': 'int', 'fd': 'int'} }
327
328##
329# @add-fd:
330#
331# Add a file descriptor, that was passed via SCM rights, to an fd set.
332#
333# @fdset-id: The ID of the fd set to add the file descriptor to.
334#
335# @opaque: A free-form string that can be used to describe the fd.
336#
337# Returns:
338#     @AddfdInfo
339#
340# Errors:
341#     - If file descriptor was not received, GenericError
342#     - If @fdset-id is a negative value, GenericError
343#
344# .. note:: The list of fd sets is shared by all monitor connections.
345#
346# .. note:: If @fdset-id is not specified, a new fd set will be
347#    created.
348#
349# Since: 1.2
350#
351# .. qmp-example::
352#
353#     -> { "execute": "add-fd", "arguments": { "fdset-id": 1 } }
354#     <- { "return": { "fdset-id": 1, "fd": 3 } }
355##
356{ 'command': 'add-fd',
357  'data': { '*fdset-id': 'int',
358            '*opaque': 'str' },
359  'returns': 'AddfdInfo' }
360
361##
362# @remove-fd:
363#
364# Remove a file descriptor from an fd set.
365#
366# @fdset-id: The ID of the fd set that the file descriptor belongs to.
367#
368# @fd: The file descriptor that is to be removed.
369#
370# Errors:
371#     - If @fdset-id or @fd is not found, GenericError
372#
373# Since: 1.2
374#
375# .. note:: The list of fd sets is shared by all monitor connections.
376#
377# .. note:: If @fd is not specified, all file descriptors in @fdset-id
378#    will be removed.
379#
380# .. qmp-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# .. qmp-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).
523#
524# Errors:
525#     - if the given @option doesn't exist
526#
527# Since: 1.5
528#
529# .. qmp-example::
530#
531#     -> { "execute": "query-command-line-options",
532#          "arguments": { "option": "option-rom" } }
533#     <- { "return": [
534#             {
535#                 "parameters": [
536#                     {
537#                         "name": "romfile",
538#                         "type": "string"
539#                     },
540#                     {
541#                         "name": "bootindex",
542#                         "type": "number"
543#                     }
544#                 ],
545#                 "option": "option-rom"
546#             }
547#          ]
548#        }
549##
550{'command': 'query-command-line-options',
551 'data': {'*option': 'str'},
552 'returns': ['CommandLineOptionInfo'],
553 'allow-preconfig': true}
554
555##
556# @RTC_CHANGE:
557#
558# Emitted when the guest changes the RTC time.
559#
560# @offset: offset in seconds between base RTC clock (as specified by
561#     -rtc base), and new RTC clock value
562#
563# @qom-path: path to the RTC object in the QOM tree
564#
565# .. note:: This event is rate-limited.  It is not guaranteed that the
566#    RTC in the system implements this event, or even that the system
567#    has an RTC at all.
568#
569# Since: 0.13
570#
571# .. qmp-example::
572#
573#     <- { "event": "RTC_CHANGE",
574#          "data": { "offset": 78 },
575#          "timestamp": { "seconds": 1267020223, "microseconds": 435656 } }
576##
577{ 'event': 'RTC_CHANGE',
578  'data': { 'offset': 'int', 'qom-path': 'str' } }
579
580##
581# @VFU_CLIENT_HANGUP:
582#
583# Emitted when the client of a TYPE_VFIO_USER_SERVER closes the
584# communication channel
585#
586# @vfu-id: ID of the TYPE_VFIO_USER_SERVER object.  It is the last
587#     component of @vfu-qom-path referenced below
588#
589# @vfu-qom-path: path to the TYPE_VFIO_USER_SERVER object in the QOM
590#     tree
591#
592# @dev-id: ID of attached PCI device
593#
594# @dev-qom-path: path to attached PCI device in the QOM tree
595#
596# Since: 7.1
597#
598# .. qmp-example::
599#
600#     <- { "event": "VFU_CLIENT_HANGUP",
601#          "data": { "vfu-id": "vfu1",
602#                    "vfu-qom-path": "/objects/vfu1",
603#                    "dev-id": "sas1",
604#                    "dev-qom-path": "/machine/peripheral/sas1" },
605#          "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
606##
607{ 'event': 'VFU_CLIENT_HANGUP',
608  'data': { 'vfu-id': 'str', 'vfu-qom-path': 'str',
609            'dev-id': 'str', 'dev-qom-path': 'str' } }
610