Bug 1461787 - Keyboard doesn't work when using virtio-keyboard-pci device on RHEL6.9 Guest
Keyboard doesn't work when using virtio-keyboard-pci device on RHEL6.9 Guest
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev (Show other bugs)
All Linux
unspecified Severity unspecified
: rc
: ---
Assigned To: David Gibson
Virtualization Bugs
Depends On:
  Show dependency treegraph
Reported: 2017-06-15 06:44 EDT by yilzhang
Modified: 2017-07-30 23:23 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2017-06-15 23:03:08 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description yilzhang 2017-06-15 06:44:12 EDT
Description of problem:
When testing PPC RHEL6.9BE Guest, keyboard doesn't work when using virtio-keyboard-pci device

Version-Release number of selected component (if applicable):
Host:  3.10.0-679.el7.ppc64le
guest kernel:   2.6.32-696.el6.ppc64  

How reproducible: 100%

Steps to Reproduce:
1. Boot guest with virtio-keyboard-pci, but without usb-kbd (for POWER should add -nodefaults)

qemu cli:
 /usr/libexec/qemu-kvm \
 -name yilzhang_vm \
 -m 8192 -smp 8,sockets=2,cores=2,threads=2 \
 -rtc base=localtime,clock=host \
 -boot menu=on \
 -monitor stdio -nodefaults \
-vga virtio \
-device virtio-keyboard-pci,id=kbd0,serial=virtio-keyboard \
-vnc :1 \
 -device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x4 \
 -drive file=rhel69.qcow2,format=qcow2,id=drive_sysdisk,if=none,cache=none,aio=native,werror=stop,rerror=stop \
 -device scsi-hd,drive=drive_sysdisk,bus=scsi0.0,id=sysdisk,bootindex=0 \
 -netdev tap,id=net0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown,vhost=on \
 -device virtio-net-pci,netdev=net0,id=nic0,mac=52:54:00:c3:e7:84,bus=pci.0,addr=0x5 \
 -device nec-usb-xhci,id=xhci0,bus=pci.0,addr=0x6 \
 -device usb-mouse,bus=xhci0.0  -device usb-tablet,bus=xhci0.0

2. Login guest via vnc, and check if keyboard works well

Actual results:
Connect guest via vnc, and find that keyboard doesn't work at all.
(qemu) info pci
  Bus  0, device   0, function 0:
    VGA controller: PCI device 1af4:1050
      IRQ 0.
      BAR0: 32 bit prefetchable memory at 0x80000000 [0x807fffff].
      BAR2: 64 bit prefetchable memory at 0x210000000000 [0x210000003fff].
      BAR4: 32 bit memory at 0xc0000000 [0xc0000fff].
      BAR6: 32 bit memory at 0xffffffffffffffff [0x0000fffe].
      id ""
  Bus  0, device   1, function 0:
    Keyboard: PCI device 1af4:1052
      IRQ 0.
      BAR1: 32 bit memory at 0xffffffffffffffff [0x00000ffe].
      BAR4: 64 bit prefetchable memory at 0xffffffffffffffff [0x00003ffe].
      id "kbd0"

Expected results:
Keyboard works well

Additional info:
1. x86 doesn't have this problem (guest kernel version: 2.6.32-696.el6.x86_64)
2. Just change guest kernel from RHEL6.9BE to RHEL7.4le (3.10.0-675.el7.ppc64le), keyboard will work well
Comment 2 Laurent Vivier 2017-06-15 11:53:21 EDT
I've checked config files from kernel 2.6.32-707.el6: virtio-input has been introduced in 4.1 and not backported to 2.6.32, only to 3.10.0-280.

Are you sure it works for x86_64?
You should check you don't have an USB keyboard with "lsusb" and "lspci -v".

Comment 3 yilzhang 2017-06-15 21:23:25 EDT
On x86_64 guest:

# lspci -v

00:03.0 Keyboard controller: Red Hat, Inc Virtio input (rev 01)
	Subsystem: Red Hat, Inc Device 1100
	Physical Slot: 3
	Flags: fast devsel, IRQ 11
	Memory at febd5000 (32-bit, non-prefetchable) [size=4K]
	Memory at fe804000 (64-bit, prefetchable) [size=16K]
	Capabilities: [98] MSI-X: Enable- Count=2 Masked-
	Capabilities: [84] Vendor Specific Information: Len=14 <?>
	Capabilities: [70] Vendor Specific Information: Len=14 <?>
	Capabilities: [60] Vendor Specific Information: Len=10 <?>
	Capabilities: [50] Vendor Specific Information: Len=10 <?>
	Capabilities: [40] Vendor Specific Information: Len=10 <?>
	Kernel modules: virtio_pci

# cat /proc/bus/input/devices     ----------(only one keyboard is listed)

I: Bus=0011 Vendor=0001 Product=0001 Version=ab41
N: Name="AT Translated Set 2 keyboard"
P: Phys=isa0060/serio0/input0
S: Sysfs=/devices/platform/i8042/serio0/input/input2
U: Uniq=
H: Handlers=kbd event2 
B: EV=120013
B: KEY=402000000 3803078f800d001 feffffdfffefffff fffffffffffffffe
B: MSC=10
B: LED=7

It seems x86 guest doesn't recognize QEMU Virtio Keyboard too, but it can use a default keyboard ("AT Translated Set 2 keyboard"), although I added "-nodefaults" to the qemu command line.

So x86_64 also have this problem. 

I see that you mentioned "virtio-input is not backported to 2.6.32", so you can decide what to do next with this bug.
Thanks a lot.
Comment 4 David Gibson 2017-06-15 23:03:08 EDT
I'm pretty sure we're not going to add a whole new keyboard driver to RHEL6 at this late stage, particularly when an XHCI keyboard will work perfectly well.

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