qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Albert Esteve <aesteve@redhat.com>
To: qemu-devel@nongnu.org
Cc: marcandre.lureau@gmail.com, kraxel@redhat.com, cohuck@redhat.com,
	Albert Esteve <aesteve@redhat.com>, Fam Zheng <fam@euphon.net>,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: [PATCH v5 0/4] Virtio shared dma-buf
Date: Wed,  2 Aug 2023 11:08:20 +0200	[thread overview]
Message-ID: <20230802090824.91688-1-aesteve@redhat.com> (raw)

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
v4 -> v5:
- Allow shared table to hold pointers for vhost devices, in a struct that defines the types that the table can store
- New message VHOST_USER_GET_SHARED_OBJECT to retrieve objects stored in vhost backends
- Minor additions to support the previous items (e.g. new test usecases).

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 38a6de80b917b2a822cff0e38d83563ab401c890

[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):
  uuid: add a hash function
  virtio-dmabuf: introduce virtio-dmabuf
  vhost-user: add shared_object msg
  vhost-user: refactor send_resp code

 MAINTAINERS                               |   7 +
 docs/interop/vhost-user.rst               |  57 +++++++
 hw/display/meson.build                    |   1 +
 hw/display/virtio-dmabuf.c                | 136 +++++++++++++++++
 hw/virtio/vhost-user.c                    | 174 ++++++++++++++++++++--
 include/hw/virtio/vhost-backend.h         |   3 +
 include/hw/virtio/virtio-dmabuf.h         | 103 +++++++++++++
 include/qemu/uuid.h                       |   2 +
 subprojects/libvhost-user/libvhost-user.c | 118 +++++++++++++++
 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                               |  14 ++
 14 files changed, 821 insertions(+), 14 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.40.0



             reply	other threads:[~2023-08-02  9:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-02  9:08 Albert Esteve [this message]
2023-08-02  9:08 ` [PATCH v5 1/4] uuid: add a hash function Albert Esteve
2023-09-06  5:06   ` Philippe Mathieu-Daudé
2023-08-02  9:08 ` [PATCH v5 2/4] virtio-dmabuf: introduce virtio-dmabuf Albert Esteve
2023-09-06  5:56   ` Philippe Mathieu-Daudé
2023-09-06  7:42     ` Albert Esteve
2023-09-06  8:45       ` Albert Esteve
2023-09-06  9:16         ` Philippe Mathieu-Daudé
2023-08-02  9:08 ` [PATCH v5 3/4] vhost-user: add shared_object msg Albert Esteve
2023-09-06  6:04   ` Philippe Mathieu-Daudé
2023-09-06  6:09     ` Philippe Mathieu-Daudé
2023-09-06  6:54       ` Albert Esteve
2023-08-02  9:08 ` [PATCH v5 4/4] vhost-user: refactor send_resp code Albert Esteve
2023-09-06  6:11   ` Philippe Mathieu-Daudé
2023-08-21 12:37 ` [PATCH v5 0/4] Virtio shared dma-buf Albert Esteve
2023-09-05 20:45   ` Michael S. Tsirkin
2023-09-06  6:13     ` Philippe Mathieu-Daudé
2023-09-06  9:39       ` Albert Esteve
2023-09-06 10:16         ` Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230802090824.91688-1-aesteve@redhat.com \
    --to=aesteve@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=fam@euphon.net \
    --cc=kraxel@redhat.com \
    --cc=marcandre.lureau@gmail.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).