Bug 1461787

Summary: Keyboard doesn't work when using virtio-keyboard-pci device on RHEL6.9 Guest
Product: Red Hat Enterprise Linux 7 Reporter: yilzhang
Component: qemu-kvm-rhevAssignee: David Gibson <dgibson>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.4CC: knoel, lvivier, qzhang, virt-maint, xuma, yilzhang
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-06-16 03:03:08 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:

Description yilzhang 2017-06-15 10:44:12 UTC
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
       qemu-kvm-rhev-2.9.0-9.el7.ppc64le
       SLOF-20170303-4.git66d250e.el7.noarch
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 15:53:21 UTC
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".

Thanks

Comment 3 yilzhang 2017-06-16 01:23:25 UTC
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: PROP=0
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-16 03:03:08 UTC
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.