xref: /kvmtool/include/linux/virtio_config.h (revision 1a992bbaab08994e12a7594b0c39535152093a6b)
1*1a992bbaSAndre Przywara #ifndef _UAPI_LINUX_VIRTIO_CONFIG_H
2*1a992bbaSAndre Przywara #define _UAPI_LINUX_VIRTIO_CONFIG_H
3*1a992bbaSAndre Przywara /* This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so
4*1a992bbaSAndre Przywara  * anyone can use the definitions to implement compatible drivers/servers.
5*1a992bbaSAndre Przywara  *
6*1a992bbaSAndre Przywara  * Redistribution and use in source and binary forms, with or without
7*1a992bbaSAndre Przywara  * modification, are permitted provided that the following conditions
8*1a992bbaSAndre Przywara  * are met:
9*1a992bbaSAndre Przywara  * 1. Redistributions of source code must retain the above copyright
10*1a992bbaSAndre Przywara  *    notice, this list of conditions and the following disclaimer.
11*1a992bbaSAndre Przywara  * 2. Redistributions in binary form must reproduce the above copyright
12*1a992bbaSAndre Przywara  *    notice, this list of conditions and the following disclaimer in the
13*1a992bbaSAndre Przywara  *    documentation and/or other materials provided with the distribution.
14*1a992bbaSAndre Przywara  * 3. Neither the name of IBM nor the names of its contributors
15*1a992bbaSAndre Przywara  *    may be used to endorse or promote products derived from this software
16*1a992bbaSAndre Przywara  *    without specific prior written permission.
17*1a992bbaSAndre Przywara  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
18*1a992bbaSAndre Przywara  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19*1a992bbaSAndre Przywara  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20*1a992bbaSAndre Przywara  * ARE DISCLAIMED.  IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE
21*1a992bbaSAndre Przywara  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22*1a992bbaSAndre Przywara  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23*1a992bbaSAndre Przywara  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24*1a992bbaSAndre Przywara  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25*1a992bbaSAndre Przywara  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26*1a992bbaSAndre Przywara  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27*1a992bbaSAndre Przywara  * SUCH DAMAGE. */
28*1a992bbaSAndre Przywara 
29*1a992bbaSAndre Przywara /* Virtio devices use a standardized configuration space to define their
30*1a992bbaSAndre Przywara  * features and pass configuration information, but each implementation can
31*1a992bbaSAndre Przywara  * store and access that space differently. */
32*1a992bbaSAndre Przywara #include <linux/types.h>
33*1a992bbaSAndre Przywara 
34*1a992bbaSAndre Przywara /* Status byte for guest to report progress, and synchronize features. */
35*1a992bbaSAndre Przywara /* We have seen device and processed generic fields (VIRTIO_CONFIG_F_VIRTIO) */
36*1a992bbaSAndre Przywara #define VIRTIO_CONFIG_S_ACKNOWLEDGE	1
37*1a992bbaSAndre Przywara /* We have found a driver for the device. */
38*1a992bbaSAndre Przywara #define VIRTIO_CONFIG_S_DRIVER		2
39*1a992bbaSAndre Przywara /* Driver has used its parts of the config, and is happy */
40*1a992bbaSAndre Przywara #define VIRTIO_CONFIG_S_DRIVER_OK	4
41*1a992bbaSAndre Przywara /* Driver has finished configuring features */
42*1a992bbaSAndre Przywara #define VIRTIO_CONFIG_S_FEATURES_OK	8
43*1a992bbaSAndre Przywara /* Device entered invalid state, driver must reset it */
44*1a992bbaSAndre Przywara #define VIRTIO_CONFIG_S_NEEDS_RESET	0x40
45*1a992bbaSAndre Przywara /* We've given up on this device. */
46*1a992bbaSAndre Przywara #define VIRTIO_CONFIG_S_FAILED		0x80
47*1a992bbaSAndre Przywara 
48*1a992bbaSAndre Przywara /*
49*1a992bbaSAndre Przywara  * Virtio feature bits VIRTIO_TRANSPORT_F_START through
50*1a992bbaSAndre Przywara  * VIRTIO_TRANSPORT_F_END are reserved for the transport
51*1a992bbaSAndre Przywara  * being used (e.g. virtio_ring, virtio_pci etc.), the
52*1a992bbaSAndre Przywara  * rest are per-device feature bits.
53*1a992bbaSAndre Przywara  */
54*1a992bbaSAndre Przywara #define VIRTIO_TRANSPORT_F_START	28
55*1a992bbaSAndre Przywara #define VIRTIO_TRANSPORT_F_END		38
56*1a992bbaSAndre Przywara 
57*1a992bbaSAndre Przywara #ifndef VIRTIO_CONFIG_NO_LEGACY
58*1a992bbaSAndre Przywara /* Do we get callbacks when the ring is completely used, even if we've
59*1a992bbaSAndre Przywara  * suppressed them? */
60*1a992bbaSAndre Przywara #define VIRTIO_F_NOTIFY_ON_EMPTY	24
61*1a992bbaSAndre Przywara 
62*1a992bbaSAndre Przywara /* Can the device handle any descriptor layout? */
63*1a992bbaSAndre Przywara #define VIRTIO_F_ANY_LAYOUT		27
64*1a992bbaSAndre Przywara #endif /* VIRTIO_CONFIG_NO_LEGACY */
65*1a992bbaSAndre Przywara 
66*1a992bbaSAndre Przywara /* v1.0 compliant. */
67*1a992bbaSAndre Przywara #define VIRTIO_F_VERSION_1		32
68*1a992bbaSAndre Przywara 
69*1a992bbaSAndre Przywara /*
70*1a992bbaSAndre Przywara  * If clear - device has the platform DMA (e.g. IOMMU) bypass quirk feature.
71*1a992bbaSAndre Przywara  * If set - use platform DMA tools to access the memory.
72*1a992bbaSAndre Przywara  *
73*1a992bbaSAndre Przywara  * Note the reverse polarity (compared to most other features),
74*1a992bbaSAndre Przywara  * this is for compatibility with legacy systems.
75*1a992bbaSAndre Przywara  */
76*1a992bbaSAndre Przywara #define VIRTIO_F_ACCESS_PLATFORM	33
77*1a992bbaSAndre Przywara #ifndef __KERNEL__
78*1a992bbaSAndre Przywara /* Legacy name for VIRTIO_F_ACCESS_PLATFORM (for compatibility with old userspace) */
79*1a992bbaSAndre Przywara #define VIRTIO_F_IOMMU_PLATFORM		VIRTIO_F_ACCESS_PLATFORM
80*1a992bbaSAndre Przywara #endif /* __KERNEL__ */
81*1a992bbaSAndre Przywara 
82*1a992bbaSAndre Przywara /* This feature indicates support for the packed virtqueue layout. */
83*1a992bbaSAndre Przywara #define VIRTIO_F_RING_PACKED		34
84*1a992bbaSAndre Przywara 
85*1a992bbaSAndre Przywara /*
86*1a992bbaSAndre Przywara  * Inorder feature indicates that all buffers are used by the device
87*1a992bbaSAndre Przywara  * in the same order in which they have been made available.
88*1a992bbaSAndre Przywara  */
89*1a992bbaSAndre Przywara #define VIRTIO_F_IN_ORDER		35
90*1a992bbaSAndre Przywara 
91*1a992bbaSAndre Przywara /*
92*1a992bbaSAndre Przywara  * This feature indicates that memory accesses by the driver and the
93*1a992bbaSAndre Przywara  * device are ordered in a way described by the platform.
94*1a992bbaSAndre Przywara  */
95*1a992bbaSAndre Przywara #define VIRTIO_F_ORDER_PLATFORM		36
96*1a992bbaSAndre Przywara 
97*1a992bbaSAndre Przywara /*
98*1a992bbaSAndre Przywara  * Does the device support Single Root I/O Virtualization?
99*1a992bbaSAndre Przywara  */
100*1a992bbaSAndre Przywara #define VIRTIO_F_SR_IOV			37
101*1a992bbaSAndre Przywara #endif /* _UAPI_LINUX_VIRTIO_CONFIG_H */
102