diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2015-06-23 13:32:50 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2015-06-23 13:32:50 +0100 |
commit | 6966b2a07190004e18ede33ce50a65009b36f3a6 (patch) | |
tree | fc6f9a9585687329bbd6fa763866cb01cbe7b938 /hw/virtio | |
parent | a3206972a9eab65ec8e8f9ae320ad628ba4b58f1 (diff) | |
parent | a5d4d7b580f42c47d240a2068c810e4147147f6e (diff) |
Merge remote-tracking branch 'remotes/kraxel/tags/pull-input-20150623-1' into staging
virtio-input: property fixes, add evdev passthrough
# gpg: Signature made Tue Jun 23 09:33:29 2015 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg: aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>"
* remotes/kraxel/tags/pull-input-20150623-1:
Add MAINTAINERS entry for virtio-input
virtio-input: evdev passthrough
virtio-input: move properties, use virtio_instance_init_common
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/virtio')
-rw-r--r-- | hw/virtio/virtio-pci.c | 43 | ||||
-rw-r--r-- | hw/virtio/virtio-pci.h | 10 |
2 files changed, 37 insertions, 16 deletions
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index d7cf34cee9..70bc6d801e 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1900,8 +1900,7 @@ static const TypeInfo virtio_rng_pci_info = { /* virtio-input-pci */ -static Property virtio_input_hid_pci_properties[] = { - DEFINE_VIRTIO_INPUT_PROPERTIES(VirtIOInputPCI, vdev.input), +static Property virtio_input_pci_properties[] = { DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, 2), DEFINE_PROP_END_OF_LIST(), }; @@ -1924,19 +1923,13 @@ static void virtio_input_pci_class_init(ObjectClass *klass, void *data) VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass); PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass); + dc->props = virtio_input_pci_properties; k->realize = virtio_input_pci_realize; set_bit(DEVICE_CATEGORY_INPUT, dc->categories); pcidev_k->class_id = PCI_CLASS_INPUT_OTHER; } -static void virtio_input_hid_pci_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc = DEVICE_CLASS(klass); - - dc->props = virtio_input_hid_pci_properties; -} - static void virtio_input_hid_kbd_pci_class_init(ObjectClass *klass, void *data) { PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass); @@ -1955,22 +1948,33 @@ static void virtio_input_hid_mouse_pci_class_init(ObjectClass *klass, static void virtio_keyboard_initfn(Object *obj) { VirtIOInputHIDPCI *dev = VIRTIO_INPUT_HID_PCI(obj); - object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_KEYBOARD); - object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VIRTIO_KEYBOARD); } static void virtio_mouse_initfn(Object *obj) { VirtIOInputHIDPCI *dev = VIRTIO_INPUT_HID_PCI(obj); - object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_MOUSE); - object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VIRTIO_MOUSE); } static void virtio_tablet_initfn(Object *obj) { VirtIOInputHIDPCI *dev = VIRTIO_INPUT_HID_PCI(obj); - object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_TABLET); - object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VIRTIO_TABLET); +} + +static void virtio_host_initfn(Object *obj) +{ + VirtIOInputHostPCI *dev = VIRTIO_INPUT_HOST_PCI(obj); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VIRTIO_INPUT_HOST); } static const TypeInfo virtio_input_pci_info = { @@ -1985,7 +1989,6 @@ static const TypeInfo virtio_input_hid_pci_info = { .name = TYPE_VIRTIO_INPUT_HID_PCI, .parent = TYPE_VIRTIO_INPUT_PCI, .instance_size = sizeof(VirtIOInputHIDPCI), - .class_init = virtio_input_hid_pci_class_init, .abstract = true, }; @@ -2012,6 +2015,13 @@ static const TypeInfo virtio_tablet_pci_info = { .instance_init = virtio_tablet_initfn, }; +static const TypeInfo virtio_host_pci_info = { + .name = TYPE_VIRTIO_INPUT_HOST_PCI, + .parent = TYPE_VIRTIO_INPUT_PCI, + .instance_size = sizeof(VirtIOInputHostPCI), + .instance_init = virtio_host_initfn, +}; + /* virtio-pci-bus */ static void virtio_pci_bus_new(VirtioBusState *bus, size_t bus_size, @@ -2058,6 +2068,7 @@ static void virtio_pci_register_types(void) type_register_static(&virtio_keyboard_pci_info); type_register_static(&virtio_mouse_pci_info); type_register_static(&virtio_tablet_pci_info); + type_register_static(&virtio_host_pci_info); type_register_static(&virtio_pci_bus_info); type_register_static(&virtio_pci_info); #ifdef CONFIG_VIRTFS diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h index 96025ca205..05d9d243f6 100644 --- a/hw/virtio/virtio-pci.h +++ b/hw/virtio/virtio-pci.h @@ -43,6 +43,7 @@ typedef struct VHostSCSIPCI VHostSCSIPCI; typedef struct VirtIORngPCI VirtIORngPCI; typedef struct VirtIOInputPCI VirtIOInputPCI; typedef struct VirtIOInputHIDPCI VirtIOInputHIDPCI; +typedef struct VirtIOInputHostPCI VirtIOInputHostPCI; typedef struct VirtIOGPUPCI VirtIOGPUPCI; /* virtio-pci-bus */ @@ -263,6 +264,15 @@ struct VirtIOInputHIDPCI { VirtIOInputHID vdev; }; +#define TYPE_VIRTIO_INPUT_HOST_PCI "virtio-input-host-pci" +#define VIRTIO_INPUT_HOST_PCI(obj) \ + OBJECT_CHECK(VirtIOInputHostPCI, (obj), TYPE_VIRTIO_INPUT_HOST_PCI) + +struct VirtIOInputHostPCI { + VirtIOPCIProxy parent_obj; + VirtIOInputHost vdev; +}; + /* * virtio-gpu-pci: This extends VirtioPCIProxy. */ |