]> git.proxmox.com Git - mirror_qemu.git/blame - qapi/qdev.json
Merge tag 'pull-tcg-20231106' of https://gitlab.com/rth7680/qemu into staging
[mirror_qemu.git] / qapi / qdev.json
CommitLineData
c577ff62 1# -*- Mode: Python -*-
f7160f32 2# vim: filetype=python
c577ff62
MA
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#
a937b6aa
MA
20# Returns: a list of ObjectPropertyInfo describing a devices
21# properties
c577ff62 22#
a937b6aa
MA
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.
c577ff62
MA
26#
27# Since: 1.2
28##
29{ 'command': 'device-list-properties',
30 'data': { 'typename': 'str'},
31 'returns': [ 'ObjectPropertyInfo' ] }
32
33##
34# @device_add:
35#
5dacda51
KW
36# Add a device.
37#
c577ff62
MA
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#
5dacda51 44# Features:
a937b6aa
MA
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
c577ff62
MA
53#
54# Notes:
5dacda51 55#
a9c72efd 56# 1. Additional arguments depend on the type.
5dacda51 57#
a9c72efd 58# 2. For detailed information about this command, please refer to the
c577ff62
MA
59# 'docs/qdev-device-use.txt' file.
60#
a9c72efd 61# 3. It's possible to list device properties by running QEMU with the
c577ff62
MA
62# "-device DEVICE,help" command-line argument, where DEVICE is the
63# device's name
64#
65# Example:
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
a937b6aa
MA
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.
c577ff62
MA
77#
78# Since: 0.13
79##
80{ 'command': 'device_add',
81 'data': {'driver': 'str', '*bus': 'str', '*id': 'str'},
5dacda51 82 'gen': false, # so we can get the additional arguments
64b4529a 83 'features': ['json-cli', 'json-cli-hotplug'] }
c577ff62
MA
84
85##
86# @device_del:
87#
88# Remove a device from a guest
89#
90# @id: the device's ID or QOM path
91#
a937b6aa
MA
92# Returns: Nothing on success If @id is not a valid device,
93# DeviceNotFound
c577ff62 94#
a937b6aa
MA
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.
c577ff62 104#
9bc6e893 105# Since: 0.14
c577ff62 106#
37fa48a4 107# Examples:
c577ff62
MA
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": {} }
c577ff62
MA
116##
117{ 'command': 'device_del', 'data': {'id': 'str'} }
118
119##
120# @DEVICE_DELETED:
121#
a937b6aa
MA
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.
c577ff62 126#
a5bc19c5 127# @device: the device's ID if it has one
c577ff62 128#
a5bc19c5 129# @path: the device's QOM path
c577ff62
MA
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 } }
c577ff62
MA
139##
140{ 'event': 'DEVICE_DELETED',
141 'data': { '*device': 'str', 'path': 'str' } }
d43f1670
DHB
142
143##
144# @DEVICE_UNPLUG_GUEST_ERROR:
145#
a937b6aa
MA
146# Emitted when a device hot unplug fails due to a guest reported
147# error.
d43f1670
DHB
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#
0cd5a5e9 157# <- { "event": "DEVICE_UNPLUG_GUEST_ERROR",
d43f1670
DHB
158# "data": { "device": "core1",
159# "path": "/machine/peripheral/core1" },
d43f1670 160# "timestamp": { "seconds": 1615570772, "microseconds": 202844 } }
d43f1670
DHB
161##
162{ 'event': 'DEVICE_UNPLUG_GUEST_ERROR',
163 'data': { '*device': 'str', 'path': 'str' } }