xref: /linux/include/uapi/linux/virtio_config.h (revision 607ca46e97a1b6594b29647d98a32d545c24bdff)
1*607ca46eSDavid Howells #ifndef _UAPI_LINUX_VIRTIO_CONFIG_H
2*607ca46eSDavid Howells #define _UAPI_LINUX_VIRTIO_CONFIG_H
3*607ca46eSDavid Howells /* This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so
4*607ca46eSDavid Howells  * anyone can use the definitions to implement compatible drivers/servers.
5*607ca46eSDavid Howells  *
6*607ca46eSDavid Howells  * Redistribution and use in source and binary forms, with or without
7*607ca46eSDavid Howells  * modification, are permitted provided that the following conditions
8*607ca46eSDavid Howells  * are met:
9*607ca46eSDavid Howells  * 1. Redistributions of source code must retain the above copyright
10*607ca46eSDavid Howells  *    notice, this list of conditions and the following disclaimer.
11*607ca46eSDavid Howells  * 2. Redistributions in binary form must reproduce the above copyright
12*607ca46eSDavid Howells  *    notice, this list of conditions and the following disclaimer in the
13*607ca46eSDavid Howells  *    documentation and/or other materials provided with the distribution.
14*607ca46eSDavid Howells  * 3. Neither the name of IBM nor the names of its contributors
15*607ca46eSDavid Howells  *    may be used to endorse or promote products derived from this software
16*607ca46eSDavid Howells  *    without specific prior written permission.
17*607ca46eSDavid Howells  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
18*607ca46eSDavid Howells  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19*607ca46eSDavid Howells  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20*607ca46eSDavid Howells  * ARE DISCLAIMED.  IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE
21*607ca46eSDavid Howells  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22*607ca46eSDavid Howells  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23*607ca46eSDavid Howells  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24*607ca46eSDavid Howells  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25*607ca46eSDavid Howells  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26*607ca46eSDavid Howells  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27*607ca46eSDavid Howells  * SUCH DAMAGE. */
28*607ca46eSDavid Howells 
29*607ca46eSDavid Howells /* Virtio devices use a standardized configuration space to define their
30*607ca46eSDavid Howells  * features and pass configuration information, but each implementation can
31*607ca46eSDavid Howells  * store and access that space differently. */
32*607ca46eSDavid Howells #include <linux/types.h>
33*607ca46eSDavid Howells 
34*607ca46eSDavid Howells /* Status byte for guest to report progress, and synchronize features. */
35*607ca46eSDavid Howells /* We have seen device and processed generic fields (VIRTIO_CONFIG_F_VIRTIO) */
36*607ca46eSDavid Howells #define VIRTIO_CONFIG_S_ACKNOWLEDGE	1
37*607ca46eSDavid Howells /* We have found a driver for the device. */
38*607ca46eSDavid Howells #define VIRTIO_CONFIG_S_DRIVER		2
39*607ca46eSDavid Howells /* Driver has used its parts of the config, and is happy */
40*607ca46eSDavid Howells #define VIRTIO_CONFIG_S_DRIVER_OK	4
41*607ca46eSDavid Howells /* We've given up on this device. */
42*607ca46eSDavid Howells #define VIRTIO_CONFIG_S_FAILED		0x80
43*607ca46eSDavid Howells 
44*607ca46eSDavid Howells /* Some virtio feature bits (currently bits 28 through 31) are reserved for the
45*607ca46eSDavid Howells  * transport being used (eg. virtio_ring), the rest are per-device feature
46*607ca46eSDavid Howells  * bits. */
47*607ca46eSDavid Howells #define VIRTIO_TRANSPORT_F_START	28
48*607ca46eSDavid Howells #define VIRTIO_TRANSPORT_F_END		32
49*607ca46eSDavid Howells 
50*607ca46eSDavid Howells /* Do we get callbacks when the ring is completely used, even if we've
51*607ca46eSDavid Howells  * suppressed them? */
52*607ca46eSDavid Howells #define VIRTIO_F_NOTIFY_ON_EMPTY	24
53*607ca46eSDavid Howells 
54*607ca46eSDavid Howells #endif /* _UAPI_LINUX_VIRTIO_CONFIG_H */
55