Re: [gentoo-user] Re: new USB question

2020-10-06 Thread Jack
Bottom line - as far as I can tell, the motherboard and software are  
actually all behaving correctly, if confusingly.  Details below.


On 2020.10.06 00:45, Sid Spry wrote:

On Mon, Oct 5, 2020, at 1:33 PM, Jack wrote:
> Grant - thanks for the info.
>
I'm curious about the pairing by PCI device - it's not clear if the  
every root_hub is a real controller, or not.  The specs of the board  
say USB2: two ports on the back and two USB2 headers (so I don't  
know why it claims 10 ports instead of 6) and USB3: three type A and  
one Type C ports on the back.  Bus 2 is a bit of a mystery, as  
although the B350 chipset presumably does have an enhanced  
superspeed (3.1) controller, it is not available through the  
motherboard.  If bus 3 is the unavailable 3.1 controller, then is  
bus 1 driven by the CPU or the chipset, and where is the other one?   
So far, anything plugged into any of the front ports or rear USB2  
ports shows up on bus 1, and anything plugged into the rear USB3  
ports shows up on bus 3.  I think my new USB flash drive is really  
USB2 and not USB3 as advertised.


Logically I think the controllers are separate, but they are spawned  
from the same device. On an ARM64 system there is a single DWC3  
device per USB3/2 pair. Intel is moving to DesignWare's IP, and I  
think existing platforms that split devices are similar. Additionally  
the xHCI driver is now being used to drive all USB bus types.
Agreed.  Under Linux, a single USB2/3 port shows up as two separate  
ports, under separate hubs, but both mapped to the same controller.   
Plug in a device, and it shows up on the hub for the speed of the  
device.  (We may have a terminology issue, but I'm calling the  
controller the physical implementation in the CPU or chipset, and the  
hub a more logical thing more based in the driver software.


If you want to test this you can unbind the driver from individual  
PCIe devices. Check /sys/bus/pci/devices and see what disappears.


On a development board I see:

$ lsusb -t
/:  Bus 06.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 5000M
/:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 480M
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=ohci-platform/1p, 12M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=ohci-platform/1p, 12M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-platform/1p,  
480M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-platform/1p,  
480M


And I happen to know the first 2 lines are the platform device at  
fe90. If I disable that device both disappear.


However, as I tried to describe earlier, on most x86 systems I have  
used it is possible to actually plug a USB2 device into a port  
associated with a USB3 root hub and the output would be rewritten as  
such:


$ lsusb -t
/:  Bus 06.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 480M
/:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 480M
Here, my current understanding is not that bus 6 will be rewritten to  
show the slower speed, but that a true USB3 device plugged into that  
port will show up on bus 6, and a USB2 device plugged into the same  
port will show up on bus 5.


When all USB2 devices are removed the bus speed returns to 5000M.
I"m still guessing slightly, still not having a true USB 3.0 device to  
test, but in my case, I don't think any hubs will switch speed.  Two  
hub/ports show up for each physical port.


I suspect you are encountering some variation of this. Can you unplug  
absolutely everything and see the speeds reported by lsusb -t? Then,  
plug things in and see if they change. If you've already done this my  
apologies, it's kind of hard to find the text among all the dmesg.
No lines in libusb or libusb -t output change, only lines get  
added/removed when plugging/unplugging anything.  As I said, however,  
my biggest problem now is that I don't actually have a real USB 3.0  
device.  The USB 3.0 flash drive I bought was simply a fraudulent  
listing (already refunded) and the webcam seems to be internally  
capable of SuperSpeed, but will never actually do so, since it's plug  
is an old USB2 Type A plug, without the five extra connectors which  
would carry the USB3 signale.


Later, I'll reboot into Windows to see what that shows, as MSI tech  
support refuses to talk about Linux.
As much as I hate to have done so, running Microsoft's USB Viewer  
finally made things click for me.  That shows only two controllers,  
both xHCI, and the IDs let me map them to what I see in Linux.  One has  
eight ports.  Four of those ports are USB 3.0 only and the other four  
are USB 1.1/2.0 - and they are listed as pairs of "companion ports."
On linux, each set of four shows up as a separate hub.  These map to  
the two USB3 headers, one of which is currently connected to the front  
USB ports.   All that comes from the CPU.  the other controller shows  
fourteen ports.  The first eight are four pairs as with the other  
controller.  These are 

Re: [gentoo-user] Re: new USB question

2020-10-05 Thread Sid Spry
On Mon, Oct 5, 2020, at 1:33 PM, Jack wrote:
> Grant - thanks for the info.
> 
> I'm curious about the pairing by PCI device - it's not clear if the  
> every root_hub is a real controller, or not.  The specs of the board  
> say USB2: two ports on the back and two USB2 headers (so I don't know  
> why it claims 10 ports instead of 6) and USB3: three type A and one  
> Type C ports on the back.  Bus 2 is a bit of a mystery, as although the  
> B350 chipset presumably does have an enhanced superspeed (3.1)  
> controller, it is not available through the motherboard.  If bus 3 is  
> the unavailable 3.1 controller, then is bus 1 driven by the CPU or the  
> chipset, and where is the other one?  So far, anything plugged into any  
> of the front ports or rear USB2 ports shows up on bus 1, and anything  
> plugged into the rear USB3 ports shows up on bus 3.  I think my new USB  
> flash drive is really USB2 and not USB3 as advertised.
> 

Logically I think the controllers are separate, but they are spawned from
the same device. On an ARM64 system there is a single DWC3 device
per USB3/2 pair. Intel is moving to DesignWare's IP, and I think
existing platforms that split devices are similar. Additionally the xHCI
driver is now being used to drive all USB bus types.

If you want to test this you can unbind the driver from individual PCIe
devices. Check /sys/bus/pci/devices and see what disappears.

On a development board I see:

$ lsusb -t
/:  Bus 06.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 5000M
/:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 480M
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=ohci-platform/1p, 12M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=ohci-platform/1p, 12M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-platform/1p, 480M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-platform/1p, 480M

And I happen to know the first 2 lines are the platform device at fe90.
If I disable that device both disappear.

However, as I tried to describe earlier, on most x86 systems I have used
it is possible to actually plug a USB2 device into a port associated with
a USB3 root hub and the output would be rewritten as such:

$ lsusb -t
/:  Bus 06.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 480M
/:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 480M

When all USB2 devices are removed the bus speed returns to 5000M.

I suspect you are encountering some variation of this. Can you unplug
absolutely everything and see the speeds reported by lsusb -t? Then,
plug things in and see if they change. If you've already done this my
apologies, it's kind of hard to find the text among all the dmesg.

> Later, I'll reboot into Windows to see what that shows, as MSI tech  
> support refuses to talk about Linux.
> 

It may be worth pointing out the platform implements standards that are
divorced from the OS you are running. If it doesn't work with both it
can still be their problem.

Recently I had to do a differential test using Windows, assuming it'd
be more featureful. It is. But Windows has issues with device enumeration.
I am wondering if the original link speed problems (USB2 devices slowing
down USB3 busses) was a Linux-specific issue, or if it was just
only visible to me on Linux.

I think I am encountering some variation of your problem, but mine is
even weirder. I have control over the device which is USB-C. In one
cable orientation it will enumerate with Windows, in the other it will not.
In that same orientation it will enumerate against an ARM64 system
as USB3. In the other orientation it will enumerate against ARM64/x86
systems as USB2. It seems to be unable to enumerate as a USB3
device on Linux, but I need to do more testing.

A friend of mine reports he has a USB-C cable that is not reversible.
This may not be the cable's fault.

So: Check your cable, and try more than one device. Also there may be
bugs in either the kernel's xhci drivers or new USB3 hardware.



Re: [gentoo-user] Re: new USB question

2020-10-05 Thread Jack

Grant - thanks for the info.

On 2020.10.04 21:41, Grant Edwards wrote:

On 2020-10-05, Jack  wrote:

Still not Gentoo specific, but I'm still trying to figure out if my  
motherboard (MSI B350 Tomahawk) is doing something funny with the  
USB connections.  In theory, there should be USB3 connections both  
on the back IO panel and on the front case ports.
I don't know if this is helpful, but I have an MSI B450 Tomahawk Max,  
and the USB3.3 headers that I route to front-panel connectors work  
fine. I just plugged a USB3 flash drive into one of them:


[299865.738407] usb 2-4: new SuperSpeed Gen 1 USB device number 2  
using xhci_hcd
[299865.760045] usb 2-4: New USB device found, idVendor=05dc,  
idProduct=a838, bcdDevice=11.00
[299865.760051] usb 2-4: New USB device strings: Mfr=1, Product=2,  
SerialNumber=3

[299865.760053] usb 2-4: Product: USB Flash Drive
[299865.760056] usb 2-4: Manufacturer: Lexar
[299865.760058] usb 2-4: SerialNumber: AAHDQZ7ENQ3ORRPS
[299865.770842] usb-storage 2-4:1.0: USB Mass Storage device detected
[299865.771034] scsi host9: usb-storage 2-4:1.0
[299867.095086] scsi 9:0:0:0: Direct-Access LexarUSB Flash  
Drive  1100 PQ: 0 ANSI: 6

[299867.095310] sd 9:0:0:0: Attached scsi generic sg4 type 0
[299867.095905] sd 9:0:0:0: [sdd] 62517248 512-byte logical blocks:  
(32.0 GB/29.8 GiB)

[299867.096389] sd 9:0:0:0: [sdd] Write Protect is off
[299867.096394] sd 9:0:0:0: [sdd] Mode Sense: 43 00 00 00
[299867.096872] sd 9:0:0:0: [sdd] Write cache: enabled, read cache:  
enabled, doesn't support DPO or FUA

[299867.112375]  sdd: sdd1 sdd2
[299867.114301] sd 9:0:0:0: [sdd] Attached SCSI removable disk

I also have two USB2 connectors on the front panel.

All total, there are

  2 x USB2in back panel
  4 x USB3.2  in back panel

  4 x USB2on two dual-port 10-pin headers
  2 x USB3.2  on one dual-port 20-pin header

It appears that I have a total of 6 USB hubs on the motherboard:

$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

It looks like you should have two 20-pin USB3 headers on your  
motherboard (mine only has 1).  Are you sure your front-panel  
connectors are plugged into a USB3 header and not one of the 10-pin  
USB2 headers?
Front panel is definitely plugged into one of the two USB3 headers.   
There are also two USB2 headers, unused.


lsusb -tv shows
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
ID 1d6b:0003 Linux Foundation 3.0 root hub
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M
ID 1d6b:0002 Linux Foundation 2.0 root hub
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 1M
ID 1d6b:0003 Linux Foundation 3.0 root hub
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/10p, 480M
ID 1d6b:0002 Linux Foundation 2.0 root hub

extracted from dmesg
[8.465096] xhci_hcd :03:00.0: xHCI Host Controller
[8.465728] xhci_hcd :03:00.0: new USB bus registered, assigned  
bus number 1
[8.521723] xhci_hcd :03:00.0: hcc params 0x0200ef81 hci version  
0x110 quirks 0x48000410
[8.523257] usb usb1: New USB device found, idVendor=1d6b,  
idProduct=0002, bcdDevice= 5.08
[8.523974] usb usb1: New USB device strings: Mfr=3, Product=2,  
SerialNumber=1

[8.524693] usb usb1: Product: xHCI Host Controller
[8.525411] usb usb1: Manufacturer: Linux 5.8.10-gentoo-x86_64-01  
xhci-hcd

[8.526141] usb usb1: SerialNumber: :03:00.0
[8.526931] hub 1-0:1.0: USB hub found
[8.527674] hub 1-0:1.0: 10 ports detected

[8.528580] xhci_hcd :03:00.0: xHCI Host Controller
[8.529307] xhci_hcd :03:00.0: new USB bus registered, assigned  
bus number 2
[8.530042] xhci_hcd :03:00.0: Host supports USB 3.1 Enhanced  
SuperSpeed
[8.530809] usb usb2: We don't know the algorithms for LPM for this  
host, disabling LPM.
[8.531568] usb usb2: New USB device found, idVendor=1d6b,  
idProduct=0003, bcdDevice= 5.08
[8.532313] usb usb2: New USB device strings: Mfr=3, Product=2,  
SerialNumber=1

[8.533049] usb usb2: Product: xHCI Host Controller
[8.533780] usb usb2: Manufacturer: Linux 5.8.10-gentoo-x86_64-01  
xhci-hcd

[8.534524] usb usb2: SerialNumber: :03:00.0
[8.535329] hub 2-0:1.0: USB hub found
[8.536081] hub 2-0:1.0: 4 ports detected

[8.536954] xhci_hcd :1d:00.3: xHCI Host Controller
[8.537710] xhci_hcd :1d:00.3: new USB bus registered, assigned  
bus number 3
[8.538558] xhci_hcd :1d:00.3: hcc params 0x0270f665 hci version  
0x100 quirks 0x0410
[8.539440] usb usb3: New USB device found, idVendor=1d6b,  
idProduct=0002, bcdDevice= 5.08
[

[gentoo-user] Re: new USB question

2020-10-04 Thread Grant Edwards
On 2020-10-05, Grant Edwards  wrote:

[on a B450 tomahawk]

> It appears that I have a total of 6 USB hubs on the motherboard:
>
> $ lsusb
> Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
> Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
> Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
> Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub


And with a few devices plugged in:

 $ lsusb -t
 /:  Bus 06.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 1M
 /:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M
 /:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 1M
 /:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M
 /:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 1M
 |__ Port 3: Dev 3, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
 /:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/10p, 480M
 |__ Port 8: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
 |__ Port 9: Dev 3, If 0, Class=Printer, Driver=usblp, 12M
 |__ Port 10: Dev 4, If 2, Class=Vendor Specific Class, Driver=ftdi_sio, 
480M
 |__ Port 10: Dev 4, If 0, Class=Vendor Specific Class, Driver=ftdi_sio, 
480M
 |__ Port 10: Dev 4, If 3, Class=Vendor Specific Class, Driver=ftdi_sio, 
480M
 |__ Port 10: Dev 4, If 1, Class=Vendor Specific Class, Driver=ftdi_sio, 
480M





[gentoo-user] Re: new USB question

2020-10-04 Thread Grant Edwards
On 2020-10-05, Jack  wrote:

> Still not Gentoo specific, but I'm still trying to figure out if my
> motherboard (MSI B350 Tomahawk) is doing something funny with the
> USB connections.  In theory, there should be USB3 connections both
> on the back IO panel and on the front case ports.


I don't know if this is helpful, but I have an MSI B450 Tomahawk Max,
and the USB3.3 headers that I route to front-panel connectors work fine.
I just plugged a USB3 flash drive into one of them:

[299865.738407] usb 2-4: new SuperSpeed Gen 1 USB device number 2 using xhci_hcd
[299865.760045] usb 2-4: New USB device found, idVendor=05dc, idProduct=a838, 
bcdDevice=11.00
[299865.760051] usb 2-4: New USB device strings: Mfr=1, Product=2, 
SerialNumber=3
[299865.760053] usb 2-4: Product: USB Flash Drive
[299865.760056] usb 2-4: Manufacturer: Lexar
[299865.760058] usb 2-4: SerialNumber: AAHDQZ7ENQ3ORRPS
[299865.770842] usb-storage 2-4:1.0: USB Mass Storage device detected
[299865.771034] scsi host9: usb-storage 2-4:1.0
[299867.095086] scsi 9:0:0:0: Direct-Access LexarUSB Flash Drive  1100 
PQ: 0 ANSI: 6
[299867.095310] sd 9:0:0:0: Attached scsi generic sg4 type 0
[299867.095905] sd 9:0:0:0: [sdd] 62517248 512-byte logical blocks: (32.0 
GB/29.8 GiB)
[299867.096389] sd 9:0:0:0: [sdd] Write Protect is off
[299867.096394] sd 9:0:0:0: [sdd] Mode Sense: 43 00 00 00
[299867.096872] sd 9:0:0:0: [sdd] Write cache: enabled, read cache: enabled, 
doesn't support DPO or FUA
[299867.112375]  sdd: sdd1 sdd2
[299867.114301] sd 9:0:0:0: [sdd] Attached SCSI removable disk

I also have two USB2 connectors on the front panel.

All total, there are

  2 x USB2in back panel
  4 x USB3.2  in back panel

  4 x USB2on two dual-port 10-pin headers
  2 x USB3.2  on one dual-port 20-pin header

It appears that I have a total of 6 USB hubs on the motherboard:

$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

It looks like you should have two 20-pin USB3 headers on your
motherboard (mine only has 1).  Are you sure your front-panel
connectors are plugged into a USB3 header and not one of the 10-pin
USB2 headers?

--
Grant