Bug 1231114
| Summary: | [RFE] add virtio-input support | |||
|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Gerd Hoffmann <kraxel> | |
| Component: | libvirt | Assignee: | Ján Tomko <jtomko> | |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> | |
| Severity: | unspecified | Docs Contact: | ||
| Priority: | unspecified | |||
| Version: | 7.2 | CC: | dyuan, fjin, hhan, jtomko, juzhang, knoel, lmiksik, michen, mzhan, qzhang, rbalakri | |
| Target Milestone: | rc | Keywords: | FutureFeature | |
| Target Release: | --- | |||
| Hardware: | Unspecified | |||
| OS: | Unspecified | |||
| Whiteboard: | ||||
| Fixed In Version: | libvirt-1.3.1-1.el7 | Doc Type: | Enhancement | |
| Doc Text: | Story Points: | --- | ||
| Clone Of: | ||||
| : | 1241691 (view as bug list) | Environment: | ||
| Last Closed: | 2016-11-03 18:18:38 UTC | Type: | Bug | |
| Regression: | --- | Mount Type: | --- | |
| Documentation: | --- | CRM: | ||
| Verified Versions: | Category: | --- | ||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
| Cloudforms Team: | --- | Target Upstream Version: | ||
| Embargoed: | ||||
| Bug Depends On: | ||||
| Bug Blocks: | 1241691 | |||
|
Description
Gerd Hoffmann
2015-06-12 08:05:37 UTC
Proposed upstream patches: https://www.redhat.com/archives/libvir-list/2015-November/msg00772.html Pushed upstream as:
commit 971f5f229dc4b36a4ad62fdeef67f209b875822e
Author: Ján Tomko <jtomko>
CommitDate: 2015-11-30 13:00:04 +0100
qemu: build command line for virtio-input-host device
<input type='passthrough' bus='virtio'>
<source evdev='/dev/input/event1234'/>
</input>
results in:
-device virtio-input-host-pci,id=input0,evdev=/dev/input/event1234
https://bugzilla.redhat.com/show_bug.cgi?id=1231114
commit 1c00dcd6652b4a42eea089f7bd1fb5e1a80d2662
qemu: add passed-through input devs to cgroup ACL
commit d5aba1a4d926849577af950af8f51edff2bf433b
security: label the evdev for input device passthrough
commit 1a538a07c71f6ef0ce57542301d78e55e5b0b581
conf: add XML for input device passthrough
commit e9d7550ac2b5463eac3834c3199fe5ddfd87bfa0
qemu: add capability for virtio-input-host-device
commit 7210cef452dbed7f6ab1ff0d585ba8360c8f6e24
qemu: build command line for virtio input devices
commit bebdfafb2b5a0f70713ec94b61f3c6d0200db6cd
conf: parse and format virtio input bus in domain XML
To be used by the family of virtio input devices:
<input type='mouse' bus='virtio'/>
<input type='tablet' bus='virtio'/>
<input type='keyboard' bus='virtio'/>
https://bugzilla.redhat.com/show_bug.cgi?id=1231114
commit 5c62d6c4566d4cca627b601e9c4c70244e73b940
qemu: add capabilities for virtio input devices
git describe: v1.2.21-191-g971f5f2
Verify pass on build libvirt-1.3.3-1.el7.x86_64
1. virtio keyboard
1) Prepare a guest with virtio keyboard and graphic:
# virsh dumpxml rhel7.2-1030
<input type='keyboard' bus='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</input>
...
<graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0'>
<listen type='address' address='0.0.0.0'/>
</graphics>
2) # virsh start rhel7.2-1030
3) # ps aux|grep rhel7.2-1030
...-device virtio-keyboard-pci,id=input0,bus=pci.0,addr=0x3...
4) # virt-viewer rhel7.2-1030
5) In guest, characters can be inputted by keyboard:
# xinput list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ ImExPS/2 Generic Explorer Mouse id=9 [slave pointer (2)]
⎜ ↳ spice vdagent tablet id=10 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ **QEMU Virtio Keyboard** id=7 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=8 [slave keyboard (3)]
2. virtio mouse
1) Prepare a guest with virtio mouse and graphic:
# virsh dumpxml rhel7.2-1030
<input type='mouse' bus='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</input>
...
<graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0'>
<listen type='address' address='0.0.0.0'/>
</graphics>
2) # virsh start rhel7.2-1030
3) # ps aux|grep rhel7.2-1030
...-device virtio-mouse-pci,id=input1,bus=pci.0,addr=0x3
4) # virt-viewer rhel7.2-1030
5) In guest, click mouse, and you have to press Ctrl+Alt to release mouse:
$ xinput list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ **QEMU Virtio Mouse** id=7 [slave pointer (2)]
⎜ ↳ ImExPS/2 Generic Explorer Mouse id=9 [slave pointer (2)]
⎜ ↳ spice vdagent tablet id=10 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=8 [slave keyboard (3)]
6) # virsh qemu-monitor-command rhel7.2-1030 '{"execute":"query-mice"}'
{"return":[{"index":2,"name":"QEMU PS/2 Mouse","current":false,"absolute":false},{"index":3,"name":"**QEMU Virtio Mouse**","current":true,"absolute":false}],"id":"libvirt-49"}
3. virtio tablet
1) Prepare a guest with virtio tablet and graphic:
# virsh dumpxml rhel7.2-1030
<input type='tablet' bus='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</input>
...
<graphics type='spice' port='-1' autoport='yes' listen='0.0.0.0'>
<listen type='address' address='0.0.0.0'/>
</graphics>
2) # virsh start rhel7.2-1030
3) # ps aux|grep rhel7.2-1030
...-device virtio-tablet-pci,id=input1,bus=pci.0,addr=0x3
4) # virt-viewer rhel7.2-1030
5) In guest, click mouse, move the mouse out of guest, it can be used on the host without pressing Ctrl+Alt:
$ xinput
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ **QEMU Virtio Tablet** id=7 [slave pointer (2)]
⎜ ↳ ImExPS/2 Generic Explorer Mouse id=9 [slave pointer (2)]
⎜ ↳ spice vdagent tablet id=10 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=8 [slave keyboard (3)]
6) # virsh qemu-monitor-command rhel7.2-1030 '{"execute":"query-mice"}'
{"return":[{"index":2,"name":"QEMU PS/2 Mouse","current":false,"absolute":false},{"index":3,"name":"**QEMU Virtio Tablet**","current":true,"absolute":true}],"id":"libvirt-50"}
4.virtio tablet + virtio mouse + virtio keyboard
1) Prepare a guest with virtio tablet+mouse+keyboard and graphic:
# virsh dumpxml rhel7.2-1030
<input type='keyboard' bus='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
</input>
<input type='mouse' bus='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</input>
<input type='tablet' bus='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
</input>
...
<graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0'>
<listen type='address' address='0.0.0.0'/>
</graphics>
2) # virsh start rhel7.2-1030
3) # ps aux|grep rhel7.2-1030
...-device virtio-keyboard-pci,id=input0,bus=pci.0,addr=0xa
-device virtio-mouse-pci,id=input1,bus=pci.0,addr=0x3
-device virtio-tablet-pci,id=input3,bus=pci.0,addr=0x9
4) In guest, click mouse,:
$ xinput list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ **QEMU Virtio Mouse** id=7 [slave pointer (2)]
⎜ ↳ **QEMU Virtio Tablet** id=8 [slave pointer (2)]
⎜ ↳ ImExPS/2 Generic Explorer Mouse id=11 [slave pointer (2)]
⎜ ↳ spice vdagent tablet id=12 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ **QEMU Virtio Keyboard** id=9 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=10 [slave keyboard (3)]
5) # virsh qemu-monitor-command rhel7.2-1030 '{"execute":"query-mice"}'
{"return":[{"index":2,"name":"QEMU PS/2 Mouse","current":false,"absolute":false},{"index":3,"name":"QEMU Virtio Mouse","current":false,"absolute":false},{"index":4,"name":"QEMU Virtio Tablet","current":true,"absolute":true}],"id":"libvirt-52"}
5. passthrough host input device
0) On host:
# cat /proc/bus/input/devices
I: Bus=0003 Vendor=413c Product=2105 Version=0110
N: Name="Dell Dell USB Keyvboard" ===> passthrough this input device to guest
P: Phys=usb-0000:00:14.0-4/input0
S: Sysfs=/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:1.0/input/input3
U: Uniq=
H: Handlers=sysrq kbd event3
B: PROP=0
B: EV=120013
B: KEY=1000000000007 ff9f207ac14057ff febeffdfffefffff fffffffffffffffe
B: MSC=10
B: LED=7
1) Prepare a guest that use host input device: event3
# virsh dumpxml rhel7.2-1030
<input type='passthrough' bus='virtio'>
<source evdev='/dev/input/event3'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
</input>
2) # virsh start rhel7.2-1030
3) # ps aux|grep rhel7.2-1030
...-device virtio-input-host-pci,id=input1,evdev=/dev/input/event3,bus=pci.0,addr=0xb
4) In guest:
$ xinput list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ QEMU Virtio Tablet id=7 [slave pointer (2)]
⎜ ↳ QEMU Virtio Mouse id=8 [slave pointer (2)]
⎜ ↳ ImExPS/2 Generic Explorer Mouse id=11 [slave pointer (2)]
⎜ ↳ spice vdagent tablet id=12 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ **Dell Dell USB Keyboard** id=9 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=10 [slave keyboard (3)]
5) On host, keyboard can't be used.
6) # virsh destroy rhel7.2-1030
On host, keyboard can be used again.
Hi Jan As far as I know, qemu-kvm-rhev supports hotplug of virtio input devices, but libvirt doesn't support it for now. So do you think it's necessary to open a bug for libvirt supporting virtio-input device hotplug? Thank you! Hi, hotplugging them would be useful, especially type='passthrough'. Please open a bug. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHSA-2016-2577.html |