Update VirtIO definitions from Linux virtio_config.h and virtio_ring.h headers
This commit is contained in:
parent
9cd818a3f4
commit
56f63b7364
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=335305
@ -33,35 +33,58 @@
|
|||||||
|
|
||||||
/* Status byte for guest to report progress. */
|
/* Status byte for guest to report progress. */
|
||||||
#define VIRTIO_CONFIG_STATUS_RESET 0x00
|
#define VIRTIO_CONFIG_STATUS_RESET 0x00
|
||||||
|
/* We have seen device and processed generic fields. */
|
||||||
#define VIRTIO_CONFIG_STATUS_ACK 0x01
|
#define VIRTIO_CONFIG_STATUS_ACK 0x01
|
||||||
#define VIRTIO_CONFIG_STATUS_DRIVER 0x03
|
/* We have found a driver for the device. */
|
||||||
|
#define VIRTIO_CONFIG_STATUS_DRIVER 0x02
|
||||||
|
/* Driver has used its parts of the config, and is happy. */
|
||||||
#define VIRTIO_CONFIG_STATUS_DRIVER_OK 0x04
|
#define VIRTIO_CONFIG_STATUS_DRIVER_OK 0x04
|
||||||
|
/* Driver has finished configuring features (modern only). */
|
||||||
|
#define VIRTIO_CONFIG_S_FEATURES_OK 0x08
|
||||||
|
/* Device entered invalid state, driver must reset it. */
|
||||||
|
#define VIRTIO_CONFIG_S_NEEDS_RESET 0x40
|
||||||
|
/* We've given up on this device. */
|
||||||
#define VIRTIO_CONFIG_STATUS_FAILED 0x80
|
#define VIRTIO_CONFIG_STATUS_FAILED 0x80
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generate interrupt when the virtqueue ring is
|
* Generate interrupt when the virtqueue ring is
|
||||||
* completely used, even if we've suppressed them.
|
* completely used, even if we've suppressed them.
|
||||||
*/
|
*/
|
||||||
#define VIRTIO_F_NOTIFY_ON_EMPTY (1 << 24)
|
#define VIRTIO_F_NOTIFY_ON_EMPTY (1UL << 24)
|
||||||
|
|
||||||
|
/* Can the device handle any descriptor layout? */
|
||||||
|
#define VIRTIO_F_ANY_LAYOUT (1UL << 27)
|
||||||
|
|
||||||
/* Support for indirect buffer descriptors. */
|
/* Support for indirect buffer descriptors. */
|
||||||
#define VIRTIO_RING_F_INDIRECT_DESC (1 << 28)
|
#define VIRTIO_RING_F_INDIRECT_DESC (1UL << 28)
|
||||||
|
|
||||||
/* Support to suppress interrupt until specific index is reached. */
|
/* Support to suppress interrupt until specific index is reached. */
|
||||||
#define VIRTIO_RING_F_EVENT_IDX (1 << 29)
|
#define VIRTIO_RING_F_EVENT_IDX (1UL << 29)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The guest should never negotiate this feature; it
|
* The guest should never negotiate this feature; it
|
||||||
* is used to detect faulty drivers.
|
* is used to detect faulty drivers.
|
||||||
*/
|
*/
|
||||||
#define VIRTIO_F_BAD_FEATURE (1 << 30)
|
#define VIRTIO_F_BAD_FEATURE (1UL << 30)
|
||||||
|
|
||||||
|
/* v1.0 compliant. */
|
||||||
|
#define VIRTIO_F_VERSION_1 (1ULL << 32)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Some VirtIO feature bits (currently bits 28 through 31) are
|
* If clear - device has the IOMMU bypass quirk feature.
|
||||||
|
* If set - use platform tools to detect the IOMMU.
|
||||||
|
*
|
||||||
|
* Note the reverse polarity (compared to most other features),
|
||||||
|
* this is for compatibility with legacy systems.
|
||||||
|
*/
|
||||||
|
#define VIRTIO_F_IOMMU_PLATFORM (1ULL << 33)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Some VirtIO feature bits (currently bits 28 through 34) are
|
||||||
* reserved for the transport being used (eg. virtio_ring), the
|
* reserved for the transport being used (eg. virtio_ring), the
|
||||||
* rest are per-device feature bits.
|
* rest are per-device feature bits.
|
||||||
*/
|
*/
|
||||||
#define VIRTIO_TRANSPORT_F_START 28
|
#define VIRTIO_TRANSPORT_F_START 28
|
||||||
#define VIRTIO_TRANSPORT_F_END 32
|
#define VIRTIO_TRANSPORT_F_END 34
|
||||||
|
|
||||||
#endif /* _VIRTIO_CONFIG_H_ */
|
#endif /* _VIRTIO_CONFIG_H_ */
|
||||||
|
@ -92,6 +92,13 @@ struct vring {
|
|||||||
struct vring_used *used;
|
struct vring_used *used;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Alignment requirements for vring elements.
|
||||||
|
* When using pre-virtio 1.0 layout, these fall out naturally.
|
||||||
|
*/
|
||||||
|
#define VRING_AVAIL_ALIGN_SIZE 2
|
||||||
|
#define VRING_USED_ALIGN_SIZE 4
|
||||||
|
#define VRING_DESC_ALIGN_SIZE 16
|
||||||
|
|
||||||
/* The standard layout for the ring is a continuous chunk of memory which
|
/* The standard layout for the ring is a continuous chunk of memory which
|
||||||
* looks like this. We assume num is a power of 2.
|
* looks like this. We assume num is a power of 2.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user