summaryrefslogtreecommitdiff
path: root/docs/interop/vhost-user.json
blob: ef8ac5941f5c8d14402566a984a0a0876d768c19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
# -*- Mode: Python -*-
#
# Copyright (C) 2018 Red Hat, Inc.
#
# Authors:
#  Marc-André Lureau <marcandre.lureau@redhat.com>
#
# This work is licensed under the terms of the GNU GPL, version 2 or
# later. See the COPYING file in the top-level directory.

##
# = vhost user backend discovery & capabilities
##

##
# @VHostUserBackendType:
#
# List the various vhost user backend types.
#
# @9p: 9p virtio console
# @balloon: virtio balloon
# @block: virtio block
# @caif: virtio caif
# @console: virtio console
# @crypto: virtio crypto
# @gpu: virtio gpu
# @input: virtio input
# @net: virtio net
# @rng: virtio rng
# @rpmsg: virtio remote processor messaging
# @rproc-serial: virtio remoteproc serial link
# @scsi: virtio scsi
# @vsock: virtio vsock transport
# @fs: virtio fs (since 4.2)
#
# Since: 4.0
##
{
  'enum': 'VHostUserBackendType',
  'data': [
      '9p',
      'balloon',
      'block',
      'caif',
      'console',
      'crypto',
      'gpu',
      'input',
      'net',
      'rng',
      'rpmsg',
      'rproc-serial',
      'scsi',
      'vsock',
      'fs'
  ]
}

##
# @VHostUserBackendBlockFeature:
#
# List of vhost user "block" features.
#
# @read-only: The --read-only command line option is supported.
# @blk-file: The --blk-file command line option is supported.
#
# Since: 5.0
##
{
  'enum': 'VHostUserBackendBlockFeature',
  'data': [ 'read-only', 'blk-file' ]
}

##
# @VHostUserBackendCapabilitiesBlock:
#
# Capabilities reported by vhost user "block" backends
#
# @features: list of supported features.
#
# Since: 5.0
##
{
  'struct': 'VHostUserBackendCapabilitiesBlock',
  'data': {
    'features': [ 'VHostUserBackendBlockFeature' ]
  }
}

##
# @VHostUserBackendInputFeature:
#
# List of vhost user "input" features.
#
# @evdev-path: The --evdev-path command line option is supported.
# @no-grab: The --no-grab command line option is supported.
#
# Since: 4.0
##
{
  'enum': 'VHostUserBackendInputFeature',
  'data': [ 'evdev-path', 'no-grab' ]
}

##
# @VHostUserBackendCapabilitiesInput:
#
# Capabilities reported by vhost user "input" backends
#
# @features: list of supported features.
#
# Since: 4.0
##
{
  'struct': 'VHostUserBackendCapabilitiesInput',
  'data': {
    'features': [ 'VHostUserBackendInputFeature' ]
  }
}

##
# @VHostUserBackendGPUFeature:
#
# List of vhost user "gpu" features.
#
# @render-node: The --render-node command line option is supported.
# @virgl: The --virgl command line option is supported.
#
# Since: 4.0
##
{
  'enum': 'VHostUserBackendGPUFeature',
  'data': [ 'render-node', 'virgl' ]
}

##
# @VHostUserBackendCapabilitiesGPU:
#
# Capabilities reported by vhost user "gpu" backends.
#
# @features: list of supported features.
#
# Since: 4.0
##
{
  'struct': 'VHostUserBackendCapabilitiesGPU',
  'data': {
    'features': [ 'VHostUserBackendGPUFeature' ]
  }
}

##
# @VHostUserBackendCapabilities:
#
# Capabilities reported by vhost user backends.
#
# @type: The vhost user backend type.
#
# Since: 4.0
##
{
  'union': 'VHostUserBackendCapabilities',
  'base': { 'type': 'VHostUserBackendType' },
  'discriminator': 'type',
  'data': {
    'input': 'VHostUserBackendCapabilitiesInput',
    'gpu': 'VHostUserBackendCapabilitiesGPU'
  }
}

##
# @VhostUserBackend:
#
# Describes a vhost user backend to management software.
#
# It is possible for multiple @VhostUserBackend elements to match the
# search criteria of management software. Applications thus need rules
# to pick one of the many matches, and users need the ability to
# override distro defaults.
#
# It is recommended to create vhost user backend JSON files (each
# containing a single @VhostUserBackend root element) with a
# double-digit prefix, for example "50-qemu-gpu.json",
# "50-crosvm-gpu.json", etc, so they can be sorted in predictable
# order. The backend JSON files should be searched for in three
# directories:
#
#   - /usr/share/qemu/vhost-user -- populated by distro-provided
#                                   packages (XDG_DATA_DIRS covers
#                                   /usr/share by default),
#
#   - /etc/qemu/vhost-user -- exclusively for sysadmins' local additions,
#
#   - $XDG_CONFIG_HOME/qemu/vhost-user -- exclusively for per-user local
#                                         additions (XDG_CONFIG_HOME
#                                         defaults to $HOME/.config).
#
# Top-down, the list of directories goes from general to specific.
#
# Management software should build a list of files from all three
# locations, then sort the list by filename (i.e., basename
# component). Management software should choose the first JSON file on
# the sorted list that matches the search criteria. If a more specific
# directory has a file with same name as a less specific directory,
# then the file in the more specific directory takes effect. If the
# more specific file is zero length, it hides the less specific one.
#
# For example, if a distro ships
#
#   - /usr/share/qemu/vhost-user/50-qemu-gpu.json
#
#   - /usr/share/qemu/vhost-user/50-crosvm-gpu.json
#
# then the sysadmin can prevent the default QEMU GPU being used at all with
#
#   $ touch /etc/qemu/vhost-user/50-qemu-gpu.json
#
# The sysadmin can replace/alter the distro default QEMU GPU with
#
#   $ vim /etc/qemu/vhost-user/50-qemu-gpu.json
#
# or they can provide a parallel QEMU GPU with higher priority
#
#   $ vim /etc/qemu/vhost-user/10-qemu-gpu.json
#
# or they can provide a parallel QEMU GPU with lower priority
#
#   $ vim /etc/qemu/vhost-user/99-qemu-gpu.json
#
# @type: The vhost user backend type.
#
# @description: Provides a human-readable description of the backend.
#               Management software may or may not display @description.
#
# @binary: Absolute path to the backend binary.
#
# @tags: An optional list of auxiliary strings associated with the
#        backend for which @description is not appropriate, due to the
#        latter's possible exposure to the end-user. @tags serves
#        development and debugging purposes only, and management
#        software shall explicitly ignore it.
#
# Since: 4.0
#
# Example:
#
# {
#   "description": "QEMU vhost-user-gpu",
#   "type": "gpu",
#   "binary": "/usr/libexec/qemu/vhost-user-gpu",
#   "tags": [
#     "CONFIG_OPENGL_DMABUF=y"
#   ]
# }
#
##
{
  'struct' : 'VhostUserBackend',
  'data'   : {
    'description': 'str',
    'type': 'VHostUserBackendType',
    'binary': 'str',
    '*tags': [ 'str' ]
  }
}