1d5657258SPeter Maydell.. 2d5657258SPeter Maydell Copyright (C) 2009-2016 Red Hat, Inc. 3d5657258SPeter Maydell 4d5657258SPeter Maydell This work is licensed under the terms of the GNU GPL, version 2 or 5d5657258SPeter Maydell later. See the COPYING file in the top-level directory. 6d5657258SPeter Maydell 7d5657258SPeter Maydell 8d5657258SPeter Maydell=================================== 9d5657258SPeter MaydellQEMU Machine Protocol Specification 10d5657258SPeter Maydell=================================== 11d5657258SPeter Maydell 12d5657258SPeter MaydellThe QEMU Machine Protocol (QMP) is a JSON-based 13d5657258SPeter Maydellprotocol which is available for applications to operate QEMU at the 14d5657258SPeter Maydellmachine-level. It is also in use by the QEMU Guest Agent (QGA), which 15d5657258SPeter Maydellis available for host applications to interact with the guest 16d5657258SPeter Maydelloperating system. This page specifies the general format of 17d5657258SPeter Maydellthe protocol; details of the commands and data structures can 18d5657258SPeter Maydellbe found in the :doc:`qemu-qmp-ref` and the :doc:`qemu-ga-ref`. 19d5657258SPeter Maydell 20d5657258SPeter Maydell.. contents:: 21d5657258SPeter Maydell 22d5657258SPeter MaydellProtocol Specification 23d5657258SPeter Maydell====================== 24d5657258SPeter Maydell 25d5657258SPeter MaydellThis section details the protocol format. For the purpose of this 26d5657258SPeter Maydelldocument, "Server" is either QEMU or the QEMU Guest Agent, and 27d5657258SPeter Maydell"Client" is any application communicating with it via QMP. 28d5657258SPeter Maydell 29d5657258SPeter MaydellJSON data structures, when mentioned in this document, are always in the 30d5657258SPeter Maydellfollowing format: 31d5657258SPeter Maydell 32d5657258SPeter Maydell json-DATA-STRUCTURE-NAME 33d5657258SPeter Maydell 34d5657258SPeter MaydellWhere DATA-STRUCTURE-NAME is any valid JSON data structure, as defined 35d5657258SPeter Maydellby the `JSON standard <http://www.ietf.org/rfc/rfc8259.txt>`_. 36d5657258SPeter Maydell 37d5657258SPeter MaydellThe server expects its input to be encoded in UTF-8, and sends its 38d5657258SPeter Maydelloutput encoded in ASCII. 39d5657258SPeter Maydell 40d5657258SPeter MaydellFor convenience, json-object members mentioned in this document will 41d5657258SPeter Maydellbe in a certain order. However, in real protocol usage they can be in 42d5657258SPeter MaydellANY order, thus no particular order should be assumed. On the other 43d5657258SPeter Maydellhand, use of json-array elements presumes that preserving order is 44d5657258SPeter Maydellimportant unless specifically documented otherwise. Repeating a key 45d5657258SPeter Maydellwithin a json-object gives unpredictable results. 46d5657258SPeter Maydell 47d5657258SPeter MaydellAlso for convenience, the server will accept an extension of 48d5657258SPeter Maydell``'single-quoted'`` strings in place of the usual ``"double-quoted"`` 49d5657258SPeter Maydelljson-string, and both input forms of strings understand an additional 50d5657258SPeter Maydellescape sequence of ``\'`` for a single quote. The server will only use 51d5657258SPeter Maydelldouble quoting on output. 52d5657258SPeter Maydell 53d5657258SPeter MaydellGeneral Definitions 54d5657258SPeter Maydell------------------- 55d5657258SPeter Maydell 56d5657258SPeter MaydellAll interactions transmitted by the Server are json-objects, always 57d5657258SPeter Maydellterminating with CRLF. 58d5657258SPeter Maydell 59d5657258SPeter MaydellAll json-objects members are mandatory when not specified otherwise. 60d5657258SPeter Maydell 61d5657258SPeter MaydellServer Greeting 62d5657258SPeter Maydell--------------- 63d5657258SPeter Maydell 64d5657258SPeter MaydellRight when connected the Server will issue a greeting message, which signals 65d5657258SPeter Maydellthat the connection has been successfully established and that the Server is 66d5657258SPeter Maydellready for capabilities negotiation (for more information refer to section 67d5657258SPeter Maydell`Capabilities Negotiation`_). 68d5657258SPeter Maydell 69d5657258SPeter MaydellThe greeting message format is: 70d5657258SPeter Maydell 71d5657258SPeter Maydell:: 72d5657258SPeter Maydell 73d5657258SPeter Maydell { "QMP": { "version": json-object, "capabilities": json-array } } 74d5657258SPeter Maydell 75d5657258SPeter MaydellWhere: 76d5657258SPeter Maydell 77d5657258SPeter Maydell- The ``version`` member contains the Server's version information (the format 78d5657258SPeter Maydell is the same as for the query-version command). 79d5657258SPeter Maydell- The ``capabilities`` member specifies the availability of features beyond the 80d5657258SPeter Maydell baseline specification; the order of elements in this array has no 81d5657258SPeter Maydell particular significance. 82d5657258SPeter Maydell 83d5657258SPeter MaydellCapabilities 84d5657258SPeter Maydell------------ 85d5657258SPeter Maydell 86d5657258SPeter MaydellCurrently supported capabilities are: 87d5657258SPeter Maydell 88d5657258SPeter Maydell``oob`` 89d5657258SPeter Maydell the QMP server supports "out-of-band" (OOB) command 90d5657258SPeter Maydell execution, as described in section `Out-of-band execution`_. 91d5657258SPeter Maydell 92d5657258SPeter MaydellIssuing Commands 93d5657258SPeter Maydell---------------- 94d5657258SPeter Maydell 95d5657258SPeter MaydellThe format for command execution is: 96d5657258SPeter Maydell 97d5657258SPeter Maydell:: 98d5657258SPeter Maydell 99d5657258SPeter Maydell { "execute": json-string, "arguments": json-object, "id": json-value } 100d5657258SPeter Maydell 101d5657258SPeter Maydellor 102d5657258SPeter Maydell 103d5657258SPeter Maydell:: 104d5657258SPeter Maydell 105d5657258SPeter Maydell { "exec-oob": json-string, "arguments": json-object, "id": json-value } 106d5657258SPeter Maydell 107d5657258SPeter MaydellWhere: 108d5657258SPeter Maydell 109d5657258SPeter Maydell- The ``execute`` or ``exec-oob`` member identifies the command to be 110d5657258SPeter Maydell executed by the server. The latter requests out-of-band execution. 111d5657258SPeter Maydell- The ``arguments`` member is used to pass any arguments required for the 112d5657258SPeter Maydell execution of the command, it is optional when no arguments are 113d5657258SPeter Maydell required. Each command documents what contents will be considered 114d5657258SPeter Maydell valid when handling the json-argument. 115d5657258SPeter Maydell- The ``id`` member is a transaction identification associated with the 116d5657258SPeter Maydell command execution, it is optional and will be part of the response 117d5657258SPeter Maydell if provided. The ``id`` member can be any json-value. A json-number 118d5657258SPeter Maydell incremented for each successive command works fine. 119d5657258SPeter Maydell 120d5657258SPeter MaydellThe actual commands are documented in the :doc:`qemu-qmp-ref`. 121d5657258SPeter Maydell 122d5657258SPeter MaydellOut-of-band execution 123d5657258SPeter Maydell--------------------- 124d5657258SPeter Maydell 125d5657258SPeter MaydellThe server normally reads, executes and responds to one command after 126d5657258SPeter Maydellthe other. The client therefore receives command responses in issue 127d5657258SPeter Maydellorder. 128d5657258SPeter Maydell 129d5657258SPeter MaydellWith out-of-band execution enabled via `capabilities negotiation`_, 130d5657258SPeter Maydellthe server reads and queues commands as they arrive. It executes 131d5657258SPeter Maydellcommands from the queue one after the other. Commands executed 132d5657258SPeter Maydellout-of-band jump the queue: the command get executed right away, 133d5657258SPeter Maydellpossibly overtaking prior in-band commands. The client may therefore 134d5657258SPeter Maydellreceive such a command's response before responses from prior in-band 135d5657258SPeter Maydellcommands. 136d5657258SPeter Maydell 137d5657258SPeter MaydellTo be able to match responses back to their commands, the client needs 138d5657258SPeter Maydellto pass ``id`` with out-of-band commands. Passing it with all commands 139d5657258SPeter Maydellis recommended for clients that accept capability ``oob``. 140d5657258SPeter Maydell 141d5657258SPeter MaydellIf the client sends in-band commands faster than the server can 142d5657258SPeter Maydellexecute them, the server will stop reading requests until the request 143d5657258SPeter Maydellqueue length is reduced to an acceptable range. 144d5657258SPeter Maydell 145d5657258SPeter MaydellTo ensure commands to be executed out-of-band get read and executed, 146d5657258SPeter Maydellthe client should have at most eight in-band commands in flight. 147d5657258SPeter Maydell 148d5657258SPeter MaydellOnly a few commands support out-of-band execution. The ones that do 149d5657258SPeter Maydellhave ``"allow-oob": true`` in the output of ``query-qmp-schema``. 150d5657258SPeter Maydell 151d5657258SPeter MaydellCommands Responses 152d5657258SPeter Maydell------------------ 153d5657258SPeter Maydell 154d5657258SPeter MaydellThere are two possible responses which the Server will issue as the result 155d5657258SPeter Maydellof a command execution: success or error. 156d5657258SPeter Maydell 157d5657258SPeter MaydellAs long as the commands were issued with a proper ``id`` field, then the 158d5657258SPeter Maydellsame ``id`` field will be attached in the corresponding response message 159d5657258SPeter Maydellso that requests and responses can match. Clients should drop all the 160d5657258SPeter Maydellresponses that have an unknown ``id`` field. 161d5657258SPeter Maydell 162d5657258SPeter MaydellSuccess 163d5657258SPeter Maydell------- 164d5657258SPeter Maydell 165d5657258SPeter MaydellThe format of a success response is: 166d5657258SPeter Maydell 167d5657258SPeter Maydell:: 168d5657258SPeter Maydell 169d5657258SPeter Maydell { "return": json-value, "id": json-value } 170d5657258SPeter Maydell 171d5657258SPeter MaydellWhere: 172d5657258SPeter Maydell 173d5657258SPeter Maydell- The ``return`` member contains the data returned by the command, which 174d5657258SPeter Maydell is defined on a per-command basis (usually a json-object or 175d5657258SPeter Maydell json-array of json-objects, but sometimes a json-number, json-string, 176d5657258SPeter Maydell or json-array of json-strings); it is an empty json-object if the 177d5657258SPeter Maydell command does not return data. 178d5657258SPeter Maydell- The ``id`` member contains the transaction identification associated 179d5657258SPeter Maydell with the command execution if issued by the Client. 180d5657258SPeter Maydell 181d5657258SPeter MaydellError 182d5657258SPeter Maydell----- 183d5657258SPeter Maydell 184d5657258SPeter MaydellThe format of an error response is: 185d5657258SPeter Maydell 186d5657258SPeter Maydell:: 187d5657258SPeter Maydell 188d5657258SPeter Maydell { "error": { "class": json-string, "desc": json-string }, "id": json-value } 189d5657258SPeter Maydell 190d5657258SPeter MaydellWhere: 191d5657258SPeter Maydell 192d5657258SPeter Maydell- The ``class`` member contains the error class name (eg. ``"GenericError"``). 193d5657258SPeter Maydell- The ``desc`` member is a human-readable error message. Clients should 194d5657258SPeter Maydell not attempt to parse this message. 195d5657258SPeter Maydell- The ``id`` member contains the transaction identification associated with 196d5657258SPeter Maydell the command execution if issued by the Client. 197d5657258SPeter Maydell 198d5657258SPeter MaydellNOTE: Some errors can occur before the Server is able to read the ``id`` member; 199d5657258SPeter Maydellin these cases the ``id`` member will not be part of the error response, even 200d5657258SPeter Maydellif provided by the client. 201d5657258SPeter Maydell 202d5657258SPeter MaydellAsynchronous events 203d5657258SPeter Maydell------------------- 204d5657258SPeter Maydell 205d5657258SPeter MaydellAs a result of state changes, the Server may send messages unilaterally 206d5657258SPeter Maydellto the Client at any time, when not in the middle of any other 207d5657258SPeter Maydellresponse. They are called "asynchronous events". 208d5657258SPeter Maydell 209d5657258SPeter MaydellThe format of asynchronous events is: 210d5657258SPeter Maydell 211d5657258SPeter Maydell:: 212d5657258SPeter Maydell 213d5657258SPeter Maydell { "event": json-string, "data": json-object, 214d5657258SPeter Maydell "timestamp": { "seconds": json-number, "microseconds": json-number } } 215d5657258SPeter Maydell 216d5657258SPeter MaydellWhere: 217d5657258SPeter Maydell 218d5657258SPeter Maydell- The ``event`` member contains the event's name. 219d5657258SPeter Maydell- The ``data`` member contains event specific data, which is defined in a 220d5657258SPeter Maydell per-event basis. It is optional. 221d5657258SPeter Maydell- The ``timestamp`` member contains the exact time of when the event 222d5657258SPeter Maydell occurred in the Server. It is a fixed json-object with time in 223d5657258SPeter Maydell seconds and microseconds relative to the Unix Epoch (1 Jan 1970); if 224d5657258SPeter Maydell there is a failure to retrieve host time, both members of the 225d5657258SPeter Maydell timestamp will be set to -1. 226d5657258SPeter Maydell 227d5657258SPeter MaydellThe actual asynchronous events are documented in the :doc:`qemu-qmp-ref`. 228d5657258SPeter Maydell 229d5657258SPeter MaydellSome events are rate-limited to at most one per second. If additional 230d5657258SPeter Maydell"similar" events arrive within one second, all but the last one are 231d5657258SPeter Maydelldropped, and the last one is delayed. "Similar" normally means same 232d5657258SPeter Maydellevent type. 233d5657258SPeter Maydell 234d5657258SPeter MaydellForcing the JSON parser into known-good state 235d5657258SPeter Maydell--------------------------------------------- 236d5657258SPeter Maydell 237d5657258SPeter MaydellIncomplete or invalid input can leave the server's JSON parser in a 238d5657258SPeter Maydellstate where it can't parse additional commands. To get it back into 239d5657258SPeter Maydellknown-good state, the client should provoke a lexical error. 240d5657258SPeter Maydell 241d5657258SPeter MaydellThe cleanest way to do that is sending an ASCII control character 242d5657258SPeter Maydellother than ``\t`` (horizontal tab), ``\r`` (carriage return), or 243d5657258SPeter Maydell``\n`` (new line). 244d5657258SPeter Maydell 245d5657258SPeter MaydellSadly, older versions of QEMU can fail to flag this as an error. If a 246d5657258SPeter Maydellclient needs to deal with them, it should send a 0xFF byte. 247d5657258SPeter Maydell 248d5657258SPeter MaydellQGA Synchronization 249d5657258SPeter Maydell------------------- 250d5657258SPeter Maydell 251d5657258SPeter MaydellWhen a client connects to QGA over a transport lacking proper 252d5657258SPeter Maydellconnection semantics such as virtio-serial, QGA may have read partial 253d5657258SPeter Maydellinput from a previous client. The client needs to force QGA's parser 254d5657258SPeter Maydellinto known-good state using the previous section's technique. 255d5657258SPeter MaydellMoreover, the client may receive output a previous client didn't read. 256d5657258SPeter MaydellTo help with skipping that output, QGA provides the 257d5657258SPeter Maydell``guest-sync-delimited`` command. Refer to its documentation for 258d5657258SPeter Maydelldetails. 259d5657258SPeter Maydell 260d5657258SPeter Maydell 261d5657258SPeter MaydellQMP Examples 262d5657258SPeter Maydell============ 263d5657258SPeter Maydell 264d5657258SPeter MaydellThis section provides some examples of real QMP usage, in all of them 265d5657258SPeter Maydell``->`` marks text sent by the Client and ``<-`` marks replies by the Server. 266d5657258SPeter Maydell 267d5657258SPeter Maydell.. admonition:: Example 268d5657258SPeter Maydell 269d5657258SPeter Maydell Server greeting 270d5657258SPeter Maydell 271d5657258SPeter Maydell .. code-block:: QMP 272d5657258SPeter Maydell 273d5657258SPeter Maydell <- { "QMP": {"version": {"qemu": {"micro": 0, "minor": 0, "major": 3}, 274d5657258SPeter Maydell "package": "v3.0.0"}, "capabilities": ["oob"] } } 275d5657258SPeter Maydell 276d5657258SPeter Maydell.. admonition:: Example 277d5657258SPeter Maydell 278d5657258SPeter Maydell Capabilities negotiation 279d5657258SPeter Maydell 280d5657258SPeter Maydell .. code-block:: QMP 281d5657258SPeter Maydell 282d5657258SPeter Maydell -> { "execute": "qmp_capabilities", "arguments": { "enable": ["oob"] } } 283d5657258SPeter Maydell <- { "return": {}} 284d5657258SPeter Maydell 285d5657258SPeter Maydell.. admonition:: Example 286d5657258SPeter Maydell 287d5657258SPeter Maydell Simple 'stop' execution 288d5657258SPeter Maydell 289d5657258SPeter Maydell .. code-block:: QMP 290d5657258SPeter Maydell 291d5657258SPeter Maydell -> { "execute": "stop" } 292d5657258SPeter Maydell <- { "return": {} } 293d5657258SPeter Maydell 294d5657258SPeter Maydell.. admonition:: Example 295d5657258SPeter Maydell 296d5657258SPeter Maydell KVM information 297d5657258SPeter Maydell 298d5657258SPeter Maydell .. code-block:: QMP 299d5657258SPeter Maydell 300d5657258SPeter Maydell -> { "execute": "query-kvm", "id": "example" } 301d5657258SPeter Maydell <- { "return": { "enabled": true, "present": true }, "id": "example"} 302d5657258SPeter Maydell 303d5657258SPeter Maydell.. admonition:: Example 304d5657258SPeter Maydell 305d5657258SPeter Maydell Parsing error 306d5657258SPeter Maydell 307d5657258SPeter Maydell .. code-block:: QMP 308d5657258SPeter Maydell 309d5657258SPeter Maydell -> { "execute": } 310*8a85b8ecSPeter Maydell <- { "error": { "class": "GenericError", "desc": "JSON parse error, expecting value" } } 311d5657258SPeter Maydell 312d5657258SPeter Maydell.. admonition:: Example 313d5657258SPeter Maydell 314d5657258SPeter Maydell Powerdown event 315d5657258SPeter Maydell 316d5657258SPeter Maydell .. code-block:: QMP 317d5657258SPeter Maydell 318d5657258SPeter Maydell <- { "timestamp": { "seconds": 1258551470, "microseconds": 802384 }, 319d5657258SPeter Maydell "event": "POWERDOWN" } 320d5657258SPeter Maydell 321d5657258SPeter Maydell.. admonition:: Example 322d5657258SPeter Maydell 323d5657258SPeter Maydell Out-of-band execution 324d5657258SPeter Maydell 325d5657258SPeter Maydell .. code-block:: QMP 326d5657258SPeter Maydell 327d5657258SPeter Maydell -> { "exec-oob": "migrate-pause", "id": 42 } 328d5657258SPeter Maydell <- { "id": 42, 329d5657258SPeter Maydell "error": { "class": "GenericError", 330d5657258SPeter Maydell "desc": "migrate-pause is currently only supported during postcopy-active state" } } 331d5657258SPeter Maydell 332d5657258SPeter Maydell 333d5657258SPeter MaydellCapabilities Negotiation 334d5657258SPeter Maydell======================== 335d5657258SPeter Maydell 336d5657258SPeter MaydellWhen a Client successfully establishes a connection, the Server is in 337d5657258SPeter MaydellCapabilities Negotiation mode. 338d5657258SPeter Maydell 339d5657258SPeter MaydellIn this mode only the ``qmp_capabilities`` command is allowed to run; all 340d5657258SPeter Maydellother commands will return the ``CommandNotFound`` error. Asynchronous 341d5657258SPeter Maydellmessages are not delivered either. 342d5657258SPeter Maydell 343d5657258SPeter MaydellClients should use the ``qmp_capabilities`` command to enable capabilities 344d5657258SPeter Maydelladvertised in the `Server Greeting`_ which they support. 345d5657258SPeter Maydell 346d5657258SPeter MaydellWhen the ``qmp_capabilities`` command is issued, and if it does not return an 347d5657258SPeter Maydellerror, the Server enters Command mode where capabilities changes take 348d5657258SPeter Maydelleffect, all commands (except ``qmp_capabilities``) are allowed and asynchronous 349d5657258SPeter Maydellmessages are delivered. 350d5657258SPeter Maydell 351d5657258SPeter MaydellCompatibility Considerations 352d5657258SPeter Maydell============================ 353d5657258SPeter Maydell 354d5657258SPeter MaydellAll protocol changes or new features which modify the protocol format in an 355d5657258SPeter Maydellincompatible way are disabled by default and will be advertised by the 356d5657258SPeter Maydellcapabilities array (in the `Server Greeting`_). Thus, Clients can check 357d5657258SPeter Maydellthat array and enable the capabilities they support. 358d5657258SPeter Maydell 359d5657258SPeter MaydellThe QMP Server performs a type check on the arguments to a command. It 360d5657258SPeter Maydellgenerates an error if a value does not have the expected type for its 361d5657258SPeter Maydellkey, or if it does not understand a key that the Client included. The 362d5657258SPeter Maydellstrictness of the Server catches wrong assumptions of Clients about 363d5657258SPeter Maydellthe Server's schema. Clients can assume that, when such validation 364d5657258SPeter Maydellerrors occur, they will be reported before the command generated any 365d5657258SPeter Maydellside effect. 366d5657258SPeter Maydell 367d5657258SPeter MaydellHowever, Clients must not assume any particular: 368d5657258SPeter Maydell 369d5657258SPeter Maydell- Length of json-arrays 370d5657258SPeter Maydell- Size of json-objects; in particular, future versions of QEMU may add 371d5657258SPeter Maydell new keys and Clients should be able to ignore them 372d5657258SPeter Maydell- Order of json-object members or json-array elements 373d5657258SPeter Maydell- Amount of errors generated by a command, that is, new errors can be added 374d5657258SPeter Maydell to any existing command in newer versions of the Server 375d5657258SPeter Maydell 376d5657258SPeter MaydellAny command or member name beginning with ``x-`` is deemed experimental, 377d5657258SPeter Maydelland may be withdrawn or changed in an incompatible manner in a future 378d5657258SPeter Maydellrelease. 379d5657258SPeter Maydell 380d5657258SPeter MaydellOf course, the Server does guarantee to send valid JSON. But apart from 381d5657258SPeter Maydellthis, a Client should be "conservative in what they send, and liberal in 382d5657258SPeter Maydellwhat they accept". 383d5657258SPeter Maydell 384d5657258SPeter MaydellDownstream extension of QMP 385d5657258SPeter Maydell=========================== 386d5657258SPeter Maydell 387d5657258SPeter MaydellWe recommend that downstream consumers of QEMU do *not* modify QMP. 388d5657258SPeter MaydellManagement tools should be able to support both upstream and downstream 389d5657258SPeter Maydellversions of QMP without special logic, and downstream extensions are 390d5657258SPeter Maydellinherently at odds with that. 391d5657258SPeter Maydell 392d5657258SPeter MaydellHowever, we recognize that it is sometimes impossible for downstreams to 393d5657258SPeter Maydellavoid modifying QMP. Both upstream and downstream need to take care to 394d5657258SPeter Maydellpreserve long-term compatibility and interoperability. 395d5657258SPeter Maydell 396d5657258SPeter MaydellTo help with that, QMP reserves JSON object member names beginning with 397d5657258SPeter Maydell``__`` (double underscore) for downstream use ("downstream names"). This 398d5657258SPeter Maydellmeans upstream will never use any downstream names for its commands, 399d5657258SPeter Maydellarguments, errors, asynchronous events, and so forth. 400d5657258SPeter Maydell 401d5657258SPeter MaydellAny new names downstream wishes to add must begin with ``__``. To 402d5657258SPeter Maydellensure compatibility with other downstreams, it is strongly 403d5657258SPeter Maydellrecommended that you prefix your downstream names with ``__RFQDN_`` where 404d5657258SPeter MaydellRFQDN is a valid, reverse fully qualified domain name which you 405d5657258SPeter Maydellcontrol. For example, a qemu-kvm specific monitor command would be: 406d5657258SPeter Maydell 407d5657258SPeter Maydell:: 408d5657258SPeter Maydell 409d5657258SPeter Maydell (qemu) __org.linux-kvm_enable_irqchip 410d5657258SPeter Maydell 411d5657258SPeter MaydellDownstream must not change the `server greeting`_ other than 412d5657258SPeter Maydellto offer additional capabilities. But see below for why even that is 413d5657258SPeter Maydelldiscouraged. 414d5657258SPeter Maydell 415d5657258SPeter MaydellThe section `Compatibility Considerations`_ applies to downstream as well 416d5657258SPeter Maydellas to upstream, obviously. It follows that downstream must behave 417d5657258SPeter Maydellexactly like upstream for any input not containing members with 418d5657258SPeter Maydelldownstream names ("downstream members"), except it may add members 419d5657258SPeter Maydellwith downstream names to its output. 420d5657258SPeter Maydell 421d5657258SPeter MaydellThus, a client should not be able to distinguish downstream from 422d5657258SPeter Maydellupstream as long as it doesn't send input with downstream members, and 423d5657258SPeter Maydellproperly ignores any downstream members in the output it receives. 424d5657258SPeter Maydell 425d5657258SPeter MaydellAdvice on downstream modifications: 426d5657258SPeter Maydell 427d5657258SPeter Maydell1. Introducing new commands is okay. If you want to extend an existing 428d5657258SPeter Maydell command, consider introducing a new one with the new behaviour 429d5657258SPeter Maydell instead. 430d5657258SPeter Maydell 431d5657258SPeter Maydell2. Introducing new asynchronous messages is okay. If you want to extend 432d5657258SPeter Maydell an existing message, consider adding a new one instead. 433d5657258SPeter Maydell 434d5657258SPeter Maydell3. Introducing new errors for use in new commands is okay. Adding new 435d5657258SPeter Maydell errors to existing commands counts as extension, so 1. applies. 436d5657258SPeter Maydell 437d5657258SPeter Maydell4. New capabilities are strongly discouraged. Capabilities are for 438d5657258SPeter Maydell evolving the basic protocol, and multiple diverging basic protocol 439d5657258SPeter Maydell dialects are most undesirable. 440