vhost-user-backend & vhost-user-input
Subsystems (2)
v3 cover vhost-user-backend & vhost-user-input
Hi,
This series is based on previously discussed "[PATCH v4 00/29] vhost-user for input & GPU" and "vhost-user: define conventions for vhost-user backends" work. The GPU part is left off for now.
This series introduces a "vhost-user-backend": an helper object to be used by vhost-user devices to ease with backend initialization and handling. As a simple showcase, a "vhost-user-input-pci" device is introduced, which can be used with the "contrib: add vhost-user-input" example. vhost-user-input isn't meant to be installed, discovered or used by libvirt: no installation is done (no vhost-user JSON file is provided either).
thanks
v3:
- add previously sent patch "libvhost-user: fix clang enum-conversion warning" to fix clang build
- "define conventions for vhost-user backends" updates after Eric review
- Drop user-creatable from vhost-user-backend
- Make vhost-user-input-pci take a chardev= (instead of vhost-user=)
v2:
- rebased (VhostUserInputPCI got most of the changes, due to split)
- added "RFC: add explicit can_migrate to vhost_user_backend_dev_init()" to attempt to address Michael concerns about migration.
Marc-André Lureau (13):
libvhost-user: fix clang enum-conversion warning
vhost-user: define conventions for vhost-user backends
vhost-user: simplify vhost_user_init/vhost_user_cleanup
libvhost-user: exit by default on VHOST_USER_NONE
vhost-user: wrap some read/write with retry handling Add vhost-user-backend
vhost-user: split vhost_user_read()
vhost-user: add vhost_user_input_get_config()
libvhost-user-glib: export vug_source_new()
libvhost-user: add vu_queue_unpop()
Add vhost-user-input-pci
contrib: add vhost-user-input
RFC: add explicit can_migrate to vhost_user_backend_dev_init()
contrib/libvhost-user/libvhost-user-glib.h | 3 + contrib/libvhost-user/libvhost-user.h | 17 +- include/hw/virtio/vhost-backend.h | 4 + include/hw/virtio/vhost-user-blk.h | 2 +- include/hw/virtio/vhost-user-scsi.h | 2 +- include/hw/virtio/vhost-user.h | 2 +- include/hw/virtio/virtio-input.h | 14 + include/sysemu/vhost-user-backend.h | 60 ++++ backends/cryptodev-vhost-user.c | 18 +- backends/vhost-user.c | 218 +++++++++++ contrib/libvhost-user/libvhost-user-glib.c | 11 +- contrib/libvhost-user/libvhost-user.c | 19 +- contrib/vhost-user-input/main.c | 398 +++++++++++++++++++++ hw/block/vhost-user-blk.c | 22 +- hw/input/vhost-user-input.c | 104 ++++++ hw/scsi/vhost-user-scsi.c | 20 +- hw/virtio/vhost-stub.c | 4 +- hw/virtio/vhost-user-input-pci.c | 53 +++ hw/virtio/vhost-user.c | 118 +++++- net/vhost-user.c | 13 +- MAINTAINERS | 5 + Makefile | 3 + Makefile.objs | 1 + backends/Makefile.objs | 3 +- configure | 3 + contrib/vhost-user-input/Makefile.objs | 1 + default-configs/virtio.mak | 1 + docs/interop/vhost-user.json | 232 ++++++++++++ docs/interop/vhost-user.txt | 109 +++++- hw/input/Makefile.objs | 1 + hw/virtio/Makefile.objs | 1 + 31 files changed, 1375 insertions(+), 87 deletions(-) create mode 100644 include/sysemu/vhost-user-backend.h create mode 100644 backends/vhost-user.c create mode 100644 contrib/vhost-user-input/main.c create mode 100644 hw/input/vhost-user-input.c create mode 100644 hw/virtio/vhost-user-input-pci.c create mode 100644 contrib/vhost-user-input/Makefile.objs create mode 100644 docs/interop/vhost-user.json
Signature · 1 line
2.20.1.519.g8feddda32c
PATCH v3 1/13 libvhost-user: fix clang enum-conversion warning
Now that the VhostUserMsg.request field is used for both master & slave requests, since commit d84599f56c820d8c1ac9928a76500dcdfbbf194d:
contrib/libvhost-user/libvhost-user.c:953:20: error: implicit conversion from enumeration type 'enum VhostUserSlaveRequest' to different enumeration type 'VhostUserRequest' (aka 'enum VhostUserRequest') [-Werror,-Wenum-conversion]
.request = VHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--- contrib/libvhost-user/libvhost-user.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/libvhost-user/libvhost-user.h +1 -1
@@ -145,7 +145,7 @@ typedef struct VhostUserVringArea {#endif typedef struct VhostUserMsg { - VhostUserRequest request; + int request; #define VHOST_USER_VERSION_MASK (0x3) #define VHOST_USER_REPLY_MASK (0x1 << 2)
Signature · 1 line
2.20.1.519.g8feddda32c
PATCH v3 2/13 vhost-user: define conventions for vhost-user backends
In reply to Marc-André LureauAs discussed during "[PATCH v4 00/29] vhost-user for input & GPU" review, let's define a common set of backend conventions to help with management layer implementation, and interoperability.
--- MAINTAINERS | 1 + docs/interop/vhost-user.json | 232 +++++++++++++++++++++++++++++++++++ docs/interop/vhost-user.txt | 101 ++++++++++++++- 3 files changed, 332 insertions(+), 2 deletions(-) create mode 100644 docs/interop/vhost-user.json
MAINTAINERS +1 -0
@@ -1421,6 +1421,7 @@ vhost M: Michael S. Tsirkin <[email protected]> S: Supported F: hw/*/*vhost* +F: docs/interop/vhost-user.json F: docs/interop/vhost-user.txt F: contrib/vhost-user-*/
docs/interop/vhost-user.json new file +232 -0
232 lines not on this page · raw message
docs/interop/vhost-user.txt +99 -2
110 lines not on this page · raw message
Signature · 1 line
2.20.1.519.g8feddda32c
PATCH v3 3/13 vhost-user: simplify vhost_user_init/vhost_user_cleanup
In reply to Marc-André LureauTake a VhostUserState* that can be pre-allocated, and initialize it with the associated chardev.
--- include/hw/virtio/vhost-user-blk.h | 2 +- include/hw/virtio/vhost-user-scsi.h | 2 +- include/hw/virtio/vhost-user.h | 2 +- backends/cryptodev-vhost-user.c | 18 ++++-------------- hw/block/vhost-user-blk.c | 22 ++++------------------ hw/scsi/vhost-user-scsi.c | 20 ++++---------------- hw/virtio/vhost-stub.c | 4 ++-- hw/virtio/vhost-user.c | 16 ++++++++++++---- net/vhost-user.c | 13 ++++--------- 9 files changed, 33 insertions(+), 66 deletions(-)
include/hw/virtio/vhost-user-blk.h +1 -1
@@ -36,7 +36,7 @@ typedef struct VHostUserBlk {uint32_t queue_size;uint32_t config_wce;struct vhost_dev dev; - VhostUserState *vhost_user; + VhostUserState vhost_user; } VHostUserBlk;#endif
include/hw/virtio/vhost-user-scsi.h +1 -1
@@ -30,7 +30,7 @@typedef struct VHostUserSCSI {VHostSCSICommon parent_obj; -VhostUserState *vhost_user; +VhostUserState vhost_user; }VHostUserSCSI ;#endif /* VHOST_USER_SCSI_H */
include/hw/virtio/vhost-user.h +1 -1
@@ -22,7 +22,7 @@ typedef struct VhostUserState { VhostUserHostNotifier notifier[VIRTIO_QUEUE_MAX]; } VhostUserState; -VhostUserState *vhost_user_init (void ); +bool vhost_user_init (VhostUserState *user,CharBackend *chr,Error **errp);void vhost_user_cleanup (VhostUserState *user);#endif
backends/cryptodev-vhost-user.c +4 -14
@@ -47,7 +47,7 @@ typedef struct CryptoDevBackendVhostUser { CryptoDevBackend parent_obj; - VhostUserState *vhost_user; + VhostUserState vhost_user; CharBackend chr; char *chr_name; bool opened;
@@ -104,7 +104,7 @@ cryptodev_vhost_user_start(int queues,continue ; } - options.opaque = s->vhost_user; + options.opaque = &s->vhost_user; options.backend_type =VHOST_BACKEND_TYPE_USER ; options.cc = b->conf.peers.ccs[i]; s->vhost_crypto[i] =cryptodev_vhost_init (&options);
@@ -182,7 +182,6 @@ static void cryptodev_vhost_user_init(size_t i;Error *local_err =NULL ;Chardev *chr; -VhostUserState *user;CryptoDevBackendClient *cc;CryptoDevBackendVhostUser *s =CRYPTODEV_BACKEND_VHOST_USER (backend);
@@ -213,15 +212,10 @@ static void cryptodev_vhost_user_init( } } - user =vhost_user_init (); -if (!user) { -error_setg (errp,"Failed to init vhost_user" ); +if (!vhost_user_init (&s->vhost_user, &s->chr, errp)) {return ; } - user->chr = &s->chr; - s->vhost_user = user; -qemu_chr_fe_set_handlers (&s->chr,NULL ,NULL , cryptodev_vhost_user_event,NULL , s,NULL , true);
@@ -307,11 +301,7 @@ static void cryptodev_vhost_user_cleanup( } } -if (s->vhost_user) { -vhost_user_cleanup (s->vhost_user); -g_free (s->vhost_user); - s->vhost_user =NULL ; - } +vhost_user_cleanup (&s->vhost_user); } static void cryptodev_vhost_user_set_chardev(Object *obj,
hw/block/vhost-user-blk.c +4 -18
@@ -253,7 +253,6 @@ static void vhost_user_blk_device_realize(DeviceState *dev, Error **errp) {VirtIODevice *vdev =VIRTIO_DEVICE (dev);VHostUserBlk *s =VHOST_USER_BLK (vdev); -VhostUserState *user;struct vhost_virtqueue *vqs =NULL ;int i, ret;
@@ -272,15 +271,10 @@ static void vhost_user_blk_device_realize(DeviceState *dev, Error **errp)return ; } - user =vhost_user_init (); -if (!user) { -error_setg (errp,"vhost-user-blk: failed to init vhost_user" ); +if (!vhost_user_init (&s->vhost_user, &s->chardev, errp)) {return ; } - user->chr = &s->chardev; - s->vhost_user = user; -virtio_init (vdev,"virtio-blk" ,VIRTIO_ID_BLOCK ,sizeof (struct virtio_blk_config ));
@@ -297,7 +291,7 @@ static void vhost_user_blk_device_realize(DeviceState *dev, Error **errp)vhost_dev_set_config_notifier (&s->dev, &blk_ops); - ret =vhost_dev_init (&s->dev, s->vhost_user,VHOST_BACKEND_TYPE_USER ,0 ); + ret =vhost_dev_init (&s->dev, &s->vhost_user,VHOST_BACKEND_TYPE_USER ,0 );if (ret <0 ) {error_setg (errp,"vhost-user-blk: vhost initialization failed: %s" ,strerror (-ret));
@@ -322,10 +316,7 @@ vhost_err: virtio_err:g_free (vqs);virtio_cleanup (vdev); - -vhost_user_cleanup (user); -g_free (user); - s->vhost_user =NULL ; +vhost_user_cleanup (&s->vhost_user); }static void vhost_user_blk_device_unrealize (DeviceState *dev,Error **errp)
@@ -338,12 +329,7 @@ static void vhost_user_blk_device_unrealize(DeviceState *dev, Error **errp)vhost_dev_cleanup (&s->dev);g_free (vqs);virtio_cleanup (vdev); - -if (s->vhost_user) { -vhost_user_cleanup (s->vhost_user); -g_free (s->vhost_user); - s->vhost_user =NULL ; - } +vhost_user_cleanup (&s->vhost_user); }static void vhost_user_blk_instance_init (Object *obj)
hw/scsi/vhost-user-scsi.c +4 -16
@@ -69,7 +69,6 @@ static void vhost_user_scsi_realize(DeviceState *dev, Error **errp)VirtIOSCSICommon *vs =VIRTIO_SCSI_COMMON (dev);VHostUserSCSI *s =VHOST_USER_SCSI (dev);VHostSCSICommon *vsc =VHOST_SCSI_COMMON (s); -VhostUserState *user;Error *err =NULL ;int ret;
@@ -86,30 +85,24 @@ static void vhost_user_scsi_realize(DeviceState *dev, Error **errp)return ; } - user =vhost_user_init (); -if (!user) { -error_setg (errp,"vhost-user-scsi: failed to init vhost_user" ); +if (!vhost_user_init (&s->vhost_user, &vs->conf.chardev, errp)) {return ; } - user->chr = &vs->conf.chardev; vsc->dev.nvqs =2 + vs->conf.num_queues; vsc->dev.vqs = g_new(struct vhost_virtqueue, vsc->dev.nvqs); vsc->dev.vq_index =0 ; vsc->dev.backend_features =0 ; - ret =vhost_dev_init (&vsc->dev, user, + ret =vhost_dev_init (&vsc->dev, &s->vhost_user,VHOST_BACKEND_TYPE_USER ,0 );if (ret <0 ) {error_setg (errp,"vhost-user-scsi: vhost initialization failed: %s" ,strerror (-ret)); -vhost_user_cleanup (user); -g_free (user); +vhost_user_cleanup (&s->vhost_user);return ; } - s->vhost_user = user; -/* Channel and lun both are 0 for bootable vhost-user-scsi disk */ vsc->channel =0 ; vsc->lun =0 ;
@@ -130,12 +123,7 @@ static void vhost_user_scsi_unrealize(DeviceState *dev, Error **errp)g_free (vqs);virtio_scsi_common_unrealize (dev, errp); - -if (s->vhost_user) { -vhost_user_cleanup (s->vhost_user); -g_free (s->vhost_user); - s->vhost_user =NULL ; - } +vhost_user_cleanup (&s->vhost_user); }static Property vhost_user_scsi_properties[] = {
hw/virtio/vhost-stub.c +2 -2
@@ -7,9 +7,9 @@ bool vhost_has_free_slot(void)return true; } -VhostUserState *vhost_user_init (void ) +bool vhost_user_init (VhostUserState *user,CharBackend *chr,Error **errp) { -return NULL ; +return false; }void vhost_user_cleanup (VhostUserState *user)
hw/virtio/vhost-user.c +12 -4
@@ -1739,17 +1739,24 @@ static bool vhost_user_mem_section_filter(struct vhost_dev *dev,return result; } -VhostUserState *vhost_user_init (void ) +bool vhost_user_init (VhostUserState *user,CharBackend *chr,Error **errp) { - VhostUserState *user = g_new0(struct VhostUserState, 1); - -return user; +if (user->chr) { +error_setg (errp,"Cannot initialize vhost-user state" ); +return false; + } + user->chr = chr; +return true; }void vhost_user_cleanup (VhostUserState *user) {int i; +if (!user->chr) { +return ; + } +for (i =0 ; i <VIRTIO_QUEUE_MAX ; i++) {if (user->notifier[i].addr) {object_unparent (OBJECT (&user->notifier[i].mr));
@@ -1757,6 +1764,7 @@ void vhost_user_cleanup(VhostUserState *user) user->notifier[i].addr =NULL ; } } + user->chr =NULL ; }const VhostOps user_ops = {
net/vhost-user.c +4 -9
@@ -291,19 +291,14 @@ static int net_vhost_user_init(NetClientState *peer, const char *device, {Error *err =NULL ;NetClientState *nc, *nc0 =NULL ; -VhostUserState *user =NULL ;NetVhostUserState *s =NULL ; +VhostUserState *user;int i;assert (name);assert (queues >0 ); - user =vhost_user_init (); -if (!user) { -error_report ("failed to init vhost_user" ); - goto err; - } - + user = g_new0(struct VhostUserState, 1);for (i =0 ; i < queues; i++) { nc =qemu_new_net_client (&net_vhost_user_info, peer, device, name); snprintf(nc->info_str, sizeof(nc->info_str), "vhost-user%d to %s",
@@ -312,11 +307,11 @@ static int net_vhost_user_init(NetClientState *peer, const char *device,if (!nc0) { nc0 = nc; s =DO_UPCAST (NetVhostUserState, nc, nc); -if (!qemu_chr_fe_init (&s->chr, chr, &err)) { +if (!qemu_chr_fe_init (&s->chr, chr, &err) || + !vhost_user_init (user, &s->chr, &err)) {error_report_err (err); goto err; } - user->chr = &s->chr; } s =DO_UPCAST (NetVhostUserState, nc, nc); s->vhost_user = user;
Signature · 1 line
2.20.1.519.g8feddda32c
PATCH v3 4/13 libvhost-user: exit by default on VHOST_USER_NONE
In reply to Marc-André LureauSince commit 2566378d6d13bf4d28c7770bdbda5f7682594bbe, libvhost-user no longer panics on disconnect (rc == 0), and instead silently ignores an invalid VHOST_USER_NONE message.
Without extra work from the API user, this will simply busy-loop on HUP events. The obvious thing to do is to exit(0) instead, while additional or different work can be done by overriding iface->process_msg().
--- contrib/libvhost-user/libvhost-user.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
contrib/libvhost-user/libvhost-user.c +2 -1
@@ -1285,7 +1285,8 @@ vu_process_message(VuDev *dev, VhostUserMsg *vmsg)case VHOST_USER_SET_CONFIG :return vu_set_config (dev, vmsg);case VHOST_USER_NONE : -break ; +/* if you need processing before exit, override iface->process_msg */ +exit (0 );case VHOST_USER_POSTCOPY_ADVISE :return vu_set_postcopy_advise (dev, vmsg);case VHOST_USER_POSTCOPY_LISTEN :
Signature · 1 line
2.20.1.519.g8feddda32c
PATCH v3 5/13 vhost-user: wrap some read/write with retry handling
In reply to Marc-André Lureau--- hw/virtio/vhost-user.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
hw/virtio/vhost-user.c +12 -3
@@ -964,7 +964,10 @@ static void slave_read(void *opaque) iov.iov_base = &hdr; iov.iov_len =VHOST_USER_HDR_SIZE ; - size =recvmsg (u->slave_fd, &msgh,0 ); +do { + size =recvmsg (u->slave_fd, &msgh,0 ); + }while (size <0 && (errno ==EINTR || errno ==EAGAIN )); +if (size !=VHOST_USER_HDR_SIZE ) {error_report ("Failed to read from slave." ); goto err;
@@ -993,7 +996,10 @@ static void slave_read(void *opaque) }/* Read payload */ - size =read (u->slave_fd, &payload, hdr.size); +do { + size =read (u->slave_fd, &payload, hdr.size); + }while (size <0 && (errno ==EINTR || errno ==EAGAIN )); +if (size != hdr.size) {error_report ("Failed to read payload from slave." ); goto err;
@@ -1041,7 +1047,10 @@ static void slave_read(void *opaque) iovec[1 ].iov_base = &payload; iovec[1 ].iov_len = hdr.size; - size =writev (u->slave_fd, iovec,ARRAY_SIZE (iovec)); +do { + size =writev (u->slave_fd, iovec,ARRAY_SIZE (iovec)); + }while (size <0 && (errno ==EINTR || errno ==EAGAIN )); +if (size !=VHOST_USER_HDR_SIZE + hdr.size) {error_report ("Failed to send msg reply to slave." ); goto err;
Signature · 1 line
2.20.1.519.g8feddda32c
PATCH v3 6/13 Add vhost-user-backend
In reply to Marc-André LureauCreate a vhost-user-backend object that holds a connection to a vhost-user backend and can be referenced from virtio devices that support it. See later patches for input & gpu usage.
--- include/sysemu/vhost-user-backend.h | 60 ++++++++ backends/vhost-user.c | 213 ++++++++++++++++++++++++++++ MAINTAINERS | 2 + backends/Makefile.objs | 3 +- 4 files changed, 277 insertions(+), 1 deletion(-) create mode 100644 include/sysemu/vhost-user-backend.h create mode 100644 backends/vhost-user.c
include/sysemu/vhost-user-backend.h new file +60 -0
@@ -0,0 +1,60 @@ +/* +* QEMU vhost-user backend +* +* Copyright (C) 2018 Red Hat Inc +* +* Authors: +* Marc-André Lureau <[email protected]> +* +* This work is licensed under the terms of the GNU GPL, version 2 or later. +* See the COPYING file in the top-level directory. +*/ +#ifndef QEMU_VHOST_USER_BACKEND_H +#define QEMU_VHOST_USER_BACKEND_H + +#include "qom/object.h" +#include "exec/memory.h" +#include "qemu/option.h" +#include "qemu/bitmap.h" +#include "hw/virtio/vhost.h" +#include "hw/virtio/vhost-user.h" +#include "chardev/char-fe.h" +#include "io/channel.h" + +#define TYPE_VHOST_USER_BACKEND "vhost-user-backend" +#define VHOST_USER_BACKEND (obj) \ + OBJECT_CHECK(VhostUserBackend, (obj), TYPE_VHOST_USER_BACKEND) +#define VHOST_USER_BACKEND_GET_CLASS (obj) \ + OBJECT_GET_CLASS(VhostUserBackendClass, (obj), TYPE_VHOST_USER_BACKEND) +#define VHOST_USER_BACKEND_CLASS (klass) \ + OBJECT_CLASS_CHECK(VhostUserBackendClass, (klass), TYPE_VHOST_USER_BACKEND) + +typedef struct VhostUserBackend VhostUserBackend ; +typedef struct VhostUserBackendClass VhostUserBackendClass ; + +struct VhostUserBackendClass { +ObjectClass parent_class; +}; + +struct VhostUserBackend { +/* private */ +Object parent; + +char *cmd; +char *chr_name; + +CharBackend chr; +VhostUserState vhost_user; +struct vhost_dev dev; +QIOChannel *child; +VirtIODevice *vdev; +bool started; +bool completed; +}; + +int vhost_user_backend_dev_init (VhostUserBackend *b,VirtIODevice *vdev, +unsigned nvqs,Error **errp); +void vhost_user_backend_start (VhostUserBackend *b); +void vhost_user_backend_stop (VhostUserBackend *b); + +#endif
backends/vhost-user.c new file +213 -0
213 lines not on this page · raw message
MAINTAINERS +2 -0
@@ -1424,6 +1424,8 @@ F: hw/*/*vhost* F: docs/interop/vhost-user.json F: docs/interop/vhost-user.txt F: contrib/vhost-user-*/ +F: backends/vhost-user.c +F: include/sysemu/vhost-user-backend.h virtio M: Michael S. Tsirkin <[email protected]>
backends/Makefile.objs +2 -1
@@ -12,7 +12,8 @@ common-obj-y += cryptodev-builtin.o ifeq ($(CONFIG_VIRTIO),y) common-obj-y += cryptodev-vhost.o common-obj-$(call land,$(CONFIG_VHOST_USER),$(CONFIG_LINUX)) += \ - cryptodev-vhost-user.o + cryptodev-vhost-user.o \ + vhost-user.o endif common-obj-$(CONFIG_LINUX) += hostmem-memfd.o
Signature · 1 line
2.20.1.519.g8feddda32c
Re: [Qemu-devel] [PATCH v3 06/13] Add vhost-user-backend
Quoted 53 lines · Marc-André Lureau
Create a vhost-user-backend object that holds a connection to a vhost-user backend and can be referenced from virtio devices that support it. See later patches for input & gpu usage.
Signed-off-by Marc-André Lureau <[email protected]>--- include/sysemu/vhost-user-backend.h | 60 ++++++++ backends/vhost-user.c | 213 ++++++++++++++++++++++++++++ MAINTAINERS | 2 + backends/Makefile.objs | 3 +- 4 files changed, 277 insertions(+), 1 deletion(-) create mode 100644 include/sysemu/vhost-user-backend.h create mode 100644 backends/vhost-user.cinclude/sysemu/vhost-user-backend.h new file +33
-0@@ -0,0 +1,60 @@ +/* +* QEMU vhost-user backend +* +* Copyright (C) 2018 Red Hat Inc +* +* Authors: +* Marc-André Lureau <[email protected]> +* +* This work is licensed under the terms of the GNU GPL, version 2 or later. +* See the COPYING file in the top-level directory. +*/ +#ifndef QEMU_VHOST_USER_BACKEND_H +#define QEMU_VHOST_USER_BACKEND_H + +#include "qom/object.h" +#include "exec/memory.h" +#include "qemu/option.h" +#include "qemu/bitmap.h" +#include "hw/virtio/vhost.h" +#include "hw/virtio/vhost-user.h" +#include "chardev/char-fe.h" +#include "io/channel.h" + +#define TYPE_VHOST_USER_BACKEND "vhost-user-backend" +#define VHOST_USER_BACKEND (obj) \ + OBJECT_CHECK(VhostUserBackend, (obj), TYPE_VHOST_USER_BACKEND) +#define VHOST_USER_BACKEND_GET_CLASS (obj) \ + OBJECT_GET_CLASS(VhostUserBackendClass, (obj), TYPE_VHOST_USER_BACKEND) +#define VHOST_USER_BACKEND_CLASS (klass) \ + OBJECT_CLASS_CHECK(VhostUserBackendClass, (klass), TYPE_VHOST_USER_BACKEND) + +typedef struct VhostUserBackend VhostUserBackend ; +typedef struct VhostUserBackendClass VhostUserBackendClass ;
include/sysemu/vhost-user-backend.h line 43
Quoted 10 lines
include/sysemu/vhost-user-backend.h new file +10
-0+ +struct VhostUserBackendClass { +ObjectClass parent_class; +}; + +struct VhostUserBackend { +/* private */ +Object parent; + +char *cmd;
This field doesn't appear to be used any more
include/sysemu/vhost-user-backend.h line 53
Quoted 10 lines
include/sysemu/vhost-user-backend.h new file +10
-0+char *chr_name; + +CharBackend chr; +VhostUserState vhost_user; +struct vhost_dev dev; +QIOChannel *child; +VirtIODevice *vdev; +bool started; +bool completed; +};
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [Qemu-devel] [PATCH v3 06/13] Add vhost-user-backend
Hi
Quoted 59 lines · Daniel P. Berrangé
Quoted 57 lines · Marc-André Lureau
Create a vhost-user-backend object that holds a connection to a vhost-user backend and can be referenced from virtio devices that support it. See later patches for input & gpu usage.
Signed-off-by Marc-André Lureau <[email protected]>--- include/sysemu/vhost-user-backend.h | 60 ++++++++ backends/vhost-user.c | 213 ++++++++++++++++++++++++++++ MAINTAINERS | 2 + backends/Makefile.objs | 3 +- 4 files changed, 277 insertions(+), 1 deletion(-) create mode 100644 include/sysemu/vhost-user-backend.h create mode 100644 backends/vhost-user.cinclude/sysemu/vhost-user-backend.h new file +37
-0@@ -0,0 +1,60 @@ +/* +* QEMU vhost-user backend +* +* Copyright (C) 2018 Red Hat Inc +* +* Authors: +* Marc-André Lureau <[email protected]> +* +* This work is licensed under the terms of the GNU GPL, version 2 or later. +* See the COPYING file in the top-level directory. +*/ +#ifndef QEMU_VHOST_USER_BACKEND_H +#define QEMU_VHOST_USER_BACKEND_H + +#include "qom/object.h" +#include "exec/memory.h" +#include "qemu/option.h" +#include "qemu/bitmap.h" +#include "hw/virtio/vhost.h" +#include "hw/virtio/vhost-user.h" +#include "chardev/char-fe.h" +#include "io/channel.h" + +#define TYPE_VHOST_USER_BACKEND "vhost-user-backend" +#define VHOST_USER_BACKEND (obj) \ + OBJECT_CHECK(VhostUserBackend, (obj), TYPE_VHOST_USER_BACKEND) +#define VHOST_USER_BACKEND_GET_CLASS (obj) \ + OBJECT_GET_CLASS(VhostUserBackendClass, (obj), TYPE_VHOST_USER_BACKEND) +#define VHOST_USER_BACKEND_CLASS (klass) \ + OBJECT_CLASS_CHECK(VhostUserBackendClass, (klass), TYPE_VHOST_USER_BACKEND) + +typedef struct VhostUserBackend VhostUserBackend ; +typedef struct VhostUserBackendClass VhostUserBackendClass ; + +struct VhostUserBackendClass { +ObjectClass parent_class; +};
Quoted 8 lines
include/sysemu/vhost-user-backend.h line 43
Quoted 6 lines
include/sysemu/vhost-user-backend.h new file +6
-0+ +struct VhostUserBackend { +/* private */ +Object parent; + +char *cmd;This field doesn't appear to be used any more
Good catch! thanks
Quoted 18 lines
include/sysemu/vhost-user-backend.h line 53
Quoted 11 lines
include/sysemu/vhost-user-backend.h new file +10
-0+char *chr_name; + +CharBackend chr; +VhostUserState vhost_user; +struct vhost_dev dev; +QIOChannel *child; +VirtIODevice *vdev; +bool started; +bool completed; +};Regards,
Daniel
--|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
PATCH v3 7/13 vhost-user: split vhost_user_read()
In reply to Marc-André LureauSplit vhost_user_read(), so only header can be read with vhost_user_read_header().
--- hw/virtio/vhost-user.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-)
hw/virtio/vhost-user.c +19 -8
@@ -210,7 +210,7 @@ static bool ioeventfd_enabled(void)return !kvm_enabled () ||kvm_eventfds_enabled (); } -static int vhost_user_read (struct vhost_dev *dev,VhostUserMsg *msg) +static int vhost_user_read_header (struct vhost_dev *dev,VhostUserMsg *msg) {struct vhost_user *u = dev->opaque;CharBackend *chr = u->user->chr;
@@ -221,7 +221,7 @@ static int vhost_user_read(struct vhost_dev *dev, VhostUserMsg *msg)if (r != size) {error_report ("Failed to read msg header. Read %d instead of %d." " Original request %d." , r, size, msg->hdr.request); - goto fail; +return -1 ; }/* validate received flags */
@@ -229,7 +229,21 @@ static int vhost_user_read(struct vhost_dev *dev, VhostUserMsg *msg)error_report ("Failed to read msg header." " Flags 0x%x instead of 0x%x." , msg->hdr.flags,VHOST_USER_REPLY_MASK |VHOST_USER_VERSION ); - goto fail; +return -1 ; + } + +return 0 ; +} + +static int vhost_user_read (struct vhost_dev *dev,VhostUserMsg *msg) +{ +struct vhost_user *u = dev->opaque; +CharBackend *chr = u->user->chr; +uint8_t *p = (uint8_t *) msg; +int r, size; + +if (vhost_user_read_header (dev, msg) <0 ) { +return -1 ; }/* validate message size is sane */
@@ -237,7 +251,7 @@ static int vhost_user_read(struct vhost_dev *dev, VhostUserMsg *msg)error_report ("Failed to read msg header." " Size %d exceeds the maximum %zu." , msg->hdr.size,VHOST_USER_PAYLOAD_SIZE ); - goto fail; +return -1 ; }if (msg->hdr.size) {
@@ -247,14 +261,11 @@ static int vhost_user_read(struct vhost_dev *dev, VhostUserMsg *msg)if (r != size) {error_report ("Failed to read msg payload." " Read %d instead of %d." , r, msg->hdr.size); - goto fail; +return -1 ; } }return 0 ; - -fail: -return -1 ; } static int process_message_reply(struct vhost_dev *dev,
Signature · 1 line
2.20.1.519.g8feddda32c
PATCH v3 8/13 vhost-user: add vhost_user_input_get_config()
In reply to Marc-André LureauAsk vhost user input backend the list of virtio_input_config.
--- contrib/libvhost-user/libvhost-user.h | 1 + include/hw/virtio/vhost-backend.h | 4 ++ hw/virtio/vhost-user.c | 60 +++++++++++++++++++++++++++ docs/interop/vhost-user.txt | 8 ++++ 4 files changed, 73 insertions(+)
contrib/libvhost-user/libvhost-user.h +1 -0
@@ -91,6 +91,7 @@ typedef enum VhostUserRequest {VHOST_USER_POSTCOPY_ADVISE =28 ,VHOST_USER_POSTCOPY_LISTEN =29 ,VHOST_USER_POSTCOPY_END =30 , +VHOST_USER_INPUT_GET_CONFIG =31 , VHOST_USER_MAX } VhostUserRequest;
include/hw/virtio/vhost-backend.h +4 -0
@@ -12,6 +12,7 @@#define VHOST_BACKEND_H #include "exec/memory.h" +#include "standard-headers/linux/virtio_input.h" typedef enum VhostBackendType { VHOST_BACKEND_TYPE_NONE = 0,
@@ -160,4 +161,7 @@ int vhost_backend_invalidate_device_iotlb(struct vhost_dev *dev,int vhost_backend_handle_iotlb_msg (struct vhost_dev *dev,struct vhost_iotlb_msg *imsg); +int vhost_user_input_get_config (struct vhost_dev *dev, +struct virtio_input_config **config); +#endif /* VHOST_BACKEND_H */
hw/virtio/vhost-user.c +60 -0
72 lines not on this page · raw message
docs/interop/vhost-user.txt +8 -0
@@ -766,6 +766,14 @@ Master message types was previously sent. The value returned is an error indication; 0 is success. + * VHOST_USER_INPUT_GET_CONFIG + Id: 31 + Master payload: N/A + Slave payload: (struct virtio_input_config)* + + Ask vhost user input backend the list of virtio_input_config, in + host endianness. + Slave message types -------------------
Signature · 1 line
2.20.1.519.g8feddda32c
PATCH v3 9/13 libvhost-user-glib: export vug_source_new()
In reply to Marc-André LureauSimplify the creation of FD sources for other users. This is just convenience to avoid duplicating similar code elsewhere.
--- contrib/libvhost-user/libvhost-user-glib.h | 3 +++ contrib/libvhost-user/libvhost-user-glib.c | 11 ++++++----- 2 files changed, 9 insertions(+), 5 deletions(-)
contrib/libvhost-user/libvhost-user-glib.h +3 -0
@@ -29,4 +29,7 @@ void vug_init(VugDev *dev, int socket, vu_panic_cb panic, const VuDevIface *iface);void vug_deinit (VugDev *dev); +GSource *vug_source_new (VugDev *dev,int fd,GIOCondition cond, +vu_watch_cb vu_cb,gpointer data); +#endif /* LIBVHOST_USER_GLIB_H */
contrib/libvhost-user/libvhost-user-glib.c +6 -5
@@ -68,15 +68,16 @@ static GSourceFuncs vug_src_funcs = { NULL }; -static GSource * -vug_source_new (VuDev *dev,int fd,GIOCondition cond, +GSource * +vug_source_new (VugDev *gdev,int fd,GIOCondition cond,vu_watch_cb vu_cb,gpointer data) { +VuDev *dev = &gdev->parent;GSource *gsrc;VugSrc *src;guint id; -g_assert (dev); +g_assert (gdev);g_assert (fd >=0 );g_assert (vu_cb);
@@ -106,7 +107,7 @@ set_watch(VuDev *vu_dev, int fd, int vu_evt, vu_watch_cb cb, void *pvt)g_assert (cb); dev =container_of (vu_dev, VugDev, parent); - src =vug_source_new (vu_dev, fd, vu_evt, cb, pvt); + src =vug_source_new (dev, fd, vu_evt, cb, pvt);g_hash_table_replace (dev->fdmap,GINT_TO_POINTER (fd), src); }
@@ -141,7 +142,7 @@ vug_init(VugDev *dev, int socket, dev->fdmap =g_hash_table_new_full (NULL ,NULL ,NULL , (GDestroyNotify ) g_source_destroy); - dev->src =vug_source_new (&dev->parent, socket,G_IO_IN , vug_watch,NULL ); + dev->src =vug_source_new (dev, socket,G_IO_IN , vug_watch,NULL ); }void
Signature · 1 line
2.20.1.519.g8feddda32c
PATCH v3 10/13 libvhost-user: add vu_queue_unpop()
In reply to Marc-André Lureauvhost-user-input will make use of this function to undo some queue pop in case the virtio queue does not have enough room.
--- contrib/libvhost-user/libvhost-user.h | 14 ++++++++++++++ contrib/libvhost-user/libvhost-user.c | 16 ++++++++++++++++ 2 files changed, 30 insertions(+)
contrib/libvhost-user/libvhost-user.h +14 -0
@@ -459,6 +459,20 @@ void vu_queue_notify(VuDev *dev, VuVirtq *vq);*/ void *vu_queue_pop (VuDev *dev,VuVirtq *vq,size_t sz); + +/** +* vu_queue_unpop: +* @dev: a VuDev context +* @vq: a VuVirtq queue +* @elem: The #VuVirtqElement +* @len: number of bytes written +* +* Pretend the most recent element wasn't popped from the virtqueue. The next +* call to vu_queue_pop() will refetch the element. +*/ +void vu_queue_unpop (VuDev *dev,VuVirtq *vq,VuVirtqElement *elem, +size_t len); +/** * vu_queue_rewind: * @dev: a VuDev context
contrib/libvhost-user/libvhost-user.c +16 -0
@@ -1966,6 +1966,22 @@ vu_queue_pop(VuDev *dev, VuVirtq *vq, size_t sz)return elem; } +static void +vu_queue_detach_element (VuDev *dev,VuVirtq *vq,VuVirtqElement *elem, +size_t len) +{ + vq->inuse--; +/* unmap, when DMA support is added */ +} + +void +vu_queue_unpop (VuDev *dev,VuVirtq *vq,VuVirtqElement *elem, +size_t len) +{ + vq->last_avail_idx--; +vu_queue_detach_element (dev, vq, elem, len); +} +bool vu_queue_rewind (VuDev *dev,VuVirtq *vq,unsigned int num) {
Signature · 1 line
2.20.1.519.g8feddda32c
PATCH v3 11/13 Add vhost-user-input-pci
In reply to Marc-André LureauAdd a new virtio-input device, which connects to a vhost-user backend.
vhost-user-input is similar to virtio-input-host, it is wrapped by vhost-user-input-pci. Instead of reading configuration directly from an input device / evdev, it reads it over vhost-user protocol with INPUT_GET_CONFIG message. Then vhost-user-backend takes care of interfacing the virtio device with the backend, for the queue & events processing.
--- include/hw/virtio/virtio-input.h | 14 +++++ hw/input/vhost-user-input.c | 104 +++++++++++++++++++++++++++++++ hw/virtio/vhost-user-input-pci.c | 53 ++++++++++++++++ MAINTAINERS | 1 + default-configs/virtio.mak | 1 + hw/input/Makefile.objs | 1 + hw/virtio/Makefile.objs | 1 + 7 files changed, 175 insertions(+) create mode 100644 hw/input/vhost-user-input.c create mode 100644 hw/virtio/vhost-user-input-pci.c
include/hw/virtio/virtio-input.h +14 -0
@@ -2,6 +2,7 @@#define QEMU_VIRTIO_INPUT_H #include "ui/input.h" +#include "sysemu/vhost-user-backend.h" /* ----------------------------------------------------------------- */ /* virtio input protocol */
@@ -42,11 +43,18 @@ typedef struct virtio_input_event virtio_input_event;#define VIRTIO_INPUT_HOST_GET_PARENT_CLASS (obj) \ OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_INPUT_HOST) +#define TYPE_VHOST_USER_INPUT "vhost-user-input" +#define VHOST_USER_INPUT (obj) \ + OBJECT_CHECK(VHostUserInput, (obj), TYPE_VHOST_USER_INPUT) +#define VHOST_USER_INPUT_GET_PARENT_CLASS (obj) \ + OBJECT_GET_PARENT_CLASS(obj, TYPE_VHOST_USER_INPUT) +typedef struct VirtIOInput VirtIOInput ;typedef struct VirtIOInputClass VirtIOInputClass ;typedef struct VirtIOInputConfig VirtIOInputConfig ;typedef struct VirtIOInputHID VirtIOInputHID ;typedef struct VirtIOInputHost VirtIOInputHost ; +typedef struct VHostUserInput VHostUserInput ;struct VirtIOInputConfig {virtio_input_config config;
@@ -98,6 +106,12 @@ struct VirtIOInputHost {int fd; }; +struct VHostUserInput { +VirtIOInput parent_obj; + +VhostUserBackend *vhost; +}; +void virtio_input_send (VirtIOInput *vinput,virtio_input_event *event);void virtio_input_init_config (VirtIOInput *vinput,virtio_input_config *config);
hw/input/vhost-user-input.c new file +104 -0
104 lines not on this page · raw message
hw/virtio/vhost-user-input-pci.c new file +53 -0
53 lines not on this page · raw message
MAINTAINERS +1 -0
@@ -1467,6 +1467,7 @@ L: [email protected] virtio-input M: Gerd Hoffmann <[email protected]> S: Maintained +F: hw/input/vhost-user-input.c F: hw/input/virtio-input*.c F: include/hw/virtio/virtio-input.h
default-configs/virtio.mak +1 -0
@@ -13,3 +13,4 @@ CONFIG_SCSI=y CONFIG_VIRTIO_SCSI=y CONFIG_VIRTIO_SERIAL=y CONFIG_VIRTIO_INPUT_HOST=$(CONFIG_LINUX) +CONFIG_VHOST_USER_INPUT=$(call land,$(CONFIG_VHOST_USER),$(CONFIG_VIRTIO_INPUT))
hw/input/Makefile.objs +1 -0
@@ -11,6 +11,7 @@ common-obj-$(CONFIG_VIRTIO_INPUT) += virtio-input.o common-obj-$(CONFIG_VIRTIO_INPUT) += virtio-input-hid.o ifeq ($(CONFIG_LINUX),y) common-obj-$(CONFIG_VIRTIO_INPUT) += virtio-input-host.o +common-obj-$(CONFIG_VHOST_USER_INPUT) += vhost-user-input.o endif obj-$(CONFIG_MILKYMIST) += milkymist-softusb.o
hw/virtio/Makefile.objs +1 -0
@@ -14,6 +14,7 @@ obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock.o ifeq ($(CONFIG_VIRTIO_PCI),y) obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock-pci.o obj-$(CONFIG_VHOST_USER_BLK) += vhost-user-blk-pci.o +obj-$(CONFIG_VHOST_USER_INPUT) += vhost-user-input-pci.o obj-$(CONFIG_VHOST_USER_SCSI) += vhost-user-scsi-pci.o obj-$(CONFIG_VHOST_SCSI) += vhost-scsi-pci.o obj-$(CONFIG_VIRTIO_INPUT_HOST) += virtio-input-host-pci.o
Signature · 1 line
2.20.1.519.g8feddda32c
Re: [Qemu-devel] [PATCH v3 11/13] Add vhost-user-input-pci
Quoted 11 lines · Marc-André Lureau
Add a new virtio-input device, which connects to a vhost-user backend.
vhost-user-input is similar to virtio-input-host, it is wrapped by vhost-user-input-pci. Instead of reading configuration directly from an input device / evdev, it reads it over vhost-user protocol with
INPUT_GET_CONFIGmessage. Then vhost-user-backend takes care of interfacing the virtio device with the backend, for the queue & events processing.Signed-off-by Marc-André Lureau <[email protected]>
Gerd what's your take on this? Do we want this functionality?
Quoted 272 lines
--- include/hw/virtio/virtio-input.h | 14 +++++ hw/input/vhost-user-input.c | 104 +++++++++++++++++++++++++++++++ hw/virtio/vhost-user-input-pci.c | 53 ++++++++++++++++ MAINTAINERS | 1 + default-configs/virtio.mak | 1 + hw/input/Makefile.objs | 1 + hw/virtio/Makefile.objs | 1 + 7 files changed, 175 insertions(+) create mode 100644 hw/input/vhost-user-input.c create mode 100644 hw/virtio/vhost-user-input-pci.cinclude/hw/virtio/virtio-input.h +14
-0@@ -2,6 +2,7 @@#define QEMU_VIRTIO_INPUT_H #include "ui/input.h" +#include "sysemu/vhost-user-backend.h" /* ----------------------------------------------------------------- */ /* virtio input protocol */ @@ -42,11 +43,18 @@ typedef struct virtio_input_event virtio_input_event;#define VIRTIO_INPUT_HOST_GET_PARENT_CLASS (obj) \ OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_INPUT_HOST) +#define TYPE_VHOST_USER_INPUT "vhost-user-input" +#define VHOST_USER_INPUT (obj) \ + OBJECT_CHECK(VHostUserInput, (obj), TYPE_VHOST_USER_INPUT) +#define VHOST_USER_INPUT_GET_PARENT_CLASS (obj) \ + OBJECT_GET_PARENT_CLASS(obj, TYPE_VHOST_USER_INPUT) +typedef struct VirtIOInput VirtIOInput ;typedef struct VirtIOInputClass VirtIOInputClass ;typedef struct VirtIOInputConfig VirtIOInputConfig ;typedef struct VirtIOInputHID VirtIOInputHID ;typedef struct VirtIOInputHost VirtIOInputHost ; +typedef struct VHostUserInput VHostUserInput ;struct VirtIOInputConfig {virtio_input_config config;@@ -98,6 +106,12 @@ struct VirtIOInputHost {int fd; }; +struct VHostUserInput { +VirtIOInput parent_obj; + +VhostUserBackend *vhost; +}; +void virtio_input_send (VirtIOInput *vinput,virtio_input_event *event);void virtio_input_init_config (VirtIOInput *vinput,virtio_input_config *config);hw/input/vhost-user-input.c new file +104
-0@@ -0,0 +1,104 @@ +/* +* This work is licensed under the terms of the GNU GPL, version 2 or +* (at your option) any later version. See the COPYING file in the +* top-level directory. +*/ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qemu-common.h" + +#include "hw/qdev.h" +#include "hw/virtio/virtio-input.h" + +static void vhost_input_realize (DeviceState *dev,Error **errp) +{ +VHostUserInput *vhi =VHOST_USER_INPUT (dev); +VirtIOInput *vinput =VIRTIO_INPUT (dev); +VirtIODevice *vdev =VIRTIO_DEVICE (dev); +virtio_input_config *config; +int i, ret; + +if (!vhi->vhost) { +error_setg (errp,"'vhost-user' property is required" ); +return ; + } + +if (vhost_user_backend_dev_init (vhi->vhost, vdev,2 , errp) ==-1 ) { +return ; + } + + ret =vhost_user_input_get_config (&vhi->vhost->dev, &config); +if (ret <0 ) { +error_setg (errp,"failed to get input config" ); +return ; + } +for (i =0 ; i < ret; i++) { +virtio_input_add_config (vinput, &config[i]); + } +g_free (config); +} + +static void vhost_input_change_active (VirtIOInput *vinput) +{ +VHostUserInput *vhi =VHOST_USER_INPUT (vinput); + +if (vinput->active) { +vhost_user_backend_start (vhi->vhost); + }else { +vhost_user_backend_stop (vhi->vhost); + } +} + +static const VMStateDescription vmstate_vhost_input = { + .name ="vhost-user-input" , + .unmigratable =1 , +}; + +static void vhost_input_class_init (ObjectClass *klass,void *data) +{ +VirtIOInputClass *vic =VIRTIO_INPUT_CLASS (klass); +DeviceClass *dc =DEVICE_CLASS (klass); + + dc->vmsd = &vmstate_vhost_input; + vic->realize = vhost_input_realize; + vic->change_active = vhost_input_change_active; +} + +static void vhost_input_init (Object *obj) +{ +VHostUserInput *vhi =VHOST_USER_INPUT (obj); +VirtIOInput *vinput =VIRTIO_INPUT (obj); +struct virtio_input_config vhost_input_config[] = { {/* empty list */ } }; + +virtio_input_init_config (vinput, vhost_input_config); + + vhi->vhost =VHOST_USER_BACKEND (object_new (TYPE_VHOST_USER_BACKEND )); +object_property_add_alias (obj,"chardev" , +OBJECT (vhi->vhost),"chardev" , &error_abort); +} + +static void vhost_input_finalize (Object *obj) +{ +VHostUserInput *vhi =VHOST_USER_INPUT (obj); + +object_unref (OBJECT (vhi->vhost)); +} + +static const TypeInfo vhost_input_info = { + .name =TYPE_VHOST_USER_INPUT , + .parent =TYPE_VIRTIO_INPUT , + .instance_size =sizeof (VHostUserInput), + .instance_init = vhost_input_init, + .instance_finalize = vhost_input_finalize, + .class_init = vhost_input_class_init, +}; + +/* ----------------------------------------------------------------- */ + +static void vhost_input_register_types (void ) +{ +type_register_static (&vhost_input_info); +} + +type_init (vhost_input_register_types)hw/virtio/vhost-user-input-pci.c new file +53
-0@@ -0,0 +1,53 @@ +/* +* This work is licensed under the terms of the GNU LGPL, version 2 or +* later. See the COPYING.LIB file in the top-level directory. +*/ + +#include "qemu/osdep.h" + +#include "hw/virtio/virtio.h" +#include "hw/virtio/virtio-input.h" +#include "qapi/error.h" +#include "qemu/error-report.h" +#include "virtio-pci.h" + +typedef struct VHostUserInputPCI VHostUserInputPCI ; + +#define TYPE_VHOST_USER_INPUT_PCI "vhost-user-input-pci-base" + +#define VHOST_USER_INPUT_PCI (obj) \ + OBJECT_CHECK(VHostUserInputPCI, (obj), TYPE_VHOST_USER_INPUT_PCI) + +struct VHostUserInputPCI { +VirtIOPCIProxy parent_obj; +VHostUserInput vhi; +}; + +static void vhost_user_input_pci_instance_init (Object *obj) +{ +VHostUserInputPCI *dev =VHOST_USER_INPUT_PCI (obj); + +virtio_instance_init_common (obj, &dev->vhi,sizeof (dev->vhi), +TYPE_VHOST_USER_INPUT ); + +object_property_add_alias (obj,"chardev" , +OBJECT (&dev->vhi),"chardev" , + &error_abort); +} + +static const VirtioPCIDeviceTypeInfo vhost_user_input_pci_info = { + .base_name =TYPE_VHOST_USER_INPUT_PCI , + .generic_name ="vhost-user-input-pci" , + .transitional_name ="vhost-user-input-pci-transitional" , + .non_transitional_name ="vhost-user-input-pci-non-transitional" , + .parent =TYPE_VIRTIO_INPUT_PCI , + .instance_size =sizeof (VHostUserInputPCI), + .instance_init = vhost_user_input_pci_instance_init, +}; + +static void vhost_user_input_pci_register (void ) +{ +virtio_pci_types_register (&vhost_user_input_pci_info); +} + +type_init (vhost_user_input_pci_register)MAINTAINERS +1
-0@@ -1467,6 +1467,7 @@ L: [email protected] virtio-input M: Gerd Hoffmann <[email protected]> S: Maintained +F: hw/input/vhost-user-input.c F: hw/input/virtio-input*.c F: include/hw/virtio/virtio-input.hdefault-configs/virtio.mak +1
-0@@ -13,3 +13,4 @@ CONFIG_SCSI=y CONFIG_VIRTIO_SCSI=y CONFIG_VIRTIO_SERIAL=y CONFIG_VIRTIO_INPUT_HOST=$(CONFIG_LINUX) +CONFIG_VHOST_USER_INPUT=$(call land,$(CONFIG_VHOST_USER),$(CONFIG_VIRTIO_INPUT))hw/input/Makefile.objs +1
-0@@ -11,6 +11,7 @@ common-obj-$(CONFIG_VIRTIO_INPUT) += virtio-input.o common-obj-$(CONFIG_VIRTIO_INPUT) += virtio-input-hid.o ifeq ($(CONFIG_LINUX),y) common-obj-$(CONFIG_VIRTIO_INPUT) += virtio-input-host.o +common-obj-$(CONFIG_VHOST_USER_INPUT) += vhost-user-input.o endif obj-$(CONFIG_MILKYMIST) += milkymist-softusb.ohw/virtio/Makefile.objs +1
-0@@ -14,6 +14,7 @@ obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock.o ifeq ($(CONFIG_VIRTIO_PCI),y) obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock-pci.o obj-$(CONFIG_VHOST_USER_BLK) += vhost-user-blk-pci.o +obj-$(CONFIG_VHOST_USER_INPUT) += vhost-user-input-pci.o obj-$(CONFIG_VHOST_USER_SCSI) += vhost-user-scsi-pci.o obj-$(CONFIG_VHOST_SCSI) += vhost-scsi-pci.o obj-$(CONFIG_VIRTIO_INPUT_HOST) += virtio-input-host-pci.oSignature · 1 line
2.20.1.519.g8feddda32c
Re: [Qemu-devel] [PATCH v3 11/13] Add vhost-user-input-pci
Quoted 11 lines · Michael S. Tsirkin
Quoted 10 lines · Marc-André Lureau
Add a new virtio-input device, which connects to a vhost-user backend.
vhost-user-input is similar to virtio-input-host, it is wrapped by vhost-user-input-pci. Instead of reading configuration directly from an input device / evdev, it reads it over vhost-user protocol with
INPUT_GET_CONFIGmessage. Then vhost-user-backend takes care of interfacing the virtio device with the backend, for the queue & events processing.
Quoted 3 lines
Quoted 1 line
Signed-off-by Marc-André Lureau <[email protected]>Gerd what's your take on this? Do we want this functionality?
Yes, I think it makes sense. Moving this to a separate process isn't that useful for virtio-input, other devices like virtio-gpu will benefit much more from it from a security and performance point of view. It still is useful for (a) testing the vhost-user infrastructure and (b) as relatively simple example.
cheers,
Gerd
Re: [Qemu-devel] [PATCH v3 11/13] Add vhost-user-input-pci
In reply to Marc-André LureauQuoted 11 lines · Marc-André Lureau
Add a new virtio-input device, which connects to a vhost-user backend.
vhost-user-input is similar to virtio-input-host, it is wrapped by vhost-user-input-pci. Instead of reading configuration directly from an input device / evdev, it reads it over vhost-user protocol with
INPUT_GET_CONFIGmessage. Then vhost-user-backend takes care of interfacing the virtio device with the backend, for the queue & events processing.Signed-off-by Marc-André Lureau <[email protected]>
I wonder what do others think of this from interface POV. It's *exactly* the same as virtio input from guest POV just a different backend. Would it be better to instead just have a vhost-user property within virtio input specifying the chardev?
Quoted 272 lines
--- include/hw/virtio/virtio-input.h | 14 +++++ hw/input/vhost-user-input.c | 104 +++++++++++++++++++++++++++++++ hw/virtio/vhost-user-input-pci.c | 53 ++++++++++++++++ MAINTAINERS | 1 + default-configs/virtio.mak | 1 + hw/input/Makefile.objs | 1 + hw/virtio/Makefile.objs | 1 + 7 files changed, 175 insertions(+) create mode 100644 hw/input/vhost-user-input.c create mode 100644 hw/virtio/vhost-user-input-pci.cinclude/hw/virtio/virtio-input.h +14
-0@@ -2,6 +2,7 @@#define QEMU_VIRTIO_INPUT_H #include "ui/input.h" +#include "sysemu/vhost-user-backend.h" /* ----------------------------------------------------------------- */ /* virtio input protocol */ @@ -42,11 +43,18 @@ typedef struct virtio_input_event virtio_input_event;#define VIRTIO_INPUT_HOST_GET_PARENT_CLASS (obj) \ OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_INPUT_HOST) +#define TYPE_VHOST_USER_INPUT "vhost-user-input" +#define VHOST_USER_INPUT (obj) \ + OBJECT_CHECK(VHostUserInput, (obj), TYPE_VHOST_USER_INPUT) +#define VHOST_USER_INPUT_GET_PARENT_CLASS (obj) \ + OBJECT_GET_PARENT_CLASS(obj, TYPE_VHOST_USER_INPUT) +typedef struct VirtIOInput VirtIOInput ;typedef struct VirtIOInputClass VirtIOInputClass ;typedef struct VirtIOInputConfig VirtIOInputConfig ;typedef struct VirtIOInputHID VirtIOInputHID ;typedef struct VirtIOInputHost VirtIOInputHost ; +typedef struct VHostUserInput VHostUserInput ;struct VirtIOInputConfig {virtio_input_config config;@@ -98,6 +106,12 @@ struct VirtIOInputHost {int fd; }; +struct VHostUserInput { +VirtIOInput parent_obj; + +VhostUserBackend *vhost; +}; +void virtio_input_send (VirtIOInput *vinput,virtio_input_event *event);void virtio_input_init_config (VirtIOInput *vinput,virtio_input_config *config);hw/input/vhost-user-input.c new file +104
-0@@ -0,0 +1,104 @@ +/* +* This work is licensed under the terms of the GNU GPL, version 2 or +* (at your option) any later version. See the COPYING file in the +* top-level directory. +*/ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qemu-common.h" + +#include "hw/qdev.h" +#include "hw/virtio/virtio-input.h" + +static void vhost_input_realize (DeviceState *dev,Error **errp) +{ +VHostUserInput *vhi =VHOST_USER_INPUT (dev); +VirtIOInput *vinput =VIRTIO_INPUT (dev); +VirtIODevice *vdev =VIRTIO_DEVICE (dev); +virtio_input_config *config; +int i, ret; + +if (!vhi->vhost) { +error_setg (errp,"'vhost-user' property is required" ); +return ; + } + +if (vhost_user_backend_dev_init (vhi->vhost, vdev,2 , errp) ==-1 ) { +return ; + } + + ret =vhost_user_input_get_config (&vhi->vhost->dev, &config); +if (ret <0 ) { +error_setg (errp,"failed to get input config" ); +return ; + } +for (i =0 ; i < ret; i++) { +virtio_input_add_config (vinput, &config[i]); + } +g_free (config); +} + +static void vhost_input_change_active (VirtIOInput *vinput) +{ +VHostUserInput *vhi =VHOST_USER_INPUT (vinput); + +if (vinput->active) { +vhost_user_backend_start (vhi->vhost); + }else { +vhost_user_backend_stop (vhi->vhost); + } +} + +static const VMStateDescription vmstate_vhost_input = { + .name ="vhost-user-input" , + .unmigratable =1 , +}; + +static void vhost_input_class_init (ObjectClass *klass,void *data) +{ +VirtIOInputClass *vic =VIRTIO_INPUT_CLASS (klass); +DeviceClass *dc =DEVICE_CLASS (klass); + + dc->vmsd = &vmstate_vhost_input; + vic->realize = vhost_input_realize; + vic->change_active = vhost_input_change_active; +} + +static void vhost_input_init (Object *obj) +{ +VHostUserInput *vhi =VHOST_USER_INPUT (obj); +VirtIOInput *vinput =VIRTIO_INPUT (obj); +struct virtio_input_config vhost_input_config[] = { {/* empty list */ } }; + +virtio_input_init_config (vinput, vhost_input_config); + + vhi->vhost =VHOST_USER_BACKEND (object_new (TYPE_VHOST_USER_BACKEND )); +object_property_add_alias (obj,"chardev" , +OBJECT (vhi->vhost),"chardev" , &error_abort); +} + +static void vhost_input_finalize (Object *obj) +{ +VHostUserInput *vhi =VHOST_USER_INPUT (obj); + +object_unref (OBJECT (vhi->vhost)); +} + +static const TypeInfo vhost_input_info = { + .name =TYPE_VHOST_USER_INPUT , + .parent =TYPE_VIRTIO_INPUT , + .instance_size =sizeof (VHostUserInput), + .instance_init = vhost_input_init, + .instance_finalize = vhost_input_finalize, + .class_init = vhost_input_class_init, +}; + +/* ----------------------------------------------------------------- */ + +static void vhost_input_register_types (void ) +{ +type_register_static (&vhost_input_info); +} + +type_init (vhost_input_register_types)hw/virtio/vhost-user-input-pci.c new file +53
-0@@ -0,0 +1,53 @@ +/* +* This work is licensed under the terms of the GNU LGPL, version 2 or +* later. See the COPYING.LIB file in the top-level directory. +*/ + +#include "qemu/osdep.h" + +#include "hw/virtio/virtio.h" +#include "hw/virtio/virtio-input.h" +#include "qapi/error.h" +#include "qemu/error-report.h" +#include "virtio-pci.h" + +typedef struct VHostUserInputPCI VHostUserInputPCI ; + +#define TYPE_VHOST_USER_INPUT_PCI "vhost-user-input-pci-base" + +#define VHOST_USER_INPUT_PCI (obj) \ + OBJECT_CHECK(VHostUserInputPCI, (obj), TYPE_VHOST_USER_INPUT_PCI) + +struct VHostUserInputPCI { +VirtIOPCIProxy parent_obj; +VHostUserInput vhi; +}; + +static void vhost_user_input_pci_instance_init (Object *obj) +{ +VHostUserInputPCI *dev =VHOST_USER_INPUT_PCI (obj); + +virtio_instance_init_common (obj, &dev->vhi,sizeof (dev->vhi), +TYPE_VHOST_USER_INPUT ); + +object_property_add_alias (obj,"chardev" , +OBJECT (&dev->vhi),"chardev" , + &error_abort); +} + +static const VirtioPCIDeviceTypeInfo vhost_user_input_pci_info = { + .base_name =TYPE_VHOST_USER_INPUT_PCI , + .generic_name ="vhost-user-input-pci" , + .transitional_name ="vhost-user-input-pci-transitional" , + .non_transitional_name ="vhost-user-input-pci-non-transitional" , + .parent =TYPE_VIRTIO_INPUT_PCI , + .instance_size =sizeof (VHostUserInputPCI), + .instance_init = vhost_user_input_pci_instance_init, +}; + +static void vhost_user_input_pci_register (void ) +{ +virtio_pci_types_register (&vhost_user_input_pci_info); +} + +type_init (vhost_user_input_pci_register)MAINTAINERS +1
-0@@ -1467,6 +1467,7 @@ L: [email protected] virtio-input M: Gerd Hoffmann <[email protected]> S: Maintained +F: hw/input/vhost-user-input.c F: hw/input/virtio-input*.c F: include/hw/virtio/virtio-input.hdefault-configs/virtio.mak +1
-0@@ -13,3 +13,4 @@ CONFIG_SCSI=y CONFIG_VIRTIO_SCSI=y CONFIG_VIRTIO_SERIAL=y CONFIG_VIRTIO_INPUT_HOST=$(CONFIG_LINUX) +CONFIG_VHOST_USER_INPUT=$(call land,$(CONFIG_VHOST_USER),$(CONFIG_VIRTIO_INPUT))hw/input/Makefile.objs +1
-0@@ -11,6 +11,7 @@ common-obj-$(CONFIG_VIRTIO_INPUT) += virtio-input.o common-obj-$(CONFIG_VIRTIO_INPUT) += virtio-input-hid.o ifeq ($(CONFIG_LINUX),y) common-obj-$(CONFIG_VIRTIO_INPUT) += virtio-input-host.o +common-obj-$(CONFIG_VHOST_USER_INPUT) += vhost-user-input.o endif obj-$(CONFIG_MILKYMIST) += milkymist-softusb.ohw/virtio/Makefile.objs +1
-0@@ -14,6 +14,7 @@ obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock.o ifeq ($(CONFIG_VIRTIO_PCI),y) obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock-pci.o obj-$(CONFIG_VHOST_USER_BLK) += vhost-user-blk-pci.o +obj-$(CONFIG_VHOST_USER_INPUT) += vhost-user-input-pci.o obj-$(CONFIG_VHOST_USER_SCSI) += vhost-user-scsi-pci.o obj-$(CONFIG_VHOST_SCSI) += vhost-scsi-pci.o obj-$(CONFIG_VIRTIO_INPUT_HOST) += virtio-input-host-pci.oSignature · 1 line
2.20.1.519.g8feddda32c
Re: [Qemu-devel] [PATCH v3 11/13] Add vhost-user-input-pci
Hi
Quoted 12 lines · Michael S. Tsirkin
Quoted 10 lines · Marc-André Lureau
Add a new virtio-input device, which connects to a vhost-user backend.
vhost-user-input is similar to virtio-input-host, it is wrapped by vhost-user-input-pci. Instead of reading configuration directly from an input device / evdev, it reads it over vhost-user protocol with
INPUT_GET_CONFIGmessage. Then vhost-user-backend takes care of interfacing the virtio device with the backend, for the queue & events processing.
Quoted 7 lines
Quoted 1 line
Signed-off-by Marc-André Lureau <[email protected]>I wonder what do others think of this from interface POV. It's *exactly* the same as virtio input from guest POV just a different backend. Would it be better to instead just have a vhost-user property within virtio input specifying the chardev?
My initial approach added vhost-user support to existing devices and Gerd asked me to make them seperate devices, iirc.
Makes sense also for consistency with existing vhost-user-{blk,scsi}.
Quoted 275 lines
Quoted 274 lines
--- include/hw/virtio/virtio-input.h | 14 +++++ hw/input/vhost-user-input.c | 104 +++++++++++++++++++++++++++++++ hw/virtio/vhost-user-input-pci.c | 53 ++++++++++++++++ MAINTAINERS | 1 + default-configs/virtio.mak | 1 + hw/input/Makefile.objs | 1 + hw/virtio/Makefile.objs | 1 + 7 files changed, 175 insertions(+) create mode 100644 hw/input/vhost-user-input.c create mode 100644 hw/virtio/vhost-user-input-pci.cinclude/hw/virtio/virtio-input.h +14
-0@@ -2,6 +2,7 @@#define QEMU_VIRTIO_INPUT_H #include "ui/input.h" +#include "sysemu/vhost-user-backend.h" /* ----------------------------------------------------------------- */ /* virtio input protocol */ @@ -42,11 +43,18 @@ typedef struct virtio_input_event virtio_input_event;#define VIRTIO_INPUT_HOST_GET_PARENT_CLASS (obj) \ OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_INPUT_HOST) +#define TYPE_VHOST_USER_INPUT "vhost-user-input" +#define VHOST_USER_INPUT (obj) \ + OBJECT_CHECK(VHostUserInput, (obj), TYPE_VHOST_USER_INPUT) +#define VHOST_USER_INPUT_GET_PARENT_CLASS (obj) \ + OBJECT_GET_PARENT_CLASS(obj, TYPE_VHOST_USER_INPUT) +typedef struct VirtIOInput VirtIOInput ;typedef struct VirtIOInputClass VirtIOInputClass ;typedef struct VirtIOInputConfig VirtIOInputConfig ;typedef struct VirtIOInputHID VirtIOInputHID ;typedef struct VirtIOInputHost VirtIOInputHost ; +typedef struct VHostUserInput VHostUserInput ;struct VirtIOInputConfig {virtio_input_config config;@@ -98,6 +106,12 @@ struct VirtIOInputHost {int fd; }; +struct VHostUserInput { +VirtIOInput parent_obj; + +VhostUserBackend *vhost; +}; +void virtio_input_send (VirtIOInput *vinput,virtio_input_event *event);void virtio_input_init_config (VirtIOInput *vinput,virtio_input_config *config);hw/input/vhost-user-input.c new file +104
-0@@ -0,0 +1,104 @@ +/* +* This work is licensed under the terms of the GNU GPL, version 2 or +* (at your option) any later version. See the COPYING file in the +* top-level directory. +*/ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qemu-common.h" + +#include "hw/qdev.h" +#include "hw/virtio/virtio-input.h" + +static void vhost_input_realize (DeviceState *dev,Error **errp) +{ +VHostUserInput *vhi =VHOST_USER_INPUT (dev); +VirtIOInput *vinput =VIRTIO_INPUT (dev); +VirtIODevice *vdev =VIRTIO_DEVICE (dev); +virtio_input_config *config; +int i, ret; + +if (!vhi->vhost) { +error_setg (errp,"'vhost-user' property is required" ); +return ; + } + +if (vhost_user_backend_dev_init (vhi->vhost, vdev,2 , errp) ==-1 ) { +return ; + } + + ret =vhost_user_input_get_config (&vhi->vhost->dev, &config); +if (ret <0 ) { +error_setg (errp,"failed to get input config" ); +return ; + } +for (i =0 ; i < ret; i++) { +virtio_input_add_config (vinput, &config[i]); + } +g_free (config); +} + +static void vhost_input_change_active (VirtIOInput *vinput) +{ +VHostUserInput *vhi =VHOST_USER_INPUT (vinput); + +if (vinput->active) { +vhost_user_backend_start (vhi->vhost); + }else { +vhost_user_backend_stop (vhi->vhost); + } +} + +static const VMStateDescription vmstate_vhost_input = { + .name ="vhost-user-input" , + .unmigratable =1 , +}; + +static void vhost_input_class_init (ObjectClass *klass,void *data) +{ +VirtIOInputClass *vic =VIRTIO_INPUT_CLASS (klass); +DeviceClass *dc =DEVICE_CLASS (klass); + + dc->vmsd = &vmstate_vhost_input; + vic->realize = vhost_input_realize; + vic->change_active = vhost_input_change_active; +} + +static void vhost_input_init (Object *obj) +{ +VHostUserInput *vhi =VHOST_USER_INPUT (obj); +VirtIOInput *vinput =VIRTIO_INPUT (obj); +struct virtio_input_config vhost_input_config[] = { {/* empty list */ } }; + +virtio_input_init_config (vinput, vhost_input_config); + + vhi->vhost =VHOST_USER_BACKEND (object_new (TYPE_VHOST_USER_BACKEND )); +object_property_add_alias (obj,"chardev" , +OBJECT (vhi->vhost),"chardev" , &error_abort); +} + +static void vhost_input_finalize (Object *obj) +{ +VHostUserInput *vhi =VHOST_USER_INPUT (obj); + +object_unref (OBJECT (vhi->vhost)); +} + +static const TypeInfo vhost_input_info = { + .name =TYPE_VHOST_USER_INPUT , + .parent =TYPE_VIRTIO_INPUT , + .instance_size =sizeof (VHostUserInput), + .instance_init = vhost_input_init, + .instance_finalize = vhost_input_finalize, + .class_init = vhost_input_class_init, +}; + +/* ----------------------------------------------------------------- */ + +static void vhost_input_register_types (void ) +{ +type_register_static (&vhost_input_info); +} + +type_init (vhost_input_register_types)hw/virtio/vhost-user-input-pci.c new file +53
-0@@ -0,0 +1,53 @@ +/* +* This work is licensed under the terms of the GNU LGPL, version 2 or +* later. See the COPYING.LIB file in the top-level directory. +*/ + +#include "qemu/osdep.h" + +#include "hw/virtio/virtio.h" +#include "hw/virtio/virtio-input.h" +#include "qapi/error.h" +#include "qemu/error-report.h" +#include "virtio-pci.h" + +typedef struct VHostUserInputPCI VHostUserInputPCI ; + +#define TYPE_VHOST_USER_INPUT_PCI "vhost-user-input-pci-base" + +#define VHOST_USER_INPUT_PCI (obj) \ + OBJECT_CHECK(VHostUserInputPCI, (obj), TYPE_VHOST_USER_INPUT_PCI) + +struct VHostUserInputPCI { +VirtIOPCIProxy parent_obj; +VHostUserInput vhi; +}; + +static void vhost_user_input_pci_instance_init (Object *obj) +{ +VHostUserInputPCI *dev =VHOST_USER_INPUT_PCI (obj); + +virtio_instance_init_common (obj, &dev->vhi,sizeof (dev->vhi), +TYPE_VHOST_USER_INPUT ); + +object_property_add_alias (obj,"chardev" , +OBJECT (&dev->vhi),"chardev" , + &error_abort); +} + +static const VirtioPCIDeviceTypeInfo vhost_user_input_pci_info = { + .base_name =TYPE_VHOST_USER_INPUT_PCI , + .generic_name ="vhost-user-input-pci" , + .transitional_name ="vhost-user-input-pci-transitional" , + .non_transitional_name ="vhost-user-input-pci-non-transitional" , + .parent =TYPE_VIRTIO_INPUT_PCI , + .instance_size =sizeof (VHostUserInputPCI), + .instance_init = vhost_user_input_pci_instance_init, +}; + +static void vhost_user_input_pci_register (void ) +{ +virtio_pci_types_register (&vhost_user_input_pci_info); +} + +type_init (vhost_user_input_pci_register)MAINTAINERS +1
-0@@ -1467,6 +1467,7 @@ L: [email protected] virtio-input M: Gerd Hoffmann <[email protected]> S: Maintained +F: hw/input/vhost-user-input.c F: hw/input/virtio-input*.c F: include/hw/virtio/virtio-input.hdefault-configs/virtio.mak +1
-0@@ -13,3 +13,4 @@ CONFIG_SCSI=y CONFIG_VIRTIO_SCSI=y CONFIG_VIRTIO_SERIAL=y CONFIG_VIRTIO_INPUT_HOST=$(CONFIG_LINUX) +CONFIG_VHOST_USER_INPUT=$(call land,$(CONFIG_VHOST_USER),$(CONFIG_VIRTIO_INPUT))hw/input/Makefile.objs +1
-0@@ -11,6 +11,7 @@ common-obj-$(CONFIG_VIRTIO_INPUT) += virtio-input.o common-obj-$(CONFIG_VIRTIO_INPUT) += virtio-input-hid.o ifeq ($(CONFIG_LINUX),y) common-obj-$(CONFIG_VIRTIO_INPUT) += virtio-input-host.o +common-obj-$(CONFIG_VHOST_USER_INPUT) += vhost-user-input.o endif obj-$(CONFIG_MILKYMIST) += milkymist-softusb.ohw/virtio/Makefile.objs +1
-1@@ -14,6 +14,7 @@ obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock.o ifeq ($(CONFIG_VIRTIO_PCI),y) obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock-pci.o obj-$(CONFIG_VHOST_USER_BLK) += vhost-user-blk-pci.o +obj-$(CONFIG_VHOST_USER_INPUT) += vhost-user-input-pci.o obj-$(CONFIG_VHOST_USER_SCSI) += vhost-user-scsi-pci.o obj-$(CONFIG_VHOST_SCSI) += vhost-scsi-pci.o obj-$(CONFIG_VIRTIO_INPUT_HOST) += virtio-input-host-pci.o --2.20.1.519.g8feddda32c
Signature · 1 line
Marc-André Lureau
PATCH v3 12/13 contrib: add vhost-user-input
In reply to Marc-André LureauAdd a vhost-user input backend example, based on virtio-input-host device. It takes an evdev path as argument, and can be associated with a vhost-user-input device via a UNIX socket:
$ vhost-user-input -p /dev/input/eventX -s /tmp/vui.sock
$ qemu ... -chardev socket,id=vuic,path=/tmp/vui.sock -device vhost-user-input-pci,chardev=vuic
--- contrib/vhost-user-input/main.c | 398 +++++++++++++++++++++++++ MAINTAINERS | 1 + Makefile | 3 + Makefile.objs | 1 + configure | 3 + contrib/vhost-user-input/Makefile.objs | 1 + 6 files changed, 407 insertions(+) create mode 100644 contrib/vhost-user-input/main.c create mode 100644 contrib/vhost-user-input/Makefile.objs
contrib/vhost-user-input/main.c new file +398 -0
@@ -0,0 +1,398 @@ +/* +* This work is licensed under the terms of the GNU GPL, version 2 or +* (at your option) any later version. See the COPYING file in the +* top-level directory. +*/ + +#include "qemu/osdep.h" + +#include <glib.h> +#include <linux/input.h> + +#include "qemu/iov.h" +#include "qemu/bswap.h" +#include "contrib/libvhost-user/libvhost-user.h" +#include "contrib/libvhost-user/libvhost-user-glib.h" +#include "standard-headers/linux/virtio_input.h" +#include "qapi/error.h" + +typedef struct virtio_input_event virtio_input_event ; +typedef struct virtio_input_config virtio_input_config ; + +typedef struct VuInput { +VugDev dev; +GSource *evsrc; +int evdevfd; +GArray *config; +struct { +virtio_input_event event; +VuVirtqElement *elem; + } *queue; +uint32_t qindex, qsize; +}VuInput ; + +static void vi_input_send (VuInput *vi,struct virtio_input_event *event) +{ +VuDev *dev = &vi->dev.parent; +VuVirtq *vq =vu_get_queue (dev,0 ); +VuVirtqElement *elem; +int i, len; + +/* queue up events ... */ +if (vi->qindex == vi->qsize) { + vi->qsize++; + vi->queue =g_realloc_n (vi->queue, vi->qsize,sizeof (vi->queue[0 ])); + } + vi->queue[vi->qindex++].event = *event; + +/* ... until we see a report sync ... */ +if (event->type !=htole16 (EV_SYN ) || + event->code !=htole16 (SYN_REPORT )) { +return ; + } + +/* ... then check available space ... */ +for (i =0 ; i < vi->qindex; i++) { + elem =vu_queue_pop (dev, vq,sizeof (VuVirtqElement)); +if (!elem) { +while (--i >=0 ) { +vu_queue_unpop (dev, vq, vi->queue[i].elem,0 ); + } + vi->qindex =0 ; +g_warning ("virtio-input queue full" ); +return ; + } + vi->queue[i].elem = elem; + } + +/* ... and finally pass them to the guest */ +for (i =0 ; i < vi->qindex; i++) { + elem = vi->queue[i].elem; + len =iov_from_buf (elem->in_sg, elem->in_num, +0 , &vi->queue[i].event,sizeof (virtio_input_event)); +vu_queue_push (dev, vq, elem, len); +g_free (elem); + } + +vu_queue_notify (&vi->dev.parent, vq); + vi->qindex =0 ; +} + +static void +vi_evdev_watch (VuDev *dev,int condition,void *data) +{ +VuInput *vi = data; +int fd = vi->evdevfd; + +g_debug ("Got evdev condition %x" , condition); + +struct virtio_input_event virtio; +struct input_event evdev; +int rc; + +for (;;) { + rc =read (fd, &evdev,sizeof (evdev)); +if (rc !=sizeof (evdev)) { +break ; + } + +g_debug ("input %d %d %d" , evdev.type, evdev.code, evdev.value); + + virtio.type =htole16 (evdev.type); + virtio.code =htole16 (evdev.code); + virtio.value =htole32 (evdev.value); +vi_input_send (vi, &virtio); + } +} + + +static void vi_handle_status (VuInput *vi,virtio_input_event *event) +{ +struct input_event evdev; +int rc; + +if (gettimeofday (&evdev.time,NULL )) { +perror ("vi_handle_status: gettimeofday" ); +return ; + } + + evdev.type =le16toh (event->type); + evdev.code =le16toh (event->code); + evdev.value =le32toh (event->value); + + rc =write (vi->evdevfd, &evdev,sizeof (evdev)); +if (rc ==-1 ) { +perror ("vi_host_handle_status: write" ); + } +} + +static void vi_handle_sts (VuDev *dev,int qidx) +{ +VuInput *vi =container_of (dev, VuInput, dev.parent); +VuVirtq *vq =vu_get_queue (dev, qidx); +virtio_input_event event; +VuVirtqElement *elem; +int len; + +g_debug ("%s" ,G_STRFUNC ); + +for (;;) { + elem =vu_queue_pop (dev, vq,sizeof (VuVirtqElement)); +if (!elem) { +break ; + } + +memset (&event,0 ,sizeof (event)); + len =iov_to_buf (elem->out_sg, elem->out_num, +0 , &event,sizeof (event)); +vi_handle_status (vi, &event); +vu_queue_push (dev, vq, elem, len); +g_free (elem); + } + +vu_queue_notify (&vi->dev.parent, vq); +} + +static void +vi_panic (VuDev *dev,const char *msg) +{ +g_critical ("%s\n" , msg); +exit (EXIT_FAILURE ); +} + +static void +vi_queue_set_started (VuDev *dev,int qidx,bool started) +{ +VuInput *vi =container_of (dev, VuInput, dev.parent); +VuVirtq *vq =vu_get_queue (dev, qidx); + +g_debug ("queue started %d:%d" , qidx, started); + +if (qidx ==1 ) { +vu_set_queue_handler (dev, vq, started ? vi_handle_sts :NULL ); + } + + started =vu_queue_started (dev,vu_get_queue (dev,0 )) && +vu_queue_started (dev,vu_get_queue (dev,1 )); + +if (started && !vi->evsrc) { + vi->evsrc =vug_source_new (&vi->dev, vi->evdevfd, +G_IO_IN , vi_evdev_watch, vi); + } + +if (!started && vi->evsrc) { +g_source_destroy (vi->evsrc); + vi->evsrc =NULL ; + } +} + +static int +vi_process_msg (VuDev *dev,VhostUserMsg *vmsg,int *do_reply) +{ +VuInput *vi =container_of (dev, VuInput, dev.parent); + +switch (vmsg->request) { +case VHOST_USER_INPUT_GET_CONFIG : + vmsg->size = vi->config->len *sizeof (virtio_input_config); + vmsg->data =g_memdup (vi->config->data, vmsg->size); + *do_reply = true; +return 1 ; +default : +return 0 ; + } +} + +static const VuDevIface vuiface = { + .queue_set_started = vi_queue_set_started, + .process_msg = vi_process_msg, +}; + +static void +vi_bits_config (VuInput *vi,int type,int count) +{ +virtio_input_config bits; +int rc, i, size =0 ; + +memset (&bits,0 ,sizeof (bits)); + rc =ioctl (vi->evdevfd,EVIOCGBIT (type, count /8 ), bits.u.bitmap); +if (rc <0 ) { +return ; + } + +for (i =0 ; i < count /8 ; i++) { +if (bits.u.bitmap[i]) { + size = i +1 ; + } + } +if (size ==0 ) { +return ; + } + + bits.select =VIRTIO_INPUT_CFG_EV_BITS ; + bits.subsel = type; + bits.size = size; +g_array_append_val (vi->config, bits); +} + +static int unix_sock_new (char *path) +{ +int sock; +struct sockaddr_un un; +size_t len; + + sock =socket (AF_UNIX ,SOCK_STREAM ,0 ); +if (sock <=0 ) { +perror ("socket" ); +return -1 ; + } + + un.sun_family =AF_UNIX ; +snprintf (un.sun_path,sizeof (un.sun_path),"%s" , path); + len =sizeof (un.sun_family) +strlen (un.sun_path); + +unlink (path); +if (bind (sock, (struct sockaddr *)&un, len) <0 ) { +perror ("bind" ); + goto fail; + } + +if (listen (sock,1 ) <0 ) { +perror ("listen" ); + goto fail; + } + +return sock; + +fail: +close (sock); + +return -1 ; +} + +static char *opt_evdev; +static int opt_fdnum =-1 ; +static char *opt_socket_path; +static gboolean opt_nograb; +static gboolean opt_print_caps; + +static GOptionEntry entries[] = { + {"print-capabilities" ,'c' ,0 ,G_OPTION_ARG_NONE , &opt_print_caps, +"Print capabilities" ,NULL }, + {"no-grab" ,'n' ,0 ,G_OPTION_ARG_NONE , &opt_nograb, +"Don't grab device" ,NULL }, + {"fd" ,'f' ,0 ,G_OPTION_ARG_INT , &opt_fdnum, +"Use inherited fd socket" ,"FDNUM" }, + {"socket-path" ,'s' ,0 ,G_OPTION_ARG_FILENAME , &opt_socket_path, +"Use UNIX socket path" ,"PATH" }, + {"evdev-path" ,'p' ,0 ,G_OPTION_ARG_FILENAME , &opt_evdev, +"evdev input device path" ,"PATH" }, + {NULL , } +}; + +int +main (int argc,char *argv[]) +{ +GMainLoop *loop =NULL ; +VuInput vi = {0 , }; +int rc, ver, fd; +virtio_input_config id; +struct input_id ids; +GError *error =NULL ; +GOptionContext *context; + + context =g_option_context_new (NULL ); +g_option_context_add_main_entries (context, entries,NULL ); +if (!g_option_context_parse (context, &argc, &argv, &error)) { +g_printerr ("Option parsing failed: %s\n" , error->message); +exit (EXIT_FAILURE ); + } +if (opt_print_caps) { +g_print ("{\n" ); +g_print (" \"type\": \"input\",\n" ); +g_print (" \"features\": [\n" ); +g_print (" \"evdev-path\",\n" ); +g_print (" \"no-grab\"\n" ); +g_print (" ]\n" ); +g_print ("}\n" ); +exit (EXIT_SUCCESS ); + } +if (!opt_evdev) { +g_printerr ("Please specify an evdev path\n" ); +exit (EXIT_FAILURE ); + } +if ((!!opt_socket_path + (opt_fdnum !=-1 )) !=1 ) { +g_printerr ("Please specify either --fd or --socket-path\n" ); +exit (EXIT_FAILURE ); + } + + vi.evdevfd =open (opt_evdev,O_RDWR ); +if (vi.evdevfd <0 ) { +g_printerr ("Failed to open evdev: %s\n" ,g_strerror (errno)); +exit (EXIT_FAILURE ); + } + + rc =ioctl (vi.evdevfd,EVIOCGVERSION , &ver); +if (rc <0 ) { +g_printerr ("%s: is not an evdev device\n" , argv[1 ]); +exit (EXIT_FAILURE ); + } + +if (!opt_nograb) { + rc =ioctl (vi.evdevfd,EVIOCGRAB ,1 ); +if (rc <0 ) { +g_printerr ("Failed to grab device\n" ); +exit (EXIT_FAILURE ); + } + } + + vi.config =g_array_new (false, false,sizeof (virtio_input_config)); +memset (&id,0 ,sizeof (id)); +ioctl (vi.evdevfd,EVIOCGNAME (sizeof (id.u.string) -1 ), id.u.string); + id.select =VIRTIO_INPUT_CFG_ID_NAME ; + id.size =strlen (id.u.string); +g_array_append_val (vi.config, id); + +if (ioctl (vi.evdevfd,EVIOCGID , &ids) ==0 ) { +memset (&id,0 ,sizeof (id)); + id.select =VIRTIO_INPUT_CFG_ID_DEVIDS ; + id.size =sizeof (struct virtio_input_devids ); + id.u.ids.bustype =cpu_to_le16 (ids.bustype); + id.u.ids.vendor =cpu_to_le16 (ids.vendor); + id.u.ids.product =cpu_to_le16 (ids.product); + id.u.ids.version =cpu_to_le16 (ids.version); +g_array_append_val (vi.config, id); + } + +vi_bits_config (&vi,EV_KEY ,KEY_CNT ); +vi_bits_config (&vi,EV_REL ,REL_CNT ); +vi_bits_config (&vi,EV_ABS ,ABS_CNT ); +vi_bits_config (&vi,EV_MSC ,MSC_CNT ); +vi_bits_config (&vi,EV_SW ,SW_CNT ); +g_debug ("config length: %u" , vi.config->len); + +if (opt_socket_path) { +int lsock =unix_sock_new (opt_socket_path); + fd =accept (lsock,NULL ,NULL ); +close (lsock); + }else { + fd = opt_fdnum; + } +if (fd ==-1 ) { +g_printerr ("Invalid socket" ); +exit (EXIT_FAILURE ); + } +vug_init (&vi.dev, fd, vi_panic, &vuiface); + + loop =g_main_loop_new (NULL , FALSE); +g_main_loop_run (loop); +g_main_loop_unref (loop); + +vug_deinit (&vi.dev); + +if (vi.evsrc) { +g_source_unref (vi.evsrc); + } +g_array_free (vi.config, TRUE); +g_free (vi.queue); +return 0 ; +}
MAINTAINERS +1 -0
@@ -1470,6 +1470,7 @@ S: Maintained F: hw/input/vhost-user-input.c F: hw/input/virtio-input*.c F: include/hw/virtio/virtio-input.h +F: contrib/vhost-user-input/* virtio-serial M: Amit Shah <[email protected]>
Makefile +3 -0
@@ -369,6 +369,7 @@ dummy := $(call unnest-vars,, \ libvhost-user-obj-y \ vhost-user-scsi-obj-y \ vhost-user-blk-obj-y \ + vhost-user-input-obj-y \ qga-vss-dll-obj-y \ block-obj-y \ block-obj-m \
@@ -588,6 +589,8 @@ vhost-user-blk$(EXESUF): $(vhost-user-blk-obj-y) libvhost-user.a rdmacm-mux$(EXESUF): LIBS += "-libumad" rdmacm-mux$(EXESUF): $(rdmacm-mux-obj-y) $(COMMON_LDADDS) $(call LINK, $^) +vhost-user-input$(EXESUF): $(vhost-user-input-obj-y) libvhost-user.a libqemuutil.a + $(call LINK, $^) module_block.h: $(SRC_PATH)/scripts/modules/module_block.py config-host.mak $(call quiet-command,$(PYTHON) $< $@ \
Makefile.objs +1 -0
@@ -134,6 +134,7 @@ vhost-user-scsi.o-libs := $(LIBISCSI_LIBS) vhost-user-scsi-obj-y = contrib/vhost-user-scsi/ vhost-user-blk-obj-y = contrib/vhost-user-blk/ rdmacm-mux-obj-y = contrib/rdmacm-mux/ +vhost-user-input-obj-y = contrib/vhost-user-input/ ###################################################################### trace-events-subdirs =
configure +3 -0
@@ -5795,6 +5795,9 @@ if test "$want_tools" = "yes" ; then if [ "$curl" = "yes" ]; then tools="elf2dmp\$(EXESUF) $tools" fi + if [ "$vhost_user" = "yes" ] && [ "$linux" = "yes" ] ; then + tools="vhost-user-input\$(EXESUF) $tools" + fi fi if test "$softmmu" = yes ; then if test "$linux" = yes; then
contrib/vhost-user-input/Makefile.objs new file +1 -0
@@ -0,0 +1 @@ +vhost-user-input-obj-y = main.o
Signature · 1 line
2.20.1.519.g8feddda32c
Re: [Qemu-devel] [PATCH v3 12/13] contrib: add vhost-user-input
Review
Quoted 11 lines · Marc-André Lureau
Add a vhost-user input backend example, based on virtio-input-host device. It takes an evdev path as argument, and can be associated with a vhost-user-input device via a UNIX socket:
$ vhost-user-input -p /dev/input/eventX -s /tmp/vui.sock$ qemu ... -chardev socket,id=vuic,path=/tmp/vui.sock -device vhost-user-input-pci,chardev=vuic(quoted diff) +2
-0+static int unix_sock_new(char *path) +{
Move to the library? This looks like something other backends will need too.
cheers,
Gerd
Re: [Qemu-devel] [PATCH v3 12/13] contrib: add vhost-user-input
Hi
Quoted 8 lines · Gerd Hoffmann
Quoted 6 lines · Marc-André Lureau
Add a vhost-user input backend example, based on virtio-input-host device. It takes an evdev path as argument, and can be associated with a vhost-user-input device via a UNIX socket:
$ vhost-user-input -p /dev/input/eventX -s /tmp/vui.sock
Quoted 9 lines
Review
Quoted 5 lines
$ qemu ... -chardev socket,id=vuic,path=/tmp/vui.sock -device vhost-user-input-pci,chardev=vuic(quoted diff) +2
-0+static int unix_sock_new(char *path) +{Move to the library? This looks like something other backends will need too.
Eventually. I am not sure libvhost-user is the right place though.
We could eventually link with a util/ object.
That could be done in a seperate patch, since there are already several similar functions in qemu source tree.
Thanks
Signature · 1 line
Marc-André Lureau
PATCH v3 13/13 RFC: add explicit can_migrate to vhost_user_backend_dev_init()
In reply to Marc-André LureauIn general, there is not much support for migrating a vhost-user slave process. Many virtio devices however implement vmsd, and the vhost-user instances (as child objects) may be migrated.
Since there is no other support at this point, the slave is assumed to be state less (outside of VM state), or using a migration method outside of qemu migration stream.
Since this is not well specified, add a common blocker for the VhostUserBackend users (vhost-user-input and upcoming gpu will use it).
RFC since I am not sure that's what Michael had in mind when requesting such blocker.
--- include/sysemu/vhost-user-backend.h | 2 +- backends/vhost-user.c | 7 ++++++- hw/input/vhost-user-input.c | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-)
include/sysemu/vhost-user-backend.h +1 -1
@@ -53,7 +53,7 @@ struct VhostUserBackend { };int vhost_user_backend_dev_init (VhostUserBackend *b,VirtIODevice *vdev, -unsigned nvqs,Error **errp); +unsigned nvqs,bool can_migrate,Error **errp);void vhost_user_backend_start (VhostUserBackend *b);void vhost_user_backend_stop (VhostUserBackend *b);
backends/vhost-user.c +6 -1
@@ -30,7 +30,7 @@ ioeventfd_enabled(void)int vhost_user_backend_dev_init (VhostUserBackend *b,VirtIODevice *vdev, -unsigned nvqs,Error **errp) +unsigned nvqs,bool can_migrate,Error **errp) {int ret;
@@ -49,6 +49,11 @@ vhost_user_backend_dev_init(VhostUserBackend *b, VirtIODevice *vdev, b->dev.nvqs = nvqs; b->dev.vqs = g_new(struct vhost_virtqueue, nvqs); +if (!can_migrate && !b->dev.migration_blocker) { +error_setg (&b->dev.migration_blocker, +"Migration disabled: vhost-user device can't migrate" ); + } + ret =vhost_dev_init (&b->dev, &b->vhost_user,VHOST_BACKEND_TYPE_USER ,0 );if (ret <0 ) {error_setg_errno (errp, -ret,"vhost initialization failed" );
hw/input/vhost-user-input.c +1 -1
@@ -24,7 +24,7 @@ static void vhost_input_realize(DeviceState *dev, Error **errp)return ; } -if (vhost_user_backend_dev_init (vhi->vhost, vdev,2 , errp) ==-1 ) { +if (vhost_user_backend_dev_init (vhi->vhost, vdev,2 , false, errp) ==-1 ) {return ; }
Signature · 1 line
2.20.1.519.g8feddda32c
Re: [Qemu-devel] [PATCH v3 13/13] RFC: add explicit can_migrate to vhost_user_backend_dev_init()
Michael,
Quoted 9 lines · Marc-André Lureau
In general, there is not much support for migrating a vhost-user slave process. Many virtio devices however implement vmsd, and the vhost-user instances (as child objects) may be migrated.
Since there is no other support at this point, the slave is assumed to be state less (outside of VM state), or using a migration method outside of qemu migration stream.
Quoted 6 lines
Since this is not well specified, add a common blocker for the VhostUserBackend users (vhost-user-input and upcoming gpu will use it).
RFC since I am not sure that's what Michael had in mind when requesting such blocker.
Could you look at that proposal?
thanks
Quoted 63 lines
Signed-off-by Marc-André Lureau <[email protected]>--- include/sysemu/vhost-user-backend.h | 2 +- backends/vhost-user.c | 7 ++++++- hw/input/vhost-user-input.c | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-)include/sysemu/vhost-user-backend.h +1
-1@@ -53,7 +53,7 @@ struct VhostUserBackend { };int vhost_user_backend_dev_init (VhostUserBackend *b,VirtIODevice *vdev, -unsigned nvqs,Error **errp); +unsigned nvqs,bool can_migrate,Error **errp);void vhost_user_backend_start (VhostUserBackend *b);void vhost_user_backend_stop (VhostUserBackend *b);backends/vhost-user.c +6
-1@@ -30,7 +30,7 @@ ioeventfd_enabled(void)int vhost_user_backend_dev_init (VhostUserBackend *b,VirtIODevice *vdev, -unsigned nvqs,Error **errp) +unsigned nvqs,bool can_migrate,Error **errp) {int ret;@@ -49,6 +49,11 @@ vhost_user_backend_dev_init(VhostUserBackend *b, VirtIODevice *vdev, b->dev.nvqs = nvqs; b->dev.vqs = g_new(struct vhost_virtqueue, nvqs); +if (!can_migrate && !b->dev.migration_blocker) { +error_setg (&b->dev.migration_blocker, +"Migration disabled: vhost-user device can't migrate" ); + } + ret =vhost_dev_init (&b->dev, &b->vhost_user,VHOST_BACKEND_TYPE_USER ,0 );if (ret <0 ) {error_setg_errno (errp, -ret,"vhost initialization failed" );hw/input/vhost-user-input.c +1
-2@@ -24,7 +24,7 @@ static void vhost_input_realize(DeviceState *dev, Error **errp)return ; } -if (vhost_user_backend_dev_init (vhi->vhost, vdev,2 , errp) ==-1 ) { +if (vhost_user_backend_dev_init (vhi->vhost, vdev,2 , false, errp) ==-1 ) {return ; } --2.20.1.519.g8feddda32c
Signature · 1 line
Marc-André Lureau
Re: [Qemu-devel] [PATCH v3 13/13] RFC: add explicit can_migrate to vhost_user_backend_dev_init()
In reply to Marc-André LureauQuoted 6 lines
Since this is not well specified, add a common blocker for the VhostUserBackend users (vhost-user-input and upcoming gpu will use it).
RFC since I am not sure that's what Michael had in mind when requesting such blocker.
vmstate_vhost_input blocks migration too (via .unmigratable = 1). One way to block live migration is enough.
I think it makes sense to do it per device. virtio-input doesn't carry much state, so live-migrating it shouldn't be that difficuilt. virtio-gpu will be harder ...
cheers,
Gerd
Quoted 14 lines · Marc-André Lureau
Hi,
This series is based on previously discussed "[PATCH v4 00/29] vhost-user for input & GPU" and "vhost-user: define conventions for vhost-user backends" work. The GPU part is left off for now.
This series introduces a "vhost-user-backend": an helper object to be used by vhost-user devices to ease with backend initialization and handling. As a simple showcase, a "vhost-user-input-pci" device is introduced, which can be used with the "contrib: add vhost-user-input" example. vhost-user-input isn't meant to be installed, discovered or used by libvirt: no installation is done (no vhost-user JSON file is provided either).
Quoted 1 line
thanks
Gerd could you please review this?
Thanks!
Quoted 70 lines
v3:
- add previously sent patch "libvhost-user: fix clang enum-conversion warning" to fix clang build
- "define conventions for vhost-user backends" updates after Eric review
- Drop user-creatable from vhost-user-backend
- Make vhost-user-input-pci take a chardev= (instead of vhost-user=)v2:
- rebased (VhostUserInputPCI got most of the changes, due to split)
- added "RFC: add explicitcan_migratetovhost_user_backend_dev_init()" to attempt to address Michael concerns about migration.Marc-André Lureau (13):
libvhost-user: fix clang enum-conversion warning
vhost-user: define conventions for vhost-user backends
vhost-user: simplify vhost_user_init/vhost_user_cleanup
libvhost-user: exit by default onVHOST_USER_NONE
vhost-user: wrap some read/write with retry handling Add vhost-user-backend
vhost-user: splitvhost_user_read()
vhost-user: addvhost_user_input_get_config()
libvhost-user-glib: exportvug_source_new()
libvhost-user: addvu_queue_unpop()
Add vhost-user-input-pci
contrib: add vhost-user-input
RFC: add explicitcan_migratetovhost_user_backend_dev_init()contrib/libvhost-user/libvhost-user-glib.h | 3 + contrib/libvhost-user/libvhost-user.h | 17 +- include/hw/virtio/vhost-backend.h | 4 + include/hw/virtio/vhost-user-blk.h | 2 +- include/hw/virtio/vhost-user-scsi.h | 2 +- include/hw/virtio/vhost-user.h | 2 +- include/hw/virtio/virtio-input.h | 14 + include/sysemu/vhost-user-backend.h | 60 ++++ backends/cryptodev-vhost-user.c | 18 +- backends/vhost-user.c | 218 +++++++++++ contrib/libvhost-user/libvhost-user-glib.c | 11 +- contrib/libvhost-user/libvhost-user.c | 19 +- contrib/vhost-user-input/main.c | 398 +++++++++++++++++++++ hw/block/vhost-user-blk.c | 22 +- hw/input/vhost-user-input.c | 104 ++++++ hw/scsi/vhost-user-scsi.c | 20 +- hw/virtio/vhost-stub.c | 4 +- hw/virtio/vhost-user-input-pci.c | 53 +++ hw/virtio/vhost-user.c | 118 +++++- net/vhost-user.c | 13 +- MAINTAINERS | 5 + Makefile | 3 + Makefile.objs | 1 + backends/Makefile.objs | 3 +- configure | 3 + contrib/vhost-user-input/Makefile.objs | 1 + default-configs/virtio.mak | 1 + docs/interop/vhost-user.json | 232 ++++++++++++ docs/interop/vhost-user.txt | 109 +++++- hw/input/Makefile.objs | 1 + hw/virtio/Makefile.objs | 1 + 31 files changed, 1375 insertions(+), 87 deletions(-) create mode 100644 include/sysemu/vhost-user-backend.h create mode 100644 backends/vhost-user.c create mode 100644 contrib/vhost-user-input/main.c create mode 100644 hw/input/vhost-user-input.c create mode 100644 hw/virtio/vhost-user-input-pci.c create mode 100644 contrib/vhost-user-input/Makefile.objs create mode 100644 docs/interop/vhost-user.jsonSignature · 1 line
2.20.1.519.g8feddda32c
Hi
Quoted 16 lines · Michael S. Tsirkin
Quoted 14 lines · Marc-André Lureau
Hi,
This series is based on previously discussed "[PATCH v4 00/29] vhost-user for input & GPU" and "vhost-user: define conventions for vhost-user backends" work. The GPU part is left off for now.
This series introduces a "vhost-user-backend": an helper object to be used by vhost-user devices to ease with backend initialization and handling. As a simple showcase, a "vhost-user-input-pci" device is introduced, which can be used with the "contrib: add vhost-user-input" example. vhost-user-input isn't meant to be installed, discovered or used by libvirt: no installation is done (no vhost-user JSON file is provided either).
Quoted 4 lines
Quoted 1 line
thanks
Gerd could you please review this?
Thanks!
Except the last patch that (to drop?), are you queuing this series or expecting me to do something else?
thanks
Quoted 72 lines
Quoted 71 lines
v3:
- add previously sent patch "libvhost-user: fix clang enum-conversion warning" to fix clang build
- "define conventions for vhost-user backends" updates after Eric review
- Drop user-creatable from vhost-user-backend
- Make vhost-user-input-pci take a chardev= (instead of vhost-user=)v2:
- rebased (VhostUserInputPCI got most of the changes, due to split)
- added "RFC: add explicitcan_migratetovhost_user_backend_dev_init()" to attempt to address Michael concerns about migration.Marc-André Lureau (13):
libvhost-user: fix clang enum-conversion warning
vhost-user: define conventions for vhost-user backends
vhost-user: simplify vhost_user_init/vhost_user_cleanup
libvhost-user: exit by default onVHOST_USER_NONE
vhost-user: wrap some read/write with retry handling Add vhost-user-backend
vhost-user: splitvhost_user_read()
vhost-user: addvhost_user_input_get_config()
libvhost-user-glib: exportvug_source_new()
libvhost-user: addvu_queue_unpop()
Add vhost-user-input-pci
contrib: add vhost-user-input
RFC: add explicitcan_migratetovhost_user_backend_dev_init()contrib/libvhost-user/libvhost-user-glib.h | 3 + contrib/libvhost-user/libvhost-user.h | 17 +- include/hw/virtio/vhost-backend.h | 4 + include/hw/virtio/vhost-user-blk.h | 2 +- include/hw/virtio/vhost-user-scsi.h | 2 +- include/hw/virtio/vhost-user.h | 2 +- include/hw/virtio/virtio-input.h | 14 + include/sysemu/vhost-user-backend.h | 60 ++++ backends/cryptodev-vhost-user.c | 18 +- backends/vhost-user.c | 218 +++++++++++ contrib/libvhost-user/libvhost-user-glib.c | 11 +- contrib/libvhost-user/libvhost-user.c | 19 +- contrib/vhost-user-input/main.c | 398 +++++++++++++++++++++ hw/block/vhost-user-blk.c | 22 +- hw/input/vhost-user-input.c | 104 ++++++ hw/scsi/vhost-user-scsi.c | 20 +- hw/virtio/vhost-stub.c | 4 +- hw/virtio/vhost-user-input-pci.c | 53 +++ hw/virtio/vhost-user.c | 118 +++++- net/vhost-user.c | 13 +- MAINTAINERS | 5 + Makefile | 3 + Makefile.objs | 1 + backends/Makefile.objs | 3 +- configure | 3 + contrib/vhost-user-input/Makefile.objs | 1 + default-configs/virtio.mak | 1 + docs/interop/vhost-user.json | 232 ++++++++++++ docs/interop/vhost-user.txt | 109 +++++- hw/input/Makefile.objs | 1 + hw/virtio/Makefile.objs | 1 + 31 files changed, 1375 insertions(+), 87 deletions(-) create mode 100644 include/sysemu/vhost-user-backend.h create mode 100644 backends/vhost-user.c create mode 100644 contrib/vhost-user-input/main.c create mode 100644 hw/input/vhost-user-input.c create mode 100644 hw/virtio/vhost-user-input-pci.c create mode 100644 contrib/vhost-user-input/Makefile.objs create mode 100644 docs/interop/vhost-user.json--
2.20.1.519.g8feddda32c
Signature · 1 line
Marc-André Lureau
Quoted 21 lines · Marc-André Lureau
Hi
Quoted 18 lines · Michael S. Tsirkin
Quoted 15 lines · Marc-André Lureau
Hi,
This series is based on previously discussed "[PATCH v4 00/29] vhost-user for input & GPU" and "vhost-user: define conventions for vhost-user backends" work. The GPU part is left off for now.
This series introduces a "vhost-user-backend": an helper object to be used by vhost-user devices to ease with backend initialization and handling. As a simple showcase, a "vhost-user-input-pci" device is introduced, which can be used with the "contrib: add vhost-user-input" example. vhost-user-input isn't meant to be installed, discovered or used by libvirt: no installation is done (no vhost-user JSON file is provided either).
thanks
Quoted 7 lines
Quoted 2 lines
Gerd could you please review this?
Thanks!Except the last patch that (to drop?), are you queuing this series or expecting me to do something else?
thanks
Besides acks I also see unaddressed comments by Daniel and others.
Quoted 76 lines
Quoted 72 lines
Quoted 71 lines
v3:
- add previously sent patch "libvhost-user: fix clang enum-conversion warning" to fix clang build
- "define conventions for vhost-user backends" updates after Eric review
- Drop user-creatable from vhost-user-backend
- Make vhost-user-input-pci take a chardev= (instead of vhost-user=)v2:
- rebased (VhostUserInputPCI got most of the changes, due to split)
- added "RFC: add explicitcan_migratetovhost_user_backend_dev_init()" to attempt to address Michael concerns about migration.Marc-André Lureau (13):
libvhost-user: fix clang enum-conversion warning
vhost-user: define conventions for vhost-user backends
vhost-user: simplify vhost_user_init/vhost_user_cleanup
libvhost-user: exit by default onVHOST_USER_NONE
vhost-user: wrap some read/write with retry handling Add vhost-user-backend
vhost-user: splitvhost_user_read()
vhost-user: addvhost_user_input_get_config()
libvhost-user-glib: exportvug_source_new()
libvhost-user: addvu_queue_unpop()
Add vhost-user-input-pci
contrib: add vhost-user-input
RFC: add explicitcan_migratetovhost_user_backend_dev_init()contrib/libvhost-user/libvhost-user-glib.h | 3 + contrib/libvhost-user/libvhost-user.h | 17 +- include/hw/virtio/vhost-backend.h | 4 + include/hw/virtio/vhost-user-blk.h | 2 +- include/hw/virtio/vhost-user-scsi.h | 2 +- include/hw/virtio/vhost-user.h | 2 +- include/hw/virtio/virtio-input.h | 14 + include/sysemu/vhost-user-backend.h | 60 ++++ backends/cryptodev-vhost-user.c | 18 +- backends/vhost-user.c | 218 +++++++++++ contrib/libvhost-user/libvhost-user-glib.c | 11 +- contrib/libvhost-user/libvhost-user.c | 19 +- contrib/vhost-user-input/main.c | 398 +++++++++++++++++++++ hw/block/vhost-user-blk.c | 22 +- hw/input/vhost-user-input.c | 104 ++++++ hw/scsi/vhost-user-scsi.c | 20 +- hw/virtio/vhost-stub.c | 4 +- hw/virtio/vhost-user-input-pci.c | 53 +++ hw/virtio/vhost-user.c | 118 +++++- net/vhost-user.c | 13 +- MAINTAINERS | 5 + Makefile | 3 + Makefile.objs | 1 + backends/Makefile.objs | 3 +- configure | 3 + contrib/vhost-user-input/Makefile.objs | 1 + default-configs/virtio.mak | 1 + docs/interop/vhost-user.json | 232 ++++++++++++ docs/interop/vhost-user.txt | 109 +++++- hw/input/Makefile.objs | 1 + hw/virtio/Makefile.objs | 1 + 31 files changed, 1375 insertions(+), 87 deletions(-) create mode 100644 include/sysemu/vhost-user-backend.h create mode 100644 backends/vhost-user.c create mode 100644 contrib/vhost-user-input/main.c create mode 100644 hw/input/vhost-user-input.c create mode 100644 hw/virtio/vhost-user-input-pci.c create mode 100644 contrib/vhost-user-input/Makefile.objs create mode 100644 docs/interop/vhost-user.json--
2.20.1.519.g8feddda32cSignature · 1 line
Marc-André Lureau
Hi
Quoted 26 lines · Michael S. Tsirkin
Quoted 24 lines · Marc-André Lureau
Hi
Quoted 20 lines · Michael S. Tsirkin
Quoted 14 lines · Marc-André Lureau
Hi,
This series is based on previously discussed "[PATCH v4 00/29] vhost-user for input & GPU" and "vhost-user: define conventions for vhost-user backends" work. The GPU part is left off for now.
This series introduces a "vhost-user-backend": an helper object to be used by vhost-user devices to ease with backend initialization and handling. As a simple showcase, a "vhost-user-input-pci" device is introduced, which can be used with the "contrib: add vhost-user-input" example. vhost-user-input isn't meant to be installed, discovered or used by libvirt: no installation is done (no vhost-user JSON file is provided either).
Quoted 1 line
thanks
Gerd could you please review this?
Thanks!
Quoted 8 lines
Quoted 4 lines
Except the last patch that (to drop?), are you queuing this series or expecting me to do something else?
thanks
Besides acks I also see unaddressed comments by Daniel and others.
From v3? Yes, there is one field in a struct that should be removed, I
forgot. Gerd can do that on commit, or I can resend the whole thing.
https://patchew.org/QEMU/[email protected]/[email protected]/
Anything else I missed from earlier versions?
thanks
Quoted 77 lines
Quoted 77 lines
Quoted 70 lines
Quoted 70 lines
v3:
- add previously sent patch "libvhost-user: fix clang enum-conversion warning" to fix clang build
- "define conventions for vhost-user backends" updates after Eric review
- Drop user-creatable from vhost-user-backend
- Make vhost-user-input-pci take a chardev= (instead of vhost-user=)v2:
- rebased (VhostUserInputPCI got most of the changes, due to split)
- added "RFC: add explicitcan_migratetovhost_user_backend_dev_init()" to attempt to address Michael concerns about migration.Marc-André Lureau (13):
libvhost-user: fix clang enum-conversion warning
vhost-user: define conventions for vhost-user backends
vhost-user: simplify vhost_user_init/vhost_user_cleanup
libvhost-user: exit by default onVHOST_USER_NONE
vhost-user: wrap some read/write with retry handling Add vhost-user-backend
vhost-user: splitvhost_user_read()
vhost-user: addvhost_user_input_get_config()
libvhost-user-glib: exportvug_source_new()
libvhost-user: addvu_queue_unpop()
Add vhost-user-input-pci
contrib: add vhost-user-input
RFC: add explicitcan_migratetovhost_user_backend_dev_init()contrib/libvhost-user/libvhost-user-glib.h | 3 + contrib/libvhost-user/libvhost-user.h | 17 +- include/hw/virtio/vhost-backend.h | 4 + include/hw/virtio/vhost-user-blk.h | 2 +- include/hw/virtio/vhost-user-scsi.h | 2 +- include/hw/virtio/vhost-user.h | 2 +- include/hw/virtio/virtio-input.h | 14 + include/sysemu/vhost-user-backend.h | 60 ++++ backends/cryptodev-vhost-user.c | 18 +- backends/vhost-user.c | 218 +++++++++++ contrib/libvhost-user/libvhost-user-glib.c | 11 +- contrib/libvhost-user/libvhost-user.c | 19 +- contrib/vhost-user-input/main.c | 398 +++++++++++++++++++++ hw/block/vhost-user-blk.c | 22 +- hw/input/vhost-user-input.c | 104 ++++++ hw/scsi/vhost-user-scsi.c | 20 +- hw/virtio/vhost-stub.c | 4 +- hw/virtio/vhost-user-input-pci.c | 53 +++ hw/virtio/vhost-user.c | 118 +++++- net/vhost-user.c | 13 +- MAINTAINERS | 5 + Makefile | 3 + Makefile.objs | 1 + backends/Makefile.objs | 3 +- configure | 3 + contrib/vhost-user-input/Makefile.objs | 1 + default-configs/virtio.mak | 1 + docs/interop/vhost-user.json | 232 ++++++++++++ docs/interop/vhost-user.txt | 109 +++++- hw/input/Makefile.objs | 1 + hw/virtio/Makefile.objs | 1 + 31 files changed, 1375 insertions(+), 87 deletions(-) create mode 100644 include/sysemu/vhost-user-backend.h create mode 100644 backends/vhost-user.c create mode 100644 contrib/vhost-user-input/main.c create mode 100644 hw/input/vhost-user-input.c create mode 100644 hw/virtio/vhost-user-input-pci.c create mode 100644 contrib/vhost-user-input/Makefile.objs create mode 100644 docs/interop/vhost-user.jsonQuoted 3 lines
Quoted 2 lines
--
2.20.1.519.g8feddda32c--
Marc-André Lureau
Signature · 1 line
Marc-André Lureau
Quoted 36 lines · Marc-André Lureau
Hi
Quoted 32 lines · Michael S. Tsirkin
Quoted 21 lines · Marc-André Lureau
Hi
Quoted 18 lines · Michael S. Tsirkin
Quoted 15 lines · Marc-André Lureau
Hi,
This series is based on previously discussed "[PATCH v4 00/29] vhost-user for input & GPU" and "vhost-user: define conventions for vhost-user backends" work. The GPU part is left off for now.
This series introduces a "vhost-user-backend": an helper object to be used by vhost-user devices to ease with backend initialization and handling. As a simple showcase, a "vhost-user-input-pci" device is introduced, which can be used with the "contrib: add vhost-user-input" example. vhost-user-input isn't meant to be installed, discovered or used by libvirt: no installation is done (no vhost-user JSON file is provided either).
thanks
Quoted 7 lines
Quoted 2 lines
Gerd could you please review this?
Thanks!Except the last patch that (to drop?), are you queuing this series or expecting me to do something else?
thanks
Besides acks I also see unaddressed comments by Daniel and others.
Quoted 8 lines
Quoted 1 line
From v3? Yes, there is one field in a struct that should be removed, I
forgot. Gerd can do that on commit, or I can resend the whole thing.
https://patchew.org/QEMU/[email protected]/[email protected]/
Anything else I missed from earlier versions?
thanks
That's all I have. But I think it's best to post a new version addressing all comments so people can review the final version. And pls indicate which tree you would like to merge it through.
Thanks!
Quoted 82 lines
Quoted 77 lines
Quoted 77 lines
Quoted 70 lines
Quoted 70 lines
v3:
- add previously sent patch "libvhost-user: fix clang enum-conversion warning" to fix clang build
- "define conventions for vhost-user backends" updates after Eric review
- Drop user-creatable from vhost-user-backend
- Make vhost-user-input-pci take a chardev= (instead of vhost-user=)v2:
- rebased (VhostUserInputPCI got most of the changes, due to split)
- added "RFC: add explicitcan_migratetovhost_user_backend_dev_init()" to attempt to address Michael concerns about migration.Marc-André Lureau (13):
libvhost-user: fix clang enum-conversion warning
vhost-user: define conventions for vhost-user backends
vhost-user: simplify vhost_user_init/vhost_user_cleanup
libvhost-user: exit by default onVHOST_USER_NONE
vhost-user: wrap some read/write with retry handling Add vhost-user-backend
vhost-user: splitvhost_user_read()
vhost-user: addvhost_user_input_get_config()
libvhost-user-glib: exportvug_source_new()
libvhost-user: addvu_queue_unpop()
Add vhost-user-input-pci
contrib: add vhost-user-input
RFC: add explicitcan_migratetovhost_user_backend_dev_init()contrib/libvhost-user/libvhost-user-glib.h | 3 + contrib/libvhost-user/libvhost-user.h | 17 +- include/hw/virtio/vhost-backend.h | 4 + include/hw/virtio/vhost-user-blk.h | 2 +- include/hw/virtio/vhost-user-scsi.h | 2 +- include/hw/virtio/vhost-user.h | 2 +- include/hw/virtio/virtio-input.h | 14 + include/sysemu/vhost-user-backend.h | 60 ++++ backends/cryptodev-vhost-user.c | 18 +- backends/vhost-user.c | 218 +++++++++++ contrib/libvhost-user/libvhost-user-glib.c | 11 +- contrib/libvhost-user/libvhost-user.c | 19 +- contrib/vhost-user-input/main.c | 398 +++++++++++++++++++++ hw/block/vhost-user-blk.c | 22 +- hw/input/vhost-user-input.c | 104 ++++++ hw/scsi/vhost-user-scsi.c | 20 +- hw/virtio/vhost-stub.c | 4 +- hw/virtio/vhost-user-input-pci.c | 53 +++ hw/virtio/vhost-user.c | 118 +++++- net/vhost-user.c | 13 +- MAINTAINERS | 5 + Makefile | 3 + Makefile.objs | 1 + backends/Makefile.objs | 3 +- configure | 3 + contrib/vhost-user-input/Makefile.objs | 1 + default-configs/virtio.mak | 1 + docs/interop/vhost-user.json | 232 ++++++++++++ docs/interop/vhost-user.txt | 109 +++++- hw/input/Makefile.objs | 1 + hw/virtio/Makefile.objs | 1 + 31 files changed, 1375 insertions(+), 87 deletions(-) create mode 100644 include/sysemu/vhost-user-backend.h create mode 100644 backends/vhost-user.c create mode 100644 contrib/vhost-user-input/main.c create mode 100644 hw/input/vhost-user-input.c create mode 100644 hw/virtio/vhost-user-input-pci.c create mode 100644 contrib/vhost-user-input/Makefile.objs create mode 100644 docs/interop/vhost-user.jsonQuoted 3 lines
Quoted 2 lines
--
2.20.1.519.g8feddda32c--
Marc-André LureauSignature · 1 line
Marc-André Lureau
Quoted 21 lines · Marc-André Lureau
Hi
Quoted 18 lines · Michael S. Tsirkin
Quoted 15 lines · Marc-André Lureau
Hi,
This series is based on previously discussed "[PATCH v4 00/29] vhost-user for input & GPU" and "vhost-user: define conventions for vhost-user backends" work. The GPU part is left off for now.
This series introduces a "vhost-user-backend": an helper object to be used by vhost-user devices to ease with backend initialization and handling. As a simple showcase, a "vhost-user-input-pci" device is introduced, which can be used with the "contrib: add vhost-user-input" example. vhost-user-input isn't meant to be installed, discovered or used by libvirt: no installation is done (no vhost-user JSON file is provided either).
thanks
Quoted 7 lines
Quoted 2 lines
Gerd could you please review this?
Thanks!Except the last patch that (to drop?), are you queuing this series or expecting me to do something else?
thanks
I think that preferably we'd need Gerd to ack these. He's the most qualified to look at virtio input.
Quoted 76 lines
Quoted 72 lines
Quoted 71 lines
v3:
- add previously sent patch "libvhost-user: fix clang enum-conversion warning" to fix clang build
- "define conventions for vhost-user backends" updates after Eric review
- Drop user-creatable from vhost-user-backend
- Make vhost-user-input-pci take a chardev= (instead of vhost-user=)v2:
- rebased (VhostUserInputPCI got most of the changes, due to split)
- added "RFC: add explicitcan_migratetovhost_user_backend_dev_init()" to attempt to address Michael concerns about migration.Marc-André Lureau (13):
libvhost-user: fix clang enum-conversion warning
vhost-user: define conventions for vhost-user backends
vhost-user: simplify vhost_user_init/vhost_user_cleanup
libvhost-user: exit by default onVHOST_USER_NONE
vhost-user: wrap some read/write with retry handling Add vhost-user-backend
vhost-user: splitvhost_user_read()
vhost-user: addvhost_user_input_get_config()
libvhost-user-glib: exportvug_source_new()
libvhost-user: addvu_queue_unpop()
Add vhost-user-input-pci
contrib: add vhost-user-input
RFC: add explicitcan_migratetovhost_user_backend_dev_init()contrib/libvhost-user/libvhost-user-glib.h | 3 + contrib/libvhost-user/libvhost-user.h | 17 +- include/hw/virtio/vhost-backend.h | 4 + include/hw/virtio/vhost-user-blk.h | 2 +- include/hw/virtio/vhost-user-scsi.h | 2 +- include/hw/virtio/vhost-user.h | 2 +- include/hw/virtio/virtio-input.h | 14 + include/sysemu/vhost-user-backend.h | 60 ++++ backends/cryptodev-vhost-user.c | 18 +- backends/vhost-user.c | 218 +++++++++++ contrib/libvhost-user/libvhost-user-glib.c | 11 +- contrib/libvhost-user/libvhost-user.c | 19 +- contrib/vhost-user-input/main.c | 398 +++++++++++++++++++++ hw/block/vhost-user-blk.c | 22 +- hw/input/vhost-user-input.c | 104 ++++++ hw/scsi/vhost-user-scsi.c | 20 +- hw/virtio/vhost-stub.c | 4 +- hw/virtio/vhost-user-input-pci.c | 53 +++ hw/virtio/vhost-user.c | 118 +++++- net/vhost-user.c | 13 +- MAINTAINERS | 5 + Makefile | 3 + Makefile.objs | 1 + backends/Makefile.objs | 3 +- configure | 3 + contrib/vhost-user-input/Makefile.objs | 1 + default-configs/virtio.mak | 1 + docs/interop/vhost-user.json | 232 ++++++++++++ docs/interop/vhost-user.txt | 109 +++++- hw/input/Makefile.objs | 1 + hw/virtio/Makefile.objs | 1 + 31 files changed, 1375 insertions(+), 87 deletions(-) create mode 100644 include/sysemu/vhost-user-backend.h create mode 100644 backends/vhost-user.c create mode 100644 contrib/vhost-user-input/main.c create mode 100644 hw/input/vhost-user-input.c create mode 100644 hw/virtio/vhost-user-input-pci.c create mode 100644 contrib/vhost-user-input/Makefile.objs create mode 100644 docs/interop/vhost-user.json--
2.20.1.519.g8feddda32cSignature · 1 line
Marc-André Lureau