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 48*d36f7de8SCornelia Huck /* 49*d36f7de8SCornelia Huck * Virtio feature bits VIRTIO_TRANSPORT_F_START through 50*d36f7de8SCornelia Huck * VIRTIO_TRANSPORT_F_END are reserved for the transport 51*d36f7de8SCornelia Huck * being used (e.g. virtio_ring, virtio_pci etc.), the 52*d36f7de8SCornelia Huck * rest are per-device feature bits. 53*d36f7de8SCornelia Huck */ 549fbe302bSMichael S. Tsirkin #define VIRTIO_TRANSPORT_F_START 28 55*d36f7de8SCornelia Huck #define VIRTIO_TRANSPORT_F_END 38 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 /* 70dbdfea92SCornelia Huck * If clear - device has the IOMMU bypass quirk feature. 71dbdfea92SCornelia Huck * If set - use platform tools to detect the IOMMU. 72dbdfea92SCornelia Huck * 73dbdfea92SCornelia Huck * Note the reverse polarity (compared to most other features), 74dbdfea92SCornelia Huck * this is for compatibility with legacy systems. 75dbdfea92SCornelia Huck */ 76dbdfea92SCornelia Huck #define VIRTIO_F_IOMMU_PLATFORM 33 77*d36f7de8SCornelia Huck 78*d36f7de8SCornelia Huck /* 79*d36f7de8SCornelia Huck * Does the device support Single Root I/O Virtualization? 80*d36f7de8SCornelia Huck */ 81*d36f7de8SCornelia Huck #define VIRTIO_F_SR_IOV 37 829fbe302bSMichael S. Tsirkin #endif /* _LINUX_VIRTIO_CONFIG_H */ 83