Linux-USB Archive on lore.kernel.org
 help / color / Atom feed
* No SuperSpeedPlus on ASM2142
@ 2019-09-16  2:41 Loïc Yhuel
  2019-09-16 12:59 ` Mathias Nyman
  0 siblings, 1 reply; 7+ messages in thread
From: Loïc Yhuel @ 2019-09-16  2:41 UTC (permalink / raw)
  To: linux-usb

[-- Attachment #1: Type: text/plain, Size: 1740 bytes --]

Hello,

I'm trying to get Gen 2 working on this controller.
It drives 2 USB ports on the back panel of an ASUS Prime X399-A (latest BIOS).
ASM2142 FW is 170308_70_02_00 (seen with ASM2142A_MPTool on Windows).
On Windows 10 it uses the Microsoft xhci driver, and Gen 2 works.

On 5.3, I get :
[    1.008270] xhci_hcd 0000:08:00.0: Host supports USB 3.0 SuperSpeed
...
[    1.333145] usb 4-1: new SuperSpeed Gen 1 USB device number 2 using xhci_hcd

lsusb shows 10 Gbps support in "SuperSpeedPlus USB Device Capability" for
both the root hub and the device.

For the root hub, commit ddd57980 broke the detection, since
xhci->usb3_rhub.min_rev is 0x1 instead of expected 0x10 (SBRN is 0x30).
Reverting it changes to "Host supports USB 3.1 Enhanced SuperSpeed", and the
speed of the root hub is 10000 in sysfs.
However, I only got the device detected as "SuperSpeedPlus Gen 2 USB" once,
and the performance didn't increase, so even if the "speed" in sysfs was 10000,
I think it didn't work. After a reboot, it reverted to being detected as Gen 1.

The device (JMS580 USB Gen 2 to SATA bridge, with an SSD) seems to have a
performance issue on Gen 1 (doesn't depend on the controller or the OS), with
about 280MB/s read (almost the same without UAS).
But Gen 2 on Windows gives 510MB/s read, so even the only time Linux reported
10 Gbps speed, if it was working "hdparm -t" should have improved.

As a side note, the runtime power management doesn't seem to work either, but
since it isn't the default configuration, unless this controller is
used on laptops
it probably doesn't matter.
If the power/control of the PCIe device and its two root hubs are all set to
"auto", it is suspended if there is no USB device, and doesn't wake up on plug.

[-- Attachment #2: lsusb_5.3.txt --]
[-- Type: text/plain, Size: 9244 bytes --]

Bus 004 Device 002: ID 0578:0578 Intrinsix Corp. JMS580
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               3.10
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         9
  idVendor           0x0578 Intrinsix Corp.
  idProduct          0x0578 
  bcdDevice           41.01
  iManufacturer           1 JMicron
  iProduct                2 JMS580
  iSerial                 3 000000001114030541CB
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0079
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xc0
      Self Powered
    MaxPower                8mA
    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     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst              15
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst              15
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       1
      bNumEndpoints           4
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     98 
      iInterface             10 MSC USB Attached SCSI
      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               0
        Command pipe (0x01)
      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               0
        MaxStreams             32
        Status pipe (0x02)
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst              14
        MaxStreams             32
        Data-in pipe (0x03)
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x04  EP 4 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst              15
        MaxStreams             32
        Data-out pipe (0x04)
Binary Object Store Descriptor:
  bLength                 5
  bDescriptorType        15
  wTotalLength       0x002a
  bNumDeviceCaps          3
  USB 2.0 Extension Device Capability:
    bLength                 7
    bDescriptorType        16
    bDevCapabilityType      2
    bmAttributes   0x00000f0e
      BESL Link Power Management (LPM) Supported
    BESL value     3840 us 
  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          32 micro seconds
  SuperSpeedPlus USB Device Capability:
    bLength                20
    bDescriptorType        16
    bDevCapabilityType     10
    bmAttributes         0x00000001
      Sublink Speed Attribute count 1
      Sublink Speed ID count 0
    wFunctionalitySupport   0x1100
    bmSublinkSpeedAttr[0]   0x000a4030
      Speed Attribute ID: 0 10Gb/s Symmetric RX SuperSpeedPlus
    bmSublinkSpeedAttr[1]   0x000a40b0
      Speed Attribute ID: 0 10Gb/s Symmetric TX SuperSpeedPlus
Device Status:     0x0001
  Self Powered

Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               3.00
  bDeviceClass            9 Hub
  bDeviceSubClass         0 
  bDeviceProtocol         3 
  bMaxPacketSize0         9
  idVendor           0x1d6b Linux Foundation
  idProduct          0x0003 3.0 root hub
  bcdDevice            5.03
  iManufacturer           3 Linux 5.3.0-rc8+ xhci-hcd
  iProduct                2 xHCI Host Controller
  iSerial                 1 0000:08:00.0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x001f
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xe0
      Self Powered
      Remote Wakeup
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         9 Hub
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 Full speed (or root) hub
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0004  1x 4 bytes
        bInterval              12
        bMaxBurst               0
Hub Descriptor:
  bLength              12
  bDescriptorType      42
  nNbrPorts             2
  wHubCharacteristic 0x000a
    No power switching (usb 1.0)
    Per-port overcurrent protection
  bPwrOn2PwrGood       10 * 2 milli seconds
  bHubContrCurrent      0 milli Ampere
  bHubDecLat          0.0 micro seconds
  wHubDelay             0 nano seconds
  DeviceRemovable    0x00
 Hub Port Status:
   Port 1: 0000.0203 5Gbps power U0 enable connect
   Port 2: 0000.02a0 5Gbps power Rx.Detect
Binary Object Store Descriptor:
  bLength                 5
  bDescriptorType        15
  wTotalLength       0x002b
  bNumDeviceCaps          2
  SuperSpeed USB Device Capability:
    bLength                10
    bDescriptorType        16
    bDevCapabilityType      3
    bmAttributes         0x00
    wSpeedsSupported   0x0008
      Device can operate at SuperSpeed (5Gbps)
    bFunctionalitySupport   3
      Lowest fully-functional device speed is SuperSpeed (5Gbps)
    bU1DevExitLat           0 micro seconds
    bU2DevExitLat           0 micro seconds
  SuperSpeedPlus USB Device Capability:
    bLength                28
    bDescriptorType        16
    bDevCapabilityType     10
    bmAttributes         0x00000023
      Sublink Speed Attribute count 3
      Sublink Speed ID count 1
    wFunctionalitySupport   0x0001
    bmSublinkSpeedAttr[0]   0x00050034
      Speed Attribute ID: 4 5Gb/s Symmetric RX SuperSpeed
    bmSublinkSpeedAttr[1]   0x000500b4
      Speed Attribute ID: 4 5Gb/s Symmetric TX SuperSpeed
    bmSublinkSpeedAttr[2]   0x000a4035
      Speed Attribute ID: 5 10Gb/s Symmetric RX SuperSpeedPlus
    bmSublinkSpeedAttr[3]   0x000a40b5
      Speed Attribute ID: 5 10Gb/s Symmetric TX SuperSpeedPlus
Device Status:     0x0001
  Self Powered

[-- Attachment #3: lspci_5.3.txt --]
[-- Type: text/plain, Size: 2967 bytes --]

08:00.0 USB controller: ASMedia Technology Inc. ASM2142 USB 3.1 Host Controller (prog-if 30 [XHCI])
	Subsystem: ASUSTeK Computer Inc. Device 8756
	Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0, Cache Line Size: 64 bytes
	Interrupt: pin A routed to IRQ 54
	NUMA node: 0
	Region 0: Memory at ba300000 (64-bit, non-prefetchable) [size=32K]
	Capabilities: [50] MSI: Enable+ Count=1/8 Maskable- 64bit+
		Address: 00000000fee0d000  Data: 4021
	Capabilities: [78] Power Management version 3
		Flags: PMEClk- DSI- D1- D2- AuxCurrent=55mA PME(D0+,D1-,D2-,D3hot-,D3cold-)
		Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
	Capabilities: [80] Express (v2) Legacy Endpoint, MSI 00
		DevCap:	MaxPayload 512 bytes, PhantFunc 0, Latency L0s <64ns, L1 <2us
			ExtTag+ AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
		DevCtl:	CorrErr- NonFatalErr- FatalErr- UnsupReq-
			RlxdOrd+ ExtTag+ PhantFunc- AuxPwr- NoSnoop+
			MaxPayload 512 bytes, MaxReadReq 512 bytes
		DevSta:	CorrErr- NonFatalErr- FatalErr- UnsupReq- AuxPwr+ TransPend-
		LnkCap:	Port #0, Speed 8GT/s, Width x2, ASPM L0s L1, Exit Latency L0s <2us, L1 unlimited
			ClockPM- Surprise- LLActRep- BwNot- ASPMOptComp+
		LnkCtl:	ASPM Disabled; RCB 64 bytes Disabled- CommClk+
			ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
		LnkSta:	Speed 5GT/s (downgraded), Width x2 (ok)
			TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
		DevCap2: Completion Timeout: Not Supported, TimeoutDis-, LTR+, OBFF Not Supported
			 AtomicOpsCap: 32bit- 64bit- 128bitCAS-
		DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR-, OBFF Disabled
			 AtomicOpsCtl: ReqEn-
		LnkCtl2: Target Link Speed: 5GT/s, EnterCompliance- SpeedDis-
			 Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
			 Compliance De-emphasis: -6dB
		LnkSta2: Current De-emphasis Level: -6dB, EqualizationComplete-, EqualizationPhase1-
			 EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
	Capabilities: [100 v1] Advanced Error Reporting
		UESta:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
		UEMsk:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
		UESvrt:	DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
		CESta:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- AdvNonFatalErr-
		CEMsk:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- AdvNonFatalErr-
		AERCap:	First Error Pointer: 00, ECRCGenCap+ ECRCGenEn- ECRCChkCap- ECRCChkEn-
			MultHdrRecCap- MultHdrRecEn- TLPPfxPres- HdrLogCap-
		HeaderLog: 00000000 00000000 00000000 00000000
	Capabilities: [200 v1] Secondary PCI Express <?>
	Capabilities: [300 v1] Latency Tolerance Reporting
		Max snoop latency: 0ns
		Max no snoop latency: 0ns
	Kernel driver in use: xhci_hcd

[-- Attachment #4: dmesg_5.3.txt --]
[-- Type: text/plain, Size: 3007 bytes --]

[    0.177632] pci 0000:08:00.0: [1b21:2142] type 00 class 0x0c0330
[    0.177667] pci 0000:08:00.0: reg 0x10: [mem 0xba300000-0xba307fff 64bit]
[    0.177853] pci 0000:08:00.0: PME# supported from D0
[    0.177897] pci 0000:08:00.0: 8.000 Gb/s available PCIe bandwidth, limited by 5 GT/s x2 link at 0000:02:09.0 (capable of 15.752 Gb/s with 8 GT/s x2 link)
...
[    0.953061] xhci_hcd 0000:08:00.0: xHCI Host Controller
[    0.953086] xhci_hcd 0000:08:00.0: new USB bus registered, assigned bus number 3
[    1.007915] xhci_hcd 0000:08:00.0: hcc params 0x0200ef81 hci version 0x110 quirks 0x0000000000000010
[    1.008103] usb usb3: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.03
[    1.008104] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.008105] usb usb3: Product: xHCI Host Controller
[    1.008105] usb usb3: Manufacturer: Linux 5.3.0-rc8+ xhci-hcd
[    1.008106] usb usb3: SerialNumber: 0000:08:00.0
[    1.008159] hub 3-0:1.0: USB hub found
[    1.008164] hub 3-0:1.0: 2 ports detected
[    1.008247] xhci_hcd 0000:08:00.0: xHCI Host Controller
[    1.008269] xhci_hcd 0000:08:00.0: new USB bus registered, assigned bus number 4
[    1.008270] xhci_hcd 0000:08:00.0: Host supports USB 3.0 SuperSpeed
[    1.008296] usb usb4: We don't know the algorithms for LPM for this host, disabling LPM.
[    1.008306] usb usb4: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 5.03
[    1.008307] usb usb4: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.008308] usb usb4: Product: xHCI Host Controller
[    1.008308] usb usb4: Manufacturer: Linux 5.3.0-rc8+ xhci-hcd
[    1.008309] usb usb4: SerialNumber: 0000:08:00.0
[    1.008353] hub 4-0:1.0: USB hub found
[    1.008358] hub 4-0:1.0: 2 ports detected
...
[    1.333145] usb 4-1: new SuperSpeed Gen 1 USB device number 2 using xhci_hcd
[    1.350639] usb 4-1: New USB device found, idVendor=0578, idProduct=0578, bcdDevice=41.01
[    1.350640] usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    1.350641] usb 4-1: Product: JMS580
[    1.350641] usb 4-1: Manufacturer: JMicron
[    1.350642] usb 4-1: SerialNumber: 000000001114030541CB
...
[    3.948947] scsi host10: uas
[    3.949320] scsi 10:0:0:0: Direct-Access     M4-CT128 M4SSD2           4101 PQ: 0 ANSI: 6
[    3.949722] sd 10:0:0:0: Attached scsi generic sg1 type 0
[    3.949875] usbcore: registered new interface driver uas
[    3.950157] sd 10:0:0:0: [sdb] 250069680 512-byte logical blocks: (128 GB/119 GiB)
[    3.950159] sd 10:0:0:0: [sdb] 4096-byte physical blocks
[    3.950250] sd 10:0:0:0: [sdb] Write Protect is off
[    3.950251] sd 10:0:0:0: [sdb] Mode Sense: 53 00 00 08
[    3.950426] sd 10:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    3.950936] sd 10:0:0:0: [sdb] Optimal transfer size 33553920 bytes not a multiple of physical block size (4096 bytes)
[    3.951940]  sdb: sdb1 sdb2
[    3.953018] sd 10:0:0:0: [sdb] Attached SCSI disk

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: No SuperSpeedPlus on ASM2142
  2019-09-16  2:41 No SuperSpeedPlus on ASM2142 Loïc Yhuel
@ 2019-09-16 12:59 ` Mathias Nyman
  2019-09-16 15:19   ` Loïc Yhuel
  0 siblings, 1 reply; 7+ messages in thread
From: Mathias Nyman @ 2019-09-16 12:59 UTC (permalink / raw)
  To: Loïc Yhuel, linux-usb

On 16.9.2019 5.41, Loïc Yhuel wrote:
> Hello,
> 
> I'm trying to get Gen 2 working on this controller.
> It drives 2 USB ports on the back panel of an ASUS Prime X399-A (latest BIOS).
> ASM2142 FW is 170308_70_02_00 (seen with ASM2142A_MPTool on Windows).
> On Windows 10 it uses the Microsoft xhci driver, and Gen 2 works.
> 
> On 5.3, I get :
> [    1.008270] xhci_hcd 0000:08:00.0: Host supports USB 3.0 SuperSpeed
> ...
> [    1.333145] usb 4-1: new SuperSpeed Gen 1 USB device number 2 using xhci_hcd
> 
> lsusb shows 10 Gbps support in "SuperSpeedPlus USB Device Capability" for
> both the root hub and the device.
> 
> For the root hub, commit ddd57980 broke the detection, since
> xhci->usb3_rhub.min_rev is 0x1 instead of expected 0x10 (SBRN is 0x30).

So both places that indicate USB 3.1 support are not according to latest spec,
SBRN (Serial Bus Release Number) is 30 instead of 31, and supported protocol
capability minor revision is 0x1 instead of 0x10.


> Reverting it changes to "Host supports USB 3.1 Enhanced SuperSpeed", and the
> speed of the root hub is 10000 in sysfs.
> However, I only got the device detected as "SuperSpeedPlus Gen 2 USB" once,
> and the performance didn't increase, so even if the "speed" in sysfs was 10000,
> I think it didn't work. After a reboot, it reverted to being detected as Gen 1.

Most reliable way of checking the current actual port speed is reading protocol speed id
from the ports PORTSC register port-speed field.
Use debugfs: (with your correct pci address and port number)

cat  /sys/kernel/debug/usb/xhci/0000\:00\:15.0/ports/port13/portsc
Powered Connected Enabled Link:U0 PortSpeed:4 Change: Wake:

PortSpeed:4 is default for SS 5Gbps, Gen1x1
PortSpeed:5 is defaulf for SSP 10Gbps, Gen2x1

> 
> The device (JMS580 USB Gen 2 to SATA bridge, with an SSD) seems to have a
> performance issue on Gen 1 (doesn't depend on the controller or the OS), with
> about 280MB/s read (almost the same without UAS).
> But Gen 2 on Windows gives 510MB/s read, so even the only time Linux reported
> 10 Gbps speed, if it was working "hdparm -t" should have improved.
> 

I recall similar numbers in Linux, ~500-550Mb/s with a USB 3.1 to SATA adapter
and fast SSD. Reading with dd

> As a side note, the runtime power management doesn't seem to work either, but
> since it isn't the default configuration, unless this controller is
> used on laptops
> it probably doesn't matter.
> If the power/control of the PCIe device and its two root hubs are all set to
> "auto", it is suspended if there is no USB device, and doesn't wake up on plug.
> 

Is the xHCI controller id PCI D0 state even when runtime suspeded?
Some ACPI tables end up preventing D3 for runtime suspend, keeping controller in D0
and possibly preventing PME# wake signaling

-Mathias

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: No SuperSpeedPlus on ASM2142
  2019-09-16 12:59 ` Mathias Nyman
@ 2019-09-16 15:19   ` Loïc Yhuel
  2019-09-16 20:53     ` Loïc Yhuel
  0 siblings, 1 reply; 7+ messages in thread
From: Loïc Yhuel @ 2019-09-16 15:19 UTC (permalink / raw)
  To: Mathias Nyman; +Cc: linux-usb

Le lun. 16 sept. 2019 à 14:57, Mathias Nyman
<mathias.nyman@linux.intel.com> a écrit :
> So both places that indicate USB 3.1 support are not according to latest spec,
> SBRN (Serial Bus Release Number) is 30 instead of 31, and supported protocol
> capability minor revision is 0x1 instead of 0x10.
Yes. I searched for firmwares, but I only saw a much older version
available on Internet.

> Most reliable way of checking the current actual port speed is reading protocol speed id
> from the ports PORTSC register port-speed field.
> Use debugfs: (with your correct pci address and port number)
Currently I have "PortSpeed:4" which matches with the "Gen 1" trace.
If I even get a "Gen 2" trace again, I will check.

> Is the xHCI controller id PCI D0 state even when runtime suspeded?
> Some ACPI tables end up preventing D3 for runtime suspend, keeping controller in D0
> and possibly preventing PME# wake signaling
It seems you are right, lspci still shows D0 :
Flags: PMEClk- DSI- D1- D2- AuxCurrent=55mA PME(D0+,D1-,D2-,D3hot-,D3cold-)
Status: D0 NoSoftRst+ PME-Enable+ DSel=0 DScale=0 PME-

The other USB controllers (AMD 3.0 and 3.1) have
"PME(D0+,D1-,D2-,D3hot+,D3cold+)",
are in D3 state when runtime suspended, and wake up correctly.

Looking at this, I realized the front panel USB3.0 connectors are on the AMD 3.1
controller, I wonder how they are limited to SuperSpeed (configured by
the BIOS ?).

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: No SuperSpeedPlus on ASM2142
  2019-09-16 15:19   ` Loïc Yhuel
@ 2019-09-16 20:53     ` Loïc Yhuel
  2019-09-24  7:57       ` Mathias Nyman
  0 siblings, 1 reply; 7+ messages in thread
From: Loïc Yhuel @ 2019-09-16 20:53 UTC (permalink / raw)
  To: Mathias Nyman; +Cc: linux-usb

Le lun. 16 sept. 2019 à 17:19, Loïc Yhuel <loic.yhuel@gmail.com> a écrit :
>
> > Most reliable way of checking the current actual port speed is reading protocol speed id
> > from the ports PORTSC register port-speed field.
> > Use debugfs: (with your correct pci address and port number)
> Currently I have "PortSpeed:4" which matches with the "Gen 1" trace.
> If I even get a "Gen 2" trace again, I will check.
>
Even after several reboots into Linux, I was still getting "Gen 1" /
"PortSpeed 4".
So I tried booting into Windows, HWinfo64 showed "Gen 2", then
rebooting into Linux.
Then I got "Gen 2" / "PortSpeed: 5" on a 5.3 with the revert, or 5.0 kernel.
With the Fedora 5.2.14, it was "Gen 1" / "PortSpeed: 5".
But performance was still the same as Gen 1.
Reboot of poweroff didn't change anything.

So I tried to play with the BIOS "Fast boot" option, even if it always
lists the USB drives.
I rebooted into Windows, HWInfo64 showed Gen 2, I did a performance test which
returned 510MB/s.
Then I rebooted into Linux, which then showed "Gen 1" / "PortSpeed: 4", but the
performance was now good ! Even after several reboots, or toggling
"Fast Boot" on/off,
it didn't change : PortSpeed 4, but performance showing 10 Gbps was working.

Then I tried powering off, unplugging AC and the USB cable, then
booting without it.
On plug, it was detected as "Gen 2", PortSpeed was 5, and performance was good.
After a reboot (so device plugged on boot), still the same.
After a poweroff, still the same.

So I really don't know how to make sense of this.
Perhaps a register of the xhci controller had a bad value kept even
after a poweroff
due to the standby +5V, and was reset either by the BIOS or Windows at
some point.
But that doesn't explain why the PORTSC value was many time incoherent with the
performance, in both ways.

Btw, I found another problem on resuming the system after a suspend :
[  137.029272] pcieport 0000:00:01.1: PME: Spurious native interrupt!
...
[  137.129618] xhci_hcd 0000:08:00.0: WARN: xHC restore state timeout
[  137.129624] xhci_hcd 0000:08:00.0: PCI post-resume error -110!
[  137.129625] xhci_hcd 0000:08:00.0: HC died; cleaning up
[  137.129633] PM: dpm_run_callback(): pci_pm_resume+0x0/0x90 returns -110
[  137.129636] PM: Device 0000:08:00.0 failed to resume async: error -110
Then a "echo 1 > remove, then "echo 1 > ../rescan" on sysfs got it back.
This is a completely different issue, but at least, I can reproduce
this one reliably.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: No SuperSpeedPlus on ASM2142
  2019-09-16 20:53     ` Loïc Yhuel
@ 2019-09-24  7:57       ` Mathias Nyman
  2019-09-24 15:50         ` Loïc Yhuel
  0 siblings, 1 reply; 7+ messages in thread
From: Mathias Nyman @ 2019-09-24  7:57 UTC (permalink / raw)
  To: Loïc Yhuel; +Cc: linux-usb

On 16.9.2019 23.53, Loïc Yhuel wrote:
> Le lun. 16 sept. 2019 à 17:19, Loïc Yhuel <loic.yhuel@gmail.com> a écrit :
>>
>>> Most reliable way of checking the current actual port speed is reading protocol speed id
>>> from the ports PORTSC register port-speed field.
>>> Use debugfs: (with your correct pci address and port number)
>> Currently I have "PortSpeed:4" which matches with the "Gen 1" trace.
>> If I even get a "Gen 2" trace again, I will check.
>>

Just fyi, turns out initial xHCI 1.1 spec was a bit unclear about SBRN
and minor revision numbers, later xHCI specs clarify them better.
A few USB 3.1 capable xHCI hosts were based on that spec, not just the ASM2142.
They have SBRN set to 30h and minor revision 0x1.
I'll send a patch to detect those correctly.

But it won't fix your inconsistency with PortSpeed bits in PORTSC register.

> 
> Btw, I found another problem on resuming the system after a suspend :
> [  137.029272] pcieport 0000:00:01.1: PME: Spurious native interrupt!
> ...
> [  137.129618] xhci_hcd 0000:08:00.0: WARN: xHC restore state timeout
> [  137.129624] xhci_hcd 0000:08:00.0: PCI post-resume error -110!
> [  137.129625] xhci_hcd 0000:08:00.0: HC died; cleaning up
> [  137.129633] PM: dpm_run_callback(): pci_pm_resume+0x0/0x90 returns -110
> [  137.129636] PM: Device 0000:08:00.0 failed to resume async: error -110
> Then a "echo 1 > remove, then "echo 1 > ../rescan" on sysfs got it back.
> This is a completely different issue, but at least, I can reproduce
> this one reliably.
> 

Looks like the xHCI PCI controller wasn't fully powered up to D0 state yet
when xhci_resume was called. Looks similar to what is discussed in thread:

https://marc.info/?l=linux-usb&m=156681068319529&w=2

-Mathias

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: No SuperSpeedPlus on ASM2142
  2019-09-24  7:57       ` Mathias Nyman
@ 2019-09-24 15:50         ` Loïc Yhuel
  2019-10-07 23:37           ` ASM2142 issues Loïc Yhuel
  0 siblings, 1 reply; 7+ messages in thread
From: Loïc Yhuel @ 2019-09-24 15:50 UTC (permalink / raw)
  To: Mathias Nyman; +Cc: linux-usb

Le mar. 24 sept. 2019 à 09:55, Mathias Nyman
<mathias.nyman@linux.intel.com> a écrit :
> Just fyi, turns out initial xHCI 1.1 spec was a bit unclear about SBRN
> and minor revision numbers, later xHCI specs clarify them better.
> A few USB 3.1 capable xHCI hosts were based on that spec, not just the ASM2142.
> They have SBRN set to 30h and minor revision 0x1.
> I'll send a patch to detect those correctly.
>
> But it won't fix your inconsistency with PortSpeed bits in PORTSC register.
Do you know anything I could try do debug the problem if it happens again ?
>
> >
> > Btw, I found another problem on resuming the system after a suspend :
> > [  137.029272] pcieport 0000:00:01.1: PME: Spurious native interrupt!
> > ...
> > [  137.129618] xhci_hcd 0000:08:00.0: WARN: xHC restore state timeout
> > [  137.129624] xhci_hcd 0000:08:00.0: PCI post-resume error -110!
> > [  137.129625] xhci_hcd 0000:08:00.0: HC died; cleaning up
> > [  137.129633] PM: dpm_run_callback(): pci_pm_resume+0x0/0x90 returns -110
> > [  137.129636] PM: Device 0000:08:00.0 failed to resume async: error -110
> > Then a "echo 1 > remove, then "echo 1 > ../rescan" on sysfs got it back.
> > This is a completely different issue, but at least, I can reproduce
> > this one reliably.
> >
>
> Looks like the xHCI PCI controller wasn't fully powered up to D0 state yet
> when xhci_resume was called. Looks similar to what is discussed in thread:
>
> https://marc.info/?l=linux-usb&m=156681068319529&w=2
In the runtime suspend case, on this laptop the xhci is stuck in D3,
where in my case it stays in D0.

I tried https://lore.kernel.org/linux-pci/20190821124519.71594-1-mika.westerberg@linux.intel.com/,
but it doesn't help.
On my machine, the PCIe "port" is supposed to support 8GT/s (but the
controller is on the motherboard,
so there is no official specification about how the internal
peripherals are linked), the device too,
but it's always in 5GT/s mode (in Windows too), so perhaps it changes
the delays.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: ASM2142 issues
  2019-09-24 15:50         ` Loïc Yhuel
@ 2019-10-07 23:37           ` Loïc Yhuel
  0 siblings, 0 replies; 7+ messages in thread
From: Loïc Yhuel @ 2019-10-07 23:37 UTC (permalink / raw)
  To: Mathias Nyman; +Cc: linux-usb

Le mar. 24 sept. 2019 à 17:50, Loïc Yhuel <loic.yhuel@gmail.com> a écrit :
> > Looks like the xHCI PCI controller wasn't fully powered up to D0 state yet
> > when xhci_resume was called. Looks similar to what is discussed in thread:
> >
> > https://marc.info/?l=linux-usb&m=156681068319529&w=2
In fact the kernel keeps the device, port, and the two bridges in D0 state.

On suspend :
[  860.578478] xhci_hcd 0000:08:00.0: PME# enabled
[  860.578511] xhci_hcd 0000:08:00.0: PCI PM: Suspend power state: D0
...
[  860.580329] pcieport 0000:02:09.0: PCI PM: Suspend power state: D0
...
[  860.603786] pcieport 0000:01:00.2: PCI PM: Suspend power state: D0
[  860.603836] pcieport 0000:00:01.1: PCI PM: Suspend power state: D0

On resume :
<restoring config space for 0000:02:09.0, then 0000:08:00.0>
...
[  861.135868] xhci_hcd 0000:08:00.0: PME# disabled
[  861.135934] xhci_hcd 0000:08:00.0: enabling bus mastering
...
[  861.235966] xhci_hcd 0000:08:00.0: WARN: xHC restore state timeout
[  861.235972] xhci_hcd 0000:08:00.0: PCI post-resume error -110!
[  861.235973] xhci_hcd 0000:08:00.0: HC died; cleaning up
[  861.235981] PM: dpm_run_callback(): pci_pm_resume+0x0/0x90 returns -110
[  861.235984] PM: Device 0000:08:00.0 failed to resume async: error -110

Setting the XHCI_RESET_ON_RESUME quirk avoids the issue.
But the real problem might be the device being marked as only supporting D0,
which seems strange for suspend.

> On my machine, the PCIe "port" is supposed to support 8GT/s (but the
> controller is on the motherboard,
> so there is no official specification about how the internal
> peripherals are linked), the device too,
> but it's always in 5GT/s mode (in Windows too), so perhaps it changes
> the delays.
This is unrelated to the other problems, but if someone else has the same HW,
I found I can enable 8GT/s :
setpci -v -s 0000:08:00.0 CAP_EXP+0x30.w=0x0003:0x000f
setpci -v -s 0000:02:09.0 CAP_EXP+0x30.w=0x0003:0x000f
setpci -v -s 0000:02:09.0 CAP_EXP+0x10.w=0x0020:0x0020

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, back to index

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-16  2:41 No SuperSpeedPlus on ASM2142 Loïc Yhuel
2019-09-16 12:59 ` Mathias Nyman
2019-09-16 15:19   ` Loïc Yhuel
2019-09-16 20:53     ` Loïc Yhuel
2019-09-24  7:57       ` Mathias Nyman
2019-09-24 15:50         ` Loïc Yhuel
2019-10-07 23:37           ` ASM2142 issues Loïc Yhuel

Linux-USB Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-usb/0 linux-usb/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-usb linux-usb/ https://lore.kernel.org/linux-usb \
		linux-usb@vger.kernel.org
	public-inbox-index linux-usb

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-usb


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git