qdev.json 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. # -*- Mode: Python -*-
  2. # vim: filetype=python
  3. #
  4. # This work is licensed under the terms of the GNU GPL, version 2 or later.
  5. # See the COPYING file in the top-level directory.
  6. ##
  7. # = Device infrastructure (qdev)
  8. ##
  9. { 'include': 'qom.json' }
  10. ##
  11. # @device-list-properties:
  12. #
  13. # List properties associated with a device.
  14. #
  15. # @typename: the type name of a device
  16. #
  17. # Returns: a list of ObjectPropertyInfo describing a devices
  18. # properties
  19. #
  20. # .. note:: Objects can create properties at runtime, for example to
  21. # describe links between different devices and/or objects. These
  22. # properties are not included in the output of this command.
  23. #
  24. # Since: 1.2
  25. ##
  26. { 'command': 'device-list-properties',
  27. 'data': { 'typename': 'str'},
  28. 'returns': [ 'ObjectPropertyInfo' ] }
  29. ##
  30. # @device_add:
  31. #
  32. # Add a device.
  33. #
  34. # @driver: the name of the new device's driver
  35. #
  36. # @bus: the device's parent bus (device tree path)
  37. #
  38. # @id: the device's ID, must be unique
  39. #
  40. # Features:
  41. #
  42. # @json-cli: If present, the "-device" command line option supports
  43. # JSON syntax with a structure identical to the arguments of this
  44. # command.
  45. #
  46. # @json-cli-hotplug: If present, the "-device" command line option
  47. # supports JSON syntax without the reference counting leak that
  48. # broke hot-unplug
  49. #
  50. # .. admonition:: Notes
  51. #
  52. # 1. Additional arguments depend on the type.
  53. #
  54. # 2. For detailed information about this command, please refer to
  55. # the 'docs/qdev-device-use.txt' file.
  56. #
  57. # 3. It's possible to list device properties by running QEMU with
  58. # the ``-device DEVICE,help`` command-line argument, where
  59. # DEVICE is the device's name.
  60. #
  61. # .. qmp-example::
  62. #
  63. # -> { "execute": "device_add",
  64. # "arguments": { "driver": "e1000", "id": "net1",
  65. # "bus": "pci.0",
  66. # "mac": "52:54:00:12:34:56" } }
  67. # <- { "return": {} }
  68. #
  69. # TODO: This command effectively bypasses QAPI completely due to its
  70. # "additional arguments" business. It shouldn't have been added
  71. # to the schema in this form. It should be qapified properly, or
  72. # replaced by a properly qapified command.
  73. #
  74. # Since: 0.13
  75. ##
  76. { 'command': 'device_add',
  77. 'data': {'driver': 'str', '*bus': 'str', '*id': 'str'},
  78. 'gen': false, # so we can get the additional arguments
  79. 'features': ['json-cli', 'json-cli-hotplug'] }
  80. ##
  81. # @device_del:
  82. #
  83. # Remove a device from a guest
  84. #
  85. # @id: the device's ID or QOM path
  86. #
  87. # Errors:
  88. # - If @id is not a valid device, DeviceNotFound
  89. #
  90. # .. note:: When this command completes, the device may not be removed
  91. # from the guest. Hot removal is an operation that requires guest
  92. # cooperation. This command merely requests that the guest begin
  93. # the hot removal process. Completion of the device removal
  94. # process is signaled with a DEVICE_DELETED event. Guest reset
  95. # will automatically complete removal for all devices. If a
  96. # guest-side error in the hot removal process is detected, the
  97. # device will not be removed and a DEVICE_UNPLUG_GUEST_ERROR event
  98. # is sent. Some errors cannot be detected.
  99. #
  100. # Since: 0.14
  101. #
  102. # .. qmp-example::
  103. #
  104. # -> { "execute": "device_del",
  105. # "arguments": { "id": "net1" } }
  106. # <- { "return": {} }
  107. #
  108. # .. qmp-example::
  109. #
  110. # -> { "execute": "device_del",
  111. # "arguments": { "id": "/machine/peripheral-anon/device[0]" } }
  112. # <- { "return": {} }
  113. ##
  114. { 'command': 'device_del', 'data': {'id': 'str'} }
  115. ##
  116. # @DEVICE_DELETED:
  117. #
  118. # Emitted whenever the device removal completion is acknowledged by
  119. # the guest. At this point, it's safe to reuse the specified device
  120. # ID. Device removal can be initiated by the guest or by HMP/QMP
  121. # commands.
  122. #
  123. # @device: the device's ID if it has one
  124. #
  125. # @path: the device's QOM path
  126. #
  127. # Since: 1.5
  128. #
  129. # .. qmp-example::
  130. #
  131. # <- { "event": "DEVICE_DELETED",
  132. # "data": { "device": "virtio-net-pci-0",
  133. # "path": "/machine/peripheral/virtio-net-pci-0" },
  134. # "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
  135. ##
  136. { 'event': 'DEVICE_DELETED',
  137. 'data': { '*device': 'str', 'path': 'str' } }
  138. ##
  139. # @DEVICE_UNPLUG_GUEST_ERROR:
  140. #
  141. # Emitted when a device hot unplug fails due to a guest reported
  142. # error.
  143. #
  144. # @device: the device's ID if it has one
  145. #
  146. # @path: the device's QOM path
  147. #
  148. # Since: 6.2
  149. #
  150. # .. qmp-example::
  151. #
  152. # <- { "event": "DEVICE_UNPLUG_GUEST_ERROR",
  153. # "data": { "device": "core1",
  154. # "path": "/machine/peripheral/core1" },
  155. # "timestamp": { "seconds": 1615570772, "microseconds": 202844 } }
  156. ##
  157. { 'event': 'DEVICE_UNPLUG_GUEST_ERROR',
  158. 'data': { '*device': 'str', 'path': 'str' } }