From: Marc-André Lureau <[email protected]> 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 <[email protected]> --- 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(+) 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_ */ -- 2.7.4
