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 
489fbe302bSMichael S. Tsirkin /* Some virtio feature bits (currently bits 28 through 32) are reserved for the
499fbe302bSMichael S. Tsirkin  * transport being used (eg. virtio_ring), the rest are per-device feature
509fbe302bSMichael S. Tsirkin  * bits. */
519fbe302bSMichael S. Tsirkin #define VIRTIO_TRANSPORT_F_START	28
52*dbdfea92SCornelia Huck #define VIRTIO_TRANSPORT_F_END		34
539fbe302bSMichael S. Tsirkin 
549fbe302bSMichael S. Tsirkin #ifndef VIRTIO_CONFIG_NO_LEGACY
559fbe302bSMichael S. Tsirkin /* Do we get callbacks when the ring is completely used, even if we've
569fbe302bSMichael S. Tsirkin  * suppressed them? */
579fbe302bSMichael S. Tsirkin #define VIRTIO_F_NOTIFY_ON_EMPTY	24
589fbe302bSMichael S. Tsirkin 
599fbe302bSMichael S. Tsirkin /* Can the device handle any descriptor layout? */
609fbe302bSMichael S. Tsirkin #define VIRTIO_F_ANY_LAYOUT		27
619fbe302bSMichael S. Tsirkin #endif /* VIRTIO_CONFIG_NO_LEGACY */
629fbe302bSMichael S. Tsirkin 
639fbe302bSMichael S. Tsirkin /* v1.0 compliant. */
649fbe302bSMichael S. Tsirkin #define VIRTIO_F_VERSION_1		32
659fbe302bSMichael S. Tsirkin 
66*dbdfea92SCornelia Huck /*
67*dbdfea92SCornelia Huck  * If clear - device has the IOMMU bypass quirk feature.
68*dbdfea92SCornelia Huck  * If set - use platform tools to detect the IOMMU.
69*dbdfea92SCornelia Huck  *
70*dbdfea92SCornelia Huck  * Note the reverse polarity (compared to most other features),
71*dbdfea92SCornelia Huck  * this is for compatibility with legacy systems.
72*dbdfea92SCornelia Huck  */
73*dbdfea92SCornelia Huck #define VIRTIO_F_IOMMU_PLATFORM		33
749fbe302bSMichael S. Tsirkin #endif /* _LINUX_VIRTIO_CONFIG_H */
75