qdev.json (9b112b1b79f0e93242a9ce9bffd1113458e93e03) qdev.json (a937b6aa739f65f2cae2ad9a7eb65a309ad2a359)
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##
8# = Device infrastructure (qdev)
9##
10
11{ 'include': 'qom.json' }
12
13##
14# @device-list-properties:
15#
16# List properties associated with a device.
17#
18# @typename: the type name of a device
19#
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##
8# = Device infrastructure (qdev)
9##
10
11{ 'include': 'qom.json' }
12
13##
14# @device-list-properties:
15#
16# List properties associated with a device.
17#
18# @typename: the type name of a device
19#
20# Returns: a list of ObjectPropertyInfo describing a devices properties
20# Returns: a list of ObjectPropertyInfo describing a devices
21# properties
21#
22#
22# Note: objects can create properties at runtime, for example to describe
23# links between different devices and/or objects. These properties
24# are not included in the output of this command.
23# Note: objects can create properties at runtime, for example to
24# describe links between different devices and/or objects. These
25# properties are not included in the output of this command.
25#
26# Since: 1.2
27##
28{ 'command': 'device-list-properties',
29 'data': { 'typename': 'str'},
30 'returns': [ 'ObjectPropertyInfo' ] }
31
32##
33# @device_add:
34#
35# Add a device.
36#
37# @driver: the name of the new device's driver
38#
39# @bus: the device's parent bus (device tree path)
40#
41# @id: the device's ID, must be unique
42#
43# Features:
26#
27# Since: 1.2
28##
29{ 'command': 'device-list-properties',
30 'data': { 'typename': 'str'},
31 'returns': [ 'ObjectPropertyInfo' ] }
32
33##
34# @device_add:
35#
36# Add a device.
37#
38# @driver: the name of the new device's driver
39#
40# @bus: the device's parent bus (device tree path)
41#
42# @id: the device's ID, must be unique
43#
44# Features:
44# @json-cli: If present, the "-device" command line option supports JSON
45# syntax with a structure identical to the arguments of this
46# command.
47# @json-cli-hotplug: If present, the "-device" command line option supports JSON
48# syntax without the reference counting leak that broke
49# hot-unplug
50#
45#
46# @json-cli: If present, the "-device" command line option supports
47# JSON syntax with a structure identical to the arguments of this
48# command.
49#
50# @json-cli-hotplug: If present, the "-device" command line option
51# supports JSON syntax without the reference counting leak that
52# broke hot-unplug
53#
51# Notes:
52#
53# Additional arguments depend on the type.
54#
55# 1. For detailed information about this command, please refer to the
56# 'docs/qdev-device-use.txt' file.
57#
58# 2. It's possible to list device properties by running QEMU with the

--- 4 unchanged lines hidden (view full) ---

63#
64# -> { "execute": "device_add",
65# "arguments": { "driver": "e1000", "id": "net1",
66# "bus": "pci.0",
67# "mac": "52:54:00:12:34:56" } }
68# <- { "return": {} }
69#
70# TODO: This command effectively bypasses QAPI completely due to its
54# Notes:
55#
56# Additional arguments depend on the type.
57#
58# 1. For detailed information about this command, please refer to the
59# 'docs/qdev-device-use.txt' file.
60#
61# 2. It's possible to list device properties by running QEMU with the

--- 4 unchanged lines hidden (view full) ---

66#
67# -> { "execute": "device_add",
68# "arguments": { "driver": "e1000", "id": "net1",
69# "bus": "pci.0",
70# "mac": "52:54:00:12:34:56" } }
71# <- { "return": {} }
72#
73# TODO: This command effectively bypasses QAPI completely due to its
71# "additional arguments" business. It shouldn't have been added to
72# the schema in this form. It should be qapified properly, or
73# replaced by a properly qapified command.
74# "additional arguments" business. It shouldn't have been added
75# to the schema in this form. It should be qapified properly, or
76# replaced by a properly qapified command.
74#
75# Since: 0.13
76##
77{ 'command': 'device_add',
78 'data': {'driver': 'str', '*bus': 'str', '*id': 'str'},
79 'gen': false, # so we can get the additional arguments
80 'features': ['json-cli', 'json-cli-hotplug'] }
81
82##
83# @device_del:
84#
85# Remove a device from a guest
86#
87# @id: the device's ID or QOM path
88#
77#
78# Since: 0.13
79##
80{ 'command': 'device_add',
81 'data': {'driver': 'str', '*bus': 'str', '*id': 'str'},
82 'gen': false, # so we can get the additional arguments
83 'features': ['json-cli', 'json-cli-hotplug'] }
84
85##
86# @device_del:
87#
88# Remove a device from a guest
89#
90# @id: the device's ID or QOM path
91#
89# Returns: Nothing on success
90# If @id is not a valid device, DeviceNotFound
92# Returns: Nothing on success If @id is not a valid device,
93# DeviceNotFound
91#
94#
92# Notes: When this command completes, the device may not be removed from the
93# guest. Hot removal is an operation that requires guest cooperation.
94# This command merely requests that the guest begin the hot removal
95# process. Completion of the device removal process is signaled with a
96# DEVICE_DELETED event. Guest reset will automatically complete removal
97# for all devices. If a guest-side error in the hot removal process is
98# detected, the device will not be removed and a DEVICE_UNPLUG_GUEST_ERROR
99# event is sent. Some errors cannot be detected.
95# Notes: When this command completes, the device may not be removed
96# from the guest. Hot removal is an operation that requires guest
97# cooperation. This command merely requests that the guest begin
98# the hot removal process. Completion of the device removal
99# process is signaled with a DEVICE_DELETED event. Guest reset
100# will automatically complete removal for all devices. If a
101# guest-side error in the hot removal process is detected, the
102# device will not be removed and a DEVICE_UNPLUG_GUEST_ERROR event
103# is sent. Some errors cannot be detected.
100#
101# Since: 0.14
102#
103# Examples:
104#
105# -> { "execute": "device_del",
106# "arguments": { "id": "net1" } }
107# <- { "return": {} }
108#
109# -> { "execute": "device_del",
110# "arguments": { "id": "/machine/peripheral-anon/device[0]" } }
111# <- { "return": {} }
104#
105# Since: 0.14
106#
107# Examples:
108#
109# -> { "execute": "device_del",
110# "arguments": { "id": "net1" } }
111# <- { "return": {} }
112#
113# -> { "execute": "device_del",
114# "arguments": { "id": "/machine/peripheral-anon/device[0]" } }
115# <- { "return": {} }
112#
113##
114{ 'command': 'device_del', 'data': {'id': 'str'} }
115
116##
117# @DEVICE_DELETED:
118#
116##
117{ 'command': 'device_del', 'data': {'id': 'str'} }
118
119##
120# @DEVICE_DELETED:
121#
119# Emitted whenever the device removal completion is acknowledged by the guest.
120# At this point, it's safe to reuse the specified device ID. Device removal can
121# be initiated by the guest or by HMP/QMP commands.
122# Emitted whenever the device removal completion is acknowledged by
123# the guest. At this point, it's safe to reuse the specified device
124# ID. Device removal can be initiated by the guest or by HMP/QMP
125# 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# 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 } }
126#
127# @device: the device's ID if it has one
128#
129# @path: the device's QOM path
130#
131# Since: 1.5
132#
133# Example:
134#
135# <- { "event": "DEVICE_DELETED",
136# "data": { "device": "virtio-net-pci-0",
137# "path": "/machine/peripheral/virtio-net-pci-0" },
138# "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
135#
136##
137{ 'event': 'DEVICE_DELETED',
138 'data': { '*device': 'str', 'path': 'str' } }
139
140##
141# @DEVICE_UNPLUG_GUEST_ERROR:
142#
139##
140{ 'event': 'DEVICE_DELETED',
141 'data': { '*device': 'str', 'path': 'str' } }
142
143##
144# @DEVICE_UNPLUG_GUEST_ERROR:
145#
143# Emitted when a device hot unplug fails due to a guest reported error.
146# Emitted when a device hot unplug fails due to a guest reported
147# error.
144#
145# @device: the device's ID if it has one
146#
147# @path: the device's QOM path
148#
149# Since: 6.2
150#
151# Example:
152#
153# <- { "event": "DEVICE_UNPLUG_GUEST_ERROR",
154# "data": { "device": "core1",
155# "path": "/machine/peripheral/core1" },
156# "timestamp": { "seconds": 1615570772, "microseconds": 202844 } }
148#
149# @device: the device's ID if it has one
150#
151# @path: the device's QOM path
152#
153# Since: 6.2
154#
155# Example:
156#
157# <- { "event": "DEVICE_UNPLUG_GUEST_ERROR",
158# "data": { "device": "core1",
159# "path": "/machine/peripheral/core1" },
160# "timestamp": { "seconds": 1615570772, "microseconds": 202844 } }
157#
158##
159{ 'event': 'DEVICE_UNPLUG_GUEST_ERROR',
160 'data': { '*device': 'str', 'path': 'str' } }
161##
162{ 'event': 'DEVICE_UNPLUG_GUEST_ERROR',
163 'data': { '*device': 'str', 'path': 'str' } }