vhost: Track number of descs in SVQDescState
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>
This commit is contained in:
parent
9e87868fca
commit
ac4cfdc6f3
@ -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;
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user