If you have build a fresh 4.1-rc kernel you might have already noticed the new CONFIG_VIRTIO_INPUT config option. So, here is some background information on what this is and how to use it.
virtio-input basically sends linux evdev events over virtio. The device capability bits (available via ioctl for evdev) live in virtio device config space. The events themself are sent over virtio queues. They look exactly like evdev events, except that the struct fields are always in little endian byte order. So this allows the host to emulate pretty much any input device the linux kernel’s input layer is able to handle.
On the guest side the only thing you need is a kernel with CONFIG_VIRTIO_INPUT=m.
On the host side you need pretty recent qemu master branch. The first release with virtio-input support will be 2.4.
qemu has three virtual devices right now:
-device virtio-keyboard-pci: virtual keyboard, simliar to the ps/2 keyboard.
-device virtio-mouse-pci: virtual mouse, simliar to the ps/2 mouse.
-device virtio-tablet-pci: virtual tablet, simliar to usb-tablet, but without the usb overhead.
The tablet is probably the most useful one in practice. The pseries guys might be interested in the keyboard too as usb-keyboard replacement.
Not yet merged, but the patch should land upstream in time for the 2.4 release: There also is support for passing through host evdev devices to the guest:
Take care: The guest gets exclusive access to the input device then. So better don’t try that with your one and only keyboard 😉