* [Qemu-devel] [PATCH v2 0/2] virtio-input: Fix device introspection on non-Linux hosts
@ 2015-10-08 16:11 Markus Armbruster
2015-10-08 16:11 ` [Qemu-devel] [PATCH v2 1/2] update-linux-headers: Rename SW_MAX to SW_MAX_ Markus Armbruster
2015-10-08 16:11 ` [Qemu-devel] [PATCH v2 2/2] virtio-input: Fix device introspection on non-Linux hosts Markus Armbruster
0 siblings, 2 replies; 4+ messages in thread
From: Markus Armbruster @ 2015-10-08 16:11 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell, mst, kraxel, pbonzini
v2: New PATCH 1.
Markus Armbruster (2):
update-linux-headers: Rename SW_MAX to SW_MAX_
virtio-input: Fix device introspection on non-Linux hosts
hw/input/Makefile.objs | 2 +-
hw/virtio/virtio-pci.c | 20 ++++++++++++--------
hw/virtio/virtio-pci.h | 4 ++++
include/standard-headers/linux/input.h | 4 ++--
scripts/update-linux-headers.sh | 1 +
5 files changed, 20 insertions(+), 11 deletions(-)
--
2.4.3
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Qemu-devel] [PATCH v2 1/2] update-linux-headers: Rename SW_MAX to SW_MAX_
2015-10-08 16:11 [Qemu-devel] [PATCH v2 0/2] virtio-input: Fix device introspection on non-Linux hosts Markus Armbruster
@ 2015-10-08 16:11 ` Markus Armbruster
2015-10-09 8:48 ` Gerd Hoffmann
2015-10-08 16:11 ` [Qemu-devel] [PATCH v2 2/2] virtio-input: Fix device introspection on non-Linux hosts Markus Armbruster
1 sibling, 1 reply; 4+ messages in thread
From: Markus Armbruster @ 2015-10-08 16:11 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell, mst, kraxel, pbonzini
The next commit will compile hw/input/virtio-input.c and
hw/input/virtio-input-hid.c even when CONFIG_LINUX is off. These
files include both "include/standard-headers/linux/input.h" and
<windows.h> then. Doesn't work, because both define SW_MAX. We don't
actually use it. Patch input.h to define SW_MAX_ instead.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
include/standard-headers/linux/input.h | 4 ++--
| 1 +
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/standard-headers/linux/input.h b/include/standard-headers/linux/input.h
index b003c67..43f1850 100644
--- a/include/standard-headers/linux/input.h
+++ b/include/standard-headers/linux/input.h
@@ -887,8 +887,8 @@ struct input_keymap_entry {
#define SW_ROTATE_LOCK 0x0c /* set = rotate locked/disabled */
#define SW_LINEIN_INSERT 0x0d /* set = inserted */
#define SW_MUTE_DEVICE 0x0e /* set = device disabled */
-#define SW_MAX 0x0f
-#define SW_CNT (SW_MAX+1)
+#define SW_MAX_ 0x0f
+#define SW_CNT (SW_MAX_+1)
/*
* Misc events
--git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers.sh
index 11076191..457ef37 100755
--- a/scripts/update-linux-headers.sh
+++ b/scripts/update-linux-headers.sh
@@ -53,6 +53,7 @@ cp_portable() {
-e 's/__attribute__((packed))/QEMU_PACKED/' \
-e 's/__inline__/inline/' \
-e '/sys\/ioctl.h/d' \
+ -e 's/SW_MAX/SW_MAX_/' \
"$f" > "$to/$header";
}
--
2.4.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Qemu-devel] [PATCH v2 2/2] virtio-input: Fix device introspection on non-Linux hosts
2015-10-08 16:11 [Qemu-devel] [PATCH v2 0/2] virtio-input: Fix device introspection on non-Linux hosts Markus Armbruster
2015-10-08 16:11 ` [Qemu-devel] [PATCH v2 1/2] update-linux-headers: Rename SW_MAX to SW_MAX_ Markus Armbruster
@ 2015-10-08 16:11 ` Markus Armbruster
1 sibling, 0 replies; 4+ messages in thread
From: Markus Armbruster @ 2015-10-08 16:11 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell, mst, kraxel, pbonzini
When CONFIG_LINUX is off, devices "virtio-keyboard-device",
"virtio-mouse-device", "virtio-tablet-device" and
"virtio-input-host-device" aren't compiled in, yet
"virtio-keyboard-pci", "virtio-mouse-pci", "virtio-tablet-pci" and
"virtio-input-host-pci" still are. Attempts to introspect them crash,
e.g.
$ qemu-system-x86_64 -device virtio-tablet-pci,help
**
ERROR:/work/armbru/qemu/qom/object.c:333:object_initialize_with_type: assertion failed: (type != NULL)
Broken in commit 710e2d9 and commit 006a5ed.
Fix by compiling the "virtio-FOO-pci" exactly when compiling the
"virtio-FOO-device": compile "virtio-keyboard-device",
"virtio-mouse-device", "virtio-tablet-device" regardless of
CONFIG_LINUX, and compile "virtio-input-host-pci" only for
CONFIG_LINUX.
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/input/Makefile.objs | 2 +-
hw/virtio/virtio-pci.c | 20 ++++++++++++--------
hw/virtio/virtio-pci.h | 4 ++++
3 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/hw/input/Makefile.objs b/hw/input/Makefile.objs
index 624ba7e..7715d72 100644
--- a/hw/input/Makefile.objs
+++ b/hw/input/Makefile.objs
@@ -8,9 +8,9 @@ common-obj-$(CONFIG_STELLARIS_INPUT) += stellaris_input.o
common-obj-$(CONFIG_TSC2005) += tsc2005.o
common-obj-$(CONFIG_VMMOUSE) += vmmouse.o
-ifeq ($(CONFIG_LINUX),y)
common-obj-$(CONFIG_VIRTIO) += virtio-input.o
common-obj-$(CONFIG_VIRTIO) += virtio-input-hid.o
+ifeq ($(CONFIG_LINUX),y)
common-obj-$(CONFIG_VIRTIO) += virtio-input-host.o
endif
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index 6703806..e5c406d 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -2134,14 +2134,6 @@ static void virtio_tablet_initfn(Object *obj)
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 = {
.name = TYPE_VIRTIO_INPUT_PCI,
.parent = TYPE_VIRTIO_PCI,
@@ -2180,12 +2172,22 @@ static const TypeInfo virtio_tablet_pci_info = {
.instance_init = virtio_tablet_initfn,
};
+#ifdef CONFIG_LINUX
+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_host_pci_info = {
.name = TYPE_VIRTIO_INPUT_HOST_PCI,
.parent = TYPE_VIRTIO_INPUT_PCI,
.instance_size = sizeof(VirtIOInputHostPCI),
.instance_init = virtio_host_initfn,
};
+#endif
/* virtio-pci-bus */
@@ -2233,7 +2235,9 @@ 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);
+#ifdef CONFIG_LINUX
type_register_static(&virtio_host_pci_info);
+#endif
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 b6c442f..801c23a 100644
--- a/hw/virtio/virtio-pci.h
+++ b/hw/virtio/virtio-pci.h
@@ -267,6 +267,8 @@ struct VirtIOInputHIDPCI {
VirtIOInputHID vdev;
};
+#ifdef CONFIG_LINUX
+
#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)
@@ -276,6 +278,8 @@ struct VirtIOInputHostPCI {
VirtIOInputHost vdev;
};
+#endif
+
/*
* virtio-gpu-pci: This extends VirtioPCIProxy.
*/
--
2.4.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH v2 1/2] update-linux-headers: Rename SW_MAX to SW_MAX_
2015-10-08 16:11 ` [Qemu-devel] [PATCH v2 1/2] update-linux-headers: Rename SW_MAX to SW_MAX_ Markus Armbruster
@ 2015-10-09 8:48 ` Gerd Hoffmann
0 siblings, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2015-10-09 8:48 UTC (permalink / raw)
To: Markus Armbruster; +Cc: peter.maydell, mst, qemu-devel, pbonzini
On Do, 2015-10-08 at 18:11 +0200, Markus Armbruster wrote:
> The next commit will compile hw/input/virtio-input.c and
> hw/input/virtio-input-hid.c even when CONFIG_LINUX is off. These
> files include both "include/standard-headers/linux/input.h" and
> <windows.h> then. Doesn't work, because both define SW_MAX. We don't
> actually use it. Patch input.h to define SW_MAX_ instead.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-10-09 8:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-08 16:11 [Qemu-devel] [PATCH v2 0/2] virtio-input: Fix device introspection on non-Linux hosts Markus Armbruster
2015-10-08 16:11 ` [Qemu-devel] [PATCH v2 1/2] update-linux-headers: Rename SW_MAX to SW_MAX_ Markus Armbruster
2015-10-09 8:48 ` Gerd Hoffmann
2015-10-08 16:11 ` [Qemu-devel] [PATCH v2 2/2] virtio-input: Fix device introspection on non-Linux hosts Markus Armbruster
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.