Bug 1165478

Summary: guest can not find usb stick when attach this usb stick via usb-host using usb-hub
Product: Red Hat Enterprise Linux 7 Reporter: Jun Li <juli>
Component: qemu-kvm-rhevAssignee: Gerd Hoffmann <kraxel>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: hhuang, juli, juzhang, kraxel, michen, qzhang, sluo, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-11-27 10:11:19 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 Jun Li 2014-11-19 03:16:25 UTC
Description of problem:
Insert a usb stick to host. Then boot guest attach this usb stick via usb-host using usb-hub. After guest boot up, can not find this usb stick inside guest.

Version-Release number of selected component (if applicable):
qemu-kvm-rhev-2.1.2-8.el7.x86_64
host kernel:
3.10.0-205.el7.x86_64
Guest kernel:
3.10.0-205.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Insert a usb stick into host via xhci.
# lsusb
...
Bus 003 Device 004: ID 0951:1642 Kingston Technology DT101 G2
...
# lsusb -t
/:  Bus 06.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 5000M
/:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 480M
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 12M
        |__ Port 1: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
        |__ Port 1: Dev 3, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
    |__ Port 4: Dev 4, If 0, Class=Mass Storage, Driver=usbfs, 480M
...
2.boot guest attach this usb stick via usb-host using usb-hub.
e.g:
# /usr/libexec/qemu-kvm -m 2G -smp 2 -boot menu=on -drive file=/root/RHEL-7.1-20141111.0.qcow2,if=none,id=img,snapshot=on -device virtio-blk-pci,drive=img,id=sys-img,bootindex=1 -monitor stdio -qmp tcp::8888,server,nowait -spice port=5931,disable-ticketing -serial unix:/tmp/ttyS0,server,nowait -netdev tap,id=tap0,script=/etc/qemu-ifup,vhost=on -device virtio-net-pci,netdev=tap0,id=net0,mac=24:be:05:12:33:11,mq=on,bootindex=2 -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 \
-device nec-usb-xhci,id=xhci0 \
-device usb-hub,id=hub,bus=xhci0.0,port=2 \
-device usb-host,bus=xhci0.0,hostbus=3,hostaddr=4,port=2.1
3.check this usb stick inside guest.

Actual results:
After step3, can not find this usb stick inside guest.
Guest dmesg:
# dmesg
...
[    6.283377] XFS (vda1): Mounting V4 Filesystem
[    6.290699] ppdev: user-space parallel port driver
[    6.294134] usb 1-2.1: new low-speed USB device number 6 using xhci_hcd
[    6.851180] usb 1-2.1: Invalid ep0 maxpacket: 64
[    6.851361] usb 1-2-port1: unable to enumerate USB device
[    6.875011] Adding 2097148k swap on /dev/mapper/rhel_dhcp--8--122-swap.  Priority:-1 extents:1 across:2097148k FS
[    6.930237] XFS (vda1): Starting recovery (logdev: internal)
[    6.931164] XFS (vda1): Ending recovery (logdev: internal)
...

Check this usb stick inside guest:
# lsusb
Bus 001 Device 002: ID 0409:55aa NEC Corp. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
# lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M
    |__ Port 2: Dev 2, If 0, Class=Hub, Driver=hub/8p, 12M


Expected results:
can find this usb stick correctly.

Additional info:

Comment 2 Sibiao Luo 2014-11-19 04:39:26 UTC
(In reply to Jun Li from comment #0)
> -device nec-usb-xhci,id=xhci0 \
> -device usb-hub,id=hub,bus=xhci0.0,port=2 \
> -device usb-host,bus=xhci0.0,hostbus=3,hostaddr=4,port=2.1
You cann't passthrough the physical usb stick via simulate usb-hub, you can try usb-storage + usb-hub or physical usb stick pass-through to VM via physical usb hub device.

Best Regards,
sluo

Comment 3 Jun Li 2014-11-20 02:29:05 UTC


(In reply to Sibiao Luo from comment #2)
> (In reply to Jun Li from comment #0)
> > -device nec-usb-xhci,id=xhci0 \
> > -device usb-hub,id=hub,bus=xhci0.0,port=2 \
> > -device usb-host,bus=xhci0.0,hostbus=3,hostaddr=4,port=2.1
> You cann't passthrough the physical usb stick via simulate usb-hub, you can
> try usb-storage + usb-hub or physical usb stick pass-through to VM via
> physical usb hub device.
> 
> Best Regards,
> sluo

Retest with following tree:
http://people.redhat.com/ghoffman/bz1160504/

Version of components:
qemu-kvm-rhev-2.1.2-8.el7.bz1160504.1.x86_64

Steps and command line just as comment 0 show, this bz has gone. Can find usb stick inside guest correctly. Guest dmesg don't print "usb 1-2.1: Invalid ep0 maxpacket: 64".

Thanks Gerd and sluo.

Best Regards,
Jun Li

Comment 4 Gerd Hoffmann 2014-11-27 10:11:19 UTC

*** This bug has been marked as a duplicate of bug 1160504 ***