Back to home page

OSCL-LXR

 
 

    


0001 #ifndef _UAPI_LINUX_VIRTIO_CONFIG_H
0002 #define _UAPI_LINUX_VIRTIO_CONFIG_H
0003 /* This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so
0004  * anyone can use the definitions to implement compatible drivers/servers.
0005  *
0006  * Redistribution and use in source and binary forms, with or without
0007  * modification, are permitted provided that the following conditions
0008  * are met:
0009  * 1. Redistributions of source code must retain the above copyright
0010  *    notice, this list of conditions and the following disclaimer.
0011  * 2. Redistributions in binary form must reproduce the above copyright
0012  *    notice, this list of conditions and the following disclaimer in the
0013  *    documentation and/or other materials provided with the distribution.
0014  * 3. Neither the name of IBM nor the names of its contributors
0015  *    may be used to endorse or promote products derived from this software
0016  *    without specific prior written permission.
0017  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
0018  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0019  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0020  * ARE DISCLAIMED.  IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE
0021  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
0022  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
0023  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
0024  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
0025  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
0026  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
0027  * SUCH DAMAGE. */
0028 
0029 /* Virtio devices use a standardized configuration space to define their
0030  * features and pass configuration information, but each implementation can
0031  * store and access that space differently. */
0032 #include <linux/types.h>
0033 
0034 /* Status byte for guest to report progress, and synchronize features. */
0035 /* We have seen device and processed generic fields (VIRTIO_CONFIG_F_VIRTIO) */
0036 #define VIRTIO_CONFIG_S_ACKNOWLEDGE 1
0037 /* We have found a driver for the device. */
0038 #define VIRTIO_CONFIG_S_DRIVER      2
0039 /* Driver has used its parts of the config, and is happy */
0040 #define VIRTIO_CONFIG_S_DRIVER_OK   4
0041 /* Driver has finished configuring features */
0042 #define VIRTIO_CONFIG_S_FEATURES_OK 8
0043 /* Device entered invalid state, driver must reset it */
0044 #define VIRTIO_CONFIG_S_NEEDS_RESET 0x40
0045 /* We've given up on this device. */
0046 #define VIRTIO_CONFIG_S_FAILED      0x80
0047 
0048 /*
0049  * Virtio feature bits VIRTIO_TRANSPORT_F_START through
0050  * VIRTIO_TRANSPORT_F_END are reserved for the transport
0051  * being used (e.g. virtio_ring, virtio_pci etc.), the
0052  * rest are per-device feature bits.
0053  */
0054 #define VIRTIO_TRANSPORT_F_START    28
0055 #define VIRTIO_TRANSPORT_F_END      41
0056 
0057 #ifndef VIRTIO_CONFIG_NO_LEGACY
0058 /* Do we get callbacks when the ring is completely used, even if we've
0059  * suppressed them? */
0060 #define VIRTIO_F_NOTIFY_ON_EMPTY    24
0061 
0062 /* Can the device handle any descriptor layout? */
0063 #define VIRTIO_F_ANY_LAYOUT     27
0064 #endif /* VIRTIO_CONFIG_NO_LEGACY */
0065 
0066 /* v1.0 compliant. */
0067 #define VIRTIO_F_VERSION_1      32
0068 
0069 /*
0070  * If clear - device has the platform DMA (e.g. IOMMU) bypass quirk feature.
0071  * If set - use platform DMA tools to access the memory.
0072  *
0073  * Note the reverse polarity (compared to most other features),
0074  * this is for compatibility with legacy systems.
0075  */
0076 #define VIRTIO_F_ACCESS_PLATFORM    33
0077 #ifndef __KERNEL__
0078 /* Legacy name for VIRTIO_F_ACCESS_PLATFORM (for compatibility with old userspace) */
0079 #define VIRTIO_F_IOMMU_PLATFORM     VIRTIO_F_ACCESS_PLATFORM
0080 #endif /* __KERNEL__ */
0081 
0082 /* This feature indicates support for the packed virtqueue layout. */
0083 #define VIRTIO_F_RING_PACKED        34
0084 
0085 /*
0086  * Inorder feature indicates that all buffers are used by the device
0087  * in the same order in which they have been made available.
0088  */
0089 #define VIRTIO_F_IN_ORDER       35
0090 
0091 /*
0092  * This feature indicates that memory accesses by the driver and the
0093  * device are ordered in a way described by the platform.
0094  */
0095 #define VIRTIO_F_ORDER_PLATFORM     36
0096 
0097 /*
0098  * Does the device support Single Root I/O Virtualization?
0099  */
0100 #define VIRTIO_F_SR_IOV         37
0101 
0102 /*
0103  * This feature indicates that the driver can reset a queue individually.
0104  */
0105 #define VIRTIO_F_RING_RESET     40
0106 #endif /* _UAPI_LINUX_VIRTIO_CONFIG_H */