Jason Wang
2021-Oct-13 03:43 UTC
[RFC PATCH v4 10/20] vhost-vdpa: Take into account SVQ in vhost_vdpa_set_vring_call
? 2021/10/1 ??3:05, Eugenio P?rez ??:> Signed-off-by: Eugenio P?rez <eperezma at redhat.com> > --- > hw/virtio/vhost-vdpa.c | 17 ++++++++++++++--- > 1 file changed, 14 insertions(+), 3 deletions(-) > > diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c > index 57a857444a..bc34de2439 100644 > --- a/hw/virtio/vhost-vdpa.c > +++ b/hw/virtio/vhost-vdpa.c > @@ -649,16 +649,27 @@ static int vhost_vdpa_set_vring_kick(struct vhost_dev *dev, > return vhost_vdpa_call(dev, VHOST_SET_VRING_KICK, file); > } > > +static int vhost_vdpa_set_vring_dev_call(struct vhost_dev *dev, > + struct vhost_vring_file *file) > +{ > + trace_vhost_vdpa_set_vring_call(dev, file->index, file->fd); > + return vhost_vdpa_call(dev, VHOST_SET_VRING_CALL, file); > +} > + > static int vhost_vdpa_set_vring_call(struct vhost_dev *dev, > struct vhost_vring_file *file) > { > struct vhost_vdpa *v = dev->opaque; > int vdpa_idx = vhost_vdpa_get_vq_index(dev, file->index); > > - trace_vhost_vdpa_set_vring_call(dev, file->index, file->fd); > - > v->call_fd[vdpa_idx] = file->fd; > - return vhost_vdpa_call(dev, VHOST_SET_VRING_CALL, file); > + if (v->shadow_vqs_enabled) { > + VhostShadowVirtqueue *svq = g_ptr_array_index(v->shadow_vqs, vdpa_idx); > + vhost_svq_set_guest_call_notifier(svq, file->fd); > + return 0; > + } else { > + return vhost_vdpa_set_vring_dev_call(dev, file); > + }I feel like we should do the same for kick fd. Thanks> } > > static int vhost_vdpa_get_features(struct vhost_dev *dev,