xref: /openbmc/qemu/docs/interop/vhost-user.json (revision 58ea30f5)
1# -*- Mode: Python -*-
2#
3# Copyright (C) 2018 Red Hat, Inc.
4#
5# Authors:
6#  Marc-André Lureau <marcandre.lureau@redhat.com>
7#
8# This work is licensed under the terms of the GNU GPL, version 2 or
9# later. See the COPYING file in the top-level directory.
10
11##
12# = vhost user backend discovery & capabilities
13##
14
15##
16# @VHostUserBackendType:
17#
18# List the various vhost user backend types.
19#
20# @9p: 9p virtio console
21# @balloon: virtio balloon
22# @block: virtio block
23# @caif: virtio caif
24# @console: virtio console
25# @crypto: virtio crypto
26# @gpu: virtio gpu
27# @input: virtio input
28# @net: virtio net
29# @rng: virtio rng
30# @rpmsg: virtio remote processor messaging
31# @rproc-serial: virtio remoteproc serial link
32# @scsi: virtio scsi
33# @vsock: virtio vsock transport
34#
35# Since: 4.0
36##
37{
38  'enum': 'VHostUserBackendType',
39  'data': [
40      '9p',
41      'balloon',
42      'block',
43      'caif',
44      'console',
45      'crypto',
46      'gpu',
47      'input',
48      'net',
49      'rng',
50      'rpmsg',
51      'rproc-serial',
52      'scsi',
53      'vsock'
54  ]
55}
56
57##
58# @VHostUserBackendInputFeature:
59#
60# List of vhost user "input" features.
61#
62# @evdev-path: The --evdev-path command line option is supported.
63# @no-grab: The --no-grab command line option is supported.
64#
65# Since: 4.0
66##
67{
68  'enum': 'VHostUserBackendInputFeature',
69  'data': [ 'evdev-path', 'no-grab' ]
70}
71
72##
73# @VHostUserBackendCapabilitiesInput:
74#
75# Capabilities reported by vhost user "input" backends
76#
77# @features: list of supported features.
78#
79# Since: 4.0
80##
81{
82  'struct': 'VHostUserBackendCapabilitiesInput',
83  'data': {
84    'features': [ 'VHostUserBackendInputFeature' ]
85  }
86}
87
88##
89# @VHostUserBackendGPUFeature:
90#
91# List of vhost user "gpu" features.
92#
93# @render-node: The --render-node command line option is supported.
94# @virgl: The --virgl command line option is supported.
95#
96# Since: 4.0
97##
98{
99  'enum': 'VHostUserBackendGPUFeature',
100  'data': [ 'render-node', 'virgl' ]
101}
102
103##
104# @VHostUserBackendCapabilitiesGPU:
105#
106# Capabilities reported by vhost user "gpu" backends.
107#
108# @features: list of supported features.
109#
110# Since: 4.0
111##
112{
113  'struct': 'VHostUserBackendCapabilitiesGPU',
114  'data': {
115    'features': [ 'VHostUserBackendGPUFeature' ]
116  }
117}
118
119##
120# @VHostUserBackendCapabilities:
121#
122# Capabilities reported by vhost user backends.
123#
124# @type: The vhost user backend type.
125#
126# Since: 4.0
127##
128{
129  'union': 'VHostUserBackendCapabilities',
130  'base': { 'type': 'VHostUserBackendType' },
131  'discriminator': 'type',
132  'data': {
133    'input': 'VHostUserBackendCapabilitiesInput',
134    'gpu': 'VHostUserBackendCapabilitiesGPU'
135  }
136}
137
138##
139# @VhostUserBackend:
140#
141# Describes a vhost user backend to management software.
142#
143# It is possible for multiple @VhostUserBackend elements to match the
144# search criteria of management software. Applications thus need rules
145# to pick one of the many matches, and users need the ability to
146# override distro defaults.
147#
148# It is recommended to create vhost user backend JSON files (each
149# containing a single @VhostUserBackend root element) with a
150# double-digit prefix, for example "50-qemu-gpu.json",
151# "50-crosvm-gpu.json", etc, so they can be sorted in predictable
152# order. The backend JSON files should be searched for in three
153# directories:
154#
155#   - /usr/share/qemu/vhost-user -- populated by distro-provided
156#                                   packages (XDG_DATA_DIRS covers
157#                                   /usr/share by default),
158#
159#   - /etc/qemu/vhost-user -- exclusively for sysadmins' local additions,
160#
161#   - $XDG_CONFIG_HOME/qemu/vhost-user -- exclusively for per-user local
162#                                         additions (XDG_CONFIG_HOME
163#                                         defaults to $HOME/.config).
164#
165# Top-down, the list of directories goes from general to specific.
166#
167# Management software should build a list of files from all three
168# locations, then sort the list by filename (i.e., basename
169# component). Management software should choose the first JSON file on
170# the sorted list that matches the search criteria. If a more specific
171# directory has a file with same name as a less specific directory,
172# then the file in the more specific directory takes effect. If the
173# more specific file is zero length, it hides the less specific one.
174#
175# For example, if a distro ships
176#
177#   - /usr/share/qemu/vhost-user/50-qemu-gpu.json
178#
179#   - /usr/share/qemu/vhost-user/50-crosvm-gpu.json
180#
181# then the sysadmin can prevent the default QEMU being used at all with
182#
183#   $ touch /etc/qemu/vhost-user/50-qemu-gpu.json
184#
185# The sysadmin can replace/alter the distro default OVMF with
186#
187#   $ vim /etc/qemu/vhost-user/50-qemu-gpu.json
188#
189# or they can provide a parallel QEMU GPU with higher priority
190#
191#   $ vim /etc/qemu/vhost-user/10-qemu-gpu.json
192#
193# or they can provide a parallel OVMF with lower priority
194#
195#   $ vim /etc/qemu/vhost-user/99-qemu-gpu.json
196#
197# @type: The vhost user backend type.
198#
199# @description: Provides a human-readable description of the backend.
200#               Management software may or may not display @description.
201#
202# @binary: Absolute path to the backend binary.
203#
204# @tags: An optional list of auxiliary strings associated with the
205#        backend for which @description is not appropriate, due to the
206#        latter's possible exposure to the end-user. @tags serves
207#        development and debugging purposes only, and management
208#        software shall explicitly ignore it.
209#
210# Since: 4.0
211#
212# Example:
213#
214# {
215#   "description": "QEMU vhost-user-gpu",
216#   "type": "gpu",
217#   "binary": "/usr/libexec/qemu/vhost-user-gpu",
218#   "tags": [
219#     "CONFIG_OPENGL_DMABUF=y"
220#   ]
221# }
222#
223##
224{
225  'struct' : 'VhostUserBackend',
226  'data'   : {
227    'description': 'str',
228    'type': 'VHostUserBackendType',
229    'binary': 'str',
230    '*tags': [ 'str' ]
231  }
232}
233