* [PATCH v3 0/4] virtio: Refactor vhost input stub
@ 2023-11-20 4:37 Leo Yan
2023-11-20 4:37 ` [PATCH v3 1/4] hw/virtio: Support set_config() callback in vhost-user-base Leo Yan
` (6 more replies)
0 siblings, 7 replies; 12+ messages in thread
From: Leo Yan @ 2023-11-20 4:37 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Gerd Hoffmann, Michael S . Tsirkin,
Manos Pitsidianakis, Marc-André Lureau, Leo Yan
This series is to refactor vhost stub vhost-user-input.
Since vhost input stub requires set_config() callback for communication
event configurations between the backend and the guest, patch 01 is a
preparison for support set_config() callback in vhost-user-base.
The patch 02 is to add documentation for vhost-user-input.
The patch 03 is to move virtio input stub from the input folder to the
virtio folder.
The patch 04 derives vhost-user-input from vhost-user-base. We reuse
the common code from vhhost-user-base as possible and the input stub is
simplized significantly.
This patch set has been tested with the backend daemon:
# ./build/contrib/vhost-user-input/vhost-user-input \
-p /dev/input/event20 -s /tmp/input.sock
The series is based on "[PATCH v8 0/7] virtio: cleanup
vhost-user-generic and reduce c&p" which introduces vhost-user-base.
Based-on: <20231107180752.3458672-1-alex.bennee@linaro.org>
Changes from v2:
- Created reference for shared memory object and updated
vhost-user-input.rst respectively. (Marc-André)
Changes from v1:
- Fixed typo in vhost-user-input.rst.
- Updated MAINTAINERS for new added input document and
changing folder for vhost-user-input.c. (Manos)
Leo Yan (4):
hw/virtio: Support set_config() callback in vhost-user-base
docs/system: Add vhost-user-input documentation
hw/virtio: Move vhost-user-input into virtio folder
hw/virtio: derive vhost-user-input from vhost-user-base
MAINTAINERS | 3 +-
docs/system/device-emulation.rst | 1 +
docs/system/devices/vhost-user-input.rst | 45 ++++++++
docs/system/devices/vhost-user.rst | 4 +-
hw/input/meson.build | 1 -
hw/input/vhost-user-input.c | 136 -----------------------
hw/virtio/meson.build | 4 +-
hw/virtio/vhost-user-base.c | 17 +++
hw/virtio/vhost-user-input-pci.c | 3 -
hw/virtio/vhost-user-input.c | 58 ++++++++++
include/hw/virtio/virtio-input.h | 6 +-
11 files changed, 132 insertions(+), 146 deletions(-)
create mode 100644 docs/system/devices/vhost-user-input.rst
delete mode 100644 hw/input/vhost-user-input.c
create mode 100644 hw/virtio/vhost-user-input.c
--
2.39.2
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v3 1/4] hw/virtio: Support set_config() callback in vhost-user-base
2023-11-20 4:37 [PATCH v3 0/4] virtio: Refactor vhost input stub Leo Yan
@ 2023-11-20 4:37 ` Leo Yan
2023-11-20 4:37 ` [PATCH v3 2/4] docs/system: Add vhost-user-input documentation Leo Yan
` (5 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Leo Yan @ 2023-11-20 4:37 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Gerd Hoffmann, Michael S . Tsirkin,
Manos Pitsidianakis, Marc-André Lureau, Leo Yan
The Virtio input device invokes set_config() callback for retrieving
the event configuration info, but the callback is not supported in
vhost-user-base.
This patch adds support set_config() callback in vhost-user-base.
Signed-off-by: Leo Yan <leo.yan@linaro.org>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
hw/virtio/vhost-user-base.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/hw/virtio/vhost-user-base.c b/hw/virtio/vhost-user-base.c
index 78cfa9a5bb..a83167191e 100644
--- a/hw/virtio/vhost-user-base.c
+++ b/hw/virtio/vhost-user-base.c
@@ -140,6 +140,22 @@ static void vub_get_config(VirtIODevice *vdev, uint8_t *config)
}
}
+static void vub_set_config(VirtIODevice *vdev, const uint8_t *config_data)
+{
+ VHostUserBase *vub = VHOST_USER_BASE(vdev);
+ int ret;
+
+ g_assert(vub->config_size && vub->vhost_user.supports_config == true);
+
+ ret = vhost_dev_set_config(&vub->vhost_dev, config_data,
+ 0, vub->config_size,
+ VHOST_SET_CONFIG_TYPE_FRONTEND);
+ if (ret) {
+ error_report("vhost guest set device config space failed: %d", ret);
+ return;
+ }
+}
+
/*
* When the daemon signals an update to the config we just need to
* signal the guest as we re-read the config on demand above.
@@ -337,6 +353,7 @@ static void vub_class_init(ObjectClass *klass, void *data)
vdc->unrealize = vub_device_unrealize;
vdc->get_features = vub_get_features;
vdc->get_config = vub_get_config;
+ vdc->set_config = vub_set_config;
vdc->set_status = vub_set_status;
}
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v3 2/4] docs/system: Add vhost-user-input documentation
2023-11-20 4:37 [PATCH v3 0/4] virtio: Refactor vhost input stub Leo Yan
2023-11-20 4:37 ` [PATCH v3 1/4] hw/virtio: Support set_config() callback in vhost-user-base Leo Yan
@ 2023-11-20 4:37 ` Leo Yan
2023-11-20 4:37 ` [PATCH v3 3/4] hw/virtio: Move vhost-user-input into virtio folder Leo Yan
` (4 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Leo Yan @ 2023-11-20 4:37 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Gerd Hoffmann, Michael S . Tsirkin,
Manos Pitsidianakis, Marc-André Lureau, Leo Yan
This adds basic documentation for vhost-user-input.
Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
MAINTAINERS | 1 +
docs/system/device-emulation.rst | 1 +
docs/system/devices/vhost-user-input.rst | 45 ++++++++++++++++++++++++
docs/system/devices/vhost-user.rst | 4 ++-
4 files changed, 50 insertions(+), 1 deletion(-)
create mode 100644 docs/system/devices/vhost-user-input.rst
diff --git a/MAINTAINERS b/MAINTAINERS
index 0624d67932..8a26fe9493 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2262,6 +2262,7 @@ L: virtio-fs@lists.linux.dev
virtio-input
M: Gerd Hoffmann <kraxel@redhat.com>
S: Odd Fixes
+F: docs/system/devices/vhost-user-input.rst
F: hw/input/vhost-user-input.c
F: hw/input/virtio-input*.c
F: include/hw/virtio/virtio-input.h
diff --git a/docs/system/device-emulation.rst b/docs/system/device-emulation.rst
index d1f3277cb0..f19777411c 100644
--- a/docs/system/device-emulation.rst
+++ b/docs/system/device-emulation.rst
@@ -94,6 +94,7 @@ Emulated Devices
devices/virtio-gpu.rst
devices/virtio-pmem.rst
devices/virtio-snd.rst
+ devices/vhost-user-input.rst
devices/vhost-user-rng.rst
devices/canokey.rst
devices/usb-u2f.rst
diff --git a/docs/system/devices/vhost-user-input.rst b/docs/system/devices/vhost-user-input.rst
new file mode 100644
index 0000000000..118eb78101
--- /dev/null
+++ b/docs/system/devices/vhost-user-input.rst
@@ -0,0 +1,45 @@
+.. _vhost_user_input:
+
+QEMU vhost-user-input - Input emulation
+=======================================
+
+This document describes the setup and usage of the Virtio input device.
+The Virtio input device is a paravirtualized device for input events.
+
+Description
+-----------
+
+The vhost-user-input device implementation was designed to work with a daemon
+polling on input devices and passes input events to the guest.
+
+QEMU provides a backend implementation in contrib/vhost-user-input.
+
+Linux kernel support
+--------------------
+
+Virtio input requires a guest Linux kernel built with the
+``CONFIG_VIRTIO_INPUT`` option.
+
+Examples
+--------
+
+The backend daemon should be started first:
+
+::
+
+ host# vhost-user-input --socket-path=input.sock \
+ --evdev-path=/dev/input/event17
+
+The QEMU invocation needs to create a chardev socket to communicate with the
+backend daemon and access the VirtIO queues with the guest over the
+:ref:`shared memory <shared_memory_object>`.
+
+::
+
+ host# qemu-system \
+ -chardev socket,path=/tmp/input.sock,id=mouse0 \
+ -device vhost-user-input-pci,chardev=mouse0 \
+ -m 4096 \
+ -object memory-backend-file,id=mem,size=4G,mem-path=/dev/shm,share=on \
+ -numa node,memdev=mem \
+ ...
diff --git a/docs/system/devices/vhost-user.rst b/docs/system/devices/vhost-user.rst
index c6afc4836f..9b2da106ce 100644
--- a/docs/system/devices/vhost-user.rst
+++ b/docs/system/devices/vhost-user.rst
@@ -42,7 +42,7 @@ platform details for what sort of virtio bus to use.
- See https://github.com/rust-vmm/vhost-device
* - vhost-user-input
- Generic input driver
- - See contrib/vhost-user-input
+ - :ref:`vhost_user_input`
* - vhost-user-rng
- Entropy driver
- :ref:`vhost_user_rng`
@@ -91,6 +91,8 @@ following the :ref:`vhost_user_proto`. There are a number of daemons
that can be built when enabled by the project although any daemon that
meets the specification for a given device can be used.
+.. _shared_memory_object:
+
Shared memory object
====================
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v3 3/4] hw/virtio: Move vhost-user-input into virtio folder
2023-11-20 4:37 [PATCH v3 0/4] virtio: Refactor vhost input stub Leo Yan
2023-11-20 4:37 ` [PATCH v3 1/4] hw/virtio: Support set_config() callback in vhost-user-base Leo Yan
2023-11-20 4:37 ` [PATCH v3 2/4] docs/system: Add vhost-user-input documentation Leo Yan
@ 2023-11-20 4:37 ` Leo Yan
2023-11-20 5:17 ` Manos Pitsidianakis
2023-11-20 4:37 ` [PATCH v3 4/4] hw/virtio: derive vhost-user-input from vhost-user-base Leo Yan
` (3 subsequent siblings)
6 siblings, 1 reply; 12+ messages in thread
From: Leo Yan @ 2023-11-20 4:37 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Gerd Hoffmann, Michael S . Tsirkin,
Manos Pitsidianakis, Marc-André Lureau, Leo Yan
vhost-user-input is in the input folder. On the other hand, the folder
'hw/virtio' maintains other virtio stubs (e.g. I2C, RNG, GPIO, etc).
This patch moves vhost-user-input into the virtio folder for better code
organization. No functionality change.
Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
MAINTAINERS | 2 +-
hw/input/meson.build | 1 -
hw/virtio/meson.build | 4 +++-
hw/{input => virtio}/vhost-user-input.c | 0
4 files changed, 4 insertions(+), 3 deletions(-)
rename hw/{input => virtio}/vhost-user-input.c (100%)
diff --git a/MAINTAINERS b/MAINTAINERS
index 8a26fe9493..fdc3edc6cb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2263,8 +2263,8 @@ virtio-input
M: Gerd Hoffmann <kraxel@redhat.com>
S: Odd Fixes
F: docs/system/devices/vhost-user-input.rst
-F: hw/input/vhost-user-input.c
F: hw/input/virtio-input*.c
+F: hw/virtio/vhost-user-input.c
F: include/hw/virtio/virtio-input.h
F: contrib/vhost-user-input/*
diff --git a/hw/input/meson.build b/hw/input/meson.build
index 640556bbbc..3cc8ab85f0 100644
--- a/hw/input/meson.build
+++ b/hw/input/meson.build
@@ -11,7 +11,6 @@ system_ss.add(when: 'CONFIG_TSC2005', if_true: files('tsc2005.c'))
system_ss.add(when: 'CONFIG_VIRTIO_INPUT', if_true: files('virtio-input.c'))
system_ss.add(when: 'CONFIG_VIRTIO_INPUT', if_true: files('virtio-input-hid.c'))
system_ss.add(when: 'CONFIG_VIRTIO_INPUT_HOST', if_true: files('virtio-input-host.c'))
-system_ss.add(when: 'CONFIG_VHOST_USER_INPUT', if_true: files('vhost-user-input.c'))
system_ss.add(when: 'CONFIG_PXA2XX', if_true: files('pxa2xx_keypad.c'))
system_ss.add(when: 'CONFIG_TSC210X', if_true: files('tsc210x.c'))
diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build
index 118d4d4da7..c924afcafc 100644
--- a/hw/virtio/meson.build
+++ b/hw/virtio/meson.build
@@ -25,6 +25,7 @@ if have_vhost
system_virtio_ss.add(when: 'CONFIG_VHOST_USER_I2C', if_true: files('vhost-user-i2c.c'))
system_virtio_ss.add(when: 'CONFIG_VHOST_USER_RNG', if_true: files('vhost-user-rng.c'))
system_virtio_ss.add(when: 'CONFIG_VHOST_USER_SND', if_true: files('vhost-user-snd.c'))
+ system_virtio_ss.add(when: 'CONFIG_VHOST_USER_INPUT', if_true: files('vhost-user-input.c'))
# PCI Stubs
system_virtio_ss.add(when: 'CONFIG_VIRTIO_PCI', if_true: files('vhost-user-device-pci.c'))
@@ -36,6 +37,8 @@ if have_vhost
if_true: files('vhost-user-rng-pci.c'))
system_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_SND'],
if_true: files('vhost-user-snd-pci.c'))
+ system_virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_INPUT'],
+ if_true: files('vhost-user-input-pci.c'))
endif
if have_vhost_vdpa
system_virtio_ss.add(files('vhost-vdpa.c'))
@@ -59,7 +62,6 @@ virtio_pci_ss = ss.source_set()
virtio_pci_ss.add(when: 'CONFIG_VHOST_VSOCK', if_true: files('vhost-vsock-pci.c'))
virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_VSOCK', if_true: files('vhost-user-vsock-pci.c'))
virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_BLK', if_true: files('vhost-user-blk-pci.c'))
-virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_INPUT', if_true: files('vhost-user-input-pci.c'))
virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_SCSI', if_true: files('vhost-user-scsi-pci.c'))
virtio_pci_ss.add(when: 'CONFIG_VHOST_SCSI', if_true: files('vhost-scsi-pci.c'))
virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_FS', if_true: files('vhost-user-fs-pci.c'))
diff --git a/hw/input/vhost-user-input.c b/hw/virtio/vhost-user-input.c
similarity index 100%
rename from hw/input/vhost-user-input.c
rename to hw/virtio/vhost-user-input.c
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v3 4/4] hw/virtio: derive vhost-user-input from vhost-user-base
2023-11-20 4:37 [PATCH v3 0/4] virtio: Refactor vhost input stub Leo Yan
` (2 preceding siblings ...)
2023-11-20 4:37 ` [PATCH v3 3/4] hw/virtio: Move vhost-user-input into virtio folder Leo Yan
@ 2023-11-20 4:37 ` Leo Yan
2023-11-20 5:20 ` Manos Pitsidianakis
2023-11-20 9:20 ` [PATCH v3 0/4] virtio: Refactor vhost input stub Michael S. Tsirkin
` (2 subsequent siblings)
6 siblings, 1 reply; 12+ messages in thread
From: Leo Yan @ 2023-11-20 4:37 UTC (permalink / raw)
To: qemu-devel
Cc: Alex Bennée, Gerd Hoffmann, Michael S . Tsirkin,
Manos Pitsidianakis, Marc-André Lureau, Leo Yan
This patch derives vhost-user-input from vhost-user-base class, so make
the input stub as a simpler boilerplate wrapper.
With the refactoring, vhost-user-input adds the property 'chardev', this
leads to conflict with the vhost-user-input-pci adds the same property.
To resolve the error, remove the duplicate property from
vhost-user-input-pci.
Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
hw/virtio/vhost-user-input-pci.c | 3 -
hw/virtio/vhost-user-input.c | 114 +++++--------------------------
include/hw/virtio/virtio-input.h | 6 +-
3 files changed, 21 insertions(+), 102 deletions(-)
diff --git a/hw/virtio/vhost-user-input-pci.c b/hw/virtio/vhost-user-input-pci.c
index b858898a36..3f4761ce88 100644
--- a/hw/virtio/vhost-user-input-pci.c
+++ b/hw/virtio/vhost-user-input-pci.c
@@ -30,9 +30,6 @@ static void vhost_user_input_pci_instance_init(Object *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");
}
static const VirtioPCIDeviceTypeInfo vhost_user_input_pci_info = {
diff --git a/hw/virtio/vhost-user-input.c b/hw/virtio/vhost-user-input.c
index 4ee3542106..bedec0468c 100644
--- a/hw/virtio/vhost-user-input.c
+++ b/hw/virtio/vhost-user-input.c
@@ -5,83 +5,25 @@
*/
#include "qemu/osdep.h"
-#include "qemu/error-report.h"
-#include "qapi/error.h"
-
#include "hw/virtio/virtio-input.h"
-static int vhost_input_config_change(struct vhost_dev *dev)
-{
- error_report("vhost-user-input: unhandled backend config change");
- return -1;
-}
-
-static const VhostDevConfigOps config_ops = {
- .vhost_dev_config_notifier = vhost_input_config_change,
+static Property vinput_properties[] = {
+ DEFINE_PROP_CHR("chardev", VHostUserBase, chardev),
+ DEFINE_PROP_END_OF_LIST(),
};
-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);
-
- vhost_dev_set_config_notifier(&vhi->vhost->dev, &config_ops);
- vinput->cfg_size = sizeof_field(virtio_input_config, u);
- if (vhost_user_backend_dev_init(vhi->vhost, vdev, 2, errp) == -1) {
- return;
- }
-}
-
-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 void vhost_input_get_config(VirtIODevice *vdev, uint8_t *config_data)
-{
- VirtIOInput *vinput = VIRTIO_INPUT(vdev);
- VHostUserInput *vhi = VHOST_USER_INPUT(vdev);
- Error *local_err = NULL;
- int ret;
-
- memset(config_data, 0, vinput->cfg_size);
-
- ret = vhost_dev_get_config(&vhi->vhost->dev, config_data, vinput->cfg_size,
- &local_err);
- if (ret) {
- error_report_err(local_err);
- return;
- }
-}
-
-static void vhost_input_set_config(VirtIODevice *vdev,
- const uint8_t *config_data)
+static void vinput_realize(DeviceState *dev, Error **errp)
{
- VHostUserInput *vhi = VHOST_USER_INPUT(vdev);
- int ret;
+ VHostUserBase *vub = VHOST_USER_BASE(dev);
+ VHostUserBaseClass *vubc = VHOST_USER_BASE_GET_CLASS(dev);
- ret = vhost_dev_set_config(&vhi->vhost->dev, config_data,
- 0, sizeof(virtio_input_config),
- VHOST_SET_CONFIG_TYPE_FRONTEND);
- if (ret) {
- error_report("vhost-user-input: set device config space failed");
- return;
- }
+ /* Fixed for input device */
+ vub->virtio_id = VIRTIO_ID_INPUT;
+ vub->num_vqs = 2;
+ vub->vq_size = 4;
+ vub->config_size = sizeof(virtio_input_config);
- virtio_notify_config(vdev);
-}
-
-static struct vhost_dev *vhost_input_get_vhost(VirtIODevice *vdev)
-{
- VHostUserInput *vhi = VHOST_USER_INPUT(vdev);
- return &vhi->vhost->dev;
+ vubc->parent_realize(dev, errp);
}
static const VMStateDescription vmstate_vhost_input = {
@@ -91,40 +33,20 @@ static const VMStateDescription vmstate_vhost_input = {
static void vhost_input_class_init(ObjectClass *klass, void *data)
{
- VirtIOInputClass *vic = VIRTIO_INPUT_CLASS(klass);
- VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
+ VHostUserBaseClass *vubc = VHOST_USER_BASE_CLASS(klass);
DeviceClass *dc = DEVICE_CLASS(klass);
dc->vmsd = &vmstate_vhost_input;
- vdc->get_config = vhost_input_get_config;
- vdc->set_config = vhost_input_set_config;
- vdc->get_vhost = vhost_input_get_vhost;
- 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);
-
- vhi->vhost = VHOST_USER_BACKEND(object_new(TYPE_VHOST_USER_BACKEND));
- object_property_add_alias(obj, "chardev",
- OBJECT(vhi->vhost), "chardev");
-}
-
-static void vhost_input_finalize(Object *obj)
-{
- VHostUserInput *vhi = VHOST_USER_INPUT(obj);
-
- object_unref(OBJECT(vhi->vhost));
+ device_class_set_props(dc, vinput_properties);
+ device_class_set_parent_realize(dc, vinput_realize,
+ &vubc->parent_realize);
+ set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
}
static const TypeInfo vhost_input_info = {
.name = TYPE_VHOST_USER_INPUT,
- .parent = TYPE_VIRTIO_INPUT,
+ .parent = TYPE_VHOST_USER_BASE,
.instance_size = sizeof(VHostUserInput),
- .instance_init = vhost_input_init,
- .instance_finalize = vhost_input_finalize,
.class_init = vhost_input_class_init,
};
diff --git a/include/hw/virtio/virtio-input.h b/include/hw/virtio/virtio-input.h
index a6c9703644..e69c0aeca3 100644
--- a/include/hw/virtio/virtio-input.h
+++ b/include/hw/virtio/virtio-input.h
@@ -1,6 +1,8 @@
#ifndef QEMU_VIRTIO_INPUT_H
#define QEMU_VIRTIO_INPUT_H
+#include "hw/virtio/vhost-user.h"
+#include "hw/virtio/vhost-user-base.h"
#include "ui/input.h"
#include "sysemu/vhost-user-backend.h"
@@ -97,9 +99,7 @@ struct VirtIOInputHost {
};
struct VHostUserInput {
- VirtIOInput parent_obj;
-
- VhostUserBackend *vhost;
+ VHostUserBase parent_obj;
};
void virtio_input_send(VirtIOInput *vinput, virtio_input_event *event);
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v3 3/4] hw/virtio: Move vhost-user-input into virtio folder
2023-11-20 4:37 ` [PATCH v3 3/4] hw/virtio: Move vhost-user-input into virtio folder Leo Yan
@ 2023-11-20 5:17 ` Manos Pitsidianakis
0 siblings, 0 replies; 12+ messages in thread
From: Manos Pitsidianakis @ 2023-11-20 5:17 UTC (permalink / raw)
To: Leo Yan, qemu-devel
Cc: Alex Benné e, Gerd Hoffmann, Michael S . Tsirkin,
Manos Pitsidianakis, Marc-André Lureau, Leo Yan
On Mon, 20 Nov 2023 06:37, Leo Yan <leo.yan@linaro.org> wrote:
>vhost-user-input is in the input folder. On the other hand, the folder
>'hw/virtio' maintains other virtio stubs (e.g. I2C, RNG, GPIO, etc).
>
>This patch moves vhost-user-input into the virtio folder for better code
>organization. No functionality change.
>
>Signed-off-by: Leo Yan <leo.yan@linaro.org>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 4/4] hw/virtio: derive vhost-user-input from vhost-user-base
2023-11-20 4:37 ` [PATCH v3 4/4] hw/virtio: derive vhost-user-input from vhost-user-base Leo Yan
@ 2023-11-20 5:20 ` Manos Pitsidianakis
0 siblings, 0 replies; 12+ messages in thread
From: Manos Pitsidianakis @ 2023-11-20 5:20 UTC (permalink / raw)
To: Leo Yan, qemu-devel
Cc: Alex Benné e, Gerd Hoffmann, Michael S . Tsirkin,
Manos Pitsidianakis, Marc-André Lureau, Leo Yan
On Mon, 20 Nov 2023 06:37, Leo Yan <leo.yan@linaro.org> wrote:
>This patch derives vhost-user-input from vhost-user-base class, so make
>the input stub as a simpler boilerplate wrapper.
>
>With the refactoring, vhost-user-input adds the property 'chardev', this
>leads to conflict with the vhost-user-input-pci adds the same property.
>To resolve the error, remove the duplicate property from
>vhost-user-input-pci.
>
>Signed-off-by: Leo Yan <leo.yan@linaro.org>
>---
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 0/4] virtio: Refactor vhost input stub
2023-11-20 4:37 [PATCH v3 0/4] virtio: Refactor vhost input stub Leo Yan
` (3 preceding siblings ...)
2023-11-20 4:37 ` [PATCH v3 4/4] hw/virtio: derive vhost-user-input from vhost-user-base Leo Yan
@ 2023-11-20 9:20 ` Michael S. Tsirkin
2023-12-25 16:06 ` Michael S. Tsirkin
2024-01-04 12:34 ` Alex Bennée
6 siblings, 0 replies; 12+ messages in thread
From: Michael S. Tsirkin @ 2023-11-20 9:20 UTC (permalink / raw)
To: Leo Yan
Cc: qemu-devel, Alex Bennée, Gerd Hoffmann, Manos Pitsidianakis,
Marc-André Lureau
On Mon, Nov 20, 2023 at 12:37:17PM +0800, Leo Yan wrote:
> This series is to refactor vhost stub vhost-user-input.
I tagged this. Given we are in freeze, this will me merged
after the release. To help make sure I don't lose this
please ping me after the release. Thanks!
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 0/4] virtio: Refactor vhost input stub
2023-11-20 4:37 [PATCH v3 0/4] virtio: Refactor vhost input stub Leo Yan
` (4 preceding siblings ...)
2023-11-20 9:20 ` [PATCH v3 0/4] virtio: Refactor vhost input stub Michael S. Tsirkin
@ 2023-12-25 16:06 ` Michael S. Tsirkin
2023-12-29 9:01 ` Leo Yan
2024-01-04 12:34 ` Alex Bennée
6 siblings, 1 reply; 12+ messages in thread
From: Michael S. Tsirkin @ 2023-12-25 16:06 UTC (permalink / raw)
To: Leo Yan
Cc: qemu-devel, Alex Bennée, Gerd Hoffmann, Manos Pitsidianakis,
Marc-André Lureau
On Mon, Nov 20, 2023 at 12:37:17PM +0800, Leo Yan wrote:
> This series is to refactor vhost stub vhost-user-input.
>
> Since vhost input stub requires set_config() callback for communication
> event configurations between the backend and the guest, patch 01 is a
> preparison for support set_config() callback in vhost-user-base.
>
> The patch 02 is to add documentation for vhost-user-input.
>
> The patch 03 is to move virtio input stub from the input folder to the
> virtio folder.
Thanks!
Now the release is out I'd like to apply this - can you please rebase on latest master and
repost?
> The patch 04 derives vhost-user-input from vhost-user-base. We reuse
> the common code from vhhost-user-base as possible and the input stub is
> simplized significantly.
>
> This patch set has been tested with the backend daemon:
>
> # ./build/contrib/vhost-user-input/vhost-user-input \
> -p /dev/input/event20 -s /tmp/input.sock
>
> The series is based on "[PATCH v8 0/7] virtio: cleanup
> vhost-user-generic and reduce c&p" which introduces vhost-user-base.
> Based-on: <20231107180752.3458672-1-alex.bennee@linaro.org>
>
> Changes from v2:
> - Created reference for shared memory object and updated
> vhost-user-input.rst respectively. (Marc-André)
>
> Changes from v1:
> - Fixed typo in vhost-user-input.rst.
> - Updated MAINTAINERS for new added input document and
> changing folder for vhost-user-input.c. (Manos)
>
>
> Leo Yan (4):
> hw/virtio: Support set_config() callback in vhost-user-base
> docs/system: Add vhost-user-input documentation
> hw/virtio: Move vhost-user-input into virtio folder
> hw/virtio: derive vhost-user-input from vhost-user-base
>
> MAINTAINERS | 3 +-
> docs/system/device-emulation.rst | 1 +
> docs/system/devices/vhost-user-input.rst | 45 ++++++++
> docs/system/devices/vhost-user.rst | 4 +-
> hw/input/meson.build | 1 -
> hw/input/vhost-user-input.c | 136 -----------------------
> hw/virtio/meson.build | 4 +-
> hw/virtio/vhost-user-base.c | 17 +++
> hw/virtio/vhost-user-input-pci.c | 3 -
> hw/virtio/vhost-user-input.c | 58 ++++++++++
> include/hw/virtio/virtio-input.h | 6 +-
> 11 files changed, 132 insertions(+), 146 deletions(-)
> create mode 100644 docs/system/devices/vhost-user-input.rst
> delete mode 100644 hw/input/vhost-user-input.c
> create mode 100644 hw/virtio/vhost-user-input.c
>
> --
> 2.39.2
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 0/4] virtio: Refactor vhost input stub
2023-12-25 16:06 ` Michael S. Tsirkin
@ 2023-12-29 9:01 ` Leo Yan
2024-01-03 13:25 ` Alex Bennée
0 siblings, 1 reply; 12+ messages in thread
From: Leo Yan @ 2023-12-29 9:01 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: qemu-devel, Alex Bennée, Gerd Hoffmann, Manos Pitsidianakis,
Marc-André Lureau
Hi Michael,
On Mon, Dec 25, 2023 at 11:06:35AM -0500, Michael S. Tsirkin wrote:
> On Mon, Nov 20, 2023 at 12:37:17PM +0800, Leo Yan wrote:
> > This series is to refactor vhost stub vhost-user-input.
> >
> > Since vhost input stub requires set_config() callback for communication
> > event configurations between the backend and the guest, patch 01 is a
> > preparison for support set_config() callback in vhost-user-base.
> >
> > The patch 02 is to add documentation for vhost-user-input.
> >
> > The patch 03 is to move virtio input stub from the input folder to the
> > virtio folder.
>
> Thanks!
> Now the release is out I'd like to apply this - can you please rebase on latest master and
> repost?
Sure. But I found it's not this patch series causing merging conflict.
Since my patch series is based on Alex's patch series "virtio: cleanup
vhost-user-generic and reduce c&p" [1], when applying Alex's patch
series on the master branch, I found the confliction with below commeits:
91208dd297 ("virtio: i2c: Check notifier helpers for VIRTIO_CONFIG_IRQ_IDX")
298d4f892e ("vhost-user: fix the reconnect error")
@Alex, could you rebase the patch set "virtio: cleanup
vhost-user-generic and reduce c&p" and then I will resend my patch set?
Thanks,
Leo
[1] https://lore.kernel.org/qemu-devel/20231107180752.3458672-1-alex.bennee@linaro.org/
> > The patch 04 derives vhost-user-input from vhost-user-base. We reuse
> > the common code from vhhost-user-base as possible and the input stub is
> > simplized significantly.
> >
> > This patch set has been tested with the backend daemon:
> >
> > # ./build/contrib/vhost-user-input/vhost-user-input \
> > -p /dev/input/event20 -s /tmp/input.sock
> >
> > The series is based on "[PATCH v8 0/7] virtio: cleanup
> > vhost-user-generic and reduce c&p" which introduces vhost-user-base.
> > Based-on: <20231107180752.3458672-1-alex.bennee@linaro.org>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 0/4] virtio: Refactor vhost input stub
2023-12-29 9:01 ` Leo Yan
@ 2024-01-03 13:25 ` Alex Bennée
0 siblings, 0 replies; 12+ messages in thread
From: Alex Bennée @ 2024-01-03 13:25 UTC (permalink / raw)
To: Leo Yan
Cc: Michael S. Tsirkin, qemu-devel, Gerd Hoffmann,
Manos Pitsidianakis, Marc-André Lureau
Leo Yan <leo.yan@linaro.org> writes:
> Hi Michael,
>
> On Mon, Dec 25, 2023 at 11:06:35AM -0500, Michael S. Tsirkin wrote:
>> On Mon, Nov 20, 2023 at 12:37:17PM +0800, Leo Yan wrote:
>> > This series is to refactor vhost stub vhost-user-input.
>> >
>> > Since vhost input stub requires set_config() callback for communication
>> > event configurations between the backend and the guest, patch 01 is a
>> > preparison for support set_config() callback in vhost-user-base.
>> >
>> > The patch 02 is to add documentation for vhost-user-input.
>> >
>> > The patch 03 is to move virtio input stub from the input folder to the
>> > virtio folder.
>>
>> Thanks!
>> Now the release is out I'd like to apply this - can you please rebase on latest master and
>> repost?
>
> Sure. But I found it's not this patch series causing merging conflict.
>
> Since my patch series is based on Alex's patch series "virtio: cleanup
> vhost-user-generic and reduce c&p" [1], when applying Alex's patch
> series on the master branch, I found the confliction with below commeits:
>
> 91208dd297 ("virtio: i2c: Check notifier helpers for VIRTIO_CONFIG_IRQ_IDX")
> 298d4f892e ("vhost-user: fix the reconnect error")
>
> @Alex, could you rebase the patch set "virtio: cleanup
> vhost-user-generic and reduce c&p" and then I will resend my patch set?
>
> Thanks,
> Leo
>
> [1] https://lore.kernel.org/qemu-devel/20231107180752.3458672-1-alex.bennee@linaro.org/
>
>> > The patch 04 derives vhost-user-input from vhost-user-base. We reuse
>> > the common code from vhhost-user-base as possible and the input stub is
>> > simplized significantly.
>> >
>> > This patch set has been tested with the backend daemon:
>> >
>> > # ./build/contrib/vhost-user-input/vhost-user-input \
>> > -p /dev/input/event20 -s /tmp/input.sock
>> >
>> > The series is based on "[PATCH v8 0/7] virtio: cleanup
>> > vhost-user-generic and reduce c&p" which introduces vhost-user-base.
>> > Based-on: <20231107180752.3458672-1-alex.bennee@linaro.org>
I'll fix up and include this series in my next posting. Hopefully by the
end of this week.
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 0/4] virtio: Refactor vhost input stub
2023-11-20 4:37 [PATCH v3 0/4] virtio: Refactor vhost input stub Leo Yan
` (5 preceding siblings ...)
2023-12-25 16:06 ` Michael S. Tsirkin
@ 2024-01-04 12:34 ` Alex Bennée
6 siblings, 0 replies; 12+ messages in thread
From: Alex Bennée @ 2024-01-04 12:34 UTC (permalink / raw)
To: Leo Yan
Cc: qemu-devel, Gerd Hoffmann, Michael S . Tsirkin,
Manos Pitsidianakis, Marc-André Lureau
Leo Yan <leo.yan@linaro.org> writes:
> This series is to refactor vhost stub vhost-user-input.
>
> Since vhost input stub requires set_config() callback for communication
> event configurations between the backend and the guest, patch 01 is a
> preparison for support set_config() callback in vhost-user-base.
Queued to virtio/vhost-user-device, thanks.
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2024-01-04 12:34 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-20 4:37 [PATCH v3 0/4] virtio: Refactor vhost input stub Leo Yan
2023-11-20 4:37 ` [PATCH v3 1/4] hw/virtio: Support set_config() callback in vhost-user-base Leo Yan
2023-11-20 4:37 ` [PATCH v3 2/4] docs/system: Add vhost-user-input documentation Leo Yan
2023-11-20 4:37 ` [PATCH v3 3/4] hw/virtio: Move vhost-user-input into virtio folder Leo Yan
2023-11-20 5:17 ` Manos Pitsidianakis
2023-11-20 4:37 ` [PATCH v3 4/4] hw/virtio: derive vhost-user-input from vhost-user-base Leo Yan
2023-11-20 5:20 ` Manos Pitsidianakis
2023-11-20 9:20 ` [PATCH v3 0/4] virtio: Refactor vhost input stub Michael S. Tsirkin
2023-12-25 16:06 ` Michael S. Tsirkin
2023-12-29 9:01 ` Leo Yan
2024-01-03 13:25 ` Alex Bennée
2024-01-04 12:34 ` Alex Bennée
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).