tests: fix virtio-blk-test ISR dependence
Use the new used ring APIs instead of assuming ISR being set means the request has completed. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Tested-by: Eric Blake <eblake@redhat.com> Tested-by: Kevin Wolf <kwolf@redhat.com> Message-id: 20170628184724.21378-5-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
29509a7bbc
commit
12dfbdcabf
@ -196,7 +196,7 @@ static void test_basic(QVirtioDevice *dev, QGuestAllocator *alloc,
|
|||||||
|
|
||||||
qvirtqueue_kick(dev, vq, free_head);
|
qvirtqueue_kick(dev, vq, free_head);
|
||||||
|
|
||||||
qvirtio_wait_queue_isr(dev, vq, QVIRTIO_BLK_TIMEOUT_US);
|
qvirtio_wait_used_elem(dev, vq, free_head, QVIRTIO_BLK_TIMEOUT_US);
|
||||||
status = readb(req_addr + 528);
|
status = readb(req_addr + 528);
|
||||||
g_assert_cmpint(status, ==, 0);
|
g_assert_cmpint(status, ==, 0);
|
||||||
|
|
||||||
@ -218,7 +218,7 @@ static void test_basic(QVirtioDevice *dev, QGuestAllocator *alloc,
|
|||||||
|
|
||||||
qvirtqueue_kick(dev, vq, free_head);
|
qvirtqueue_kick(dev, vq, free_head);
|
||||||
|
|
||||||
qvirtio_wait_queue_isr(dev, vq, QVIRTIO_BLK_TIMEOUT_US);
|
qvirtio_wait_used_elem(dev, vq, free_head, QVIRTIO_BLK_TIMEOUT_US);
|
||||||
status = readb(req_addr + 528);
|
status = readb(req_addr + 528);
|
||||||
g_assert_cmpint(status, ==, 0);
|
g_assert_cmpint(status, ==, 0);
|
||||||
|
|
||||||
@ -246,7 +246,7 @@ static void test_basic(QVirtioDevice *dev, QGuestAllocator *alloc,
|
|||||||
qvirtqueue_add(vq, req_addr + 528, 1, true, false);
|
qvirtqueue_add(vq, req_addr + 528, 1, true, false);
|
||||||
qvirtqueue_kick(dev, vq, free_head);
|
qvirtqueue_kick(dev, vq, free_head);
|
||||||
|
|
||||||
qvirtio_wait_queue_isr(dev, vq, QVIRTIO_BLK_TIMEOUT_US);
|
qvirtio_wait_used_elem(dev, vq, free_head, QVIRTIO_BLK_TIMEOUT_US);
|
||||||
status = readb(req_addr + 528);
|
status = readb(req_addr + 528);
|
||||||
g_assert_cmpint(status, ==, 0);
|
g_assert_cmpint(status, ==, 0);
|
||||||
|
|
||||||
@ -267,7 +267,7 @@ static void test_basic(QVirtioDevice *dev, QGuestAllocator *alloc,
|
|||||||
|
|
||||||
qvirtqueue_kick(dev, vq, free_head);
|
qvirtqueue_kick(dev, vq, free_head);
|
||||||
|
|
||||||
qvirtio_wait_queue_isr(dev, vq, QVIRTIO_BLK_TIMEOUT_US);
|
qvirtio_wait_used_elem(dev, vq, free_head, QVIRTIO_BLK_TIMEOUT_US);
|
||||||
status = readb(req_addr + 528);
|
status = readb(req_addr + 528);
|
||||||
g_assert_cmpint(status, ==, 0);
|
g_assert_cmpint(status, ==, 0);
|
||||||
|
|
||||||
@ -348,7 +348,7 @@ static void pci_indirect(void)
|
|||||||
free_head = qvirtqueue_add_indirect(&vqpci->vq, indirect);
|
free_head = qvirtqueue_add_indirect(&vqpci->vq, indirect);
|
||||||
qvirtqueue_kick(&dev->vdev, &vqpci->vq, free_head);
|
qvirtqueue_kick(&dev->vdev, &vqpci->vq, free_head);
|
||||||
|
|
||||||
qvirtio_wait_queue_isr(&dev->vdev, &vqpci->vq,
|
qvirtio_wait_used_elem(&dev->vdev, &vqpci->vq, free_head,
|
||||||
QVIRTIO_BLK_TIMEOUT_US);
|
QVIRTIO_BLK_TIMEOUT_US);
|
||||||
status = readb(req_addr + 528);
|
status = readb(req_addr + 528);
|
||||||
g_assert_cmpint(status, ==, 0);
|
g_assert_cmpint(status, ==, 0);
|
||||||
@ -373,7 +373,7 @@ static void pci_indirect(void)
|
|||||||
free_head = qvirtqueue_add_indirect(&vqpci->vq, indirect);
|
free_head = qvirtqueue_add_indirect(&vqpci->vq, indirect);
|
||||||
qvirtqueue_kick(&dev->vdev, &vqpci->vq, free_head);
|
qvirtqueue_kick(&dev->vdev, &vqpci->vq, free_head);
|
||||||
|
|
||||||
qvirtio_wait_queue_isr(&dev->vdev, &vqpci->vq,
|
qvirtio_wait_used_elem(&dev->vdev, &vqpci->vq, free_head,
|
||||||
QVIRTIO_BLK_TIMEOUT_US);
|
QVIRTIO_BLK_TIMEOUT_US);
|
||||||
status = readb(req_addr + 528);
|
status = readb(req_addr + 528);
|
||||||
g_assert_cmpint(status, ==, 0);
|
g_assert_cmpint(status, ==, 0);
|
||||||
@ -484,7 +484,7 @@ static void pci_msix(void)
|
|||||||
qvirtqueue_add(&vqpci->vq, req_addr + 528, 1, true, false);
|
qvirtqueue_add(&vqpci->vq, req_addr + 528, 1, true, false);
|
||||||
qvirtqueue_kick(&dev->vdev, &vqpci->vq, free_head);
|
qvirtqueue_kick(&dev->vdev, &vqpci->vq, free_head);
|
||||||
|
|
||||||
qvirtio_wait_queue_isr(&dev->vdev, &vqpci->vq,
|
qvirtio_wait_used_elem(&dev->vdev, &vqpci->vq, free_head,
|
||||||
QVIRTIO_BLK_TIMEOUT_US);
|
QVIRTIO_BLK_TIMEOUT_US);
|
||||||
|
|
||||||
status = readb(req_addr + 528);
|
status = readb(req_addr + 528);
|
||||||
@ -509,7 +509,7 @@ static void pci_msix(void)
|
|||||||
qvirtqueue_kick(&dev->vdev, &vqpci->vq, free_head);
|
qvirtqueue_kick(&dev->vdev, &vqpci->vq, free_head);
|
||||||
|
|
||||||
|
|
||||||
qvirtio_wait_queue_isr(&dev->vdev, &vqpci->vq,
|
qvirtio_wait_used_elem(&dev->vdev, &vqpci->vq, free_head,
|
||||||
QVIRTIO_BLK_TIMEOUT_US);
|
QVIRTIO_BLK_TIMEOUT_US);
|
||||||
|
|
||||||
status = readb(req_addr + 528);
|
status = readb(req_addr + 528);
|
||||||
@ -540,6 +540,8 @@ static void pci_idx(void)
|
|||||||
uint64_t capacity;
|
uint64_t capacity;
|
||||||
uint32_t features;
|
uint32_t features;
|
||||||
uint32_t free_head;
|
uint32_t free_head;
|
||||||
|
uint32_t write_head;
|
||||||
|
uint32_t desc_idx;
|
||||||
uint8_t status;
|
uint8_t status;
|
||||||
char *data;
|
char *data;
|
||||||
|
|
||||||
@ -581,7 +583,8 @@ static void pci_idx(void)
|
|||||||
qvirtqueue_add(&vqpci->vq, req_addr + 528, 1, true, false);
|
qvirtqueue_add(&vqpci->vq, req_addr + 528, 1, true, false);
|
||||||
qvirtqueue_kick(&dev->vdev, &vqpci->vq, free_head);
|
qvirtqueue_kick(&dev->vdev, &vqpci->vq, free_head);
|
||||||
|
|
||||||
qvirtio_wait_queue_isr(&dev->vdev, &vqpci->vq, QVIRTIO_BLK_TIMEOUT_US);
|
qvirtio_wait_used_elem(&dev->vdev, &vqpci->vq, free_head,
|
||||||
|
QVIRTIO_BLK_TIMEOUT_US);
|
||||||
|
|
||||||
/* Write request */
|
/* Write request */
|
||||||
req.type = VIRTIO_BLK_T_OUT;
|
req.type = VIRTIO_BLK_T_OUT;
|
||||||
@ -600,6 +603,7 @@ static void pci_idx(void)
|
|||||||
qvirtqueue_add(&vqpci->vq, req_addr + 16, 512, false, true);
|
qvirtqueue_add(&vqpci->vq, req_addr + 16, 512, false, true);
|
||||||
qvirtqueue_add(&vqpci->vq, req_addr + 528, 1, true, false);
|
qvirtqueue_add(&vqpci->vq, req_addr + 528, 1, true, false);
|
||||||
qvirtqueue_kick(&dev->vdev, &vqpci->vq, free_head);
|
qvirtqueue_kick(&dev->vdev, &vqpci->vq, free_head);
|
||||||
|
write_head = free_head;
|
||||||
|
|
||||||
/* No notification expected */
|
/* No notification expected */
|
||||||
status = qvirtio_wait_status_byte_no_isr(&dev->vdev,
|
status = qvirtio_wait_status_byte_no_isr(&dev->vdev,
|
||||||
@ -625,8 +629,11 @@ static void pci_idx(void)
|
|||||||
|
|
||||||
qvirtqueue_kick(&dev->vdev, &vqpci->vq, free_head);
|
qvirtqueue_kick(&dev->vdev, &vqpci->vq, free_head);
|
||||||
|
|
||||||
qvirtio_wait_queue_isr(&dev->vdev, &vqpci->vq,
|
/* We get just one notification for both requests */
|
||||||
|
qvirtio_wait_used_elem(&dev->vdev, &vqpci->vq, write_head,
|
||||||
QVIRTIO_BLK_TIMEOUT_US);
|
QVIRTIO_BLK_TIMEOUT_US);
|
||||||
|
g_assert(qvirtqueue_get_buf(&vqpci->vq, &desc_idx));
|
||||||
|
g_assert_cmpint(desc_idx, ==, free_head);
|
||||||
|
|
||||||
status = readb(req_addr + 528);
|
status = readb(req_addr + 528);
|
||||||
g_assert_cmpint(status, ==, 0);
|
g_assert_cmpint(status, ==, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user