[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 10/24] vhost: Track number of descs in SVQDescState
From: |
Jason Wang |
Subject: |
[PULL 10/24] vhost: Track number of descs in SVQDescState |
Date: |
Tue, 19 Jul 2022 21:16:23 +0800 |
From: Eugenio Pérez <eperezma@redhat.com>
A guest's buffer continuos on GPA may need multiple descriptors on
qemu's VA, so SVQ should track its length sepparatedly.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
hw/virtio/vhost-shadow-virtqueue.c | 4 ++--
hw/virtio/vhost-shadow-virtqueue.h | 6 ++++++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/hw/virtio/vhost-shadow-virtqueue.c
b/hw/virtio/vhost-shadow-virtqueue.c
index e4c09e2..8314405 100644
--- a/hw/virtio/vhost-shadow-virtqueue.c
+++ b/hw/virtio/vhost-shadow-virtqueue.c
@@ -257,6 +257,7 @@ static int vhost_svq_add(VhostShadowVirtqueue *svq, const
struct iovec *out_sg,
}
svq->desc_state[qemu_head].elem = elem;
+ svq->desc_state[qemu_head].ndescs = ndescs;
vhost_svq_kick(svq);
return 0;
}
@@ -418,8 +419,7 @@ static VirtQueueElement
*vhost_svq_get_buf(VhostShadowVirtqueue *svq,
return NULL;
}
- num = svq->desc_state[used_elem.id].elem->in_num +
- svq->desc_state[used_elem.id].elem->out_num;
+ num = svq->desc_state[used_elem.id].ndescs;
last_used_chain = vhost_svq_last_desc_of_chain(svq, num, used_elem.id);
svq->desc_next[last_used_chain] = svq->free_head;
svq->free_head = used_elem.id;
diff --git a/hw/virtio/vhost-shadow-virtqueue.h
b/hw/virtio/vhost-shadow-virtqueue.h
index d646c35..5c7e7cb 100644
--- a/hw/virtio/vhost-shadow-virtqueue.h
+++ b/hw/virtio/vhost-shadow-virtqueue.h
@@ -17,6 +17,12 @@
typedef struct SVQDescState {
VirtQueueElement *elem;
+
+ /*
+ * Number of descriptors exposed to the device. May or may not match
+ * guest's
+ */
+ unsigned int ndescs;
} SVQDescState;
/* Shadow virtqueue to relay notifications */
--
2.7.4
- [PULL 00/24] Net Patches, Jason Wang, 2022/07/19
- [PULL 01/24] vhost: move descriptor translation to vhost_svq_vring_write_descs, Jason Wang, 2022/07/19
- [PULL 02/24] virtio-net: Expose MAC_TABLE_ENTRIES, Jason Wang, 2022/07/19
- [PULL 03/24] virtio-net: Expose ctrl virtqueue logic, Jason Wang, 2022/07/19
- [PULL 04/24] vdpa: Avoid compiler to squash reads to used idx, Jason Wang, 2022/07/19
- [PULL 05/24] vhost: Reorder vhost_svq_kick, Jason Wang, 2022/07/19
- [PULL 06/24] vhost: Move vhost_svq_kick call to vhost_svq_add, Jason Wang, 2022/07/19
- [PULL 07/24] vhost: Check for queue full at vhost_svq_add, Jason Wang, 2022/07/19
- [PULL 08/24] vhost: Decouple vhost_svq_add from VirtQueueElement, Jason Wang, 2022/07/19
- [PULL 09/24] vhost: Add SVQDescState, Jason Wang, 2022/07/19
- [PULL 10/24] vhost: Track number of descs in SVQDescState,
Jason Wang <=
- [PULL 12/24] vhost: Expose vhost_svq_add, Jason Wang, 2022/07/19
- [PULL 13/24] vhost: add vhost_svq_poll, Jason Wang, 2022/07/19
- [PULL 11/24] vhost: add vhost_svq_push_elem, Jason Wang, 2022/07/19
- [PULL 15/24] vdpa: Export vhost_vdpa_dma_map and unmap calls, Jason Wang, 2022/07/19
- [PULL 14/24] vhost: Add svq avail_handler callback, Jason Wang, 2022/07/19
- [PULL 16/24] vdpa: manual forward CVQ buffers, Jason Wang, 2022/07/19
- [PULL 17/24] vdpa: Buffer CVQ support on shadow virtqueue, Jason Wang, 2022/07/19
- [PULL 19/24] vdpa: Add device migration blocker, Jason Wang, 2022/07/19
- [PULL 18/24] vdpa: Extract get features part from vhost_vdpa_get_max_queue_pairs, Jason Wang, 2022/07/19
- [PULL 20/24] vdpa: Add x-svq to NetdevVhostVDPAOptions, Jason Wang, 2022/07/19