qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH for 8.1 v2 2/6] vdpa: add vhost_vdpa_reset_status_fd


From: Michael S. Tsirkin
Subject: Re: [PATCH for 8.1 v2 2/6] vdpa: add vhost_vdpa_reset_status_fd
Date: Fri, 21 Apr 2023 03:45:40 -0400

On Tue, Mar 28, 2023 at 09:37:16AM +0200, Eugenio Perez Martin wrote:
> > > diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
> > > index bbabea18f3..7a2053b8d9 100644
> > > --- a/hw/virtio/vhost-vdpa.c
> > > +++ b/hw/virtio/vhost-vdpa.c
> > > @@ -335,38 +335,45 @@ static const MemoryListener 
> > > vhost_vdpa_memory_listener = {
> > >      .region_del = vhost_vdpa_listener_region_del,
> > >  };
> > >
> > > -static int vhost_vdpa_call(struct vhost_dev *dev, unsigned long int 
> > > request,
> > > -                             void *arg)
> > > +static int vhost_vdpa_dev_fd(const struct vhost_dev *dev)
> > >  {
> > >      struct vhost_vdpa *v = dev->opaque;
> > > -    int fd = v->device_fd;
> > > -    int ret;
> > >
> > >      assert(dev->vhost_ops->backend_type == VHOST_BACKEND_TYPE_VDPA);
> > > +    return v->device_fd;
> > > +}
> > > +
> > > +static int vhost_vdpa_call_fd(int fd, unsigned long int request, void 
> > > *arg)
> > > +{
> > > +    int ret = ioctl(fd, request, arg);
> > >
> > > -    ret = ioctl(fd, request, arg);
> > >      return ret < 0 ? -errno : ret;
> > >  }
> > >
> > > -static int vhost_vdpa_add_status(struct vhost_dev *dev, uint8_t status)
> > > +static int vhost_vdpa_call(struct vhost_dev *dev, unsigned long int 
> > > request,
> > > +                           void *arg)
> > > +{
> > > +    return vhost_vdpa_call_fd(vhost_vdpa_dev_fd(dev), request, arg);
> > > +}
> > > +
> > > +static int vhost_vdpa_add_status_fd(int fd, uint8_t status)
> > >  {
> > >      uint8_t s;
> > >      int ret;
> > >
> > > -    trace_vhost_vdpa_add_status(dev, status);
> > > -    ret = vhost_vdpa_call(dev, VHOST_VDPA_GET_STATUS, &s);
> >
> > We can stick a vhost_vdpa_call() function that calls
> > vhost_vdpa_call_fd() then we can avoid a lot of changes?
> >
> 
> I don't follow this. vhost_vdpa_call already calls vhost_vdpa_call_fd.
> 
> Thanks!


Jason were you going to reply?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]