Bug 728120

Summary: print error on usb speed mismatch between device and bus/port
Product: Red Hat Enterprise Linux 6 Reporter: juzhang <juzhang>
Component: qemu-kvmAssignee: Gerd Hoffmann <kraxel>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2CC: michen, mkenneth, qzhang, qzhou, shuang, tburke, virt-maint
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-0.12.1.2-2.206.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-06 15:55:10 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
ich9-ehci-uhci.cfg none

Description juzhang 2011-08-04 06:52:40 UTC
Description of problem:
Can't find usb-tablet device in guest under  EHCI adapter 


Version-Release number of selected component (if applicable):
qemu-kvm-0.12.1.2-2.175.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Boot guest with usb-tablet and -device usb-ehci,id=ehci
#/usr/libexec/qemu-kvm -M rhel6.2.0 -enable-kvm -m 2G -smp 2,cores=2,threads=1,sockets=1  -name RHEL6.1_32 -uuid 50eba0fa-c3bc-4634-9c87-e46fc4dafab9 -rtc base=utc,clock=host,driftfix=slew -boot menu=on -drive file=/root/zhangjunyi/RHEL6.1_64-copy-2.qcow2,if=none,id=drive-ide-0-0,media=disk,format=qcow2,cache=none,werror=stop,index=0 -device virtio-blk-pci,drive=drive-ide-0-0,id=ide0-0-0,bootindex=1 -netdev tap,id=hostnet1 -device virtio-net-pci,netdev=hostnet1,id=net1,mac=78:2B:CB:AF:11:11 -vnc :10 -monitor stdio -balloon none
/ 
-device usb-ehci,id=ehci -device usb-tablet,bus=ehci.0
2.check usb in qemu
#(qemu) info usb
  Device 0.1, Port 1, Speed 12 Mb/s, Product QEMU USB Tablet

3.In guest
#lsusb 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
#dmesg
hub 1-0:1.0: Cannot enable port 1.  Maybe the USB cable is bad?
hub 1-0:1.0: Cannot enable port 1.  Maybe the USB cable is bad?
hub 1-0:1.0: Cannot enable port 1.  Maybe the USB cable is bad?
hub 1-0:1.0: Cannot enable port 1.  Maybe the USB cable is bad?
#usb-devices 
T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480 MxCh= 4
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1d6b ProdID=0002 Rev=02.06
S:  Manufacturer=Linux 2.6.32-131.0.15.el6.x86_64 ehci_hcd
S:  Product=EHCI Host Controller
S:  SerialNumber=0000:00:05.0
C:  #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
  
Actual results:
can't find usb-tablet device,in addition,saw error message about usb "hub 1-0:1.0: Cannot enable port 1.  Maybe the USB cable is bad?"

Expected results:
1.if we support usb-tablet  work under EHCI adapter 
usb-tablet works well
2.if we don't support usb-tablet&EHCI adapter
should not let guest boot and promote friendly message.

Additional info:
1. usb-tablet doesn't work under UHCI adapter,can find usb-tablet and no error message in dmesg.
#/usr/libexec/qemu-kvm -M rhel6.2.0 -enable-kvm -m 2G -smp 2,cores=2,threads=1,sockets=1  -name RHEL6.1_32 -uuid 50eba0fa-c3bc-4634-9c87-e46fc4dafab9 -rtc base=utc,clock=host,driftfix=slew -boot menu=on -drive file=/root/zhangjunyi/RHEL6.1_64-copy-2.qcow2,if=none,id=drive-ide-0-0,media=disk,format=qcow2,cache=none,werror=stop,index=0 -device virtio-blk-pci,drive=drive-ide-0-0,id=ide0-0-0,bootindex=1 -netdev tap,id=hostnet1 -device virtio-net-pci,netdev=hostnet1,id=net1,mac=78:2B:CB:AF:11:11 -vnc :10 -monitor stdio -balloon none
/ 
-usb -device usb-tablet,bus=usb.0
2.(qemu) info usb
  Device 0.2, Port 1, Speed 12 Mb/s, Product QEMU USB Tablet
3.in guest
1.lsusb 
Bus 001 Device 002: ID 0627:0001 Adomax Technology Co., Ltd 
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
2. usb-devices 

T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=12  MxCh= 2
D:  Ver= 1.10 Cls=09(hub  ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1d6b ProdID=0001 Rev=02.06
S:  Manufacturer=Linux 2.6.32-131.0.15.el6.x86_64 uhci_hcd
S:  Product=UHCI Host Controller
S:  SerialNumber=0000:00:01.2
C:  #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=12  MxCh= 0
D:  Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=0627 ProdID=0001 Rev=00.00
S:  Manufacturer=QEMU 0.12.1
S:  Product=QEMU USB Tablet
S:  SerialNumber=42
C:  #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=100mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=00 Prot=02 Driver=usbhid

Comment 1 Gerd Hoffmann 2011-08-12 09:05:26 UTC
HID devices are lowspeed devices and thus by design don't work on the highspeed EHCI adapter.

It is possible to add companion UHCI controllers to the EHCI adapter, so the guest can ask EHCI to hand off the lowspeed devices which it can't handle itself to the UHCI companion.

The easiest way to do this is "qemu [ ... ] -readconfig ich9-ehci-uhci.cfg -device usb-tablet,bus=ehci.0"

Comment 2 Gerd Hoffmann 2011-08-12 09:06:26 UTC
Created attachment 517994 [details]
ich9-ehci-uhci.cfg

Comment 3 Gerd Hoffmann 2011-08-12 09:10:18 UTC
Forgot to mention: qemu-kvm-0.12.1.2-2.180.el6.x86_64 or newer is required.

Comment 4 juzhang 2011-08-12 09:28:41 UTC
(In reply to comment #1)
> HID devices are lowspeed devices and thus by design don't work on the highspeed
> EHCI adapter.
> 
Would you please tell me can promote more friendly messages when do operations like these. and like bz728167 and bz723760,maybe better :)

Comment 5 Gerd Hoffmann 2011-08-12 10:24:10 UTC
Oh, looks like some patches slipped though when backporting.
upstream complains on speed mismatch whereas rhel6 doesn't indeed ...

Comment 9 Qunfang Zhang 2011-10-12 03:34:14 UTC
Reproduced on qemu-kvm-0.12.1.2-2.172.el6, and verified pass on qemu-kvm-0.12.1.2-2.195.el6. 
Steps:
Boot a guest with the speed mismatch devices.
/usr/libexec/qemu-kvm -M rhel6.2.0 -enable-kvm -m 2G -smp 2,cores=2,threads=1,sockets=1  -name RHEL6.1_32 -uuid 50eba0fa-c3bc-4634-9c87-e46fc4dafab9 -rtc base=utc,clock=host,driftfix=slew -boot menu=on -drive file=/home/RHEL6.1-64-virtio.qcow2,if=none,id=drive-ide-0-0,media=disk,format=qcow2,cache=none,werror=stop,index=0 -device virtio-blk-pci,drive=drive-ide-0-0,id=ide0-0-0,bootindex=1 -netdev tap,id=hostnet1 -device virtio-net-pci,netdev=hostnet1,id=net1,mac=78:2B:CB:AF:11:11 -vnc :10 -monitor stdio -balloon none -device usb-ehci,id=ehci -device usb-tablet,bus=ehci.0

For the qemu-kvm-0.12.1.2-2.172.el6, the result is the same as bug description.

For qemu-kvm-0.12.1.2-2.195.el6, it prompts:
*** EHCI support is under development ***
qemu-kvm: -device usb-tablet,bus=ehci.0: Warning: speed mismatch trying to attach usb device QEMU USB Tablet to bus ehci.0

qemu-kvm: -device usb-tablet,bus=ehci.0: Device 'usb-tablet' could not be initialized

Also boot with "-device usb-ehci,id=ehci -device usb-hub,bus=ehci.0,port=1 -device usb-hub,bus=ehci.0,port=2 -device usb-hub,bus=ehci.0,port=3 -device usb-hub,bus=ehci.0,port=4  -device usb-storage,bus=ehci.0,port=1.1,drive=usbstick1 -drive if=none,id=usbstick1,file=disk.qcow2"

The error prompts are the same. Guest can not boot up, so this issue if fixed.

Comment 12 Eduardo Habkost 2011-10-28 18:00:53 UTC
Moving to ON_QA because Errata Tool did not do it

Comment 14 errata-xmlrpc 2011-12-06 15:55:10 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.

http://rhn.redhat.com/errata/RHSA-2011-1531.html