[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC v2 10/12] vhost-user: add vhost_user_gpu_set_socket()
From: |
Marc-André Lureau |
Subject: |
[Qemu-devel] [RFC v2 10/12] vhost-user: add vhost_user_gpu_set_socket() |
Date: |
Fri, 1 Jun 2018 18:27:47 +0200 |
Add a new vhost-user message to give a unix socket for gpu updates to
a vhost-user backend.
Back when I started that work, I added a new GPU channel because the
vhost-user protocol wasn't bidirectional. Since then, there is a
vhost-user-slave channel for the slave to send requests to the master.
We could extend it with GPU messages. However, the GPU protocol is
quite orthogonal to vhost-user and may not need the same kind of
stability guarantees, thus I recommend to have a new dedicated
channel.
FIXME: document the GPU protocol.
Signed-off-by: Marc-André Lureau <address@hidden>
---
contrib/libvhost-user/libvhost-user.h | 1 +
include/hw/virtio/vhost-backend.h | 1 +
hw/virtio/vhost-user.c | 11 +++++++++++
3 files changed, 13 insertions(+)
diff --git a/contrib/libvhost-user/libvhost-user.h
b/contrib/libvhost-user/libvhost-user.h
index d6badc8653..57a3a36100 100644
--- a/contrib/libvhost-user/libvhost-user.h
+++ b/contrib/libvhost-user/libvhost-user.h
@@ -90,6 +90,7 @@ typedef enum VhostUserRequest {
VHOST_USER_POSTCOPY_LISTEN = 29,
VHOST_USER_POSTCOPY_END = 30,
VHOST_USER_INPUT_GET_CONFIG,
+ VHOST_USER_GPU_SET_SOCKET,
VHOST_USER_MAX
} VhostUserRequest;
diff --git a/include/hw/virtio/vhost-backend.h
b/include/hw/virtio/vhost-backend.h
index 6cc2edacc5..a60d278f05 100644
--- a/include/hw/virtio/vhost-backend.h
+++ b/include/hw/virtio/vhost-backend.h
@@ -159,5 +159,6 @@ int vhost_backend_handle_iotlb_msg(struct vhost_dev *dev,
int vhost_user_input_get_config(struct vhost_dev *dev,
struct virtio_input_config **config);
+int vhost_user_gpu_set_socket(struct vhost_dev *dev, int fd);
#endif /* VHOST_BACKEND_H */
diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index 19ed87d07c..5cb76f436b 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -85,6 +85,7 @@ typedef enum VhostUserRequest {
VHOST_USER_POSTCOPY_LISTEN = 29,
VHOST_USER_POSTCOPY_END = 30,
VHOST_USER_INPUT_GET_CONFIG,
+ VHOST_USER_GPU_SET_SOCKET,
VHOST_USER_MAX
} VhostUserRequest;
@@ -383,6 +384,16 @@ err:
return -1;
}
+int vhost_user_gpu_set_socket(struct vhost_dev *dev, int fd)
+{
+ VhostUserMsg msg = {
+ .hdr.request = VHOST_USER_GPU_SET_SOCKET,
+ .hdr.flags = VHOST_USER_VERSION,
+ };
+
+ return vhost_user_write(dev, &msg, &fd, 1);
+}
+
static int vhost_user_set_log_base(struct vhost_dev *dev, uint64_t base,
struct vhost_log *log)
{
--
2.17.1.906.g10fd178552
[Qemu-devel] [RFC v2 12/12] contrib: add vhost-user-gpu, Marc-André Lureau, 2018/06/01
Re: [Qemu-devel] [RFC v2 00/12] vhost-user for input & GPU, no-reply, 2018/06/01