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