diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2016-05-09 13:47:37 +0100 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2016-06-20 11:44:12 +0100 |
commit | ee3b850a70613a9e0cedef8c79f76e9ee45cbef3 (patch) | |
tree | 89886d0aab0f638ae133ea35f6478d836348ad9a /tests/virtio-blk-test.c | |
parent | 1373a4c2568282a8f998a778f09d9d628afcd7fd (diff) |
libqos: drop duplicated virtio_ring.h bit definitions
Note that virtio_ring.h defines feature bits using their bit number:
#define VIRTIO_RING_F_INDIRECT_DESC 28
On the other hand libqos virtio.h uses the bit mask:
#define QVIRTIO_F_RING_INDIRECT_DESC 0x10000000
The patch makes the necessary adjustments.
I have used "1u << BITMASK" instead of "1ULL << BITMASK" because the
64-bit feature fields are not implemented in libqos virtio.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1462798061-30382-5-git-send-email-stefanha@redhat.com
Diffstat (limited to 'tests/virtio-blk-test.c')
-rw-r--r-- | tests/virtio-blk-test.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/tests/virtio-blk-test.c b/tests/virtio-blk-test.c index 84eb056305..8efe3d6efb 100644 --- a/tests/virtio-blk-test.c +++ b/tests/virtio-blk-test.c @@ -20,6 +20,7 @@ #include "qemu/bswap.h" #include "standard-headers/linux/virtio_ids.h" #include "standard-headers/linux/virtio_config.h" +#include "standard-headers/linux/virtio_ring.h" #define QVIRTIO_BLK_F_BARRIER 0x00000001 #define QVIRTIO_BLK_F_SIZE_MAX 0x00000002 @@ -183,7 +184,8 @@ static void test_basic(const QVirtioBus *bus, QVirtioDevice *dev, features = qvirtio_get_features(bus, dev); features = features & ~(QVIRTIO_F_BAD_FEATURE | - QVIRTIO_F_RING_INDIRECT_DESC | QVIRTIO_F_RING_EVENT_IDX | + (1u << VIRTIO_RING_F_INDIRECT_DESC) | + (1u << VIRTIO_RING_F_EVENT_IDX) | QVIRTIO_BLK_F_SCSI); qvirtio_set_features(bus, dev, features); @@ -349,9 +351,10 @@ static void pci_indirect(void) g_assert_cmpint(capacity, ==, TEST_IMAGE_SIZE / 512); features = qvirtio_get_features(&qvirtio_pci, &dev->vdev); - g_assert_cmphex(features & QVIRTIO_F_RING_INDIRECT_DESC, !=, 0); - features = features & ~(QVIRTIO_F_BAD_FEATURE | QVIRTIO_F_RING_EVENT_IDX | - QVIRTIO_BLK_F_SCSI); + g_assert_cmphex(features & (1u << VIRTIO_RING_F_INDIRECT_DESC), !=, 0); + features = features & ~(QVIRTIO_F_BAD_FEATURE | + (1u << VIRTIO_RING_F_EVENT_IDX) | + QVIRTIO_BLK_F_SCSI); qvirtio_set_features(&qvirtio_pci, &dev->vdev, features); alloc = pc_alloc_init(); @@ -491,8 +494,9 @@ static void pci_msix(void) features = qvirtio_get_features(&qvirtio_pci, &dev->vdev); features = features & ~(QVIRTIO_F_BAD_FEATURE | - QVIRTIO_F_RING_INDIRECT_DESC | - QVIRTIO_F_RING_EVENT_IDX | QVIRTIO_BLK_F_SCSI); + (1u << VIRTIO_RING_F_INDIRECT_DESC) | + (1u << VIRTIO_RING_F_EVENT_IDX) | + QVIRTIO_BLK_F_SCSI); qvirtio_set_features(&qvirtio_pci, &dev->vdev, features); vqpci = (QVirtQueuePCI *)qvirtqueue_setup(&qvirtio_pci, &dev->vdev, @@ -606,7 +610,7 @@ static void pci_idx(void) features = qvirtio_get_features(&qvirtio_pci, &dev->vdev); features = features & ~(QVIRTIO_F_BAD_FEATURE | - QVIRTIO_F_RING_INDIRECT_DESC | + (1u << VIRTIO_RING_F_INDIRECT_DESC) | (1u << VIRTIO_F_NOTIFY_ON_EMPTY) | QVIRTIO_BLK_F_SCSI); qvirtio_set_features(&qvirtio_pci, &dev->vdev, features); |