qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v1 05/10] vhost-backend: export the vhost backend helper


From: Laurent Vivier
Subject: Re: [PATCH v1 05/10] vhost-backend: export the vhost backend helper
Date: Thu, 25 Jun 2020 17:07:32 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0

On 22/06/2020 17:37, Cindy Lu wrote:
> export the helper then we can reuse them in other backend
> 
> Signed-off-by: Cindy Lu <lulu@redhat.com>
> ---
>  hw/virtio/vhost-backend.c         | 18 +++++++++---------
>  include/hw/virtio/vhost-backend.h | 28 ++++++++++++++++++++++++++++
>  2 files changed, 37 insertions(+), 9 deletions(-)
> 

This looks weird to export all these functions whereas they are all
already exported by the vhost_ops structure.

So if vhost-vdpa is not a subset of vhost-kernel and if these functions
will diverge from vhost-backend.c definition in the future, perhaps it
is wise to already copy their definitions right now in vhost-vdpa.c
rather than exporting them now and to have to copy them in the future in
vhost-vdpa.c to modify them.

It will also simplify the definition of vhost_kernel_call().

Thanks,
Laurent

> diff --git a/hw/virtio/vhost-backend.c b/hw/virtio/vhost-backend.c
> index 48905383f8..660e9e8588 100644
> --- a/hw/virtio/vhost-backend.c
> +++ b/hw/virtio/vhost-backend.c
> @@ -89,7 +89,7 @@ static int vhost_kernel_scsi_get_abi_version(struct 
> vhost_dev *dev, int *version
>      return vhost_kernel_call(dev, VHOST_SCSI_GET_ABI_VERSION, version);
>  }
>  
> -static int vhost_kernel_set_log_base(struct vhost_dev *dev, uint64_t base,
> +int vhost_kernel_set_log_base(struct vhost_dev *dev, uint64_t base,
>                                       struct vhost_log *log)
>  {
>      return vhost_kernel_call(dev, VHOST_SET_LOG_BASE, &base);
> @@ -101,7 +101,7 @@ static int vhost_kernel_set_mem_table(struct vhost_dev 
> *dev,
>      return vhost_kernel_call(dev, VHOST_SET_MEM_TABLE, mem);
>  }
>  
> -static int vhost_kernel_set_vring_addr(struct vhost_dev *dev,
> +int vhost_kernel_set_vring_addr(struct vhost_dev *dev,
>                                         struct vhost_vring_addr *addr)
>  {
>      return vhost_kernel_call(dev, VHOST_SET_VRING_ADDR, addr);
> @@ -113,31 +113,31 @@ static int vhost_kernel_set_vring_endian(struct 
> vhost_dev *dev,
>      return vhost_kernel_call(dev, VHOST_SET_VRING_ENDIAN, ring);
>  }
>  
> -static int vhost_kernel_set_vring_num(struct vhost_dev *dev,
> +int vhost_kernel_set_vring_num(struct vhost_dev *dev,
>                                        struct vhost_vring_state *ring)
>  {
>      return vhost_kernel_call(dev, VHOST_SET_VRING_NUM, ring);
>  }
>  
> -static int vhost_kernel_set_vring_base(struct vhost_dev *dev,
> +int vhost_kernel_set_vring_base(struct vhost_dev *dev,
>                                         struct vhost_vring_state *ring)
>  {
>      return vhost_kernel_call(dev, VHOST_SET_VRING_BASE, ring);
>  }
>  
> -static int vhost_kernel_get_vring_base(struct vhost_dev *dev,
> +int vhost_kernel_get_vring_base(struct vhost_dev *dev,
>                                         struct vhost_vring_state *ring)
>  {
>      return vhost_kernel_call(dev, VHOST_GET_VRING_BASE, ring);
>  }
>  
> -static int vhost_kernel_set_vring_kick(struct vhost_dev *dev,
> +int vhost_kernel_set_vring_kick(struct vhost_dev *dev,
>                                         struct vhost_vring_file *file)
>  {
>      return vhost_kernel_call(dev, VHOST_SET_VRING_KICK, file);
>  }
>  
> -static int vhost_kernel_set_vring_call(struct vhost_dev *dev,
> +int vhost_kernel_set_vring_call(struct vhost_dev *dev,
>                                         struct vhost_vring_file *file)
>  {
>      return vhost_kernel_call(dev, VHOST_SET_VRING_CALL, file);
> @@ -155,13 +155,13 @@ static int vhost_kernel_set_features(struct vhost_dev 
> *dev,
>      return vhost_kernel_call(dev, VHOST_SET_FEATURES, &features);
>  }
>  
> -static int vhost_kernel_get_features(struct vhost_dev *dev,
> +int vhost_kernel_get_features(struct vhost_dev *dev,
>                                       uint64_t *features)
>  {
>      return vhost_kernel_call(dev, VHOST_GET_FEATURES, features);
>  }
>  
> -static int vhost_kernel_set_owner(struct vhost_dev *dev)
> +int vhost_kernel_set_owner(struct vhost_dev *dev)
>  {
>      return vhost_kernel_call(dev, VHOST_SET_OWNER, NULL);
>  }
> diff --git a/include/hw/virtio/vhost-backend.h 
> b/include/hw/virtio/vhost-backend.h
> index 6f6670783f..300b59c172 100644
> --- a/include/hw/virtio/vhost-backend.h
> +++ b/include/hw/virtio/vhost-backend.h
> @@ -172,4 +172,32 @@ int vhost_backend_handle_iotlb_msg(struct vhost_dev *dev,
>  
>  int vhost_user_gpu_set_socket(struct vhost_dev *dev, int fd);
>  
> +
> +int vhost_kernel_set_log_base(struct vhost_dev *dev, uint64_t base,
> +                                     struct vhost_log *log);
> +
> +int vhost_kernel_set_vring_addr(struct vhost_dev *dev,
> +                                       struct vhost_vring_addr *addr);
> +
> +int vhost_kernel_set_vring_num(struct vhost_dev *dev,
> +                                      struct vhost_vring_state *ring);
> +
> +int vhost_kernel_set_vring_base(struct vhost_dev *dev,
> +                                       struct vhost_vring_state *ring);
> +
> +int vhost_kernel_get_vring_base(struct vhost_dev *dev,
> +                                       struct vhost_vring_state *ring);
> +
> +int vhost_kernel_set_vring_kick(struct vhost_dev *dev,
> +                                       struct vhost_vring_file *file);
> +
> +int vhost_kernel_set_vring_call(struct vhost_dev *dev,
> +                                       struct vhost_vring_file *file);
> +
> +int vhost_kernel_set_owner(struct vhost_dev *dev);
> +
> +int vhost_kernel_get_features(struct vhost_dev *dev,
> +                                     uint64_t *features);
> +
> +
>  #endif /* VHOST_BACKEND_H */
> 




reply via email to

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