diff options
author | Marc MarĂ <marc.mari.barcelo@gmail.com> | 2014-09-01 12:07:57 +0200 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2014-09-08 11:12:43 +0100 |
commit | f294b029aa2beb1c67116e04bff5d331f0b18288 (patch) | |
tree | c310d6a49c2e00e2316d8cbac5400aab2838642a /tests/libqos/virtio.h | |
parent | bf3c63d2010c5ef52f8b988bee2a1486a056795f (diff) |
libqos: Added indirect descriptor support to virtio implementation
Add functions necessary for working with indirect descriptors.
Add test using new functions.
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Marc MarĂ <marc.mari.barcelo@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'tests/libqos/virtio.h')
-rw-r--r-- | tests/libqos/virtio.h | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/libqos/virtio.h b/tests/libqos/virtio.h index aba5a1e12c..1860660dfd 100644 --- a/tests/libqos/virtio.h +++ b/tests/libqos/virtio.h @@ -22,6 +22,11 @@ #define QVIRTIO_NET_DEVICE_ID 0x1 #define QVIRTIO_BLK_DEVICE_ID 0x2 +#define QVIRTIO_F_NOTIFY_ON_EMPTY 0x01000000 +#define QVIRTIO_F_ANY_LAYOUT 0x08000000 +#define QVIRTIO_F_RING_INDIRECT_DESC 0x10000000 +#define QVIRTIO_F_RING_EVENT_IDX 0x20000000 + #define QVRING_DESC_F_NEXT 0x1 #define QVRING_DESC_F_WRITE 0x2 #define QVRING_DESC_F_INDIRECT 0x4 @@ -74,8 +79,15 @@ typedef struct QVirtQueue { uint32_t free_head; uint32_t num_free; uint32_t align; + bool indirect; } QVirtQueue; +typedef struct QVRingIndirectDesc { + uint64_t desc; /* This points to an array fo QVRingDesc */ + uint16_t index; + uint16_t elem; +} QVRingIndirectDesc; + typedef struct QVirtioBus { uint8_t (*config_readb)(QVirtioDevice *d, void *addr); uint16_t (*config_readw)(QVirtioDevice *d, void *addr); @@ -85,9 +97,12 @@ typedef struct QVirtioBus { /* Get features of the device */ uint32_t (*get_features)(QVirtioDevice *d); - /* Get features of the device */ + /* Set features of the device */ void (*set_features)(QVirtioDevice *d, uint32_t features); + /* Get features of the guest */ + uint32_t (*get_guest_features)(QVirtioDevice *d); + /* Get status of the device */ uint8_t (*get_status)(QVirtioDevice *d); @@ -144,8 +159,13 @@ QVirtQueue *qvirtqueue_setup(const QVirtioBus *bus, QVirtioDevice *d, QGuestAllocator *alloc, uint16_t index); void qvring_init(const QGuestAllocator *alloc, QVirtQueue *vq, uint64_t addr); +QVRingIndirectDesc *qvring_indirect_desc_setup(QVirtioDevice *d, + QGuestAllocator *alloc, uint16_t elem); +void qvring_indirect_desc_add(QVRingIndirectDesc *indirect, uint64_t data, + uint32_t len, bool write); uint32_t qvirtqueue_add(QVirtQueue *vq, uint64_t data, uint32_t len, bool write, bool next); +uint32_t qvirtqueue_add_indirect(QVirtQueue *vq, QVRingIndirectDesc *indirect); void qvirtqueue_kick(const QVirtioBus *bus, QVirtioDevice *d, QVirtQueue *vq, uint32_t free_head); |