[PATCH v8 0/4] Virtio shared dma-buf

Albert Esteve posted 4 patches 7 months, 3 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20230908154743.809569-1-aesteve@redhat.com
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Albert Esteve <aesteve@redhat.com>, Fam Zheng <fam@euphon.net>
There is a newer version of this series
MAINTAINERS                               |   7 +
docs/interop/vhost-user.rst               |  57 ++++++++
hw/display/meson.build                    |   1 +
hw/display/virtio-dmabuf.c                | 138 ++++++++++++++++++
hw/virtio/vhost-user.c                    | 168 ++++++++++++++++++++--
include/hw/virtio/vhost-backend.h         |   3 +
include/hw/virtio/virtio-dmabuf.h         | 100 +++++++++++++
include/qemu/uuid.h                       |   2 +
subprojects/libvhost-user/libvhost-user.c | 120 ++++++++++++++++
subprojects/libvhost-user/libvhost-user.h |  55 ++++++-
tests/unit/meson.build                    |   1 +
tests/unit/test-uuid.c                    |  27 ++++
tests/unit/test-virtio-dmabuf.c           | 137 ++++++++++++++++++
util/uuid.c                               |  15 ++
14 files changed, 818 insertions(+), 13 deletions(-)
create mode 100644 hw/display/virtio-dmabuf.c
create mode 100644 include/hw/virtio/virtio-dmabuf.h
create mode 100644 tests/unit/test-virtio-dmabuf.c
[PATCH v8 0/4] Virtio shared dma-buf
Posted by Albert Esteve 7 months, 3 weeks ago
v1 link -> https://lists.gnu.org/archive/html/qemu-devel/2023-05/msg00598.html
v2 link -> https://lists.gnu.org/archive/html/qemu-devel/2023-05/msg04530.html
v3 link -> https://lists.gnu.org/archive/html/qemu-devel/2023-05/msg06126.html
v4 link -> https://lists.gnu.org/archive/html/qemu-devel/2023-06/msg05174.html
v5 link -> https://lists.gnu.org/archive/html/qemu-devel/2023-08/msg00255.html
v6 link -> https://lists.gnu.org/archive/html/qemu-devel/2023-09/msg00987.html
v7 link -> https://lists.gnu.org/archive/html/qemu-devel/2023-09/msg01190.html
v7 -> v8:
- Move "qemu/osdep.h" include to the virtio-dmabuf source file.
- Remove duplicated glib include.
- Change the title of commits to better reflect the path to the change

This patch covers the required steps to add support for virtio cross-device resource sharing[1],
which support is already available in the kernel.

The main usecase will be sharing dma buffers from virtio-gpu devices (as the exporter
-see VIRTIO_GPU_CMD_RESOURCE_ASSIGN_UUID in [2]), to virtio-video (under discussion)
devices (as the buffer-user or importer). Therefore, even though virtio specs talk about
resources or objects[3], this patch adds the infrastructure with dma-bufs in mind.
Note that virtio specs let the devices themselves define what a vitio object is.

These are the main parts that are covered in the patch:

- Add hash function to uuid module
- Shared resources table, to hold all resources that can be shared in the host and their assigned UUID,
  or pointers to the backend holding the resource
- Internal shared table API for virtio devices to add, lookup and remove resources
- Unit test to verify the API
- New messages to the vhost-user protocol to allow backend to interact with the shared
  table API through the control socket
- New vhost-user feature bit to enable shared objects feature

Applies cleanly to 03a3a62fbd0aa5227e978eef3c67d3978aec9e5f

[1] - https://lwn.net/Articles/828988/
[2] - https://docs.oasis-open.org/virtio/virtio/v1.2/csd01/virtio-v1.2-csd01.html#x1-3730006
[3] - https://docs.oasis-open.org/virtio/virtio/v1.2/csd01/virtio-v1.2-csd01.html#x1-10500011

Albert Esteve (4):
  util/uuid: add a hash function
  hw/display: introduce virtio-dmabuf
  vhost-user: add shared_object msg
  libvhost-user: handle shared_object msg

 MAINTAINERS                               |   7 +
 docs/interop/vhost-user.rst               |  57 ++++++++
 hw/display/meson.build                    |   1 +
 hw/display/virtio-dmabuf.c                | 138 ++++++++++++++++++
 hw/virtio/vhost-user.c                    | 168 ++++++++++++++++++++--
 include/hw/virtio/vhost-backend.h         |   3 +
 include/hw/virtio/virtio-dmabuf.h         | 100 +++++++++++++
 include/qemu/uuid.h                       |   2 +
 subprojects/libvhost-user/libvhost-user.c | 120 ++++++++++++++++
 subprojects/libvhost-user/libvhost-user.h |  55 ++++++-
 tests/unit/meson.build                    |   1 +
 tests/unit/test-uuid.c                    |  27 ++++
 tests/unit/test-virtio-dmabuf.c           | 137 ++++++++++++++++++
 util/uuid.c                               |  15 ++
 14 files changed, 818 insertions(+), 13 deletions(-)
 create mode 100644 hw/display/virtio-dmabuf.c
 create mode 100644 include/hw/virtio/virtio-dmabuf.h
 create mode 100644 tests/unit/test-virtio-dmabuf.c

-- 
2.41.0
Re: [PATCH v8 0/4] Virtio shared dma-buf
Posted by Philippe Mathieu-Daudé 7 months, 3 weeks ago
On 8/9/23 17:47, Albert Esteve wrote:
> v1 link -> https://lists.gnu.org/archive/html/qemu-devel/2023-05/msg00598.html
> v2 link -> https://lists.gnu.org/archive/html/qemu-devel/2023-05/msg04530.html
> v3 link -> https://lists.gnu.org/archive/html/qemu-devel/2023-05/msg06126.html
> v4 link -> https://lists.gnu.org/archive/html/qemu-devel/2023-06/msg05174.html
> v5 link -> https://lists.gnu.org/archive/html/qemu-devel/2023-08/msg00255.html
> v6 link -> https://lists.gnu.org/archive/html/qemu-devel/2023-09/msg00987.html
> v7 link -> https://lists.gnu.org/archive/html/qemu-devel/2023-09/msg01190.html
> v7 -> v8:
> - Move "qemu/osdep.h" include to the virtio-dmabuf source file.
> - Remove duplicated glib include.
> - Change the title of commits to better reflect the path to the change

Thank Albert you for the various respin with review comment addressed.

Michael, no other comment on my side.

Regards,

Phil.

> This patch covers the required steps to add support for virtio cross-device resource sharing[1],
> which support is already available in the kernel.

> Albert Esteve (4):
>    util/uuid: add a hash function
>    hw/display: introduce virtio-dmabuf
>    vhost-user: add shared_object msg
>    libvhost-user: handle shared_object msg
Re: [PATCH v8 0/4] Virtio shared dma-buf
Posted by Albert Esteve 7 months, 2 weeks ago
On Fri, Sep 8, 2023 at 5:55 PM Philippe Mathieu-Daudé <philmd@linaro.org>
wrote:

> On 8/9/23 17:47, Albert Esteve wrote:
> > v1 link ->
> https://lists.gnu.org/archive/html/qemu-devel/2023-05/msg00598.html
> > v2 link ->
> https://lists.gnu.org/archive/html/qemu-devel/2023-05/msg04530.html
> > v3 link ->
> https://lists.gnu.org/archive/html/qemu-devel/2023-05/msg06126.html
> > v4 link ->
> https://lists.gnu.org/archive/html/qemu-devel/2023-06/msg05174.html
> > v5 link ->
> https://lists.gnu.org/archive/html/qemu-devel/2023-08/msg00255.html
> > v6 link ->
> https://lists.gnu.org/archive/html/qemu-devel/2023-09/msg00987.html
> > v7 link ->
> https://lists.gnu.org/archive/html/qemu-devel/2023-09/msg01190.html
> > v7 -> v8:
> > - Move "qemu/osdep.h" include to the virtio-dmabuf source file.
> > - Remove duplicated glib include.
> > - Change the title of commits to better reflect the path to the change
>
> Thank Albert you for the various respin with review comment addressed.
>
>
Hi Philippe,

Thank you for taking the time to review!


> Michael, no other comment on my side.
>
> Regards,
>
> Phil.
>
> > This patch covers the required steps to add support for virtio
> cross-device resource sharing[1],
> > which support is already available in the kernel.
>
> > Albert Esteve (4):
> >    util/uuid: add a hash function
> >    hw/display: introduce virtio-dmabuf
> >    vhost-user: add shared_object msg
> >    libvhost-user: handle shared_object msg
>
>