# [solved] USB problem due to wrong PCI / IRQ settings

## ruediger

Hi *,

since a while I observe low USB performance for attached mass storage devices. Now I checked and found that they are using uhci only.

With the sysrescue live-cd I verified that it's not a HW-problem - all USB ports work fine with EHCI / 480MB/s with exactly the same configuration (used ports) that I use with gentoo. So it must be a SW-problem.

I cannot exactly define when this started, but I suspect the last major update that included xorg 1.5, HAL and related stuff.

With lshw I found 2 EHCI controllers, but under gentoo one is marked as "unclaimed". I don't know why, and I'm not a HAL/uvdev/whatever expert, so I don't know where to start. Who can give me some hints? Thanks!

RüdigerLast edited by ruediger on Wed Aug 05, 2009 9:21 pm; edited 2 times in total

----------

## NeddySeagoon

ruediger,

Please post the content of /proc/bus/usb/devices this shows your USB device tree.

You can look at it with usbview.

You must not mix USB2 and USB1 devices on the same USB root hub or all devices will work at USB1 speeds

----------

## ruediger

This is the EHCI when I attach an USB stick:

```
EHCI Host Controller

Manufacturer: Linux 2.6.29-gentoo-r5 ehci_hcd

Serial Number: 0000:00:1d.7

Speed: 480Mb/s (high)

Number of Ports: 6

Bandwidth allocated: 0 / 800 (0%)

Total number of interrupt requests: 0

Total number of isochronous requests: 0

USB Version:  2.00

Device Class: 09(hub  )

Device Subclass: 00

Device Protocol: 00

Maximum Default Endpoint Size: 64

Number of Configurations: 1

Vendor Id: 1d6b

Product Id: 0002

Revision Number:  2.06

Config Number: 1

   Number of Interfaces: 1

   Attributes: e0

   MaxPower Needed:   0mA

   Interface Number: 0

      Name: hub

      Alternate Number: 0

      Class: 09(hub  ) 

      Sub Class: 00

      Protocol: 00

      Number of Endpoints: 1

         Endpoint Address: 81

         Direction: in

         Attribute: 3

         Type: Int.

         Max Packet Size: 4

         Interval: 256ms

```

The stick is connected to the UHCI controller:

```
UHCI Host Controller

Manufacturer: Linux 2.6.29-gentoo-r5 uhci_hcd

Serial Number: 0000:00:1a.0

Speed: 12Mb/s (full)

Number of Ports: 2

Bandwidth allocated: 0 / 900 (0%)

Total number of interrupt requests: 0

Total number of isochronous requests: 0

USB Version:  1.10

Device Class: 09(hub  )

Device Subclass: 00

Device Protocol: 00

Maximum Default Endpoint Size: 64

Number of Configurations: 1

Vendor Id: 1d6b

Product Id: 0001

Revision Number:  2.06

Config Number: 1

   Number of Interfaces: 1

   Attributes: e0

   MaxPower Needed:   0mA

   Interface Number: 0

      Name: hub

      Alternate Number: 0

      Class: 09(hub  ) 

      Sub Class: 00

      Protocol: 00

      Number of Endpoints: 1

         Endpoint Address: 81

         Direction: in

         Attribute: 3

         Type: Int.

         Max Packet Size: 2

         Interval: 255ms

DISK 2.0

Manufacturer: USB

Serial Number: GUL5RIWTCY81O99A

Speed: 12Mb/s (full)

USB Version:  2.00

Device Class: 00(>ifc )

Device Subclass: 00

Device Protocol: 00

Maximum Default Endpoint Size: 64

Number of Configurations: 1

Vendor Id: 090c

Product Id: 1000

Revision Number: 12.19

Config Number: 1

   Number of Interfaces: 1

   Attributes: 80

   MaxPower Needed: 100mA

   Interface Number: 0

      Name: usb-storage

      Alternate Number: 0

      Class: 08(stor.) 

      Sub Class: 06

      Protocol: 50

      Number of Endpoints: 2

         Endpoint Address: 81

         Direction: in

         Attribute: 2

         Type: Bulk

         Max Packet Size: 64

         Interval: 0ms

         Endpoint Address: 02

         Direction: out

         Attribute: 2

         Type: Bulk

         Max Packet Size: 64

         Interval: 0ms

```

lsusb:

Bus 004 Device 002: ID 062a:0102 Creative Labs

Bus 004 Device 001: ID 1d6b:0001

Bus 003 Device 001: ID 1d6b:0001

Bus 002 Device 003: ID 090c:1000 Feiya Technology Corp. Memory Bar

Bus 002 Device 001: ID 1d6b:0001

Bus 001 Device 001: ID 1d6b:0002

with exactly the same HW setup thy SysRescue Linux uses the EHCI. Strange.

----------

## NeddySeagoon

ruediger,

```
EHCI Host Controller

Manufacturer: Linux 2.6.29-gentoo-r5 ehci_hcd

Serial Number: 0000:00:1d.7 
```

and

```
UHCI Host Controller

Manufacturer: Linux 2.6.29-gentoo-r5 uhci_hcd

Serial Number: 0000:00:1a.0 
```

are different root hubs ... look at the serial numbers.

Please post your /proc/bus/usb/devices

----------

## ruediger

cat /proc/bus/usb/devices

```
T:  Bus=04 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=12  MxCh= 2

B:  Alloc= 27/900 us ( 3%), #Int=  2, #Iso=  0

D:  Ver= 1.10 Cls=09(hub  ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1

P:  Vendor=1d6b ProdID=0001 Rev= 2.06

S:  Manufacturer=Linux 2.6.29-gentoo-r5 uhci_hcd

S:  Product=UHCI Host Controller

S:  SerialNumber=0000:00:1d.1

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

E:  Ad=81(I) Atr=03(Int.) MxPS=   2 Ivl=255ms

T:  Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=1.5 MxCh= 0

D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1

P:  Vendor=062a ProdID=0102 Rev= 1.00

S:  Manufacturer=MOSART Semi.

S:  Product=Wireless Keyboard & Mouse

C:* #Ifs= 2 Cfg#= 1 Atr=a0 MxPwr=100mA

I:* If#= 0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=01 Prot=01 Driver=usbhid

E:  Ad=81(I) Atr=03(Int.) MxPS=   8 Ivl=10ms

I:* If#= 1 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=01 Prot=02 Driver=usbhid

E:  Ad=82(I) Atr=03(Int.) MxPS=   5 Ivl=10ms

T:  Bus=03 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=12  MxCh= 2

B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0

D:  Ver= 1.10 Cls=09(hub  ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1

P:  Vendor=1d6b ProdID=0001 Rev= 2.06

S:  Manufacturer=Linux 2.6.29-gentoo-r5 uhci_hcd

S:  Product=UHCI Host Controller

S:  SerialNumber=0000:00:1d.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

E:  Ad=81(I) Atr=03(Int.) MxPS=   2 Ivl=255ms

T:  Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=12  MxCh= 2

B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0

D:  Ver= 1.10 Cls=09(hub  ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1

P:  Vendor=1d6b ProdID=0001 Rev= 2.06

S:  Manufacturer=Linux 2.6.29-gentoo-r5 uhci_hcd

S:  Product=UHCI Host Controller

S:  SerialNumber=0000:00:1a.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

E:  Ad=81(I) Atr=03(Int.) MxPS=   2 Ivl=255ms

T:  Bus=02 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#=  2 Spd=12  MxCh= 0

D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1

P:  Vendor=090c ProdID=1000 Rev=12.19

S:  Manufacturer=USB

S:  Product=DISK 2.0

S:  SerialNumber=GUL5RIWTCY81O99A

C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA

I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage

E:  Ad=81(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms

E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms

T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480 MxCh= 6

B:  Alloc=  0/800 us ( 0%), #Int=  0, #Iso=  0

D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1

P:  Vendor=1d6b ProdID=0002 Rev= 2.06

S:  Manufacturer=Linux 2.6.29-gentoo-r5 ehci_hcd

S:  Product=EHCI Host Controller

S:  SerialNumber=0000:00:1d.7

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

E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256ms

```

----------

## ruediger

some more findings

lspci -k

```

...

00:1a.0 USB Controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #4

        Kernel driver in use: uhci_hcd

00:1a.1 USB Controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #5

00:1a.2 USB Controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #6

00:1a.7 USB Controller: Intel Corporation 82801JI (ICH10 Family) USB2 EHCI Controller #2

00:1d.0 USB Controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #1

        Kernel driver in use: uhci_hcd

00:1d.1 USB Controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #2

        Kernel driver in use: uhci_hcd

00:1d.2 USB Controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #3

00:1d.7 USB Controller: Intel Corporation 82801JI (ICH10 Family) USB2 EHCI Controller #1

        Kernel driver in use: ehci_hcd

...
```

it seems that the problem is due to the fact that the second ehci controller (00:1a.7) is not claimed by a driver

if I connect to the rear backplane USB ports I get full 480 MB/s

who has an idea why the drivers / kernel don't feel responsible for that controller with my gentoo, but when I boot other linux distributions (live-CD) they do?

and I'm sure they did on my gentoo some time ago also ...

----------

## ruediger

hmmm ... coming closer to the problem:

dmesg | grep -i ehci

```
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver

ehci_hcd: block sizes: qh 128 qtd 96 itd 160 sitd 96

ehci_hcd 0000:00:1a.7: PCI INT C -> Link[LNKC] -> GSI 15 (level, low) -> IRQ 15

ehci_hcd 0000:00:1a.7: setting latency timer to 64

ehci_hcd 0000:00:1a.7: EHCI Host Controller

ehci_hcd 0000:00:1a.7: new USB bus registered, assigned bus number 1

ehci_hcd 0000:00:1a.7: reset hcs_params 0x103206 dbg=1 cc=3 pcc=2 ordered !ppc ports=6

ehci_hcd 0000:00:1a.7: reset hcc_params 16871 thresh 7 uframes 1024 64 bit addr

ehci_hcd 0000:00:1a.7: reset command 080002 (park)=0 ithresh=8 period=1024 Reset HALT

ehci_hcd 0000:00:1a.7: debug port 1

ehci_hcd 0000:00:1a.7: cache line size of 32 is not supported

ehci_hcd 0000:00:1a.7: supports USB remote wakeup

ehci_hcd 0000:00:1a.7: request interrupt 15 failed

ehci_hcd 0000:00:1a.7: USB bus 1 deregistered

ehci_hcd 0000:00:1a.7: PCI INT C disabled

ehci_hcd 0000:00:1a.7: init 0000:00:1a.7 fail, -16

ehci_hcd: probe of 0000:00:1a.7 failed with error -16

```

so it's a kernel / driver problem

how can I force the driver to use another irq?

----------

## ruediger

this is what the sysrescue linux (BTW: also a gentoo) configures

```
ehci_hcd 0000:00:1a.7: PCI INT C -> GSI 18 (level, low) -> IRQ 18

```

I tried lots of different kernel configurations, also modified some BIOS settings, but no positive results

anyone any idea?

----------

## NeddySeagoon

ruediger,

Its a requirement of the PCI specification that IRQs can be shared.

IRQ service routines havr to take this into account.  

Are you using ACPI or the old NT IRQ behaviour?

What does your /proc/interrupts show?

IO-APIC entries are good, PC-XT entries are bad.

IO-APIC is a kernel option.

----------

## ruediger

Neddy,

I read through some documents and learned a lot about APICs, PICs and other related stuff. Tried to configure accordingly but no success.

I finally "solved" the problem by creating a default kernel from scratch ("make defconfig"), modified it for my hardware and now EHCI works fine again on all my USB ports.

Thanks for your input.

Ruediger

----------

