virtio_config.h 3.2 KB

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