19fbe302bSMichael S. Tsirkin #ifndef _LINUX_VIRTIO_CONFIG_H 29fbe302bSMichael S. Tsirkin #define _LINUX_VIRTIO_CONFIG_H 39fbe302bSMichael S. Tsirkin /* This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so 49fbe302bSMichael S. Tsirkin * anyone can use the definitions to implement compatible drivers/servers. 59fbe302bSMichael S. Tsirkin * 69fbe302bSMichael S. Tsirkin * Redistribution and use in source and binary forms, with or without 79fbe302bSMichael S. Tsirkin * modification, are permitted provided that the following conditions 89fbe302bSMichael S. Tsirkin * are met: 99fbe302bSMichael S. Tsirkin * 1. Redistributions of source code must retain the above copyright 109fbe302bSMichael S. Tsirkin * notice, this list of conditions and the following disclaimer. 119fbe302bSMichael S. Tsirkin * 2. Redistributions in binary form must reproduce the above copyright 129fbe302bSMichael S. Tsirkin * notice, this list of conditions and the following disclaimer in the 139fbe302bSMichael S. Tsirkin * documentation and/or other materials provided with the distribution. 149fbe302bSMichael S. Tsirkin * 3. Neither the name of IBM nor the names of its contributors 159fbe302bSMichael S. Tsirkin * may be used to endorse or promote products derived from this software 169fbe302bSMichael S. Tsirkin * without specific prior written permission. 179fbe302bSMichael S. Tsirkin * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND 189fbe302bSMichael S. Tsirkin * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 199fbe302bSMichael S. Tsirkin * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 209fbe302bSMichael S. Tsirkin * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE 219fbe302bSMichael S. Tsirkin * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 229fbe302bSMichael S. Tsirkin * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 239fbe302bSMichael S. Tsirkin * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 249fbe302bSMichael S. Tsirkin * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 259fbe302bSMichael S. Tsirkin * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 269fbe302bSMichael S. Tsirkin * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 279fbe302bSMichael S. Tsirkin * SUCH DAMAGE. */ 289fbe302bSMichael S. Tsirkin 299fbe302bSMichael S. Tsirkin /* Virtio devices use a standardized configuration space to define their 309fbe302bSMichael S. Tsirkin * features and pass configuration information, but each implementation can 319fbe302bSMichael S. Tsirkin * store and access that space differently. */ 329fbe302bSMichael S. Tsirkin #include "standard-headers/linux/types.h" 339fbe302bSMichael S. Tsirkin 349fbe302bSMichael S. Tsirkin /* Status byte for guest to report progress, and synchronize features. */ 359fbe302bSMichael S. Tsirkin /* We have seen device and processed generic fields (VIRTIO_CONFIG_F_VIRTIO) */ 369fbe302bSMichael S. Tsirkin #define VIRTIO_CONFIG_S_ACKNOWLEDGE 1 379fbe302bSMichael S. Tsirkin /* We have found a driver for the device. */ 389fbe302bSMichael S. Tsirkin #define VIRTIO_CONFIG_S_DRIVER 2 399fbe302bSMichael S. Tsirkin /* Driver has used its parts of the config, and is happy */ 409fbe302bSMichael S. Tsirkin #define VIRTIO_CONFIG_S_DRIVER_OK 4 419fbe302bSMichael S. Tsirkin /* Driver has finished configuring features */ 429fbe302bSMichael S. Tsirkin #define VIRTIO_CONFIG_S_FEATURES_OK 8 43ff804f15SCornelia Huck /* Device entered invalid state, driver must reset it */ 44ff804f15SCornelia Huck #define VIRTIO_CONFIG_S_NEEDS_RESET 0x40 459fbe302bSMichael S. Tsirkin /* We've given up on this device. */ 469fbe302bSMichael S. Tsirkin #define VIRTIO_CONFIG_S_FAILED 0x80 479fbe302bSMichael S. Tsirkin 48d36f7de8SCornelia Huck /* 49d36f7de8SCornelia Huck * Virtio feature bits VIRTIO_TRANSPORT_F_START through 50d36f7de8SCornelia Huck * VIRTIO_TRANSPORT_F_END are reserved for the transport 51d36f7de8SCornelia Huck * being used (e.g. virtio_ring, virtio_pci etc.), the 52d36f7de8SCornelia Huck * rest are per-device feature bits. 53d36f7de8SCornelia Huck */ 549fbe302bSMichael S. Tsirkin #define VIRTIO_TRANSPORT_F_START 28 55*d525f73fSChenyi Qiang #define VIRTIO_TRANSPORT_F_END 41 569fbe302bSMichael S. Tsirkin 579fbe302bSMichael S. Tsirkin #ifndef VIRTIO_CONFIG_NO_LEGACY 589fbe302bSMichael S. Tsirkin /* Do we get callbacks when the ring is completely used, even if we've 599fbe302bSMichael S. Tsirkin * suppressed them? */ 609fbe302bSMichael S. Tsirkin #define VIRTIO_F_NOTIFY_ON_EMPTY 24 619fbe302bSMichael S. Tsirkin 629fbe302bSMichael S. Tsirkin /* Can the device handle any descriptor layout? */ 639fbe302bSMichael S. Tsirkin #define VIRTIO_F_ANY_LAYOUT 27 649fbe302bSMichael S. Tsirkin #endif /* VIRTIO_CONFIG_NO_LEGACY */ 659fbe302bSMichael S. Tsirkin 669fbe302bSMichael S. Tsirkin /* v1.0 compliant. */ 679fbe302bSMichael S. Tsirkin #define VIRTIO_F_VERSION_1 32 689fbe302bSMichael S. Tsirkin 69dbdfea92SCornelia Huck /* 70e6546342SJason Wang * If clear - device has the platform DMA (e.g. IOMMU) bypass quirk feature. 71e6546342SJason Wang * If set - use platform DMA tools to access the memory. 72dbdfea92SCornelia Huck * 73dbdfea92SCornelia Huck * Note the reverse polarity (compared to most other features), 74dbdfea92SCornelia Huck * this is for compatibility with legacy systems. 75dbdfea92SCornelia Huck */ 76e6546342SJason Wang #define VIRTIO_F_ACCESS_PLATFORM 33 77e6546342SJason Wang /* Legacy name for VIRTIO_F_ACCESS_PLATFORM (for compatibility with old userspace) */ 78e6546342SJason Wang #define VIRTIO_F_IOMMU_PLATFORM VIRTIO_F_ACCESS_PLATFORM 79d36f7de8SCornelia Huck 80da054c64SPaolo Bonzini /* This feature indicates support for the packed virtqueue layout. */ 81da054c64SPaolo Bonzini #define VIRTIO_F_RING_PACKED 34 82da054c64SPaolo Bonzini 83d36f7de8SCornelia Huck /* 84e4082063SAlex Williamson * Inorder feature indicates that all buffers are used by the device 85e4082063SAlex Williamson * in the same order in which they have been made available. 86e4082063SAlex Williamson */ 87e4082063SAlex Williamson #define VIRTIO_F_IN_ORDER 35 88e4082063SAlex Williamson 89e4082063SAlex Williamson /* 90d9cb4336SCornelia Huck * This feature indicates that memory accesses by the driver and the 91d9cb4336SCornelia Huck * device are ordered in a way described by the platform. 92d9cb4336SCornelia Huck */ 93d9cb4336SCornelia Huck #define VIRTIO_F_ORDER_PLATFORM 36 94d9cb4336SCornelia Huck 95d9cb4336SCornelia Huck /* 96d36f7de8SCornelia Huck * Does the device support Single Root I/O Virtualization? 97d36f7de8SCornelia Huck */ 98d36f7de8SCornelia Huck #define VIRTIO_F_SR_IOV 37 99*d525f73fSChenyi Qiang 100*d525f73fSChenyi Qiang /* 101*d525f73fSChenyi Qiang * This feature indicates that the driver can reset a queue individually. 102*d525f73fSChenyi Qiang */ 103*d525f73fSChenyi Qiang #define VIRTIO_F_RING_RESET 40 1049fbe302bSMichael S. Tsirkin #endif /* _LINUX_VIRTIO_CONFIG_H */ 105