Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1046524

Summary: the USB3.0 stick fail to work when passthrough it to win2012R2 guest with xHCI controller
Product: Red Hat Enterprise Linux 7 Reporter: Sibiao Luo <sluo>
Component: qemu-kvmAssignee: Gerd Hoffmann <kraxel>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: areis, chayang, hhuang, jinzhao, juzhang, knoel, kraxel, mazhang, michen, qzhang, rbalakri, sharpwiner, virt-bugs, virt-maint, xfu, xqu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-17 18:03:05 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:
Bug Depends On:    
Bug Blocks: 947042, 1103193, 1146483, 1146486    
Attachments:
Description Flags
USB_Mass_Storage_Device_Properties.
none
Screenshot_for_Disk_Management. none

Description Sibiao Luo 2013-12-26 02:41:49 UTC
Description of problem:
passthrough the USB3.0 stick to windows guest with xHCI controller under pc machine type, it can regonize the xhci controller and USB Mass Storage Device in device manager, but fail to detect it in disk management and cann't work. 
BTW, this issue maybe not be fixed completely in bug 949514, so i set high priority to it.

Version-Release number of selected component (if applicable):
host info:
# uname -r && rpm -q qemu-kvm
3.10.0-64.el7.x86_64
qemu-kvm-1.5.3-30.el7.x86_64
guest info:
win2012R2
virtio-win-prewhql-0.1-74

How reproducible:
100%

Steps to Reproduce:
1.insert the usb3.0 stick in host via 3.0 usb controller and get the usb3.0 info from host.
# lsusb | grep CompUSA
Bus 004 Device 002: ID 1516:6221 CompUSA
# lsusb -v
...
Bus 004 Device 002: ID 1516:6221 CompUSA 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               3.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         9
  idVendor           0x1516 CompUSA
  idProduct          0x6221 
...
Binary Object Store Descriptor:
  bLength                 5
  bDescriptorType        15
  wTotalLength           22
  bNumDeviceCaps          2
  USB 2.0 Extension Device Capability:
    bLength                 7
    bDescriptorType        16
    bDevCapabilityType      2
    bmAttributes   0x00000002
      Link Power Management (LPM) Supported
  SuperSpeed USB Device Capability:
    bLength                10
    bDescriptorType        16
    bDevCapabilityType      3
    bmAttributes         0x00
    wSpeedsSupported   0x000e
      Device can operate at Full Speed (12Mbps)
      Device can operate at High Speed (480Mbps)
      Device can operate at SuperSpeed (5Gbps)
    bFunctionalitySupport   1
      Lowest fully-functional device speed is Full Speed (12Mbps)
    bU1DevExitLat          10 micro seconds
    bU2DevExitLat        2047 micro seconds
Device Status:     0x0000
  (Bus Powered)
...
2.passthrough the USB3.0 stick to windows guest with xHCI controller under pc.
e.g:...-device nec-usb-xhci,id=xhci0,bus=pci.0,addr=0x7 -device usb-host,hostbus=4,hostaddr=2,id=usb-stick,bus=xhci0.0
3.check the usb info via HMP monitor.
(qemu) info usb
(qemu) info qtree
4.check the device manager and disk management in guest.
  
Actual results:
after step 3,
(qemu) info usb
  Device 0.1, Port 1, Speed 12 Mb/s, Product QEMU USB Tablet
  Device 1.1, Port 1, Speed 5000 Mb/s, Product 
(qemu) info qtree
...
  dev: i440FX-pcihost, id ""
    pci-hole64-size = 16777216.000T
    irq 0
    bus: pci.0
      type PCI
      dev: nec-usb-xhci, id "xhci0"
        msi = on
        msix = on
        intrs = 16
        slots = 64
        p2 = 4
        p3 = 4
        addr = 07.0
        romfile = <null>
        rombar = 1
        multifunction = off
        command_serr_enable = on
        class USB controller, addr 00:07.0, pci id 1033:0194 (sub 1af4:1100)
        bar 0: mem at 0xfc030000 [0xfc033fff]
        bus: xhci0.0
          type usb-bus
          dev: usb-host, id "usb-stick"
            hostbus = 4
            hostaddr = 2
            hostport = <null>
            vendorid = 0x0
            productid = 0x0
            isobufs = 4
            isobsize = 32
            bootindex = -1
            loglevel = 2
            pipeline = on
            port = <null>
            serial = <null>
            full-path = on
            addr 1.1, port 1, speed 5000, name , attached
...
after step 4, it can regonize the xhci controller and USB Mass Storage Device in device manager, but fail to detect it in disk management and cann't work. I will attach the screenshot for it.

Expected results:
it display the disk correctly in disk management and can work well.

Additional info:
/usr/libexec/qemu-kvm -M pc -S -cpu SandyBridge,hv_spinlocks=0x1fff,hv_relaxed,hv_vapic -enable-kvm -m 2048 -smp 2,sockets=2,cores=1,threads=1 -no-kvm-pit-reinjection -usb -device usb-tablet,id=input0 -name sluo -uuid 990ea161-6b67-47b2-b803-19fb01d30d30 -rtc base=localtime,clock=host,driftfix=slew -device virtio-serial-pci,id=virtio-serial0,max_ports=16,vectors=0,bus=pci.0,addr=0x3 -chardev socket,id=channel1,path=/tmp/helloworld1,server,nowait -device virtserialport,chardev=channel1,name=com.redhat.rhevm.vdsm,bus=virtio-serial0.0,id=port1 -chardev socket,id=channel2,path=/tmp/helloworld2,server,nowait -device virtserialport,chardev=channel2,name=com.redhat.rhevm.vdsm,bus=virtio-serial0.0,id=port2 -drive file=/home/en_windows_server_2012_r2_x64.raw,if=none,id=drive-virtio-disk,format=raw,cache=none,aio=native,werror=stop,rerror=stop -device virtio-blk-pci,vectors=0,bus=pci.0,addr=0x4,scsi=off,drive=drive-virtio-disk,id=virtio-disk,bootindex=1 -netdev tap,id=hostnet0,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet0,id=virtio-net-pci0,mac=00:01:02:03:04:05,bus=pci.0,addr=0x5 -device virtio-balloon-pci,id=ballooning,bus=pci.0,addr=0x6 -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 -k en-us -boot menu=on -qmp tcp:0:4444,server,nowait -vnc :1 -spice disable-ticketing,port=5931 -vga qxl -monitor stdio -device nec-usb-xhci,id=xhci0,bus=pci.0,addr=0x7 -device usb-host,hostbus=4,hostaddr=2,id=usb-stick,bus=xhci0.0

Comment 1 Sibiao Luo 2013-12-26 02:44:51 UTC
Created attachment 841709 [details]
USB_Mass_Storage_Device_Properties.

Comment 2 Sibiao Luo 2013-12-26 02:45:22 UTC
Created attachment 841710 [details]
Screenshot_for_Disk_Management.

Comment 3 Sibiao Luo 2013-12-26 02:56:15 UTC
Tried the Q35 machine type also hit the same issue.

Comment 4 Sibiao Luo 2013-12-26 03:03:36 UTC
Tried the simulate usb-storage with xHCI controller that work well.

Comment 5 Sibiao Luo 2013-12-26 06:17:00 UTC
Summarize it as following:

1.USB3.0 stick passthrough to windows guest with xHCI under q35/pc  -----  Fail
2.USB3.0 stick passthrough to RHEL guest with xHCI under q35/pc     -----  OK
3.USB2.0 stick passthrough to RHEL/windows guest with xHCI          -----  OK
4.Simulate usb-storage with xHCI controller in widows/rhel guest    -----  OK

Best Regards,
sluo

Comment 6 Gerd Hoffmann 2014-01-15 15:34:06 UTC
Can I get full "lsusb -v" output for the stick please?

Comment 7 Sibiao Luo 2014-01-16 02:20:10 UTC
(In reply to Gerd Hoffmann from comment #6)
> Can I get full "lsusb -v" output for the stick please?
My USB3.0 stick info:

# lsusb | grep CompUSA
Bus 004 Device 002: ID 1516:6221 CompUSA 
# lsusb -v
...

Bus 004 Device 002: ID 1516:6221 CompUSA 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               3.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         9
  idVendor           0x1516 CompUSA
  idProduct          0x6221 
  bcdDevice            1.00
  iManufacturer           1 
  iProduct                2 
  iSerial                 3 ���
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           44
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst               3
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst               3
Binary Object Store Descriptor:
  bLength                 5
  bDescriptorType        15
  wTotalLength           22
  bNumDeviceCaps          2
  USB 2.0 Extension Device Capability:
    bLength                 7
    bDescriptorType        16
    bDevCapabilityType      2
    bmAttributes   0x00000002
      Link Power Management (LPM) Supported
  SuperSpeed USB Device Capability:
    bLength                10
    bDescriptorType        16
    bDevCapabilityType      3
    bmAttributes         0x00
    wSpeedsSupported   0x000e
      Device can operate at Full Speed (12Mbps)
      Device can operate at High Speed (480Mbps)
      Device can operate at SuperSpeed (5Gbps)
    bFunctionalitySupport   1
      Lowest fully-functional device speed is Full Speed (12Mbps)
    bU1DevExitLat          10 micro seconds
    bU2DevExitLat        2047 micro seconds
Device Status:     0x0000
  (Bus Powered)

Comment 10 Gerd Hoffmann 2014-05-23 11:08:02 UTC
Doesn't reproduce locally, please retest with latest packages.

Comment 11 Sibiao Luo 2014-05-26 05:03:09 UTC
(In reply to Gerd Hoffmann from comment #10)
> Doesn't reproduce locally, please retest with latest packages.
Still hit it with the same testing as comment #0 locally.

host info:
# uname -r && rpm -q qemu-kvm-rhev
3.10.0-121.el7.x86_64
qemu-kvm-rhev-1.5.3-60.el7ev.x86_64
guest info:
windows_server_2012_r2_x64

# lsusb
Bus 004 Device 002: ID 1516:6221 CompUSA 
...
e.g:...-device nec-usb-xhci,id=xhci0,bus=pci.0,addr=0x7 -device usb-host,hostbus=4,hostaddr=2,id=usb-stick,bus=xhci0.0
(qemu) info usb
  Device 0.1, Port 1, Speed 12 Mb/s, Product QEMU USB Tablet
  Device 1.1, Port 1, Speed 5000 Mb/s, Product 

It can regonize the xhci controller but the USB Mass Storage Device fail to work in device manager. Please see attachment 841709 [details] for detail.

Best Regards,
sluo

Comment 12 Gerd Hoffmann 2014-07-04 11:38:02 UTC
Please retest with this test build:
http://people.redhat.com/ghoffman/bz1103193/

Comment 14 Gerd Hoffmann 2014-09-02 12:04:59 UTC
Hmm, still doesn't reproduce.  Can you try again with an updated host kernel?
/me runs 3.10.0-138.el7, 3.10.0-146.el7 is available meanwhile.

Comment 18 Gerd Hoffmann 2015-05-04 08:26:10 UTC
please retest with qemu 2.3+

Comment 20 quxiaoya 2015-05-20 07:58:18 UTC
(In reply to Gerd Hoffmann from comment #18)
> please retest with qemu 2.3+

Hi Gerd,

I have retested with qemu-kvm-rhev-2.3.0-1.el7.x86_64, still hit this issue, too.

cli:
# /usr/libexec/qemu-kvm -monitor stdio -drive file=/home/win2012-64r2-virtio.qcow2,id=img,if=none,snapshot=on -device virtio-blk-pci,drive=img,id=sys-img -spice port=5931,disable-ticketing -m 2G -netdev tap,id=tap0,script=/etc/qemu-ifup -device virtio-net-pci,netdev=tap0,mac=24:be:05:0c:11:11,id=net0  --nodefaults -vga cirrus \
-device nec-usb-xhci,id=xhci0,bus=pci.0,addr=0x7 \
-device usb-host,hostbus=4,hostaddr=2,id=usb-stick,bus=xhci0.0

Comment 23 Gerd Hoffmann 2015-11-23 14:53:25 UTC
(In reply to quxiaoya from comment #20)
> (In reply to Gerd Hoffmann from comment #18)
> > please retest with qemu 2.3+
> 
> Hi Gerd,
> 
> I have retested with qemu-kvm-rhev-2.3.0-1.el7.x86_64, still hit this issue,
> too.

Any host kernel error messages?
Any change in behavior if you match the stick
by vendorid + productid instead of hostbus and hostaddr?

Comment 25 juzhang 2015-11-24 01:20:30 UTC
Hi Jing,

Could you give a test and update the testing result?

Best Regards,
Junyi

Comment 31 juzhang 2015-12-15 12:40:42 UTC
Hi Jing,

Could you reply comment30?

Best Regards,
Junyi