summary refs log tree commit diff stats
path: root/hw/virtio/vhost-user-input-pci.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2019-05-13 12:46:47 +0100
committerPeter Maydell <peter.maydell@linaro.org>2019-05-13 12:46:48 +0100
commit082b4061a4a28549bcb22ba3bab8e477e4fca018 (patch)
tree4dc5d995a1a4106ad79d7153cad25510cd8e4c83 /hw/virtio/vhost-user-input-pci.c
parent04d6556c5c91d6b00c70df7b85e1715a7c7870df (diff)
parent503591cb6c28c3ddbe38ea50cab2f0dd3d6cd929 (diff)
downloadfocaccia-qemu-082b4061a4a28549bcb22ba3bab8e477e4fca018.tar.gz
focaccia-qemu-082b4061a4a28549bcb22ba3bab8e477e4fca018.zip
Merge remote-tracking branch 'remotes/kraxel/tags/input-20190513-v2-pull-request' into staging
input: add vhost-user-input, virtio-input fixes.

# gpg: Signature made Mon 13 May 2019 07:52:39 BST
# gpg:                using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/input-20190513-v2-pull-request:
  virtio-input: fix Kconfig dependency and Makefile
  virtio-input-host-pci: cleanup types
  util: simplify unix_listen()
  Add vhost-user-input-pci
  Add vhost-user-backend
  libvhost-user: add PROTOCOL_F_CONFIG if {set, get}_config
  libvhost-user: fix -Waddress-of-packed-member

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/virtio/vhost-user-input-pci.c')
-rw-r--r--hw/virtio/vhost-user-input-pci.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/hw/virtio/vhost-user-input-pci.c b/hw/virtio/vhost-user-input-pci.c
new file mode 100644
index 0000000000..ae9cff9aed
--- /dev/null
+++ b/hw/virtio/vhost-user-input-pci.c
@@ -0,0 +1,50 @@
+/*
+ * 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"
+
+#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 = {
+    .generic_name = TYPE_VHOST_USER_INPUT_PCI,
+    .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)