Bug 949385

Summary: passthrough USB speaker to win2012 guest fail to work well
Product: Red Hat Enterprise Linux 7 Reporter: Sibiao Luo <sluo>
Component: qemu-kvmAssignee: Gerd Hoffmann <kraxel>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 7.0CC: chayang, hhuang, juli, juzhang, knoel, kraxel, michen, qzhang, rbalakri, sluo, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-1.5.3-76.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-05 08:00:47 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: 981183    
Bug Blocks:    
Attachments:
Description Flags
screenshot for usb speaker under Q35.
none
Screenshot for 'usbdevice' working way under Q35
none
host:0c76:160c
none
vendorid+productid
none
hostbus+hostaddr none

Description Sibiao Luo 2013-04-08 03:53:19 UTC
Description of problem:
boot guest with USB speaker passthrough under Q35 machine type, but it fail to work correctly in guest via '-device usb-host ...'.
BTW, 
If i use the '-usb -usbdevice host:0c76:160c' method that have no such issue, it can work well in guest, does it very strange ?

Version-Release number of selected component (if applicable):
host info:
kernel-3.9.0-0.rc4.45.el7.x86_64
qemu-kvm-1.4.0-1.el7.x86_64
seabios-1.7.2-0.2.gita810e4e7.el7.x86_64
guest info:
windows: win2012 64bit

How reproducible:
100%

Steps to Reproduce:
1.check the usb info from host.
# lsusb | grep JMTek
Bus 002 Device 024: ID 0c76:160c JMTek, LLC.
# lsusb -v
Bus 002 Device 024: ID 0c76:160c JMTek, LLC. 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x0c76 JMTek, LLC.
  idProduct          0x160c 
  bcdDevice            1.00
  iManufacturer           0 
  iProduct                1 USB Speaker
  iSerial                 0 
  bNumConfigurations      1
...
Device Status:     0x0000
  (Bus Powered)
2.boot a win2012 64bit guest with passthrough USB speaker under Q35.
e.g:# /usr/libexec/qemu-kvm -S -M q35 -cpu SandyBridge -enable-kvm -m 4096 -smp 2,sockets=2,cores=1,threads=1 -no-kvm-pit-reinjection -name sluo-test -uuid ed09fa10-6ffe-4811-a42f-0294afcb5a42 -rtc base=localtime,clock=host,driftfix=slew -device virtio-serial-pci,id=virtio-serial0,max_ports=16,vectors=0,bus=pcie.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/windows_server_2012_x64.qcow2,if=none,id=drive-system-disk,format=qcow2,cache=none,aio=native,werror=stop,rerror=stop,serial=QEMU-DISK1 -device virtio-scsi-pci,bus=pcie.0,addr=0x4,id=scsi0 -device scsi-hd,bus=scsi0.0,drive=drive-system-disk,id=system-disk,bootindex=1 -netdev tap,id=hostnet0,vhost=off,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet0,id=virtio-net-pci0,mac=08:2e:5f:0a:0d:b1,bus=pcie.0,addr=0x5,bootindex=2 -device virtio-balloon-pci,id=ballooning,bus=pcie.0,addr=0x6 -drive file=/home/my-data-disk.raw,if=none,id=drive-data-disk,format=raw,cache=none,aio=native,werror=stop,rerror=stop,serial=QEMU-DISK2 -device virtio-scsi-pci,bus=pcie.0,addr=0x7,id=scsi1 -device scsi-hd,bus=scsi1.0,drive=drive-data-disk,id=data-disk -usb -device usb-host,hostbus=2,hostaddr=24,id=usb-stick -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 -serial unix:/tmp/ttyS0,server,nowait -qmp tcp:0:4444,server,nowait -k en-us -boot menu=on -vnc :1 -spice disable-ticketing,port=5931 -monitor stdio
3.check the usb info via HMP monitor.
(qemu) info usb
4.check the usb speaker to work in guest.
  
Actual results:
after step 3,
(qemu) info usb
  Device 0.1, Port 1, Speed 12 Mb/s, Product USB Speaker
(qemu) info qtree
...
      dev: ich9-usb-ehci1, id ""          <-----------should use uhci
        maxframes = 128
        addr = 1d.7
        romfile = <null>
        rombar = 1
        multifunction = on
        command_serr_enable = on
        class USB controller, addr 00:1d.7, pci id 8086:293a (sub 1af4:1100)
        bar 0: mem at 0xfebf4000 [0xfebf4fff]
        bus: usb-bus.0
          type usb-bus
          dev: usb-host, id "usb-stick"
            hostbus = 2
            hostaddr = 24
            hostport = <null>
            vendorid = 0x0
            productid = 0x0
            isobufs = 4
            bootindex = -1
            pipeline = on
            port = <null>
            full-path = on
            addr 0.1, port 1, speed 12, name USB Speaker, attached
...
after step 3, it fail to work in guest correctly, it prompt that no audio device is installed. i will attach the screenshot of device manager.

Expected results:
the step 2, the qemu use the wrong controller, it should use 'piix3-usb-uhci' same as specified in cli.
the step 3, it should work well in guest.

Additional info:
Test Matrix and Results:
+------------------------------------------------------------+-----------------+
|                       Method                               |      Q35        |
+---------- -------------------------------------------------+-----------------+
|...-usb -device usb-host,hostbus=2,hostaddr=24,id=usb-stick |      FAIL       |
+------------------------------------------------------------+-----------------+
|...-usb -device usb-host,vendorid=0x0c76,productid=0x160c   |      FAIL       |
+------------------------------------------------------------+-----------------+
|...-usb -usbdevice host:0c76:160c                           |      PASS       |
+------------------------------------------------------------+-----------------+

Comment 1 Sibiao Luo 2013-04-08 03:54:08 UTC
Created attachment 732537 [details]
screenshot for usb speaker under Q35.

Comment 2 Sibiao Luo 2013-04-08 03:54:58 UTC
My usb speaker info:
# lsusb -v
Bus 002 Device 024: ID 0c76:160c JMTek, LLC. 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x0c76 JMTek, LLC.
  idProduct          0x160c 
  bcdDevice            1.00
  iManufacturer           0 
  iProduct                1 USB Speaker
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          135
    bNumInterfaces          3
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      1 Control Device
      bInterfaceProtocol      0 
      iInterface              0 
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        wTotalLength           40
        bInCollection           1
        baInterfaceNr( 0)       1
      AudioControl Interface Descriptor:
        bLength                12
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID             1
        wTerminalType      0x0101 USB Streaming
        bAssocTerminal          0
        bNrChannels             2
        wChannelConfig     0x0003
          Left Front (L)
          Right Front (R)
        iChannelNames           0 
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID            17
        wTerminalType      0x0301 Speaker
        bAssocTerminal          0
        bSourceID              49
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                10
        bDescriptorType        36
        bDescriptorSubtype      6 (FEATURE_UNIT)
        bUnitID                49
        bSourceID               1
        bControlSize            1
        bmaControls( 0)      0x01
          Mute Control
        bmaControls( 1)      0x02
          Volume Control
        bmaControls( 2)      0x02
          Volume Control
        iFeature                0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
      AudioStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink           1
        bDelay                  1 frames
        wFormatTag              1 PCM
      AudioStreaming Interface Descriptor:
        bLength                11
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bNrChannels             2
        bSubframeSize           2
        bBitResolution         16
        bSamFreqType            1 Discrete
        tSamFreq[ 0]        48000
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            9
          Transfer Type            Isochronous
          Synch Type               Adaptive
          Usage Type               Data
        wMaxPacketSize     0x00c8  1x 200 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
        AudioControl Endpoint Descriptor:
          bLength                 7
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x00
          bLockDelayUnits         1 Milliseconds
          wLockDelay              1 Milliseconds
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.00
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      50
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0004  1x 4 bytes
        bInterval              32
Device Status:     0x0000
  (Bus Powered)

Comment 3 Gerd Hoffmann 2013-04-15 09:54:11 UTC
Puzzling.  Can you add the 'info qtree' output for the working (-usbdevice) case?

Comment 4 Sibiao Luo 2013-04-15 10:43:19 UTC
(In reply to comment #3)
> Puzzling.  Can you add the 'info qtree' output for the working (-usbdevice)
> case?

Gerd, maybe i mistake it that should 'piix3-usb-uhci', while i check the working (-usbdevice) case that it also use 'ich9-usb-ehci1' controller. 

The two ways(-device  usb-host,...) fail to works well in guest, but the '-usbdevice' way can works well, i will attach the working case screenshot later.
+------------------------------------------------------------+-----------------+
|                       Method                               |      Q35        |
+---------- -------------------------------------------------+-----------------+
|...-usb -device usb-host,hostbus=2,hostaddr=24,id=usb-stick |      FAIL       |
+------------------------------------------------------------+-----------------+
|...-usb -device usb-host,vendorid=0x0c76,productid=0x160c   |      FAIL       |
+------------------------------------------------------------+-----------------+
|...-usb -usbdevice host:0c76:160c                           |      PASS       |
+------------------------------------------------------------+-----------------+

Example of '-usb -usbdevice host:xxx:xxx':

# lsusb | grep JMTek
Bus 002 Device 003: ID 0c76:160c JMTek, LLC. 
# /usr/libexec/qemu-kvm -S -M q35 -cpu SandyBridge -enable-kvm -m 4096 -smp 2,sockets=2,cores=1,threads=1 -no-kvm-pit-reinjection -name sluo-test -uuid ed09fa10-6ffe-4811-a42f-0294afcb5a42 -rtc base=localtime,clock=host,driftfix=slew -device virtio-serial-pci,id=virtio-serial0,max_ports=16,vectors=0,bus=pcie.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/win2008r2-64.qcow2,if=none,id=drive-system-disk,format=qcow2,cache=none,aio=native,werror=stop,rerror=stop,serial=QEMU-DISK1 -device virtio-scsi-pci,bus=pcie.0,addr=0x4,id=scsi0 -device scsi-hd,bus=scsi0.0,drive=drive-system-disk,id=system-disk,bootindex=1 -netdev tap,id=hostnet0,vhost=off,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet0,id=virtio-net-pci0,mac=08:2e:5f:0a:0d:b1,bus=pcie.0,addr=0x5,bootindex=2 -device virtio-balloon-pci,id=ballooning,bus=pcie.0,addr=0x6 -usb -usbdevice host:0c76:160c -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 -serial unix:/tmp/ttyS0,server,nowait -qmp tcp:0:4444,server,nowait -k en-us -boot menu=on -vnc :1 -spice disable-ticketing,port=5931 -monitor stdio
(qemu) info usbhost
  Bus 1, Addr 2, Port 1, Speed 480 Mb/s
    Hub: USB device 8087:0024
  Bus 2, Addr 2, Port 1, Speed 480 Mb/s
    Hub: USB device 8087:0024
  Bus 1, Addr 3, Port 1.3, Speed 12 Mb/s
    Hub: USB device 0557:7000
  Bus 2, Addr 3, Port 1.7, Speed 12 Mb/s
    Class 00: USB device 0c76:160c, USB Speaker
  Bus 1, Addr 4, Port 1.3.1, Speed 1.5 Mb/s
    Class 00: USB device 0557:2213, CS-1734A V4.2.414
  Auto filters:
    Bus *, Addr *, Port *, ID 0c76:160c
(qemu) info usb
  Device 0.2, Port 1, Speed 12 Mb/s, Product USB Speaker
(qemu) info qtree
...
      dev: ich9-usb-ehci1, id ""
        maxframes = 128
        addr = 1d.7
        romfile = <null>
        rombar = 1
        multifunction = on
        command_serr_enable = on
        class USB controller, addr 00:1d.7, pci id 8086:293a (sub 1af4:1100)
        bar 0: mem at 0xfebf3000 [0xfebf3fff]
        bus: usb-bus.0
          type usb-bus
          dev: usb-host, id ""
            hostbus = 0
            hostaddr = 0
            hostport = <null>
            vendorid = 0xc76
            productid = 0x160c
            isobufs = 4
            bootindex = -1
            pipeline = on
            port = <null>
            full-path = on
            addr 0.2, port 1, speed 12, name USB Speaker, attached
...

Comment 5 Sibiao Luo 2013-04-15 10:43:56 UTC
Created attachment 735865 [details]
Screenshot for 'usbdevice' working way under Q35

Comment 6 Gerd Hoffmann 2013-04-18 12:27:49 UTC
The two screenshots come from two different guests.

And given that method #2 + #3 do internally exactly the same I suspect there is something else which makes the difference.  Please double-check.

Comment 7 Sibiao Luo 2013-04-19 02:55:52 UTC
(In reply to comment #6)
> The two screenshots come from two different guests.
> 
> And given that method #2 + #3 do internally exactly the same I suspect there
> is something else which makes the difference.  Please double-check.
ok. As my host was reinstalled and have no win2012 64bit guest, I installed a new win2012 64bit guest and test it this time, the results are the same.
# lsusb | grep JMTek
Bus 002 Device 004: ID 0c76:160c JMTek, LLC. 
# lsusb -v
...
Bus 002 Device 004: ID 0c76:160c JMTek, LLC. 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x0c76 JMTek, LLC.
  idProduct          0x160c 
  bcdDevice            1.00
  iManufacturer           0 
  iProduct                1 USB Speaker
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          135
    bNumInterfaces          3
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      1 Control Device
      bInterfaceProtocol      0 
      iInterface              0 
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        wTotalLength           40
        bInCollection           1
        baInterfaceNr( 0)       1
      AudioControl Interface Descriptor:
        bLength                12
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID             1
        wTerminalType      0x0101 USB Streaming
        bAssocTerminal          0
        bNrChannels             2
        wChannelConfig     0x0003
          Left Front (L)
          Right Front (R)
        iChannelNames           0 
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID            17
        wTerminalType      0x0301 Speaker
        bAssocTerminal          0
        bSourceID              49
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                10
        bDescriptorType        36
        bDescriptorSubtype      6 (FEATURE_UNIT)
        bUnitID                49
        bSourceID               1
        bControlSize            1
        bmaControls( 0)      0x01
          Mute Control
        bmaControls( 1)      0x02
          Volume Control
        bmaControls( 2)      0x02
          Volume Control
        iFeature                0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
      AudioStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink           1
        bDelay                  1 frames
        wFormatTag              1 PCM
      AudioStreaming Interface Descriptor:
        bLength                11
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bNrChannels             2
        bSubframeSize           2
        bBitResolution         16
        bSamFreqType            1 Discrete
        tSamFreq[ 0]        48000
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            9
          Transfer Type            Isochronous
          Synch Type               Adaptive
          Usage Type               Data
        wMaxPacketSize     0x00c8  1x 200 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
        AudioControl Endpoint Descriptor:
          bLength                 7
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x00
          bLockDelayUnits         1 Milliseconds
          wLockDelay              1 Milliseconds
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.00
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      50
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0004  1x 4 bytes
        bInterval              32
Device Status:     0x0000
  (Bus Powered)

# /usr/libexec/qemu-kvm -S -M q35 -cpu SandyBridge -enable-kvm -m 4096 -smp 2,sockets=2,cores=1,threads=1 -no-kvm-pit-reinjection -name sluo-test -uuid ed09fa10-6ffe-4811-a42f-0294afcb5a42 -rtc base=localtime,clock=host,driftfix=slew -device virtio-serial-pci,id=virtio-serial0,max_ports=16,vectors=0,bus=pcie.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/win2012-64.qcow2,if=none,id=drive-system-disk,format=qcow2,cache=none,aio=native,werror=stop,rerror=stop,serial=QEMU-DISK1 -device virtio-scsi-pci,bus=pcie.0,addr=0x4,id=scsi0 -device scsi-hd,bus=scsi0.0,drive=drive-system-disk,id=system-disk,bootindex=1 -netdev tap,id=hostnet0,vhost=off,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet0,id=virtio-net-pci0,mac=08:2e:5f:0a:0d:b1,bus=pcie.0,addr=0x5,bootindex=2 -device virtio-balloon-pci,id=ballooning,bus=pcie.0,addr=0x6 -usb -usbdevice host:0c76:160c -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 -serial unix:/tmp/ttyS0,server,nowait -qmp tcp:0:4444,server,nowait -k en-us -boot menu=on -vnc :1 -spice disable-ticketing,port=5931 -monitor stdio
(qemu) info usb
  Device 0.1, Port 1, Speed 12 Mb/s, Product USB Speaker
(qemu) info usbhost
  Bus 1, Addr 2, Port 1, Speed 480 Mb/s
    Hub: USB device 8087:0024
  Bus 2, Addr 2, Port 1, Speed 480 Mb/s
    Hub: USB device 8087:0024
  Bus 1, Addr 3, Port 1.3, Speed 12 Mb/s
    Hub: USB device 0557:7000
  Bus 2, Addr 4, Port 1.8, Speed 12 Mb/s
    Class 00: USB device 0c76:160c, USB Speaker
  Bus 1, Addr 4, Port 1.3.1, Speed 1.5 Mb/s
    Class 00: USB device 0557:2213, CS-1734A V4.2.414
  Auto filters:
    Bus *, Addr *, Port *, ID 0c76:160c
(qemu) info qtree
...
      dev: ich9-usb-ehci1, id ""
        maxframes = 128
        addr = 1d.7
        romfile = <null>
        rombar = 1
        multifunction = on
        command_serr_enable = on
        class USB controller, addr 00:1d.7, pci id 8086:293a (sub 1af4:1100)
        bar 0: mem at 0xfebf3000 [0xfebf3fff]
        bus: usb-bus.0
          type usb-bus
          dev: usb-host, id ""
            hostbus = 0
            hostaddr = 0
            hostport = <null>
            vendorid = 0xc76
            productid = 0x160c
            isobufs = 4
            bootindex = -1
            pipeline = on
            port = <null>
            full-path = on
            addr 0.1, port 1, speed 12, name USB Speaker, attached
...

# /usr/libexec/qemu-kvm -S -M q35 -cpu SandyBridge -enable-kvm -m 4096 -smp 2,sockets=2,cores=1,threads=1 -no-kvm-pit-reinjection -name sluo-test -uuid ed09fa10-6ffe-4811-a42f-0294afcb5a42 -rtc base=localtime,clock=host,driftfix=slew -device virtio-serial-pci,id=virtio-serial0,max_ports=16,vectors=0,bus=pcie.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/win2012-64.qcow2,if=none,id=drive-system-disk,format=qcow2,cache=none,aio=native,werror=stop,rerror=stop,serial=QEMU-DISK1 -device virtio-scsi-pci,bus=pcie.0,addr=0x4,id=scsi0 -device scsi-hd,bus=scsi0.0,drive=drive-system-disk,id=system-disk,bootindex=1 -netdev tap,id=hostnet0,vhost=off,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet0,id=virtio-net-pci0,mac=08:2e:5f:0a:0d:b1,bus=pcie.0,addr=0x5,bootindex=2 -device virtio-balloon-pci,id=ballooning,bus=pcie.0,addr=0x6 -usb -device usb-host,vendorid=0x0c76,productid=0x160c -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 -serial unix:/tmp/ttyS0,server,nowait -qmp tcp:0:4444,server,nowait -k en-us -boot menu=on -vnc :1 -spice disable-ticketing,port=5931 -monitor stdio
(qemu) info usb
  Device 0.1, Port 1, Speed 12 Mb/s, Product USB Speaker
(qemu) info usbhost
  Bus 1, Addr 2, Port 1, Speed 480 Mb/s
    Hub: USB device 8087:0024
  Bus 2, Addr 2, Port 1, Speed 480 Mb/s
    Hub: USB device 8087:0024
  Bus 1, Addr 3, Port 1.3, Speed 12 Mb/s
    Hub: USB device 0557:7000
  Bus 2, Addr 4, Port 1.8, Speed 12 Mb/s
    Class 00: USB device 0c76:160c, USB Speaker
  Bus 1, Addr 4, Port 1.3.1, Speed 1.5 Mb/s
    Class 00: USB device 0557:2213, CS-1734A V4.2.414
  Auto filters:
    Bus *, Addr *, Port *, ID 0c76:160c
(qemu) info qtree
...
      dev: ich9-usb-ehci1, id ""
        maxframes = 128
        addr = 1d.7
        romfile = <null>
        rombar = 1
        multifunction = on
        command_serr_enable = on
        class USB controller, addr 00:1d.7, pci id 8086:293a (sub 1af4:1100)
        bar 0: mem at 0xfebf3000 [0xfebf3fff]
        bus: usb-bus.0
          type usb-bus
          dev: usb-host, id ""
            hostbus = 0
            hostaddr = 0
            hostport = <null>
            vendorid = 0xc76
            productid = 0x160c
            isobufs = 4
            bootindex = -1
            pipeline = on
            port = <null>
            full-path = on
            addr 0.1, port 1, speed 12, name USB Speaker, attached
...

# /usr/libexec/qemu-kvm -S -M q35 -cpu SandyBridge -enable-kvm -m 4096 -smp 2,sockets=2,cores=1,threads=1 -no-kvm-pit-reinjection -name sluo-test -uuid ed09fa10-6ffe-4811-a42f-0294afcb5a42 -rtc base=localtime,clock=host,driftfix=slew -device virtio-serial-pci,id=virtio-serial0,max_ports=16,vectors=0,bus=pcie.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/win2012-64-virtio.qcow2,if=none,id=drive-system-disk,format=qcow2,cache=none,aio=native,werror=stop,rerror=stop,serial=QEMU-DISK1 -device virtio-scsi-pci,bus=pcie.0,addr=0x4,id=scsi0 -device scsi-hd,bus=scsi0.0,drive=drive-system-disk,id=system-disk,bootindex=1 -netdev tap,id=hostnet0,vhost=off,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet0,id=virtio-net-pci0,mac=08:2e:5f:0a:0d:b1,bus=pcie.0,addr=0x5,bootindex=2 -device virtio-balloon-pci,id=ballooning,bus=pcie.0,addr=0x6 -usb -device usb-host,hostbus=2,hostaddr=4,id=usb-stick -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 -serial unix:/tmp/ttyS0,server,nowait -qmp tcp:0:4444,server,nowait -k en-us -boot menu=on -vnc :1 -spice disable-ticketing,port=5931 -monitor stdio
(qemu) info usb
  Device 0.1, Port 1, Speed 12 Mb/s, Product USB Speaker
(qemu) info usbhost
  Bus 1, Addr 2, Port 1, Speed 480 Mb/s
    Hub: USB device 8087:0024
  Bus 2, Addr 2, Port 1, Speed 480 Mb/s
    Hub: USB device 8087:0024
  Bus 1, Addr 3, Port 1.3, Speed 12 Mb/s
    Hub: USB device 0557:7000
  Bus 2, Addr 4, Port 1.8, Speed 12 Mb/s
    Class 00: USB device 0c76:160c, USB Speaker
  Bus 1, Addr 4, Port 1.3.1, Speed 1.5 Mb/s
    Class 00: USB device 0557:2213, CS-1734A V4.2.414
  Auto filters:
    Bus 2, Addr 4, Port *, ID *:*
(qemu) info qtree
...
      dev: ich9-usb-uhci1, id ""
        masterbus = "usb-bus.0"
        firstport = 0
        bandwidth = 1280
        maxframes = 128
        addr = 1d.0
        romfile = <null>
        rombar = 1
        multifunction = on
        command_serr_enable = on
        class USB controller, addr 00:1d.0, pci id 8086:2934 (sub 1af4:1100)
        bar 4: i/o at 0xc0e0 [0xc0ff]
      dev: ich9-usb-ehci1, id ""
        maxframes = 128
        addr = 1d.7
        romfile = <null>
        rombar = 1
        multifunction = on
        command_serr_enable = on
        class USB controller, addr 00:1d.7, pci id 8086:293a (sub 1af4:1100)
        bar 0: mem at 0xfebf3000 [0xfebf3fff]
        bus: usb-bus.0
          type usb-bus
          dev: usb-host, id "usb-stick"
            hostbus = 2
            hostaddr = 4
            hostport = <null>
            vendorid = 0x0
            productid = 0x0
            isobufs = 4
            bootindex = -1
            pipeline = on
            port = <null>
            full-path = on
            addr 0.1, port 1, speed 12, name USB Speaker, attached
...

Comment 8 Sibiao Luo 2013-04-19 02:57:03 UTC
Created attachment 737500 [details]
host:0c76:160c

Comment 9 Sibiao Luo 2013-04-19 02:57:28 UTC
Created attachment 737501 [details]
vendorid+productid

Comment 10 Sibiao Luo 2013-04-19 02:57:49 UTC
Created attachment 737502 [details]
hostbus+hostaddr

Comment 11 Sibiao Luo 2013-04-19 03:00:01 UTC
host info:
kernel-3.9.0-0.rc6.51.el7.x86_64
qemu-kvm-1.4.0-1.el7.x86_64

guest info:
win2012 64bit

# lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                8
On-line CPU(s) list:   0-7
Thread(s) per core:    2
Core(s) per socket:    4
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 42
Stepping:              7
CPU MHz:               1598.000
BogoMIPS:              6782.68
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              8192K
NUMA node0 CPU(s):     0-7

Comment 12 Gerd Hoffmann 2013-05-14 13:45:37 UTC
Please retest with qemu 1.5 once packages are available.

Comment 13 Sibiao Luo 2013-07-08 02:20:35 UTC
Try it both with qemu-kvm-1.5.1-2.el7.x86_64 and qemu-kvm-1.5.1-1.el7.x86_64 that will core dump, please refer to bug 981183.

- test one.
host info:
3.10.0-0.rc7.64.el7.x86_64
qemu-kvm-1.5.1-1.el7.x86_64
guest info:
3.10.0-0.rc7.64.el7.x86_64
# /usr/libexec/qemu-kvm -S -M q35 -cpu SandyBridge ...-usb -usbdevice host:0c76:160c...
(qemu) qemu-kvm: hw/usb/core.c:413: usb_handle_packet: Assertion `p->ep->type != 3 || (dev->flags & (1 << USB_DEV_FLAG_IS_HOST))' failed.

- test two.
host info:
3.10.0-0.rc7.64.el7.x86_64
qemu-kvm-1.5.1-2.el7.x86_64
guest info:
3.10.0-0.rc7.64.el7.x86_64
# /usr/libexec/qemu-kvm -S -M q35 -cpu SandyBridge ...-usb -usbdevice host:0c76:160c...
(qemu) qemu-kvm: hw/usb/core.c:413: usb_handle_packet: Assertion `p->ep->type != 3 || (dev->flags & (1 << USB_DEV_FLAG_IS_HOST))' failed.
Aborted (core dumped)

Best Regards,
sluo

Comment 14 Gerd Hoffmann 2013-08-30 08:22:46 UTC
Assertion (comment #13) is fixed in 1.5.3, please retest.

Comment 15 Sibiao Luo 2013-08-30 09:51:03 UTC
(In reply to Gerd Hoffmann from comment #14)
> Assertion (comment #13) is fixed in 1.5.3, please retest.
Yes, have tried it as following, it still hit this issue again on qemu-kvm-1.5.3-2.el7.x86_64.

host info:
# uname -r && rpm -q qemu-kvm
3.10.0-11.el7.x86_64
qemu-kvm-1.5.3-2.el7.x86_64
gust info:
windows_server_2012_x64

# lsusb | grep JMTek
Bus 001 Device 003: ID 0c76:160c JMTek, LLC.

# /usr/libexec/qemu-kvm -S -M q35 -cpu SandyBridge -enable-kvm -m 4096 -smp 2,sockets=2,cores=1,threads=1 -no-kvm-pit-reinjection -name sluo-test -uuid ed09fa10-6ffe-4811-a42f-0294afcb5a42 -rtc base=localtime,clock=host,driftfix=slew -device virtio-serial-pci,id=virtio-serial0,max_ports=16,vectors=0,bus=pcie.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/windows_server_2012_x64.qcow2,if=none,id=drive-system-disk,format=qcow2,aio=native,werror=stop,rerror=stop,serial=QEMU-DISK1 -device virtio-scsi-pci,bus=pcie.0,addr=0x4,id=scsi0 -device scsi-hd,bus=scsi0.0,drive=drive-system-disk,id=system-disk,bootindex=1 -net none -device virtio-balloon-pci,id=ballooning,bus=pcie.0,addr=0x6 -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 -serial unix:/tmp/ttyS0,server,nowait -qmp tcp:0:4444,server,nowait -k en-us -boot menu=on -vnc :1 -spice disable-ticketing,port=5931 -monitor stdio [ + $Method ]

+------------------------------------------------------------+-----------------+
|                       Method                               |      Q35        |
+---------- -------------------------------------------------+-----------------+
|...-usb -device usb-host,hostbus=1,hostaddr=3,id=usb-stick  |      FAIL       |
+------------------------------------------------------------+-----------------+
|...-usb -device usb-host,vendorid=0x0c76,productid=0x160c   |      FAIL       |
+------------------------------------------------------------+-----------------+
|...-usb -usbdevice host:0c76:160c                           |      PASS       |
+------------------------------------------------------------+-----------------+

Best Regards,
sluo

Comment 16 Gerd Hoffmann 2013-09-11 12:49:02 UTC
Doesn't reproduce, no matter what I do.

Comment 17 Ronen Hod 2013-10-30 10:16:37 UTC
Postponed to 7.1, since Gerd cannot reproduce, and it is not critical.

Comment 18 Sibiao Luo 2013-12-26 07:53:07 UTC
Both the Q35 and pc-* machine type can hit such issue. And if use the xhci/uhci controller also can hit such issue.

+------------------------------------------------------------+-----------------+
|                       Method                               |      Q35        |
+---------- -------------------------------------------------+-----------------+
|...-device usb-host,hostbus=1,hostaddr=3,id=usb-stick       |      FAIL       |
+------------------------------------------------------------+-----------------+
|...-device usb-host,vendorid=0x0c76,productid=0x160c        |      FAIL       |
+------------------------------------------------------------+-----------------+
|...-usbdevice host:0c76:160c                                |      PASS       |
+------------------------------------------------------------+-----------------+

Best Regards,
sluo

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

Comment 23 Miroslav Rezanina 2014-10-21 14:53:12 UTC
Fix included in qemu-kvm-1.5.3-76.el7

Comment 25 Jun Li 2014-11-10 07:29:58 UTC
Reproduce:
Version of components:
host info:
kernel-3.9.0-0.rc4.45.el7.x86_64
qemu-kvm-1.5.3-70.el7.x86_64
guest info:
windows: win2012 64bit

Steps to Reproduce:
1.check the usb info from host.
# lsusb | grep JMTek
Bus 005 Device 002: ID 0c76:160c JMTek, LLC.

2.boot a win2012 64bit guest with passthrough USB speaker under Q35.
e.g:# /usr/libexec/qemu-kvm -S -M q35 -cpu SandyBridge -enable-kvm -m 4096 -smp 2,sockets=2,cores=1,threads=1 -no-kvm-pit-reinjection -name sluo-test -uuid ed09fa10-6ffe-4811-a42f-0294afcb5a42 -rtc base=localtime,clock=host,driftfix=slew -device virtio-serial-pci,id=virtio-serial0,max_ports=16,vectors=0,bus=pcie.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=/mnt/windows_img/win2012-64-virtio.qcow2,if=none,id=drive-system-disk,format=qcow2,cache=none,aio=native,werror=stop,rerror=stop,serial=QEMU-DISK1,snapshot=on -device virtio-blk-pci,bus=pcie.0,drive=drive-system-disk,id=system-disk,bootindex=1 -netdev tap,id=hostnet0,vhost=off,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet0,id=virtio-net-pci0,mac=08:2e:5f:0a:0d:b1,bus=pcie.0,addr=0x5,bootindex=2 -device virtio-balloon-pci,id=ballooning,bus=pcie.0,addr=0x6 -drive file=/home/my-data-disk.raw,if=none,id=drive-data-disk,format=raw,cache=none,aio=native,werror=stop,rerror=stop,serial=QEMU-DISK2 -device virtio-scsi-pci,bus=pcie.0,addr=0x7,id=scsi1 -device scsi-hd,bus=scsi1.0,drive=drive-data-disk,id=data-disk -usb -device usb-host,hostbus=5,hostaddr=2,id=usb-stick -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 -serial unix:/tmp/ttyS0,server,nowait -qmp tcp:0:4444,server,nowait -k en-us -boot menu=on -vnc :1 -spice disable-ticketing,port=5931 -monitor stdio
3.check the usb info via HMP monitor.
(qemu) info qtree
4.check the usb speaker to work in guest.

Actual results:
After step 4, when use usb speaker inside guest, qemu-kvm will hang, host will coretrace.

# dmesg
...
[ 1681.370797] Call Trace:
[ 1681.373976]  [<ffffffff81602829>] schedule+0x29/0x70
[ 1681.379676]  [<ffffffff81431b15>] usb_kill_urb+0x85/0xc0
[ 1681.385723]  [<ffffffff81084d90>] ? wake_up_bit+0x30/0x30
[ 1681.391854]  [<ffffffff81430a98>] usb_hcd_flush_endpoint+0x128/0x1a0
[ 1681.398941]  [<ffffffff814337b9>] usb_disable_endpoint+0x59/0x90
[ 1681.405682]  [<ffffffff81433836>] usb_disable_interface+0x46/0x60
[ 1681.412516]  [<ffffffff81433d44>] usb_set_interface+0x194/0x360
[ 1681.419170]  [<ffffffff8143df45>] usbdev_do_ioctl+0x985/0xfd0
[ 1681.425651]  [<ffffffff8143e5be>] usbdev_ioctl+0xe/0x20
[ 1681.431601]  [<ffffffff811ae645>] do_vfs_ioctl+0x305/0x520
[ 1681.437820]  [<ffffffff8129536e>] ? file_has_perm+0x8e/0xa0
[ 1681.444126]  [<ffffffff811ae8e1>] sys_ioctl+0x81/0xa0
[ 1681.449917]  [<ffffffff8160c8d9>] system_call_fastpath+0x16/0x1b

after step 3,
(qemu) info qtree
...
      dev: ich9-usb-ehci1, id ""
        maxframes = 128
        addr = 1d.7
        romfile = <null>
        rombar = 1
        multifunction = on
        command_serr_enable = on
        class USB controller, addr 00:1d.7, pci id 8086:293a (sub 1af4:1100)
        bar 0: mem at 0xfebd4000 [0xfebd4fff]
        bus: usb-bus.0
          type usb-bus
          dev: usb-host, id "usb-stick"
            hostbus = 5
            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
            msos-desc = on
            addr 0.1, port 1, speed 12, name USB Speaker, attached
...
---
As above show, this bz has been verified.
=================
Verify:
Version of components:
host info:
3.10.0-186.el7.x86_64
qemu-kvm-1.5.3-77.el7.x86_64
guest info:
windows: win2012 64bit

Steps and cli as above show, after step4, can use this usb speaker to play music. qemu-kvm, host and guest are all works well.

Hi Gerd,

  I still have a query, does the usb speaker should be under uhci controller(Just as sluo said in comment0)? Here, I find it still under ich9-usb-ehci1 controller. Could you help to double check this issue. Thanks.

(qemu) info qtree
...
      dev: ich9-usb-ehci1, id ""     <--- Here should be uhci or not ?
        maxframes = 128
        addr = 1d.7
        romfile = <null>
        rombar = 1
        multifunction = on
        command_serr_enable = on
        class USB controller, addr 00:1d.7, pci id 8086:293a (sub 1af4:1100)
        bar 0: mem at 0xfebd4000 [0xfebd4fff]
        bus: usb-bus.0
          type usb-bus
          dev: usb-host, id "usb-stick"
            hostbus = 5
            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
            msos-desc = on
            addr 0.1, port 1, speed 12, name USB Speaker, attached
...

==================
Also test with qemu-kvm-rhev-2.1.2-6.el7.x86_64.
host info:
3.10.0-186.el7.x86_64
guest info:
windows: win2012 64bit

After step4, this usb speaker can works well inside guest(can play music correctly), qemu-kvm, guest and host are all works well.

Comment 26 Gerd Hoffmann 2014-11-10 09:23:19 UTC
>   I still have a query, does the usb speaker should be under uhci
> controller(Just as sluo said in comment0)? Here, I find it still under
> ich9-usb-ehci1 controller. Could you help to double check this issue. Thanks.

Simple mp3 playback should work on both uhci and ehci.  With uhci some features of the device (such as high sample rates) might not be available due to bandwidth constrains.

Comment 29 errata-xmlrpc 2015-03-05 08:00:47 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.

https://rhn.redhat.com/errata/RHSA-2015-0349.html