diff mbox

[RFC,13/14] vhost-user: add vhost_user_gpu_set_socket()

Message ID 1465076003-26291-14-git-send-email-marcandre.lureau@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Marc-André Lureau June 4, 2016, 9:33 p.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

Add a new vhost-user message to give a unix socket for gpu updates to a
vhost-user backend.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 contrib/libvhost-user/libvhost-user.h |  1 +
 hw/virtio/vhost-user.c                | 11 +++++++++++
 include/hw/virtio/vhost-backend.h     |  1 +
 3 files changed, 13 insertions(+)

Comments

Gerd Hoffmann June 6, 2016, 6:36 a.m. UTC | #1
On Sa, 2016-06-04 at 23:33 +0200, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Add a new vhost-user message to give a unix socket for gpu updates to a
> vhost-user backend.

--verbose please.

cheers,
  Gerd
diff mbox

Patch

diff --git a/contrib/libvhost-user/libvhost-user.h b/contrib/libvhost-user/libvhost-user.h
index 9733b1a..4bcbae3 100644
--- a/contrib/libvhost-user/libvhost-user.h
+++ b/contrib/libvhost-user/libvhost-user.h
@@ -61,6 +61,7 @@  typedef enum VhostUserRequest {
     VHOST_USER_SET_VRING_ENABLE = 18,
     VHOST_USER_SEND_RARP = 19,
     VHOST_USER_INPUT_GET_CONFIG = 20,
+    VHOST_USER_GPU_SET_SOCKET = 21,
     VHOST_USER_MAX
 } VhostUserRequest;
 
diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index 8072c16..5e6091d 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -59,6 +59,7 @@  typedef enum VhostUserRequest {
     VHOST_USER_SET_VRING_ENABLE = 18,
     VHOST_USER_SEND_RARP = 19,
     VHOST_USER_INPUT_GET_CONFIG = 20,
+    VHOST_USER_GPU_SET_SOCKET = 21,
     VHOST_USER_MAX
 } VhostUserRequest;
 
@@ -263,6 +264,16 @@  err:
     return -1;
 }
 
+int vhost_user_gpu_set_socket(struct vhost_dev *dev, int fd)
+{
+    VhostUserMsg msg = {
+        .request = VHOST_USER_GPU_SET_SOCKET,
+        .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)
 {
diff --git a/include/hw/virtio/vhost-backend.h b/include/hw/virtio/vhost-backend.h
index 08d34db..e12930c 100644
--- a/include/hw/virtio/vhost-backend.h
+++ b/include/hw/virtio/vhost-backend.h
@@ -110,5 +110,6 @@  int vhost_set_backend_type(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_ */