On Fri, Nov 20, 2020 at 07:50:48PM +0100, Eugenio Pérez wrote: > Signed-off-by: Eugenio Pérez <eperezma@xxxxxxxxxx> > --- > hw/virtio/vhost-sw-lm-ring.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/hw/virtio/vhost-sw-lm-ring.c b/hw/virtio/vhost-sw-lm-ring.c > index cbf53965cd..cd7b5ba772 100644 > --- a/hw/virtio/vhost-sw-lm-ring.c > +++ b/hw/virtio/vhost-sw-lm-ring.c > @@ -16,8 +16,11 @@ > #include "qemu/event_notifier.h" > > typedef struct VhostShadowVirtqueue { > + struct vring vring; > EventNotifier hdev_notifier; > VirtQueue *vq; > + > + vring_desc_t descs[]; > } VhostShadowVirtqueue; VhostShadowVirtqueue is starting to look like VirtQueue. Can the shadow vq code simply use the VirtIODevice's VirtQueues instead of duplicating this? What I mean is: 1. Disable the vhost hdev vq and sync the avail index back to the VirtQueue. 2. Move the irq fd to the VirtQueue as its guest notifier. 3. Install the shadow_vq_handler() as the VirtQueue's handle_output function. 4. Move the call fd to the VirtQueue as its host notifier. Now we can process requests from the VirtIODevice's VirtQueue using virtqueue_pop() and friends. We're also in sync and ready for vmstate save/load.
Attachment:
signature.asc
Description: PGP signature