RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1231114 - [RFE] add virtio-input support
Summary: [RFE] add virtio-input support
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Ján Tomko
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 1241691
TreeView+ depends on / blocked
 
Reported: 2015-06-12 08:05 UTC by Gerd Hoffmann
Modified: 2016-11-03 18:18 UTC (History)
11 users (show)

Fixed In Version: libvirt-1.3.1-1.el7
Doc Type: Enhancement
Doc Text:
Clone Of:
: 1241691 (view as bug list)
Environment:
Last Closed: 2016-11-03 18:18:38 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2577 0 normal SHIPPED_LIVE Moderate: libvirt security, bug fix, and enhancement update 2016-11-03 12:07:06 UTC

Description Gerd Hoffmann 2015-06-12 08:05:37 UTC
Description of problem:

qemu 2.4 got support for virtio input devices.
guest support (linux kernel) is present in kernel 4.1+.

libvirt should get support for these.

name "virtio-keyboard-device", bus virtio-bus
name "virtio-keyboard-pci", bus PCI
name "virtio-mouse-device", bus virtio-bus
name "virtio-mouse-pci", bus PCI
name "virtio-tablet-device", bus virtio-bus
name "virtio-tablet-pci", bus PCI

Comment 2 Ján Tomko 2015-11-20 09:00:40 UTC
Proposed upstream patches:
https://www.redhat.com/archives/libvir-list/2015-November/msg00772.html

Comment 3 Ján Tomko 2015-11-30 13:45:11 UTC
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

Comment 5 Fangge Jin 2016-04-15 01:41:31 UTC
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.

Comment 6 Fangge Jin 2016-09-06 08:32:15 UTC
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!

Comment 7 Ján Tomko 2016-09-26 10:19:27 UTC
Hi,

hotplugging them would be useful, especially type='passthrough'. Please open a bug.

Comment 9 errata-xmlrpc 2016-11-03 18:18:38 UTC
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


Note You need to log in before you can comment on or make changes to this bug.