All of lore.kernel.org
 help / color / mirror / Atom feed
* USB 3.2 Gen 2x2 "Superspeed+20GBps" support for ASM3242
@ 2021-03-09  6:41 William Allen
  2021-03-09  7:27 ` Thinh Nguyen
  0 siblings, 1 reply; 22+ messages in thread
From: William Allen @ 2021-03-09  6:41 UTC (permalink / raw)
  To: linux-usb

I've never submitted to the mailing list before, so please excuse any
formalities that I may not be observing.
I would like to be able to use USB 3.2 Gen2x2 "SuperSpeed+²⁰Gbps"
under Linux. I've tried several different kernel versions, and have
built the kernel from the usb-next tree. All without finding proper
functionality.

I have an Ableconn PEX-UB159 USB 3.2 Gen 2x2 PCIe expansion card, with
the ASM3242 controller. This controller appears to be the only Gen2x2
capable controller that exists in commercial products- so far as I've
found. Everything appears to work, except for "SuperSpeed+²⁰Gbps" when
I plug in a capable device.
Here is the dmesg output as soon as I plug in a Gen2x2 WD P50 Black
External NVMe SSD, using an appropriate SuperSpeed+²⁰Gbps certified
cable:
5.11.2-arch1-1
--------------------
usb 7-2: new SuperSpeedPlus Gen 2 USB device number 3 using xhci_hcd
usb 7-2: New USB device found, idVendor=1058, idProduct=2642, bcdDevice=10.03
usb 7-2: New USB device strings: Mfr=2, Product=3, SerialNumber=1
usb 7-2: Product: Game Drive
usb 7-2: Manufacturer: Western Digital
usb 7-2: SerialNumber: 323130334431343030303736
scsi host11: uas
scsi 11:0:0:0: Direct-Access     WD       Game Drive       1003 PQ: 0 ANSI: 6
scsi 11:0:0:1: Enclosure         WD       SES Device       1003 PQ: 0 ANSI: 6
sd 11:0:0:0: [sdf] 3907029168 512-byte logical blocks: (2.00 TB/1.82 TiB)
sd 11:0:0:0: [sdf] Write Protect is off
sd 11:0:0:0: [sdf] Mode Sense: 57 00 10 00
sd 11:0:0:0: [sdf] Write cache: enabled, read cache: enabled, supports
DPO and FUA
sd 11:0:0:0: [sdf] Optimal transfer size 33553920 bytes
sd 11:0:0:0: [sdf] Attached SCSI disk

 When I saw commits referring to Gen2x2 in the usb-next repo, I built
off that, and also ran linux-next-git.r0.gabaf6f60176f-1 from AUR,
both giving me the same results/output:
linux-next-git.r0.gabaf6f60176f-1
----------------------------------------------
usb 5-1: new SuperSpeed Gen 1x2 USB device number 3 using xhci_hcd
usb 5-1: New USB device found, idVendor=1058, idProduct=2642, bcdDevice=10.03
usb 5-1: New USB device strings: Mfr=2, Product=3, SerialNumber=1
usb 5-1: Product: Game Drive
usb 5-1: Manufacturer: Western Digital
usb 5-1: SerialNumber: 323130334431343030303736
scsi host7: uas
scsi 7:0:0:0: Direct-Access     WD       Game Drive       1003 PQ: 0 ANSI: 6
scsi 7:0:0:1: Enclosure         WD       SES Device       1003 PQ: 0 ANSI: 6
ses 7:0:0:1: Attached Enclosure device
ses 7:0:0:1: Failed to get diagnostic page 0x1
ses 7:0:0:1: Failed to bind enclosure -19
sd 7:0:0:0: [sdf] 3907029168 512-byte logical blocks: (2.00 TB/1.82 TiB)
sd 7:0:0:0: [sdf] Write Protect is off
sd 7:0:0:0: [sdf] Mode Sense: 57 00 10 00
sd 7:0:0:0: [sdf] Write cache: enabled, read cache: enabled, supports
DPO and FUA
sd 7:0:0:0: [sdf] Optimal transfer size 33553920 bytes
sd 7:0:0:0: [sdf] Attached SCSI disk

See that it's detecting it as Gen 1x2.
The output of lsusb -t shows that it is connected at 5000M using the
uas driver. Even my much slower USB 3.1 SSDs connect at 10000M on the
exact same port.
When I attach the Gen2x2 NVMe SSD to my other 3.2 Gen2 card, it
connects at 10000M, so It seems to be directly related to a
mishandling when the Gen2x2 device gets recognized by the Gen2x2 card.

lspci output from 5.11.2-arch1-1:
-------------------------------------------
USB controller: ASMedia Technology Inc. ASM3242 USB 3.2 Host
Controller (prog-if 30 [XHCI])
Subsystem: ASMedia Technology Inc. ASM3242 USB 3.2 Host Controller
Physical Slot: 1
Flags: bus master, fast devsel, latency 0, IRQ 62, NUMA node 0
Memory at f7df0000 (64-bit, non-prefetchable) [size=32K]
Capabilities: [50] MSI: Enable- Count=1/8 Maskable- 64bit+
Capabilities: [68] MSI-X: Enable+ Count=8 Masked-
Capabilities: [78] Power Management version 3
Capabilities: [80] Express Legacy Endpoint, MSI 00
Capabilities: [c0] Subsystem: ASMedia Technology Inc. Device 0201
Capabilities: [100] Advanced Error Reporting
Capabilities: [200] Secondary PCI Express
Capabilities: [300] Latency Tolerance Reporting
Capabilities: [400] L1 PM Substates
Kernel driver in use: xhci_hcd
Kernel modules: xhci_pci

I'm happy to test anything, or file this somewhere more appropriate if
you could point me in the right direction.

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

* Re: USB 3.2 Gen 2x2 "Superspeed+20GBps" support for ASM3242
  2021-03-09  6:41 USB 3.2 Gen 2x2 "Superspeed+20GBps" support for ASM3242 William Allen
@ 2021-03-09  7:27 ` Thinh Nguyen
  2021-03-09 12:02   ` Mathias Nyman
  0 siblings, 1 reply; 22+ messages in thread
From: Thinh Nguyen @ 2021-03-09  7:27 UTC (permalink / raw)
  To: William Allen, linux-usb, Mathias Nyman

+ Mathias

Hi,

William Allen wrote:
> I've never submitted to the mailing list before, so please excuse any
> formalities that I may not be observing.
> I would like to be able to use USB 3.2 Gen2x2 "SuperSpeed+²⁰Gbps"
> under Linux. I've tried several different kernel versions, and have
> built the kernel from the usb-next tree. All without finding proper
> functionality.
>
> I have an Ableconn PEX-UB159 USB 3.2 Gen 2x2 PCIe expansion card, with
> the ASM3242 controller. This controller appears to be the only Gen2x2
> capable controller that exists in commercial products- so far as I've
> found. Everything appears to work, except for "SuperSpeed+²⁰Gbps" when
> I plug in a capable device.
> Here is the dmesg output as soon as I plug in a Gen2x2 WD P50 Black
> External NVMe SSD, using an appropriate SuperSpeed+²⁰Gbps certified
> cable:
> 5.11.2-arch1-1
> --------------------
> usb 7-2: new SuperSpeedPlus Gen 2 USB device number 3 using xhci_hcd
> usb 7-2: New USB device found, idVendor=1058, idProduct=2642, bcdDevice=10.03
> usb 7-2: New USB device strings: Mfr=2, Product=3, SerialNumber=1
> usb 7-2: Product: Game Drive
> usb 7-2: Manufacturer: Western Digital
> usb 7-2: SerialNumber: 323130334431343030303736
> scsi host11: uas
> scsi 11:0:0:0: Direct-Access     WD       Game Drive       1003 PQ: 0 ANSI: 6
> scsi 11:0:0:1: Enclosure         WD       SES Device       1003 PQ: 0 ANSI: 6
> sd 11:0:0:0: [sdf] 3907029168 512-byte logical blocks: (2.00 TB/1.82 TiB)
> sd 11:0:0:0: [sdf] Write Protect is off
> sd 11:0:0:0: [sdf] Mode Sense: 57 00 10 00
> sd 11:0:0:0: [sdf] Write cache: enabled, read cache: enabled, supports
> DPO and FUA
> sd 11:0:0:0: [sdf] Optimal transfer size 33553920 bytes
> sd 11:0:0:0: [sdf] Attached SCSI disk
>
>  When I saw commits referring to Gen2x2 in the usb-next repo, I built
> off that, and also ran linux-next-git.r0.gabaf6f60176f-1 from AUR,
> both giving me the same results/output:
> linux-next-git.r0.gabaf6f60176f-1
> ----------------------------------------------
> usb 5-1: new SuperSpeed Gen 1x2 USB device number 3 using xhci_hcd
> usb 5-1: New USB device found, idVendor=1058, idProduct=2642, bcdDevice=10.03
> usb 5-1: New USB device strings: Mfr=2, Product=3, SerialNumber=1
> usb 5-1: Product: Game Drive
> usb 5-1: Manufacturer: Western Digital
> usb 5-1: SerialNumber: 323130334431343030303736
> scsi host7: uas
> scsi 7:0:0:0: Direct-Access     WD       Game Drive       1003 PQ: 0 ANSI: 6
> scsi 7:0:0:1: Enclosure         WD       SES Device       1003 PQ: 0 ANSI: 6
> ses 7:0:0:1: Attached Enclosure device
> ses 7:0:0:1: Failed to get diagnostic page 0x1
> ses 7:0:0:1: Failed to bind enclosure -19
> sd 7:0:0:0: [sdf] 3907029168 512-byte logical blocks: (2.00 TB/1.82 TiB)
> sd 7:0:0:0: [sdf] Write Protect is off
> sd 7:0:0:0: [sdf] Mode Sense: 57 00 10 00
> sd 7:0:0:0: [sdf] Write cache: enabled, read cache: enabled, supports
> DPO and FUA
> sd 7:0:0:0: [sdf] Optimal transfer size 33553920 bytes
> sd 7:0:0:0: [sdf] Attached SCSI disk
>
> See that it's detecting it as Gen 1x2.
> The output of lsusb -t shows that it is connected at 5000M using the
> uas driver. Even my much slower USB 3.1 SSDs connect at 10000M on the
> exact same port.
> When I attach the Gen2x2 NVMe SSD to my other 3.2 Gen2 card, it
> connects at 10000M, so It seems to be directly related to a
> mishandling when the Gen2x2 device gets recognized by the Gen2x2 card.
>
> lspci output from 5.11.2-arch1-1:
> -------------------------------------------
> USB controller: ASMedia Technology Inc. ASM3242 USB 3.2 Host
> Controller (prog-if 30 [XHCI])
> Subsystem: ASMedia Technology Inc. ASM3242 USB 3.2 Host Controller
> Physical Slot: 1
> Flags: bus master, fast devsel, latency 0, IRQ 62, NUMA node 0
> Memory at f7df0000 (64-bit, non-prefetchable) [size=32K]
> Capabilities: [50] MSI: Enable- Count=1/8 Maskable- 64bit+
> Capabilities: [68] MSI-X: Enable+ Count=8 Masked-
> Capabilities: [78] Power Management version 3
> Capabilities: [80] Express Legacy Endpoint, MSI 00
> Capabilities: [c0] Subsystem: ASMedia Technology Inc. Device 0201
> Capabilities: [100] Advanced Error Reporting
> Capabilities: [200] Secondary PCI Express
> Capabilities: [300] Latency Tolerance Reporting
> Capabilities: [400] L1 PM Substates
> Kernel driver in use: xhci_hcd
> Kernel modules: xhci_pci
>
> I'm happy to test anything, or file this somewhere more appropriate if
> you could point me in the right direction.

Currently the usb host stack doesn't really support USB 3.2 yet, at
least the speed check part. I made some updates to handle that.

You apply these patches and test on your setup
https://patchwork.kernel.org/project/linux-usb/list/?series=427561

Hopefully Mathias will have time to review and Ack them for the next
release cycle.

BR,
Thinh

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

* Re: USB 3.2 Gen 2x2 "Superspeed+20GBps" support for ASM3242
  2021-03-09  7:27 ` Thinh Nguyen
@ 2021-03-09 12:02   ` Mathias Nyman
  2021-03-09 22:51     ` William Allen
  2021-12-30 13:10     ` youling257
  0 siblings, 2 replies; 22+ messages in thread
From: Mathias Nyman @ 2021-03-09 12:02 UTC (permalink / raw)
  To: Thinh Nguyen, William Allen, linux-usb, Mathias Nyman

On 9.3.2021 9.27, Thinh Nguyen wrote:
> + Mathias
> 
> Hi,
> 
> William Allen wrote:
>> I've never submitted to the mailing list before, so please excuse any
>> formalities that I may not be observing.
>> I would like to be able to use USB 3.2 Gen2x2 "SuperSpeed+²⁰Gbps"
>> under Linux. I've tried several different kernel versions, and have
>> built the kernel from the usb-next tree. All without finding proper
>> functionality.
>>
>> I have an Ableconn PEX-UB159 USB 3.2 Gen 2x2 PCIe expansion card, with
>> the ASM3242 controller. This controller appears to be the only Gen2x2
>> capable controller that exists in commercial products- so far as I've
>> found. Everything appears to work, except for "SuperSpeed+²⁰Gbps" when
>> I plug in a capable device.
>> Here is the dmesg output as soon as I plug in a Gen2x2 WD P50 Black
>> External NVMe SSD, using an appropriate SuperSpeed+²⁰Gbps certified
>> cable:
>> 5.11.2-arch1-1
>> --------------------
>> usb 7-2: new SuperSpeedPlus Gen 2 USB device number 3 using xhci_hcd
>> usb 7-2: New USB device found, idVendor=1058, idProduct=2642, bcdDevice=10.03
>> usb 7-2: New USB device strings: Mfr=2, Product=3, SerialNumber=1
>> usb 7-2: Product: Game Drive
>> usb 7-2: Manufacturer: Western Digital
>> usb 7-2: SerialNumber: 323130334431343030303736
>> scsi host11: uas
>> scsi 11:0:0:0: Direct-Access     WD       Game Drive       1003 PQ: 0 ANSI: 6
>> scsi 11:0:0:1: Enclosure         WD       SES Device       1003 PQ: 0 ANSI: 6
>> sd 11:0:0:0: [sdf] 3907029168 512-byte logical blocks: (2.00 TB/1.82 TiB)
>> sd 11:0:0:0: [sdf] Write Protect is off
>> sd 11:0:0:0: [sdf] Mode Sense: 57 00 10 00
>> sd 11:0:0:0: [sdf] Write cache: enabled, read cache: enabled, supports
>> DPO and FUA
>> sd 11:0:0:0: [sdf] Optimal transfer size 33553920 bytes
>> sd 11:0:0:0: [sdf] Attached SCSI disk
>>
>>  When I saw commits referring to Gen2x2 in the usb-next repo, I built
>> off that, and also ran linux-next-git.r0.gabaf6f60176f-1 from AUR,
>> both giving me the same results/output:
>> linux-next-git.r0.gabaf6f60176f-1
>> ----------------------------------------------
>> usb 5-1: new SuperSpeed Gen 1x2 USB device number 3 using xhci_hcd
>> usb 5-1: New USB device found, idVendor=1058, idProduct=2642, bcdDevice=10.03
>> usb 5-1: New USB device strings: Mfr=2, Product=3, SerialNumber=1
>> usb 5-1: Product: Game Drive
>> usb 5-1: Manufacturer: Western Digital
>> usb 5-1: SerialNumber: 323130334431343030303736
>> scsi host7: uas
>> scsi 7:0:0:0: Direct-Access     WD       Game Drive       1003 PQ: 0 ANSI: 6
>> scsi 7:0:0:1: Enclosure         WD       SES Device       1003 PQ: 0 ANSI: 6
>> ses 7:0:0:1: Attached Enclosure device
>> ses 7:0:0:1: Failed to get diagnostic page 0x1
>> ses 7:0:0:1: Failed to bind enclosure -19
>> sd 7:0:0:0: [sdf] 3907029168 512-byte logical blocks: (2.00 TB/1.82 TiB)
>> sd 7:0:0:0: [sdf] Write Protect is off
>> sd 7:0:0:0: [sdf] Mode Sense: 57 00 10 00
>> sd 7:0:0:0: [sdf] Write cache: enabled, read cache: enabled, supports
>> DPO and FUA
>> sd 7:0:0:0: [sdf] Optimal transfer size 33553920 bytes
>> sd 7:0:0:0: [sdf] Attached SCSI disk
>>
>> See that it's detecting it as Gen 1x2.
>> The output of lsusb -t shows that it is connected at 5000M using the
>> uas driver. Even my much slower USB 3.1 SSDs connect at 10000M on the
>> exact same port.
>> When I attach the Gen2x2 NVMe SSD to my other 3.2 Gen2 card, it
>> connects at 10000M, so It seems to be directly related to a
>> mishandling when the Gen2x2 device gets recognized by the Gen2x2 card.
>>
>> lspci output from 5.11.2-arch1-1:
>> -------------------------------------------
>> USB controller: ASMedia Technology Inc. ASM3242 USB 3.2 Host
>> Controller (prog-if 30 [XHCI])
>> Subsystem: ASMedia Technology Inc. ASM3242 USB 3.2 Host Controller
>> Physical Slot: 1
>> Flags: bus master, fast devsel, latency 0, IRQ 62, NUMA node 0
>> Memory at f7df0000 (64-bit, non-prefetchable) [size=32K]
>> Capabilities: [50] MSI: Enable- Count=1/8 Maskable- 64bit+
>> Capabilities: [68] MSI-X: Enable+ Count=8 Masked-
>> Capabilities: [78] Power Management version 3
>> Capabilities: [80] Express Legacy Endpoint, MSI 00
>> Capabilities: [c0] Subsystem: ASMedia Technology Inc. Device 0201
>> Capabilities: [100] Advanced Error Reporting
>> Capabilities: [200] Secondary PCI Express
>> Capabilities: [300] Latency Tolerance Reporting
>> Capabilities: [400] L1 PM Substates
>> Kernel driver in use: xhci_hcd
>> Kernel modules: xhci_pci
>>
>> I'm happy to test anything, or file this somewhere more appropriate if
>> you could point me in the right direction.
> 
> Currently the usb host stack doesn't really support USB 3.2 yet, at
> least the speed check part. I made some updates to handle that.
> 
> You apply these patches and test on your setup
> https://patchwork.kernel.org/project/linux-usb/list/?series=427561
> 
> Hopefully Mathias will have time to review and Ack them for the next
> release cycle.

Thanks for the reminder, added some comments to the series

-Mathias


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

* Re: USB 3.2 Gen 2x2 "Superspeed+20GBps" support for ASM3242
  2021-03-09 12:02   ` Mathias Nyman
@ 2021-03-09 22:51     ` William Allen
  2021-03-10  0:56       ` Thinh Nguyen
  2021-12-30 13:10     ` youling257
  1 sibling, 1 reply; 22+ messages in thread
From: William Allen @ 2021-03-09 22:51 UTC (permalink / raw)
  To: Mathias Nyman; +Cc: Thinh Nguyen, linux-usb, Mathias Nyman

Thank you! I tested your patches and got a little bit of success. The
dmesg output now shows the drive connecting at SuperSpeedPlus Gen 2,
which is inline with the 5.11.2-arch1-1 kernel, but shows the same
failure messages, except under the "scsi" facility, rather than the
"ses" facility


5.12.0-rc2-next-20210309-2-next-git (manually added your patches to
the PKGBUILD file)
-------------------------------------------------
usb 5-1: new SuperSpeedPlus Gen 2 USB device number 2 using xhci_hcd
usb 5-1: New USB device found, idVendor=1058, idProduct=2642, bcdDevice=10.03
usb 5-1: New USB device strings: Mfr=2, Product=3, SerialNumber=1
usb 5-1: Product: Game Drive
usb 5-1: Manufacturer: Western Digital
usb 5-1: SerialNumber: 323130334431343030303736
scsi host12: uas
scsi 12:0:0:0: Direct-Access     WD       Game Drive       1003 PQ: 0 ANSI: 6
scsi 12:0:0:1: Enclosure         WD       SES Device       1003 PQ: 0 ANSI: 6
sd 12:0:0:0: [sdi] 3907029168 512-byte logical blocks: (2.00 TB/1.82 TiB)
sd 12:0:0:0: [sdi] Write Protect is off
sd 12:0:0:0: [sdi] Mode Sense: 57 00 10 00
sd 12:0:0:0: [sdi] Write cache: enabled, read cache: enabled, supports
DPO and FUA
sd 12:0:0:0: [sdi] Optimal transfer size 33553920 bytes
scsi 12:0:0:1: Failed to get diagnostic page 0x1
scsi 12:0:0:1: Failed to bind enclosure -19
sd 12:0:0:0: [sdi] Attached SCSI disk
ses 12:0:0:1: Attached Enclosure device


The drive also now connects at 10000M, whereas before it was
connecting at 5000M.
I still am not seeing anything relating to Gen 2x2 speeds.


I checked the listed lanes, which IS showing new information. Value of:
/sys/bus/usb/devices/usb5/rx_lanes = 2
/sys/bus/usb/devices/usb5/tx_lanes = 2


Here is the output of lsusb -vvv for the device:
-------------------------------------------------
Bus 005 Device 002: ID 1058:2642 Western Digital Technologies, Inc. Game Drive
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               3.20
  bDeviceClass            0
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         9
  idVendor           0x1058 Western Digital Technologies, Inc.
  idProduct          0x2642
  bcdDevice           10.03
  iManufacturer           2 Western Digital
  iProduct                3 Game Drive
  iSerial                 1 323130334431343030303736
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0079
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              896mA
    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              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
        MaxStreams             32
        Data-in pipe (0x03)
      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
        MaxStreams             32
        Data-out pipe (0x04)
      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              15
        MaxStreams             32
        Status pipe (0x02)
      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               0
        Command pipe (0x01)
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   0x0000f41e
      BESL Link Power Management (LPM) Supported
    BESL value     1024 us
    Deep BESL value    61440 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        2047 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
can't get debug descriptor: Resource temporarily unavailable
Device Status:     0x0000
  (Bus Powered)


And here is output of lspci relating to the ASM3242:
-------------------------------------------------
04:00.0 USB controller: ASMedia Technology Inc. ASM3242 USB 3.2 Host
Controller (prog-if 30 [XHCI])
     Subsystem: ASMedia Technology Inc. ASM3242 USB 3.2 Host Controller
     Physical Slot: 1
     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 62
     Region 0: Memory at f7df0000 (64-bit, non-prefetchable) [size=32K]
     Capabilities: [50] MSI: Enable- Count=1/8 Maskable- 64bit+
          Address: 0000000000000000  Data: 0000
     Capabilities: [68] MSI-X: Enable+ Count=8 Masked-
          Vector table: BAR=0 offset=00002000
          PBA: BAR=0 offset=00002080
     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 256 bytes, MaxReadReq 4096 bytes
          DevSta:   CorrErr+ NonFatalErr- FatalErr- UnsupReq+ AuxPwr+ TransPend-
          LnkCap:   Port #0, Speed 8GT/s, Width x4, ASPM L1, Exit
Latency L1 unlimited
               ClockPM- Surprise- LLActRep- BwNot- ASPMOptComp+
          LnkCtl:   ASPM Disabled; RCB 64 bytes, Disabled- CommClk+
               ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
          LnkSta:   Speed 8GT/s (ok), Width x4 (ok)
               TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
          DevCap2: Completion Timeout: Range A, TimeoutDis- NROPrPrP- LTR+
                10BitTagComp- 10BitTagReq- OBFF Not Supported, ExtFmt+
EETLPPrefix-
                EmergencyPowerReduction Not Supported,
EmergencyPowerReductionInit-
                FRS-
                AtomicOpsCap: 32bit- 64bit- 128bitCAS-
          DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis- LTR-
OBFF Disabled,
                AtomicOpsCtl: ReqEn-
          LnkCap2: Supported Link Speeds: 2.5-8GT/s, Crosslink-
Retimer- 2Retimers- DRS-
          LnkCtl2: Target Link Speed: 8GT/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-
                Retimer- 2Retimers- CrosslinkRes: unsupported
     Capabilities: [c0] Subsystem: ASMedia Technology Inc. Device 0201
     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
          LnkCtl3: LnkEquIntrruptEn- PerformEqu-
          LaneErrStat: LaneErr at lane: 0 1 2 3
     Capabilities: [300 v1] Latency Tolerance Reporting
          Max snoop latency: 0ns
          Max no snoop latency: 0ns
     Capabilities: [400 v1] L1 PM Substates
          L1SubCap: PCI-PM_L1.2+ PCI-PM_L1.1+ ASPM_L1.2+ ASPM_L1.1+
L1_PM_Substates+
                 PortCommonModeRestoreTime=0us PortTPowerOnTime=10us
          L1SubCtl1: PCI-PM_L1.2- PCI-PM_L1.1- ASPM_L1.2- ASPM_L1.1-
                  T_CommonMode=0us LTR1.2_Threshold=0ns
          L1SubCtl2: T_PwrOn=0us
     Kernel driver in use: xhci_hcd
     Kernel modules: xhci_pci

On Tue, Mar 9, 2021 at 6:00 AM Mathias Nyman
<mathias.nyman@linux.intel.com> wrote:
>
> On 9.3.2021 9.27, Thinh Nguyen wrote:
> > + Mathias
> >
> > Hi,
> >
> > William Allen wrote:
> >> I've never submitted to the mailing list before, so please excuse any
> >> formalities that I may not be observing.
> >> I would like to be able to use USB 3.2 Gen2x2 "SuperSpeed+²⁰Gbps"
> >> under Linux. I've tried several different kernel versions, and have
> >> built the kernel from the usb-next tree. All without finding proper
> >> functionality.
> >>
> >> I have an Ableconn PEX-UB159 USB 3.2 Gen 2x2 PCIe expansion card, with
> >> the ASM3242 controller. This controller appears to be the only Gen2x2
> >> capable controller that exists in commercial products- so far as I've
> >> found. Everything appears to work, except for "SuperSpeed+²⁰Gbps" when
> >> I plug in a capable device.
> >> Here is the dmesg output as soon as I plug in a Gen2x2 WD P50 Black
> >> External NVMe SSD, using an appropriate SuperSpeed+²⁰Gbps certified
> >> cable:
> >> 5.11.2-arch1-1
> >> --------------------
> >> usb 7-2: new SuperSpeedPlus Gen 2 USB device number 3 using xhci_hcd
> >> usb 7-2: New USB device found, idVendor=1058, idProduct=2642, bcdDevice=10.03
> >> usb 7-2: New USB device strings: Mfr=2, Product=3, SerialNumber=1
> >> usb 7-2: Product: Game Drive
> >> usb 7-2: Manufacturer: Western Digital
> >> usb 7-2: SerialNumber: 323130334431343030303736
> >> scsi host11: uas
> >> scsi 11:0:0:0: Direct-Access     WD       Game Drive       1003 PQ: 0 ANSI: 6
> >> scsi 11:0:0:1: Enclosure         WD       SES Device       1003 PQ: 0 ANSI: 6
> >> sd 11:0:0:0: [sdf] 3907029168 512-byte logical blocks: (2.00 TB/1.82 TiB)
> >> sd 11:0:0:0: [sdf] Write Protect is off
> >> sd 11:0:0:0: [sdf] Mode Sense: 57 00 10 00
> >> sd 11:0:0:0: [sdf] Write cache: enabled, read cache: enabled, supports
> >> DPO and FUA
> >> sd 11:0:0:0: [sdf] Optimal transfer size 33553920 bytes
> >> sd 11:0:0:0: [sdf] Attached SCSI disk
> >>
> >>  When I saw commits referring to Gen2x2 in the usb-next repo, I built
> >> off that, and also ran linux-next-git.r0.gabaf6f60176f-1 from AUR,
> >> both giving me the same results/output:
> >> linux-next-git.r0.gabaf6f60176f-1
> >> ----------------------------------------------
> >> usb 5-1: new SuperSpeed Gen 1x2 USB device number 3 using xhci_hcd
> >> usb 5-1: New USB device found, idVendor=1058, idProduct=2642, bcdDevice=10.03
> >> usb 5-1: New USB device strings: Mfr=2, Product=3, SerialNumber=1
> >> usb 5-1: Product: Game Drive
> >> usb 5-1: Manufacturer: Western Digital
> >> usb 5-1: SerialNumber: 323130334431343030303736
> >> scsi host7: uas
> >> scsi 7:0:0:0: Direct-Access     WD       Game Drive       1003 PQ: 0 ANSI: 6
> >> scsi 7:0:0:1: Enclosure         WD       SES Device       1003 PQ: 0 ANSI: 6
> >> ses 7:0:0:1: Attached Enclosure device
> >> ses 7:0:0:1: Failed to get diagnostic page 0x1
> >> ses 7:0:0:1: Failed to bind enclosure -19
> >> sd 7:0:0:0: [sdf] 3907029168 512-byte logical blocks: (2.00 TB/1.82 TiB)
> >> sd 7:0:0:0: [sdf] Write Protect is off
> >> sd 7:0:0:0: [sdf] Mode Sense: 57 00 10 00
> >> sd 7:0:0:0: [sdf] Write cache: enabled, read cache: enabled, supports
> >> DPO and FUA
> >> sd 7:0:0:0: [sdf] Optimal transfer size 33553920 bytes
> >> sd 7:0:0:0: [sdf] Attached SCSI disk
> >>
> >> See that it's detecting it as Gen 1x2.
> >> The output of lsusb -t shows that it is connected at 5000M using the
> >> uas driver. Even my much slower USB 3.1 SSDs connect at 10000M on the
> >> exact same port.
> >> When I attach the Gen2x2 NVMe SSD to my other 3.2 Gen2 card, it
> >> connects at 10000M, so It seems to be directly related to a
> >> mishandling when the Gen2x2 device gets recognized by the Gen2x2 card.
> >>
> >> lspci output from 5.11.2-arch1-1:
> >> -------------------------------------------
> >> USB controller: ASMedia Technology Inc. ASM3242 USB 3.2 Host
> >> Controller (prog-if 30 [XHCI])
> >> Subsystem: ASMedia Technology Inc. ASM3242 USB 3.2 Host Controller
> >> Physical Slot: 1
> >> Flags: bus master, fast devsel, latency 0, IRQ 62, NUMA node 0
> >> Memory at f7df0000 (64-bit, non-prefetchable) [size=32K]
> >> Capabilities: [50] MSI: Enable- Count=1/8 Maskable- 64bit+
> >> Capabilities: [68] MSI-X: Enable+ Count=8 Masked-
> >> Capabilities: [78] Power Management version 3
> >> Capabilities: [80] Express Legacy Endpoint, MSI 00
> >> Capabilities: [c0] Subsystem: ASMedia Technology Inc. Device 0201
> >> Capabilities: [100] Advanced Error Reporting
> >> Capabilities: [200] Secondary PCI Express
> >> Capabilities: [300] Latency Tolerance Reporting
> >> Capabilities: [400] L1 PM Substates
> >> Kernel driver in use: xhci_hcd
> >> Kernel modules: xhci_pci
> >>
> >> I'm happy to test anything, or file this somewhere more appropriate if
> >> you could point me in the right direction.
> >
> > Currently the usb host stack doesn't really support USB 3.2 yet, at
> > least the speed check part. I made some updates to handle that.
> >
> > You apply these patches and test on your setup
> > https://patchwork.kernel.org/project/linux-usb/list/?series=427561
> >
> > Hopefully Mathias will have time to review and Ack them for the next
> > release cycle.
>
> Thanks for the reminder, added some comments to the series
>
> -Mathias
>

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

* Re: USB 3.2 Gen 2x2 "Superspeed+20GBps" support for ASM3242
  2021-03-09 22:51     ` William Allen
@ 2021-03-10  0:56       ` Thinh Nguyen
  2021-03-10  1:19         ` Thinh Nguyen
  0 siblings, 1 reply; 22+ messages in thread
From: Thinh Nguyen @ 2021-03-10  0:56 UTC (permalink / raw)
  To: William Allen, Mathias Nyman; +Cc: Thinh Nguyen, linux-usb, Mathias Nyman

Hi,

William Allen wrote:
> Thank you! I tested your patches and got a little bit of success. The
> dmesg output now shows the drive connecting at SuperSpeedPlus Gen 2,
> which is inline with the 5.11.2-arch1-1 kernel, but shows the same
> failure messages, except under the "scsi" facility, rather than the
> "ses" facility
>
>
> 5.12.0-rc2-next-20210309-2-next-git (manually added your patches to
> the PKGBUILD file)
> -------------------------------------------------
> usb 5-1: new SuperSpeedPlus Gen 2 USB device number 2 using xhci_hcd

It seems like you did not apply all the patches I provided. It wouldn't
just print "Gen 2" here if you had applied all the patches. If the SSP
rate is unknown, it would just print "SuperSpeed Plus".

Refer to this patch:
https://patchwork.kernel.org/project/linux-usb/patch/d7049743924adf82f93ddfe403a5ebb9ac06e49b.1612410491.git.Thinh.Nguyen@synopsys.com/

Please apply all 8 of the patches here:
https://patchwork.kernel.org/project/linux-usb/list/?series=427561

If there are still issues, I can provide some debugging patches.

BR,
Thinh


> usb 5-1: New USB device found, idVendor=1058, idProduct=2642, bcdDevice=10.03
> usb 5-1: New USB device strings: Mfr=2, Product=3, SerialNumber=1
> usb 5-1: Product: Game Drive
> usb 5-1: Manufacturer: Western Digital
> usb 5-1: SerialNumber: 323130334431343030303736
> scsi host12: uas
> scsi 12:0:0:0: Direct-Access     WD       Game Drive       1003 PQ: 0 ANSI: 6
> scsi 12:0:0:1: Enclosure         WD       SES Device       1003 PQ: 0 ANSI: 6
> sd 12:0:0:0: [sdi] 3907029168 512-byte logical blocks: (2.00 TB/1.82 TiB)
> sd 12:0:0:0: [sdi] Write Protect is off
> sd 12:0:0:0: [sdi] Mode Sense: 57 00 10 00
> sd 12:0:0:0: [sdi] Write cache: enabled, read cache: enabled, supports
> DPO and FUA
> sd 12:0:0:0: [sdi] Optimal transfer size 33553920 bytes
> scsi 12:0:0:1: Failed to get diagnostic page 0x1
> scsi 12:0:0:1: Failed to bind enclosure -19
> sd 12:0:0:0: [sdi] Attached SCSI disk
> ses 12:0:0:1: Attached Enclosure device
>
>
> The drive also now connects at 10000M, whereas before it was
> connecting at 5000M.
> I still am not seeing anything relating to Gen 2x2 speeds.
>
>
> I checked the listed lanes, which IS showing new information. Value of:
> /sys/bus/usb/devices/usb5/rx_lanes = 2
> /sys/bus/usb/devices/usb5/tx_lanes = 2
>
>
> Here is the output of lsusb -vvv for the device:
> -------------------------------------------------
> Bus 005 Device 002: ID 1058:2642 Western Digital Technologies, Inc. Game Drive
> Device Descriptor:
>   bLength                18
>   bDescriptorType         1
>   bcdUSB               3.20
>   bDeviceClass            0
>   bDeviceSubClass         0
>   bDeviceProtocol         0
>   bMaxPacketSize0         9
>   idVendor           0x1058 Western Digital Technologies, Inc.
>   idProduct          0x2642
>   bcdDevice           10.03
>   iManufacturer           2 Western Digital
>   iProduct                3 Game Drive
>   iSerial                 1 323130334431343030303736
>   bNumConfigurations      1
>   Configuration Descriptor:
>     bLength                 9
>     bDescriptorType         2
>     wTotalLength       0x0079
>     bNumInterfaces          1
>     bConfigurationValue     1
>     iConfiguration          0
>     bmAttributes         0x80
>       (Bus Powered)
>     MaxPower              896mA
>     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              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
>         MaxStreams             32
>         Data-in pipe (0x03)
>       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
>         MaxStreams             32
>         Data-out pipe (0x04)
>       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              15
>         MaxStreams             32
>         Status pipe (0x02)
>       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               0
>         Command pipe (0x01)
> 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   0x0000f41e
>       BESL Link Power Management (LPM) Supported
>     BESL value     1024 us
>     Deep BESL value    61440 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        2047 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
> can't get debug descriptor: Resource temporarily unavailable
> Device Status:     0x0000
>   (Bus Powered)
>
>
> And here is output of lspci relating to the ASM3242:
> -------------------------------------------------
> 04:00.0 USB controller: ASMedia Technology Inc. ASM3242 USB 3.2 Host
> Controller (prog-if 30 [XHCI])
>      Subsystem: ASMedia Technology Inc. ASM3242 USB 3.2 Host Controller
>      Physical Slot: 1
>      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 62
>      Region 0: Memory at f7df0000 (64-bit, non-prefetchable) [size=32K]
>      Capabilities: [50] MSI: Enable- Count=1/8 Maskable- 64bit+
>           Address: 0000000000000000  Data: 0000
>      Capabilities: [68] MSI-X: Enable+ Count=8 Masked-
>           Vector table: BAR=0 offset=00002000
>           PBA: BAR=0 offset=00002080
>      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 256 bytes, MaxReadReq 4096 bytes
>           DevSta:   CorrErr+ NonFatalErr- FatalErr- UnsupReq+ AuxPwr+ TransPend-
>           LnkCap:   Port #0, Speed 8GT/s, Width x4, ASPM L1, Exit
> Latency L1 unlimited
>                ClockPM- Surprise- LLActRep- BwNot- ASPMOptComp+
>           LnkCtl:   ASPM Disabled; RCB 64 bytes, Disabled- CommClk+
>                ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
>           LnkSta:   Speed 8GT/s (ok), Width x4 (ok)
>                TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
>           DevCap2: Completion Timeout: Range A, TimeoutDis- NROPrPrP- LTR+
>                 10BitTagComp- 10BitTagReq- OBFF Not Supported, ExtFmt+
> EETLPPrefix-
>                 EmergencyPowerReduction Not Supported,
> EmergencyPowerReductionInit-
>                 FRS-
>                 AtomicOpsCap: 32bit- 64bit- 128bitCAS-
>           DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis- LTR-
> OBFF Disabled,
>                 AtomicOpsCtl: ReqEn-
>           LnkCap2: Supported Link Speeds: 2.5-8GT/s, Crosslink-
> Retimer- 2Retimers- DRS-
>           LnkCtl2: Target Link Speed: 8GT/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-
>                 Retimer- 2Retimers- CrosslinkRes: unsupported
>      Capabilities: [c0] Subsystem: ASMedia Technology Inc. Device 0201
>      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
>           LnkCtl3: LnkEquIntrruptEn- PerformEqu-
>           LaneErrStat: LaneErr at lane: 0 1 2 3
>      Capabilities: [300 v1] Latency Tolerance Reporting
>           Max snoop latency: 0ns
>           Max no snoop latency: 0ns
>      Capabilities: [400 v1] L1 PM Substates
>           L1SubCap: PCI-PM_L1.2+ PCI-PM_L1.1+ ASPM_L1.2+ ASPM_L1.1+
> L1_PM_Substates+
>                  PortCommonModeRestoreTime=0us PortTPowerOnTime=10us
>           L1SubCtl1: PCI-PM_L1.2- PCI-PM_L1.1- ASPM_L1.2- ASPM_L1.1-
>                   T_CommonMode=0us LTR1.2_Threshold=0ns
>           L1SubCtl2: T_PwrOn=0us
>      Kernel driver in use: xhci_hcd
>      Kernel modules: xhci_pci
>
> On Tue, Mar 9, 2021 at 6:00 AM Mathias Nyman
> <mathias.nyman@linux.intel.com> wrote:
>>





>>> Currently the usb host stack doesn't really support USB 3.2 yet, at
>>> least the speed check part. I made some updates to handle that.
>>>
>>> You apply these patches and test on your setup
>>> https://urldefense.com/v3/__https://patchwork.kernel.org/project/linux-usb/list/?series=427561__;!!A4F2R9G_pg!O509Jgp-IveN9AmXa5oORW98Q_B4_GyjbA5RSAXFuZaexHl4jhm8G9dWbImQUw4CrNZJ$ 
>>>
>>> Hopefully Mathias will have time to review and Ack them for the next
>>> release cycle.
>> Thanks for the reminder, added some comments to the series
>>
>> -Mathias
>>


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

* Re: USB 3.2 Gen 2x2 "Superspeed+20GBps" support for ASM3242
  2021-03-10  0:56       ` Thinh Nguyen
@ 2021-03-10  1:19         ` Thinh Nguyen
  0 siblings, 0 replies; 22+ messages in thread
From: Thinh Nguyen @ 2021-03-10  1:19 UTC (permalink / raw)
  To: William Allen, Mathias Nyman; +Cc: linux-usb, Mathias Nyman

Thinh Nguyen wrote:
> Hi,
>
> William Allen wrote:
>> Thank you! I tested your patches and got a little bit of success. The
>> dmesg output now shows the drive connecting at SuperSpeedPlus Gen 2,
>> which is inline with the 5.11.2-arch1-1 kernel, but shows the same
>> failure messages, except under the "scsi" facility, rather than the
>> "ses" facility
>>
>>
>> 5.12.0-rc2-next-20210309-2-next-git (manually added your patches to
>> the PKGBUILD file)
>> -------------------------------------------------
>> usb 5-1: new SuperSpeedPlus Gen 2 USB device number 2 using xhci_hcd
> It seems like you did not apply all the patches I provided. It wouldn't
> just print "Gen 2" here if you had applied all the patches. If the SSP
> rate is unknown, it would just print "SuperSpeed Plus".
>
> Refer to this patch:
> https://patchwork.kernel.org/project/linux-usb/patch/d7049743924adf82f93ddfe403a5ebb9ac06e49b.1612410491.git.Thinh.Nguyen@synopsys.com/
>
> Please apply all 8 of the patches here:
> https://patchwork.kernel.org/project/linux-usb/list/?series=427561
>
> If there are still issues, I can provide some debugging patches.
>
> BR,
> Thinh
>
>
>> usb 5-1: New USB device found, idVendor=1058, idProduct=2642, bcdDevice=10.03
>> usb 5-1: New USB device strings: Mfr=2, Product=3, SerialNumber=1
>> usb 5-1: Product: Game Drive
>> usb 5-1: Manufacturer: Western Digital
>> usb 5-1: SerialNumber: 323130334431343030303736
>> scsi host12: uas
>> scsi 12:0:0:0: Direct-Access     WD       Game Drive       1003 PQ: 0 ANSI: 6
>> scsi 12:0:0:1: Enclosure         WD       SES Device       1003 PQ: 0 ANSI: 6
>> sd 12:0:0:0: [sdi] 3907029168 512-byte logical blocks: (2.00 TB/1.82 TiB)
>> sd 12:0:0:0: [sdi] Write Protect is off
>> sd 12:0:0:0: [sdi] Mode Sense: 57 00 10 00
>> sd 12:0:0:0: [sdi] Write cache: enabled, read cache: enabled, supports
>> DPO and FUA
>> sd 12:0:0:0: [sdi] Optimal transfer size 33553920 bytes
>> scsi 12:0:0:1: Failed to get diagnostic page 0x1
>> scsi 12:0:0:1: Failed to bind enclosure -19

BTW, this failure is unrelated to which speed the device is connected
as. The device should just work regardless of the connected speed.
Something else is wrong here. It could be a problem with the device not
responding to a SCSI command correctly (often I find many UASP devices
don't properly handle/respond correctly for an unsupported command).

You can force the device to run with BOT protocol instead of UASP since
it's less likely to run into this problem. (Add the 'u' quirk to ignore
UAS).

Thanks,
Thinh

>> sd 12:0:0:0: [sdi] Attached SCSI disk
>> ses 12:0:0:1: Attached Enclosure device
>>
>>
>> The drive also now connects at 10000M, whereas before it was
>> connecting at 5000M.
>> I still am not seeing anything relating to Gen 2x2 speeds.
>>
>>
>> I checked the listed lanes, which IS showing new information. Value of:
>> /sys/bus/usb/devices/usb5/rx_lanes = 2
>> /sys/bus/usb/devices/usb5/tx_lanes = 2
>>
>>
>> Here is the output of lsusb -vvv for the device:
>> -------------------------------------------------
>> Bus 005 Device 002: ID 1058:2642 Western Digital Technologies, Inc. Game Drive
>> Device Descriptor:
>>   bLength                18
>>   bDescriptorType         1
>>   bcdUSB               3.20
>>   bDeviceClass            0
>>   bDeviceSubClass         0
>>   bDeviceProtocol         0
>>   bMaxPacketSize0         9
>>   idVendor           0x1058 Western Digital Technologies, Inc.
>>   idProduct          0x2642
>>   bcdDevice           10.03
>>   iManufacturer           2 Western Digital
>>   iProduct                3 Game Drive
>>   iSerial                 1 323130334431343030303736
>>   bNumConfigurations      1
>>   Configuration Descriptor:
>>     bLength                 9
>>     bDescriptorType         2
>>     wTotalLength       0x0079
>>     bNumInterfaces          1
>>     bConfigurationValue     1
>>     iConfiguration          0
>>     bmAttributes         0x80
>>       (Bus Powered)
>>     MaxPower              896mA
>>     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              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
>>         MaxStreams             32
>>         Data-in pipe (0x03)
>>       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
>>         MaxStreams             32
>>         Data-out pipe (0x04)
>>       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              15
>>         MaxStreams             32
>>         Status pipe (0x02)
>>       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               0
>>         Command pipe (0x01)
>> 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   0x0000f41e
>>       BESL Link Power Management (LPM) Supported
>>     BESL value     1024 us
>>     Deep BESL value    61440 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        2047 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
>> can't get debug descriptor: Resource temporarily unavailable
>> Device Status:     0x0000
>>   (Bus Powered)
>>
>>
>> And here is output of lspci relating to the ASM3242:
>> -------------------------------------------------
>> 04:00.0 USB controller: ASMedia Technology Inc. ASM3242 USB 3.2 Host
>> Controller (prog-if 30 [XHCI])
>>      Subsystem: ASMedia Technology Inc. ASM3242 USB 3.2 Host Controller
>>      Physical Slot: 1
>>      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 62
>>      Region 0: Memory at f7df0000 (64-bit, non-prefetchable) [size=32K]
>>      Capabilities: [50] MSI: Enable- Count=1/8 Maskable- 64bit+
>>           Address: 0000000000000000  Data: 0000
>>      Capabilities: [68] MSI-X: Enable+ Count=8 Masked-
>>           Vector table: BAR=0 offset=00002000
>>           PBA: BAR=0 offset=00002080
>>      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 256 bytes, MaxReadReq 4096 bytes
>>           DevSta:   CorrErr+ NonFatalErr- FatalErr- UnsupReq+ AuxPwr+ TransPend-
>>           LnkCap:   Port #0, Speed 8GT/s, Width x4, ASPM L1, Exit
>> Latency L1 unlimited
>>                ClockPM- Surprise- LLActRep- BwNot- ASPMOptComp+
>>           LnkCtl:   ASPM Disabled; RCB 64 bytes, Disabled- CommClk+
>>                ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
>>           LnkSta:   Speed 8GT/s (ok), Width x4 (ok)
>>                TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
>>           DevCap2: Completion Timeout: Range A, TimeoutDis- NROPrPrP- LTR+
>>                 10BitTagComp- 10BitTagReq- OBFF Not Supported, ExtFmt+
>> EETLPPrefix-
>>                 EmergencyPowerReduction Not Supported,
>> EmergencyPowerReductionInit-
>>                 FRS-
>>                 AtomicOpsCap: 32bit- 64bit- 128bitCAS-
>>           DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis- LTR-
>> OBFF Disabled,
>>                 AtomicOpsCtl: ReqEn-
>>           LnkCap2: Supported Link Speeds: 2.5-8GT/s, Crosslink-
>> Retimer- 2Retimers- DRS-
>>           LnkCtl2: Target Link Speed: 8GT/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-
>>                 Retimer- 2Retimers- CrosslinkRes: unsupported
>>      Capabilities: [c0] Subsystem: ASMedia Technology Inc. Device 0201
>>      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
>>           LnkCtl3: LnkEquIntrruptEn- PerformEqu-
>>           LaneErrStat: LaneErr at lane: 0 1 2 3
>>      Capabilities: [300 v1] Latency Tolerance Reporting
>>           Max snoop latency: 0ns
>>           Max no snoop latency: 0ns
>>      Capabilities: [400 v1] L1 PM Substates
>>           L1SubCap: PCI-PM_L1.2+ PCI-PM_L1.1+ ASPM_L1.2+ ASPM_L1.1+
>> L1_PM_Substates+
>>                  PortCommonModeRestoreTime=0us PortTPowerOnTime=10us
>>           L1SubCtl1: PCI-PM_L1.2- PCI-PM_L1.1- ASPM_L1.2- ASPM_L1.1-
>>                   T_CommonMode=0us LTR1.2_Threshold=0ns
>>           L1SubCtl2: T_PwrOn=0us
>>      Kernel driver in use: xhci_hcd
>>      Kernel modules: xhci_pci
>>
>> On Tue, Mar 9, 2021 at 6:00 AM Mathias Nyman
>> <mathias.nyman@linux.intel.com> wrote:
>
>
>
>
>>>> Currently the usb host stack doesn't really support USB 3.2 yet, at
>>>> least the speed check part. I made some updates to handle that.
>>>>
>>>> You apply these patches and test on your setup
>>>> https://urldefense.com/v3/__https://patchwork.kernel.org/project/linux-usb/list/?series=427561__;!!A4F2R9G_pg!O509Jgp-IveN9AmXa5oORW98Q_B4_GyjbA5RSAXFuZaexHl4jhm8G9dWbImQUw4CrNZJ$ 
>>>>
>>>> Hopefully Mathias will have time to review and Ack them for the next
>>>> release cycle.
>>> Thanks for the reminder, added some comments to the series
>>>
>>> -Mathias
>>>


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

* Re: USB 3.2 Gen 2x2 "Superspeed+20GBps" support for ASM3242
  2021-03-09 12:02   ` Mathias Nyman
  2021-03-09 22:51     ` William Allen
@ 2021-12-30 13:10     ` youling257
  2021-12-30 13:30       ` Greg KH
  1 sibling, 1 reply; 22+ messages in thread
From: youling257 @ 2021-12-30 13:10 UTC (permalink / raw)
  To: mathias.nyman; +Cc: william.allentx, linux-usb, Thinh.Nguyen

where i can find the series patch? https://patchwork.kernel.org/project/linux-usb/list/?series=427561

when i used maiwo k1690(10gbps) connect to ASM3242 Controller, only 500MB/s.
cat /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb3/speed, 480
cat /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb4/speed, 20000
maiwo k1690 is on /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb4/4-1.
cat /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb4/4-1/speed, 5000


01:00.0 USB controller: ASMedia Technology Inc. ASM3242 USB 3.2 Host Controller (prog-if 30 [XHCI])
        Subsystem: ASMedia Technology Inc. ASM3242 USB 3.2 Host Controller

[    0.359281] xhci_hcd 0000:01:00.0: xHCI Host Controller
[    0.359283] xhci_hcd 0000:01:00.0: new USB bus registered, assigned bus number 2
[    0.359285] xhci_hcd 0000:01:00.0: Host supports USB 3.2 Enhanced SuperSpeed

[ 1191.734123] usb 4-1: new SuperSpeed USB device number 2 using xhci_hcd
[ 1191.794767] usb-storage 4-1:1.0: USB Mass Storage device detected
[ 1191.795049] scsi host9: usb-storage 4-1:1.0
[ 1051.051274] scsi 9:0:0:0: Direct-Access     Realtek  USB 3.2 Device   1.00 PQ: 0 ANSI: 6
[ 1051.051442] sd 9:0:0:0: Attached scsi generic sg0 type 0
[ 1051.054461] sd 9:0:0:0: [sda] 500118192 512-byte logical blocks: (256 GB/238 GiB)
[ 1051.055068] sd 9:0:0:0: [sda] Write Protect is off
[ 1051.055073] sd 9:0:0:0: [sda] Mode Sense: 37 00 00 08
[ 1051.055716] sd 9:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[ 1051.072131]  sda: sda1 sda2

i don't have NVMe to USB 2x2 Enclosure (ASM2364 chipset), i have NVMe to USB 2x1 Enclosure (RTL9120B chipset), maiwo k1690, using it on PciExpress X4 add in card (ASM3242 chipset), it only 5Gbps speed, should be 10Gbps.


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

* Re: USB 3.2 Gen 2x2 "Superspeed+20GBps" support for ASM3242
  2021-12-30 13:10     ` youling257
@ 2021-12-30 13:30       ` Greg KH
  2021-12-30 13:49         ` Mathias Nyman
  2021-12-30 14:57         ` youling 257
  0 siblings, 2 replies; 22+ messages in thread
From: Greg KH @ 2021-12-30 13:30 UTC (permalink / raw)
  To: youling257; +Cc: mathias.nyman, william.allentx, linux-usb, Thinh.Nguyen

On Thu, Dec 30, 2021 at 09:10:14PM +0800, youling257 wrote:
> where i can find the series patch? https://patchwork.kernel.org/project/linux-usb/list/?series=427561

There is nothing at that link.

What is the lore.kernel.org link for the patch you are curious about?

> when i used maiwo k1690(10gbps) connect to ASM3242 Controller, only 500MB/s.
> cat /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb3/speed, 480
> cat /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb4/speed, 20000
> maiwo k1690 is on /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb4/4-1.
> cat /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb4/4-1/speed, 5000
> 
> 
> 01:00.0 USB controller: ASMedia Technology Inc. ASM3242 USB 3.2 Host Controller (prog-if 30 [XHCI])
>         Subsystem: ASMedia Technology Inc. ASM3242 USB 3.2 Host Controller
> 
> [    0.359281] xhci_hcd 0000:01:00.0: xHCI Host Controller
> [    0.359283] xhci_hcd 0000:01:00.0: new USB bus registered, assigned bus number 2
> [    0.359285] xhci_hcd 0000:01:00.0: Host supports USB 3.2 Enhanced SuperSpeed
> 
> [ 1191.734123] usb 4-1: new SuperSpeed USB device number 2 using xhci_hcd
> [ 1191.794767] usb-storage 4-1:1.0: USB Mass Storage device detected
> [ 1191.795049] scsi host9: usb-storage 4-1:1.0
> [ 1051.051274] scsi 9:0:0:0: Direct-Access     Realtek  USB 3.2 Device   1.00 PQ: 0 ANSI: 6
> [ 1051.051442] sd 9:0:0:0: Attached scsi generic sg0 type 0
> [ 1051.054461] sd 9:0:0:0: [sda] 500118192 512-byte logical blocks: (256 GB/238 GiB)
> [ 1051.055068] sd 9:0:0:0: [sda] Write Protect is off
> [ 1051.055073] sd 9:0:0:0: [sda] Mode Sense: 37 00 00 08
> [ 1051.055716] sd 9:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
> [ 1051.072131]  sda: sda1 sda2
> 
> i don't have NVMe to USB 2x2 Enclosure (ASM2364 chipset), i have NVMe to USB 2x1 Enclosure (RTL9120B chipset), maiwo k1690, using it on PciExpress X4 add in card (ASM3242 chipset), it only 5Gbps speed, should be 10Gbps.
> 

Are you sure that your hardware can really support this?  Do you have
the right cable and the device will support this speed?

And most important, what kernel version are you using?

thanks,

greg k-h

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

* Re: USB 3.2 Gen 2x2 "Superspeed+20GBps" support for ASM3242
  2021-12-30 13:30       ` Greg KH
@ 2021-12-30 13:49         ` Mathias Nyman
  2021-12-30 14:57         ` youling 257
  1 sibling, 0 replies; 22+ messages in thread
From: Mathias Nyman @ 2021-12-30 13:49 UTC (permalink / raw)
  To: Greg KH, youling257
  Cc: mathias.nyman, william.allentx, linux-usb, Thinh.Nguyen

On 30.12.2021 15.30, Greg KH wrote:
> On Thu, Dec 30, 2021 at 09:10:14PM +0800, youling257 wrote:
>> where i can find the series patch? https://patchwork.kernel.org/project/linux-usb/list/?series=427561
> 
> There is nothing at that link.
> 
> What is the lore.kernel.org link for the patch you are curious about?

That series should be in 5.13

https://lore.kernel.org/linux-usb/cover.1615432770.git.Thinh.Nguyen@synopsys.com/

> 
>> when i used maiwo k1690(10gbps) connect to ASM3242 Controller, only 500MB/s.
>> cat /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb3/speed, 480
>> cat /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb4/speed, 20000
>> maiwo k1690 is on /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb4/4-1.
>> cat /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb4/4-1/speed, 5000
>>
>>
>> 01:00.0 USB controller: ASMedia Technology Inc. ASM3242 USB 3.2 Host Controller (prog-if 30 [XHCI])
>>         Subsystem: ASMedia Technology Inc. ASM3242 USB 3.2 Host Controller
>>
>> [    0.359281] xhci_hcd 0000:01:00.0: xHCI Host Controller
>> [    0.359283] xhci_hcd 0000:01:00.0: new USB bus registered, assigned bus number 2
>> [    0.359285] xhci_hcd 0000:01:00.0: Host supports USB 3.2 Enhanced SuperSpeed
>>
>> [ 1191.734123] usb 4-1: new SuperSpeed USB device number 2 using xhci_hcd
>> [ 1191.794767] usb-storage 4-1:1.0: USB Mass Storage device detected
>> [ 1191.795049] scsi host9: usb-storage 4-1:1.0
>> [ 1051.051274] scsi 9:0:0:0: Direct-Access     Realtek  USB 3.2 Device   1.00 PQ: 0 ANSI: 6
>> [ 1051.051442] sd 9:0:0:0: Attached scsi generic sg0 type 0
>> [ 1051.054461] sd 9:0:0:0: [sda] 500118192 512-byte logical blocks: (256 GB/238 GiB)
>> [ 1051.055068] sd 9:0:0:0: [sda] Write Protect is off
>> [ 1051.055073] sd 9:0:0:0: [sda] Mode Sense: 37 00 00 08
>> [ 1051.055716] sd 9:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
>> [ 1051.072131]  sda: sda1 sda2
>>
>> i don't have NVMe to USB 2x2 Enclosure (ASM2364 chipset), i have NVMe to USB 2x1 Enclosure (RTL9120B chipset), maiwo k1690, using it on PciExpress X4 add in card (ASM3242 chipset), it only 5Gbps speed, should be 10Gbps.
>>
> 
> Are you sure that your hardware can really support this?  Do you have
> the right cable and the device will support this speed?
> 
> And most important, what kernel version are you using?
> 
> thanks,
> 
> greg k-h
> 


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

* Re: USB 3.2 Gen 2x2 "Superspeed+20GBps" support for ASM3242
  2021-12-30 13:30       ` Greg KH
  2021-12-30 13:49         ` Mathias Nyman
@ 2021-12-30 14:57         ` youling 257
  2021-12-31  1:39           ` Thinh Nguyen
  1 sibling, 1 reply; 22+ messages in thread
From: youling 257 @ 2021-12-30 14:57 UTC (permalink / raw)
  To: Greg KH; +Cc: mathias.nyman, william.allentx, linux-usb, Thinh.Nguyen

2021-12-30 21:30 GMT+08:00, Greg KH <gregkh@linuxfoundation.org>:
> On Thu, Dec 30, 2021 at 09:10:14PM +0800, youling257 wrote:
>> where i can find the series patch?
>> https://patchwork.kernel.org/project/linux-usb/list/?series=427561
>
> There is nothing at that link.
>
> What is the lore.kernel.org link for the patch you are curious about?
>
>> when i used maiwo k1690(10gbps) connect to ASM3242 Controller, only
>> 500MB/s.
>> cat /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb3/speed, 480
>> cat /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb4/speed, 20000
>> maiwo k1690 is on
>> /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb4/4-1.
>> cat /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb4/4-1/speed,
>> 5000
>>
>>
>> 01:00.0 USB controller: ASMedia Technology Inc. ASM3242 USB 3.2 Host
>> Controller (prog-if 30 [XHCI])
>>         Subsystem: ASMedia Technology Inc. ASM3242 USB 3.2 Host
>> Controller
>>
>> [    0.359281] xhci_hcd 0000:01:00.0: xHCI Host Controller
>> [    0.359283] xhci_hcd 0000:01:00.0: new USB bus registered, assigned bus
>> number 2
>> [    0.359285] xhci_hcd 0000:01:00.0: Host supports USB 3.2 Enhanced
>> SuperSpeed
>>
>> [ 1191.734123] usb 4-1: new SuperSpeed USB device number 2 using xhci_hcd
>> [ 1191.794767] usb-storage 4-1:1.0: USB Mass Storage device detected
>> [ 1191.795049] scsi host9: usb-storage 4-1:1.0
>> [ 1051.051274] scsi 9:0:0:0: Direct-Access     Realtek  USB 3.2 Device
>> 1.00 PQ: 0 ANSI: 6
>> [ 1051.051442] sd 9:0:0:0: Attached scsi generic sg0 type 0
>> [ 1051.054461] sd 9:0:0:0: [sda] 500118192 512-byte logical blocks: (256
>> GB/238 GiB)
>> [ 1051.055068] sd 9:0:0:0: [sda] Write Protect is off
>> [ 1051.055073] sd 9:0:0:0: [sda] Mode Sense: 37 00 00 08
>> [ 1051.055716] sd 9:0:0:0: [sda] Write cache: disabled, read cache:
>> enabled, doesn't support DPO or FUA
>> [ 1051.072131]  sda: sda1 sda2
>>
>> i don't have NVMe to USB 2x2 Enclosure (ASM2364 chipset), i have NVMe to
>> USB 2x1 Enclosure (RTL9120B chipset), maiwo k1690, using it on PciExpress
>> X4 add in card (ASM3242 chipset), it only 5Gbps speed, should be 10Gbps.
>>
>
> Are you sure that your hardware can really support this?  Do you have
> the right cable and the device will support this speed?
02:00.0 USB controller: Advanced Micro Devices, Inc. [AMD] 400 Series
Chipset USB 3.1 XHCI Controller (rev 01) (prog-if 30 [XHCI])
        Subsystem: ASMedia Technology Inc. 400 Series Chipset USB 3.1
XHCI Controller

maiwo k1690 connect to mainboard usb3.2 gen2x1 port can 10gbps.
[ 1049.965556] usb 2-2: new SuperSpeed Plus Gen 2x1 USB device number
2 using xhci_hcd
[ 1050.028280] usb-storage 2-2:1.0: USB Mass Storage device detected
[ 1050.028560] scsi host9: usb-storage 2-2:1.0

pcie to usb3.2 gen2x2 asm3242 should be compatible usb3.2 gen2x1.
I don't have windows os to test them, may be 5gbps on windows yet.
Is there a way to hack them to 10Gbps on linux?

> And most important, what kernel version are you using?
kernel 5.16 rc7.
> thanks,
>
> greg k-h
>

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

* Re: USB 3.2 Gen 2x2 "Superspeed+20GBps" support for ASM3242
  2021-12-30 14:57         ` youling 257
@ 2021-12-31  1:39           ` Thinh Nguyen
  2021-12-31  3:10             ` youling 257
  2021-12-31  8:49             ` youling 257
  0 siblings, 2 replies; 22+ messages in thread
From: Thinh Nguyen @ 2021-12-31  1:39 UTC (permalink / raw)
  To: youling 257, Greg KH
  Cc: mathias.nyman, william.allentx, linux-usb, Thinh Nguyen

Hi,

youling 257 wrote:
> 2021-12-30 21:30 GMT+08:00, Greg KH <gregkh@linuxfoundation.org>:
>> On Thu, Dec 30, 2021 at 09:10:14PM +0800, youling257 wrote:
>>> where i can find the series patch?
>>> https://urldefense.com/v3/__https://patchwork.kernel.org/project/linux-usb/list/?series=427561__;!!A4F2R9G_pg!M_zXKjO1JtIkz57qZ7BEEL7zjx2QXQTfau26hBNLX7bKEL_vOP-m8Xn1eZ14VRpY-0Ga$ 
>>
>> There is nothing at that link.
>>
>> What is the lore.kernel.org link for the patch you are curious about?
>>
>>> when i used maiwo k1690(10gbps) connect to ASM3242 Controller, only
>>> 500MB/s.
>>> cat /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb3/speed, 480
>>> cat /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb4/speed, 20000
>>> maiwo k1690 is on
>>> /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb4/4-1.
>>> cat /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb4/4-1/speed,
>>> 5000
>>>
>>>
>>> 01:00.0 USB controller: ASMedia Technology Inc. ASM3242 USB 3.2 Host
>>> Controller (prog-if 30 [XHCI])
>>>         Subsystem: ASMedia Technology Inc. ASM3242 USB 3.2 Host
>>> Controller
>>>
>>> [    0.359281] xhci_hcd 0000:01:00.0: xHCI Host Controller
>>> [    0.359283] xhci_hcd 0000:01:00.0: new USB bus registered, assigned bus
>>> number 2
>>> [    0.359285] xhci_hcd 0000:01:00.0: Host supports USB 3.2 Enhanced
>>> SuperSpeed
>>>
>>> [ 1191.734123] usb 4-1: new SuperSpeed USB device number 2 using xhci_hcd
>>> [ 1191.794767] usb-storage 4-1:1.0: USB Mass Storage device detected
>>> [ 1191.795049] scsi host9: usb-storage 4-1:1.0
>>> [ 1051.051274] scsi 9:0:0:0: Direct-Access     Realtek  USB 3.2 Device
>>> 1.00 PQ: 0 ANSI: 6
>>> [ 1051.051442] sd 9:0:0:0: Attached scsi generic sg0 type 0
>>> [ 1051.054461] sd 9:0:0:0: [sda] 500118192 512-byte logical blocks: (256
>>> GB/238 GiB)
>>> [ 1051.055068] sd 9:0:0:0: [sda] Write Protect is off
>>> [ 1051.055073] sd 9:0:0:0: [sda] Mode Sense: 37 00 00 08
>>> [ 1051.055716] sd 9:0:0:0: [sda] Write cache: disabled, read cache:
>>> enabled, doesn't support DPO or FUA
>>> [ 1051.072131]  sda: sda1 sda2
>>>
>>> i don't have NVMe to USB 2x2 Enclosure (ASM2364 chipset), i have NVMe to
>>> USB 2x1 Enclosure (RTL9120B chipset), maiwo k1690, using it on PciExpress
>>> X4 add in card (ASM3242 chipset), it only 5Gbps speed, should be 10Gbps.
>>>
>>
>> Are you sure that your hardware can really support this?  Do you have
>> the right cable and the device will support this speed?
> 02:00.0 USB controller: Advanced Micro Devices, Inc. [AMD] 400 Series
> Chipset USB 3.1 XHCI Controller (rev 01) (prog-if 30 [XHCI])
>         Subsystem: ASMedia Technology Inc. 400 Series Chipset USB 3.1
> XHCI Controller
> 
> maiwo k1690 connect to mainboard usb3.2 gen2x1 port can 10gbps.
> [ 1049.965556] usb 2-2: new SuperSpeed Plus Gen 2x1 USB device number
> 2 using xhci_hcd
> [ 1050.028280] usb-storage 2-2:1.0: USB Mass Storage device detected
> [ 1050.028560] scsi host9: usb-storage 2-2:1.0
> 
> pcie to usb3.2 gen2x2 asm3242 should be compatible usb3.2 gen2x1.
> I don't have windows os to test them, may be 5gbps on windows yet.
> Is there a way to hack them to 10Gbps on linux?
> 
>> And most important, what kernel version are you using?
> kernel 5.16 rc7.
>> thanks,
>>
>> greg k-h
>>

The ASmedia host controller incorrectly reports the speed ID in the
port-status mismatching with its PSI capability for SSP devices. As
a result, the host/hub driver will report the wrong speed.

To resolve/workaround this, the xHCI driver can capture the device speed
from sublink speed notification of a SSP device. All SSP devices must
send sublink speed device notification, so this method should resolve
your issue.

You can apply the change below. This should resolve your issue.

BR,
Thinh


diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 9ddcc0ab4db7..6de15f004684 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -2602,7 +2602,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
 	 */
 	temp = readl(&xhci->op_regs->dev_notification);
 	temp &= ~DEV_NOTE_MASK;
-	temp |= DEV_NOTE_FWAKE;
+	temp |= DEV_NOTE_FWAKE | DEV_NOTE_SUBLINK_SPEED;
 	writel(temp, &xhci->op_regs->dev_notification);
 
 	return 0;
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 99d9d9c88988..80081b3fd52a 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1860,6 +1860,8 @@ static void handle_device_notification(struct xhci_hcd *xhci,
 {
 	u32 slot_id;
 	struct usb_device *udev;
+	u32 type;
+	u32 dn;
 
 	slot_id = TRB_TO_SLOT_ID(le32_to_cpu(event->generic.field[3]));
 	if (!xhci->devs[slot_id]) {
@@ -1868,11 +1870,45 @@ static void handle_device_notification(struct xhci_hcd *xhci,
 		return;
 	}
 
-	xhci_dbg(xhci, "Device Wake Notification event for slot ID %u\n",
-			slot_id);
 	udev = xhci->devs[slot_id]->udev;
-	if (udev && udev->parent)
-		usb_wakeup_notification(udev->parent, udev->portnum);
+	type = TRB_DN_TYPE(le32_to_cpu(event->generic.field[0]));
+
+	switch (type) {
+	case TRB_DN_TYPE_FUNC_WAKE:
+		xhci_info(xhci, "Device Wake Notification event for slot ID %u\n",
+			  slot_id);
+		if (udev && udev->parent)
+			usb_wakeup_notification(udev->parent, udev->portnum);
+		break;
+	case TRB_DN_TYPE_SUBLINK_SPEED:
+		if (!udev)
+			break;
+
+		dn = le32_to_cpu(event->generic.field[1]);
+		udev->ssp_rate = USB_SSP_GEN_UNKNOWN;
+
+		if (TRB_DN_SUBLINK_SPEED_LP(dn) ==
+		    TRB_DN_SUBLINK_SPEED_LP_SSP) {
+			udev->speed = USB_SPEED_SUPER_PLUS;
+
+			if (TRB_DN_SUBLINK_SPEED_LSE(dn) !=
+			    TRB_DN_SUBLINK_SPEED_LSE_GBPS)
+				break;
+
+			if (TRB_DN_SUBLINK_SPEED_LSM(dn) == 10) {
+				if (TRB_DN_SUBLINK_SPEED_LANES(dn))
+					udev->ssp_rate = USB_SSP_GEN_2x2;
+				else
+					udev->ssp_rate = USB_SSP_GEN_2x1;
+			} else if (TRB_DN_SUBLINK_SPEED_LSM(dn) == 5) {
+				if (TRB_DN_SUBLINK_SPEED_LANES(dn))
+					udev->ssp_rate = USB_SSP_GEN_1x2;
+			}
+		} else {
+			udev->speed = USB_SPEED_SUPER;
+		}
+		break;
+	}
 }
 
 /*
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 9192465fd5f3..ce2ca67c115f 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -267,6 +267,7 @@ struct xhci_op_regs {
  * SW does need to pay attention to function wake notifications.
  */
 #define	DEV_NOTE_FWAKE		ENABLE_DEV_NOTE(1)
+#define	DEV_NOTE_SUBLINK_SPEED	ENABLE_DEV_NOTE(5)
 
 /* CRCR - Command Ring Control Register - cmd_ring bitmasks */
 /* bit 0 is the command ring cycle state */
@@ -1434,6 +1435,30 @@ union xhci_trb {
 /* Get NEC firmware revision. */
 #define	TRB_NEC_GET_FW		49
 
+/* Get Device Notification type */
+#define TRB_DN_TYPE(p)			(((p) >> 4) & 0xf)
+
+#define TRB_DN_TYPE_FUNC_WAKE		1
+#define TRB_DN_TYPE_SUBLINK_SPEED	5
+
+/* Get sublink speed attributes */
+#define TRB_DN_SUBLINK_SPEED_LSE(p)	(((p) >> 4) & 0x3)
+#define TRB_DN_SUBLINK_SPEED_LSE_BPS	0
+#define TRB_DN_SUBLINK_SPEED_LSE_KBPS	1
+#define TRB_DN_SUBLINK_SPEED_LSE_MBPS	2
+#define TRB_DN_SUBLINK_SPEED_LSE_GBPS	3
+#define TRB_DN_SUBLINK_SPEED_ST(p)	(((p) >> 6) & 0x3)
+#define TRB_DN_SUBLINK_SPEED_LANES(p)	(((p) >> 10) & 0xf)
+#define TRB_DN_SUBLINK_SPEED_LP(p)	(((p) >> 14) & 0x3)
+#define TRB_DN_SUBLINK_SPEED_LP_SS	0
+#define TRB_DN_SUBLINK_SPEED_LP_SSP	1
+#define TRB_DN_SUBLINK_SPEED_LSM(p)	(((p) >> 16) & 0xffff)
+
+#define TRB_DN_SUBLINK_SPEED_IS_SYMMETRIC(p) \
+	(!(TRB_DN_SUBLINK_SPEED_ST(p) & BIT(0)))
+#define TRB_DN_SUBLINK_SPEED_IS_TX(p) \
+	(!!(TRB_DN_SUBLINK_SPEED_ST(p) & BIT(1)))
+
 static inline const char *xhci_trb_type_string(u8 type)
 {
 	switch (type) {





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

* Re: USB 3.2 Gen 2x2 "Superspeed+20GBps" support for ASM3242
  2021-12-31  1:39           ` Thinh Nguyen
@ 2021-12-31  3:10             ` youling 257
  2021-12-31  3:46               ` Thinh Nguyen
  2021-12-31  8:49             ` youling 257
  1 sibling, 1 reply; 22+ messages in thread
From: youling 257 @ 2021-12-31  3:10 UTC (permalink / raw)
  To: Thinh Nguyen; +Cc: Greg KH, mathias.nyman, william.allentx, linux-usb

test this patch, cat /sys/bus/usb/devices/4-1/speed, 10000
[   74.694284] usb 4-1: new SuperSpeed Plus Gen 2x1 USB device number
2 using xhci_hcd
[   74.750329] usb-storage 4-1:1.0: USB Mass Storage device detected

but speed, pcie to usb3.2 gen2x2, WRITE: bw=642MiB/s (673MB/s),
642MiB/s-642MiB/s (673MB/s-673MB/s), io=1000MiB (1049MB),
run=1557-1557msec
READ: bw=467MiB/s (490MB/s), 467MiB/s-467MiB/s (490MB/s-490MB/s),
io=1000MiB (1049MB), run=2140-2140msec

the mainboard usb3.2 gen2x1, WRITE: bw=838MiB/s (878MB/s),
838MiB/s-838MiB/s (878MB/s-878MB/s), io=1000MiB (1049MB),
run=1194-1194msec
READ: bw=753MiB/s (790MB/s), 753MiB/s-753MiB/s (790MB/s-790MB/s),
io=1000MiB (1049MB), run=1328-1328msec

2021-12-31 9:39 GMT+08:00, Thinh Nguyen <Thinh.Nguyen@synopsys.com>:
> Hi,
>
> youling 257 wrote:
>> 2021-12-30 21:30 GMT+08:00, Greg KH <gregkh@linuxfoundation.org>:
>>> On Thu, Dec 30, 2021 at 09:10:14PM +0800, youling257 wrote:
>>>> where i can find the series patch?
>>>> https://urldefense.com/v3/__https://patchwork.kernel.org/project/linux-usb/list/?series=427561__;!!A4F2R9G_pg!M_zXKjO1JtIkz57qZ7BEEL7zjx2QXQTfau26hBNLX7bKEL_vOP-m8Xn1eZ14VRpY-0Ga$
>>>>
>>>
>>> There is nothing at that link.
>>>
>>> What is the lore.kernel.org link for the patch you are curious about?
>>>
>>>> when i used maiwo k1690(10gbps) connect to ASM3242 Controller, only
>>>> 500MB/s.
>>>> cat /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb3/speed, 480
>>>> cat /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb4/speed, 20000
>>>> maiwo k1690 is on
>>>> /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb4/4-1.
>>>> cat /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb4/4-1/speed,
>>>> 5000
>>>>
>>>>
>>>> 01:00.0 USB controller: ASMedia Technology Inc. ASM3242 USB 3.2 Host
>>>> Controller (prog-if 30 [XHCI])
>>>>         Subsystem: ASMedia Technology Inc. ASM3242 USB 3.2 Host
>>>> Controller
>>>>
>>>> [    0.359281] xhci_hcd 0000:01:00.0: xHCI Host Controller
>>>> [    0.359283] xhci_hcd 0000:01:00.0: new USB bus registered, assigned
>>>> bus
>>>> number 2
>>>> [    0.359285] xhci_hcd 0000:01:00.0: Host supports USB 3.2 Enhanced
>>>> SuperSpeed
>>>>
>>>> [ 1191.734123] usb 4-1: new SuperSpeed USB device number 2 using
>>>> xhci_hcd
>>>> [ 1191.794767] usb-storage 4-1:1.0: USB Mass Storage device detected
>>>> [ 1191.795049] scsi host9: usb-storage 4-1:1.0
>>>> [ 1051.051274] scsi 9:0:0:0: Direct-Access     Realtek  USB 3.2 Device
>>>> 1.00 PQ: 0 ANSI: 6
>>>> [ 1051.051442] sd 9:0:0:0: Attached scsi generic sg0 type 0
>>>> [ 1051.054461] sd 9:0:0:0: [sda] 500118192 512-byte logical blocks:
>>>> (256
>>>> GB/238 GiB)
>>>> [ 1051.055068] sd 9:0:0:0: [sda] Write Protect is off
>>>> [ 1051.055073] sd 9:0:0:0: [sda] Mode Sense: 37 00 00 08
>>>> [ 1051.055716] sd 9:0:0:0: [sda] Write cache: disabled, read cache:
>>>> enabled, doesn't support DPO or FUA
>>>> [ 1051.072131]  sda: sda1 sda2
>>>>
>>>> i don't have NVMe to USB 2x2 Enclosure (ASM2364 chipset), i have NVMe
>>>> to
>>>> USB 2x1 Enclosure (RTL9120B chipset), maiwo k1690, using it on
>>>> PciExpress
>>>> X4 add in card (ASM3242 chipset), it only 5Gbps speed, should be
>>>> 10Gbps.
>>>>
>>>
>>> Are you sure that your hardware can really support this?  Do you have
>>> the right cable and the device will support this speed?
>> 02:00.0 USB controller: Advanced Micro Devices, Inc. [AMD] 400 Series
>> Chipset USB 3.1 XHCI Controller (rev 01) (prog-if 30 [XHCI])
>>         Subsystem: ASMedia Technology Inc. 400 Series Chipset USB 3.1
>> XHCI Controller
>>
>> maiwo k1690 connect to mainboard usb3.2 gen2x1 port can 10gbps.
>> [ 1049.965556] usb 2-2: new SuperSpeed Plus Gen 2x1 USB device number
>> 2 using xhci_hcd
>> [ 1050.028280] usb-storage 2-2:1.0: USB Mass Storage device detected
>> [ 1050.028560] scsi host9: usb-storage 2-2:1.0
>>
>> pcie to usb3.2 gen2x2 asm3242 should be compatible usb3.2 gen2x1.
>> I don't have windows os to test them, may be 5gbps on windows yet.
>> Is there a way to hack them to 10Gbps on linux?
>>
>>> And most important, what kernel version are you using?
>> kernel 5.16 rc7.
>>> thanks,
>>>
>>> greg k-h
>>>
>
> The ASmedia host controller incorrectly reports the speed ID in the
> port-status mismatching with its PSI capability for SSP devices. As
> a result, the host/hub driver will report the wrong speed.
>
> To resolve/workaround this, the xHCI driver can capture the device speed
> from sublink speed notification of a SSP device. All SSP devices must
> send sublink speed device notification, so this method should resolve
> your issue.
>
> You can apply the change below. This should resolve your issue.
>
> BR,
> Thinh
>
>
> diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
> index 9ddcc0ab4db7..6de15f004684 100644
> --- a/drivers/usb/host/xhci-mem.c
> +++ b/drivers/usb/host/xhci-mem.c
> @@ -2602,7 +2602,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
>  	 */
>  	temp = readl(&xhci->op_regs->dev_notification);
>  	temp &= ~DEV_NOTE_MASK;
> -	temp |= DEV_NOTE_FWAKE;
> +	temp |= DEV_NOTE_FWAKE | DEV_NOTE_SUBLINK_SPEED;
>  	writel(temp, &xhci->op_regs->dev_notification);
>
>  	return 0;
> diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
> index 99d9d9c88988..80081b3fd52a 100644
> --- a/drivers/usb/host/xhci-ring.c
> +++ b/drivers/usb/host/xhci-ring.c
> @@ -1860,6 +1860,8 @@ static void handle_device_notification(struct xhci_hcd
> *xhci,
>  {
>  	u32 slot_id;
>  	struct usb_device *udev;
> +	u32 type;
> +	u32 dn;
>
>  	slot_id = TRB_TO_SLOT_ID(le32_to_cpu(event->generic.field[3]));
>  	if (!xhci->devs[slot_id]) {
> @@ -1868,11 +1870,45 @@ static void handle_device_notification(struct
> xhci_hcd *xhci,
>  		return;
>  	}
>
> -	xhci_dbg(xhci, "Device Wake Notification event for slot ID %u\n",
> -			slot_id);
>  	udev = xhci->devs[slot_id]->udev;
> -	if (udev && udev->parent)
> -		usb_wakeup_notification(udev->parent, udev->portnum);
> +	type = TRB_DN_TYPE(le32_to_cpu(event->generic.field[0]));
> +
> +	switch (type) {
> +	case TRB_DN_TYPE_FUNC_WAKE:
> +		xhci_info(xhci, "Device Wake Notification event for slot ID %u\n",
> +			  slot_id);
> +		if (udev && udev->parent)
> +			usb_wakeup_notification(udev->parent, udev->portnum);
> +		break;
> +	case TRB_DN_TYPE_SUBLINK_SPEED:
> +		if (!udev)
> +			break;
> +
> +		dn = le32_to_cpu(event->generic.field[1]);
> +		udev->ssp_rate = USB_SSP_GEN_UNKNOWN;
> +
> +		if (TRB_DN_SUBLINK_SPEED_LP(dn) ==
> +		    TRB_DN_SUBLINK_SPEED_LP_SSP) {
> +			udev->speed = USB_SPEED_SUPER_PLUS;
> +
> +			if (TRB_DN_SUBLINK_SPEED_LSE(dn) !=
> +			    TRB_DN_SUBLINK_SPEED_LSE_GBPS)
> +				break;
> +
> +			if (TRB_DN_SUBLINK_SPEED_LSM(dn) == 10) {
> +				if (TRB_DN_SUBLINK_SPEED_LANES(dn))
> +					udev->ssp_rate = USB_SSP_GEN_2x2;
> +				else
> +					udev->ssp_rate = USB_SSP_GEN_2x1;
> +			} else if (TRB_DN_SUBLINK_SPEED_LSM(dn) == 5) {
> +				if (TRB_DN_SUBLINK_SPEED_LANES(dn))
> +					udev->ssp_rate = USB_SSP_GEN_1x2;
> +			}
> +		} else {
> +			udev->speed = USB_SPEED_SUPER;
> +		}
> +		break;
> +	}
>  }
>
>  /*
> diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
> index 9192465fd5f3..ce2ca67c115f 100644
> --- a/drivers/usb/host/xhci.h
> +++ b/drivers/usb/host/xhci.h
> @@ -267,6 +267,7 @@ struct xhci_op_regs {
>   * SW does need to pay attention to function wake notifications.
>   */
>  #define	DEV_NOTE_FWAKE		ENABLE_DEV_NOTE(1)
> +#define	DEV_NOTE_SUBLINK_SPEED	ENABLE_DEV_NOTE(5)
>
>  /* CRCR - Command Ring Control Register - cmd_ring bitmasks */
>  /* bit 0 is the command ring cycle state */
> @@ -1434,6 +1435,30 @@ union xhci_trb {
>  /* Get NEC firmware revision. */
>  #define	TRB_NEC_GET_FW		49
>
> +/* Get Device Notification type */
> +#define TRB_DN_TYPE(p)			(((p) >> 4) & 0xf)
> +
> +#define TRB_DN_TYPE_FUNC_WAKE		1
> +#define TRB_DN_TYPE_SUBLINK_SPEED	5
> +
> +/* Get sublink speed attributes */
> +#define TRB_DN_SUBLINK_SPEED_LSE(p)	(((p) >> 4) & 0x3)
> +#define TRB_DN_SUBLINK_SPEED_LSE_BPS	0
> +#define TRB_DN_SUBLINK_SPEED_LSE_KBPS	1
> +#define TRB_DN_SUBLINK_SPEED_LSE_MBPS	2
> +#define TRB_DN_SUBLINK_SPEED_LSE_GBPS	3
> +#define TRB_DN_SUBLINK_SPEED_ST(p)	(((p) >> 6) & 0x3)
> +#define TRB_DN_SUBLINK_SPEED_LANES(p)	(((p) >> 10) & 0xf)
> +#define TRB_DN_SUBLINK_SPEED_LP(p)	(((p) >> 14) & 0x3)
> +#define TRB_DN_SUBLINK_SPEED_LP_SS	0
> +#define TRB_DN_SUBLINK_SPEED_LP_SSP	1
> +#define TRB_DN_SUBLINK_SPEED_LSM(p)	(((p) >> 16) & 0xffff)
> +
> +#define TRB_DN_SUBLINK_SPEED_IS_SYMMETRIC(p) \
> +	(!(TRB_DN_SUBLINK_SPEED_ST(p) & BIT(0)))
> +#define TRB_DN_SUBLINK_SPEED_IS_TX(p) \
> +	(!!(TRB_DN_SUBLINK_SPEED_ST(p) & BIT(1)))
> +
>  static inline const char *xhci_trb_type_string(u8 type)
>  {
>  	switch (type) {
>
>
>
>
>

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

* Re: USB 3.2 Gen 2x2 "Superspeed+20GBps" support for ASM3242
  2021-12-31  3:10             ` youling 257
@ 2021-12-31  3:46               ` Thinh Nguyen
  2021-12-31  4:42                 ` youling 257
  2021-12-31  4:52                 ` youling 257
  0 siblings, 2 replies; 22+ messages in thread
From: Thinh Nguyen @ 2021-12-31  3:46 UTC (permalink / raw)
  To: youling 257, Thinh Nguyen
  Cc: Greg KH, mathias.nyman, william.allentx, linux-usb

Hi,

youling 257 wrote:
> test this patch, cat /sys/bus/usb/devices/4-1/speed, 10000
> [   74.694284] usb 4-1: new SuperSpeed Plus Gen 2x1 USB device number
> 2 using xhci_hcd
> [   74.750329] usb-storage 4-1:1.0: USB Mass Storage device detected
> 
> but speed, pcie to usb3.2 gen2x2, WRITE: bw=642MiB/s (673MB/s),
> 642MiB/s-642MiB/s (673MB/s-673MB/s), io=1000MiB (1049MB),
> run=1557-1557msec
> READ: bw=467MiB/s (490MB/s), 467MiB/s-467MiB/s (490MB/s-490MB/s),
> io=1000MiB (1049MB), run=2140-2140msec
> 
> the mainboard usb3.2 gen2x1, WRITE: bw=838MiB/s (878MB/s),
> 838MiB/s-838MiB/s (878MB/s-878MB/s), io=1000MiB (1049MB),
> run=1194-1194msec
> READ: bw=753MiB/s (790MB/s), 753MiB/s-753MiB/s (790MB/s-790MB/s),
> io=1000MiB (1049MB), run=1328-1328msec
> 

Let's avoid top-post.

Some comments:
1) Just because the host is capable of gen2x2, it doesn't mean it will
run at gen2x2 speed. Your device can only operate up to gen2x1 speed, so
that's the limit. The test speed for gen2x1 above is not unreasonable.

2) You're comparing 2 different controllers performance. The "mainboard"
performs better for the specific setup and specific test that you use.
(I'm assuming that the only difference in your test setup is the host
controller and rest is the same).

3) Find a gen2x2 capable device to test ASmedia gen2x2 speed if that's
what you're checking for.

BR,
Thinh

> 2021-12-31 9:39 GMT+08:00, Thinh Nguyen <Thinh.Nguyen@synopsys.com>:
>> Hi,
>>
>> youling 257 wrote:
>>> 2021-12-30 21:30 GMT+08:00, Greg KH <gregkh@linuxfoundation.org>:
>>>> On Thu, Dec 30, 2021 at 09:10:14PM +0800, youling257 wrote:
>>>>> where i can find the series patch?
>>>>> https://urldefense.com/v3/__https://patchwork.kernel.org/project/linux-usb/list/?series=427561__;!!A4F2R9G_pg!M_zXKjO1JtIkz57qZ7BEEL7zjx2QXQTfau26hBNLX7bKEL_vOP-m8Xn1eZ14VRpY-0Ga$
>>>>>
>>>>
>>>> There is nothing at that link.
>>>>
>>>> What is the lore.kernel.org link for the patch you are curious about?
>>>>
>>>>> when i used maiwo k1690(10gbps) connect to ASM3242 Controller, only
>>>>> 500MB/s.
>>>>> cat /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb3/speed, 480
>>>>> cat /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb4/speed, 20000
>>>>> maiwo k1690 is on
>>>>> /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb4/4-1.
>>>>> cat /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb4/4-1/speed,
>>>>> 5000
>>>>>
>>>>>
>>>>> 01:00.0 USB controller: ASMedia Technology Inc. ASM3242 USB 3.2 Host
>>>>> Controller (prog-if 30 [XHCI])
>>>>>         Subsystem: ASMedia Technology Inc. ASM3242 USB 3.2 Host
>>>>> Controller
>>>>>
>>>>> [    0.359281] xhci_hcd 0000:01:00.0: xHCI Host Controller
>>>>> [    0.359283] xhci_hcd 0000:01:00.0: new USB bus registered, assigned
>>>>> bus
>>>>> number 2
>>>>> [    0.359285] xhci_hcd 0000:01:00.0: Host supports USB 3.2 Enhanced
>>>>> SuperSpeed
>>>>>
>>>>> [ 1191.734123] usb 4-1: new SuperSpeed USB device number 2 using
>>>>> xhci_hcd
>>>>> [ 1191.794767] usb-storage 4-1:1.0: USB Mass Storage device detected
>>>>> [ 1191.795049] scsi host9: usb-storage 4-1:1.0
>>>>> [ 1051.051274] scsi 9:0:0:0: Direct-Access     Realtek  USB 3.2 Device
>>>>> 1.00 PQ: 0 ANSI: 6
>>>>> [ 1051.051442] sd 9:0:0:0: Attached scsi generic sg0 type 0
>>>>> [ 1051.054461] sd 9:0:0:0: [sda] 500118192 512-byte logical blocks:
>>>>> (256
>>>>> GB/238 GiB)
>>>>> [ 1051.055068] sd 9:0:0:0: [sda] Write Protect is off
>>>>> [ 1051.055073] sd 9:0:0:0: [sda] Mode Sense: 37 00 00 08
>>>>> [ 1051.055716] sd 9:0:0:0: [sda] Write cache: disabled, read cache:
>>>>> enabled, doesn't support DPO or FUA
>>>>> [ 1051.072131]  sda: sda1 sda2
>>>>>
>>>>> i don't have NVMe to USB 2x2 Enclosure (ASM2364 chipset), i have NVMe
>>>>> to
>>>>> USB 2x1 Enclosure (RTL9120B chipset), maiwo k1690, using it on
>>>>> PciExpress
>>>>> X4 add in card (ASM3242 chipset), it only 5Gbps speed, should be
>>>>> 10Gbps.
>>>>>
>>>>
>>>> Are you sure that your hardware can really support this?  Do you have
>>>> the right cable and the device will support this speed?
>>> 02:00.0 USB controller: Advanced Micro Devices, Inc. [AMD] 400 Series
>>> Chipset USB 3.1 XHCI Controller (rev 01) (prog-if 30 [XHCI])
>>>         Subsystem: ASMedia Technology Inc. 400 Series Chipset USB 3.1
>>> XHCI Controller
>>>
>>> maiwo k1690 connect to mainboard usb3.2 gen2x1 port can 10gbps.
>>> [ 1049.965556] usb 2-2: new SuperSpeed Plus Gen 2x1 USB device number
>>> 2 using xhci_hcd
>>> [ 1050.028280] usb-storage 2-2:1.0: USB Mass Storage device detected
>>> [ 1050.028560] scsi host9: usb-storage 2-2:1.0
>>>
>>> pcie to usb3.2 gen2x2 asm3242 should be compatible usb3.2 gen2x1.
>>> I don't have windows os to test them, may be 5gbps on windows yet.
>>> Is there a way to hack them to 10Gbps on linux?
>>>
>>>> And most important, what kernel version are you using?
>>> kernel 5.16 rc7.
>>>> thanks,
>>>>
>>>> greg k-h
>>>>
>>
>> The ASmedia host controller incorrectly reports the speed ID in the
>> port-status mismatching with its PSI capability for SSP devices. As
>> a result, the host/hub driver will report the wrong speed.
>>
>> To resolve/workaround this, the xHCI driver can capture the device speed
>> from sublink speed notification of a SSP device. All SSP devices must
>> send sublink speed device notification, so this method should resolve
>> your issue.
>>

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

* Re: USB 3.2 Gen 2x2 "Superspeed+20GBps" support for ASM3242
  2021-12-31  3:46               ` Thinh Nguyen
@ 2021-12-31  4:42                 ` youling 257
  2021-12-31  4:52                 ` youling 257
  1 sibling, 0 replies; 22+ messages in thread
From: youling 257 @ 2021-12-31  4:42 UTC (permalink / raw)
  To: Thinh Nguyen; +Cc: Greg KH, mathias.nyman, william.allentx, linux-usb

2021-12-31 11:46 GMT+08:00, Thinh Nguyen <Thinh.Nguyen@synopsys.com>:
> Hi,
>
> youling 257 wrote:
>> test this patch, cat /sys/bus/usb/devices/4-1/speed, 10000
>> [   74.694284] usb 4-1: new SuperSpeed Plus Gen 2x1 USB device number
>> 2 using xhci_hcd
>> [   74.750329] usb-storage 4-1:1.0: USB Mass Storage device detected
>>
>> but speed, pcie to usb3.2 gen2x2, WRITE: bw=642MiB/s (673MB/s),
>> 642MiB/s-642MiB/s (673MB/s-673MB/s), io=1000MiB (1049MB),
>> run=1557-1557msec
>> READ: bw=467MiB/s (490MB/s), 467MiB/s-467MiB/s (490MB/s-490MB/s),
>> io=1000MiB (1049MB), run=2140-2140msec
>>
>> the mainboard usb3.2 gen2x1, WRITE: bw=838MiB/s (878MB/s),
>> 838MiB/s-838MiB/s (878MB/s-878MB/s), io=1000MiB (1049MB),
>> run=1194-1194msec
>> READ: bw=753MiB/s (790MB/s), 753MiB/s-753MiB/s (790MB/s-790MB/s),
>> io=1000MiB (1049MB), run=1328-1328msec
>>
>
> Let's avoid top-post.
>
> Some comments:
> 1) Just because the host is capable of gen2x2, it doesn't mean it will
> run at gen2x2 speed. Your device can only operate up to gen2x1 speed, so
> that's the limit. The test speed for gen2x1 above is not unreasonable.
>
> 2) You're comparing 2 different controllers performance. The "mainboard"
> performs better for the specific setup and specific test that you use.
> (I'm assuming that the only difference in your test setup is the host
> controller and rest is the same).
>
> 3) Find a gen2x2 capable device to test ASmedia gen2x2 speed if that's
> what you're checking for.
gen2x1 capable device to test ASmedia gen2x2 speed, can 1000MB/s on
win10 pe, speed faster than on linux.
> BR,
> Thinh
>
>> 2021-12-31 9:39 GMT+08:00, Thinh Nguyen <Thinh.Nguyen@synopsys.com>:
>>> Hi,
>>>
>>> youling 257 wrote:
>>>> 2021-12-30 21:30 GMT+08:00, Greg KH <gregkh@linuxfoundation.org>:
>>>>> On Thu, Dec 30, 2021 at 09:10:14PM +0800, youling257 wrote:
>>>>>> where i can find the series patch?
>>>>>> https://urldefense.com/v3/__https://patchwork.kernel.org/project/linux-usb/list/?series=427561__;!!A4F2R9G_pg!M_zXKjO1JtIkz57qZ7BEEL7zjx2QXQTfau26hBNLX7bKEL_vOP-m8Xn1eZ14VRpY-0Ga$
>>>>>>
>>>>>
>>>>> There is nothing at that link.
>>>>>
>>>>> What is the lore.kernel.org link for the patch you are curious about?
>>>>>
>>>>>> when i used maiwo k1690(10gbps) connect to ASM3242 Controller, only
>>>>>> 500MB/s.
>>>>>> cat /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb3/speed, 480
>>>>>> cat /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb4/speed,
>>>>>> 20000
>>>>>> maiwo k1690 is on
>>>>>> /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb4/4-1.
>>>>>> cat /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb4/4-1/speed,
>>>>>> 5000
>>>>>>
>>>>>>
>>>>>> 01:00.0 USB controller: ASMedia Technology Inc. ASM3242 USB 3.2 Host
>>>>>> Controller (prog-if 30 [XHCI])
>>>>>>         Subsystem: ASMedia Technology Inc. ASM3242 USB 3.2 Host
>>>>>> Controller
>>>>>>
>>>>>> [    0.359281] xhci_hcd 0000:01:00.0: xHCI Host Controller
>>>>>> [    0.359283] xhci_hcd 0000:01:00.0: new USB bus registered,
>>>>>> assigned
>>>>>> bus
>>>>>> number 2
>>>>>> [    0.359285] xhci_hcd 0000:01:00.0: Host supports USB 3.2 Enhanced
>>>>>> SuperSpeed
>>>>>>
>>>>>> [ 1191.734123] usb 4-1: new SuperSpeed USB device number 2 using
>>>>>> xhci_hcd
>>>>>> [ 1191.794767] usb-storage 4-1:1.0: USB Mass Storage device detected
>>>>>> [ 1191.795049] scsi host9: usb-storage 4-1:1.0
>>>>>> [ 1051.051274] scsi 9:0:0:0: Direct-Access     Realtek  USB 3.2
>>>>>> Device
>>>>>> 1.00 PQ: 0 ANSI: 6
>>>>>> [ 1051.051442] sd 9:0:0:0: Attached scsi generic sg0 type 0
>>>>>> [ 1051.054461] sd 9:0:0:0: [sda] 500118192 512-byte logical blocks:
>>>>>> (256
>>>>>> GB/238 GiB)
>>>>>> [ 1051.055068] sd 9:0:0:0: [sda] Write Protect is off
>>>>>> [ 1051.055073] sd 9:0:0:0: [sda] Mode Sense: 37 00 00 08
>>>>>> [ 1051.055716] sd 9:0:0:0: [sda] Write cache: disabled, read cache:
>>>>>> enabled, doesn't support DPO or FUA
>>>>>> [ 1051.072131]  sda: sda1 sda2
>>>>>>
>>>>>> i don't have NVMe to USB 2x2 Enclosure (ASM2364 chipset), i have NVMe
>>>>>> to
>>>>>> USB 2x1 Enclosure (RTL9120B chipset), maiwo k1690, using it on
>>>>>> PciExpress
>>>>>> X4 add in card (ASM3242 chipset), it only 5Gbps speed, should be
>>>>>> 10Gbps.
>>>>>>
>>>>>
>>>>> Are you sure that your hardware can really support this?  Do you have
>>>>> the right cable and the device will support this speed?
>>>> 02:00.0 USB controller: Advanced Micro Devices, Inc. [AMD] 400 Series
>>>> Chipset USB 3.1 XHCI Controller (rev 01) (prog-if 30 [XHCI])
>>>>         Subsystem: ASMedia Technology Inc. 400 Series Chipset USB 3.1
>>>> XHCI Controller
>>>>
>>>> maiwo k1690 connect to mainboard usb3.2 gen2x1 port can 10gbps.
>>>> [ 1049.965556] usb 2-2: new SuperSpeed Plus Gen 2x1 USB device number
>>>> 2 using xhci_hcd
>>>> [ 1050.028280] usb-storage 2-2:1.0: USB Mass Storage device detected
>>>> [ 1050.028560] scsi host9: usb-storage 2-2:1.0
>>>>
>>>> pcie to usb3.2 gen2x2 asm3242 should be compatible usb3.2 gen2x1.
>>>> I don't have windows os to test them, may be 5gbps on windows yet.
>>>> Is there a way to hack them to 10Gbps on linux?
>>>>
>>>>> And most important, what kernel version are you using?
>>>> kernel 5.16 rc7.
>>>>> thanks,
>>>>>
>>>>> greg k-h
>>>>>
>>>
>>> The ASmedia host controller incorrectly reports the speed ID in the
>>> port-status mismatching with its PSI capability for SSP devices. As
>>> a result, the host/hub driver will report the wrong speed.
>>>
>>> To resolve/workaround this, the xHCI driver can capture the device speed
>>> from sublink speed notification of a SSP device. All SSP devices must
>>> send sublink speed device notification, so this method should resolve
>>> your issue.
>>>
>

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

* Re: USB 3.2 Gen 2x2 "Superspeed+20GBps" support for ASM3242
  2021-12-31  3:46               ` Thinh Nguyen
  2021-12-31  4:42                 ` youling 257
@ 2021-12-31  4:52                 ` youling 257
  2021-12-31  7:02                   ` Thinh Nguyen
  1 sibling, 1 reply; 22+ messages in thread
From: youling 257 @ 2021-12-31  4:52 UTC (permalink / raw)
  To: Thinh Nguyen; +Cc: Greg KH, mathias.nyman, william.allentx, linux-usb

2021-12-31 11:46 GMT+08:00, Thinh Nguyen <Thinh.Nguyen@synopsys.com>:
> Hi,
>
> youling 257 wrote:
>> test this patch, cat /sys/bus/usb/devices/4-1/speed, 10000
>> [   74.694284] usb 4-1: new SuperSpeed Plus Gen 2x1 USB device number
>> 2 using xhci_hcd
>> [   74.750329] usb-storage 4-1:1.0: USB Mass Storage device detected
>>
>> but speed, pcie to usb3.2 gen2x2, WRITE: bw=642MiB/s (673MB/s),
>> 642MiB/s-642MiB/s (673MB/s-673MB/s), io=1000MiB (1049MB),
>> run=1557-1557msec
>> READ: bw=467MiB/s (490MB/s), 467MiB/s-467MiB/s (490MB/s-490MB/s),
>> io=1000MiB (1049MB), run=2140-2140msec
>>
>> the mainboard usb3.2 gen2x1, WRITE: bw=838MiB/s (878MB/s),
>> 838MiB/s-838MiB/s (878MB/s-878MB/s), io=1000MiB (1049MB),
>> run=1194-1194msec
>> READ: bw=753MiB/s (790MB/s), 753MiB/s-753MiB/s (790MB/s-790MB/s),
>> io=1000MiB (1049MB), run=1328-1328msec
>>
>
> Let's avoid top-post.
>
> Some comments:
> 1) Just because the host is capable of gen2x2, it doesn't mean it will
> run at gen2x2 speed. Your device can only operate up to gen2x1 speed, so
> that's the limit. The test speed for gen2x1 above is not unreasonable.
my device can only operate up to gen2x1 10gbps speed on window, only
5gbps on linux kernel 5.16rc7.
> 2) You're comparing 2 different controllers performance. The "mainboard"
> performs better for the specific setup and specific test that you use.
> (I'm assuming that the only difference in your test setup is the host
> controller and rest is the same).
>
> 3) Find a gen2x2 capable device to test ASmedia gen2x2 speed if that's
> what you're checking for.
>
> BR,
> Thinh
>
>> 2021-12-31 9:39 GMT+08:00, Thinh Nguyen <Thinh.Nguyen@synopsys.com>:
>>> Hi,
>>>
>>> youling 257 wrote:
>>>> 2021-12-30 21:30 GMT+08:00, Greg KH <gregkh@linuxfoundation.org>:
>>>>> On Thu, Dec 30, 2021 at 09:10:14PM +0800, youling257 wrote:
>>>>>> where i can find the series patch?
>>>>>> https://urldefense.com/v3/__https://patchwork.kernel.org/project/linux-usb/list/?series=427561__;!!A4F2R9G_pg!M_zXKjO1JtIkz57qZ7BEEL7zjx2QXQTfau26hBNLX7bKEL_vOP-m8Xn1eZ14VRpY-0Ga$
>>>>>>
>>>>>
>>>>> There is nothing at that link.
>>>>>
>>>>> What is the lore.kernel.org link for the patch you are curious about?
>>>>>
>>>>>> when i used maiwo k1690(10gbps) connect to ASM3242 Controller, only
>>>>>> 500MB/s.
>>>>>> cat /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb3/speed, 480
>>>>>> cat /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb4/speed,
>>>>>> 20000
>>>>>> maiwo k1690 is on
>>>>>> /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb4/4-1.
>>>>>> cat /sys/devices/pci0000:00/0000:00:01.3/0000:09:00.0/usb4/4-1/speed,
>>>>>> 5000
>>>>>>
>>>>>>
>>>>>> 01:00.0 USB controller: ASMedia Technology Inc. ASM3242 USB 3.2 Host
>>>>>> Controller (prog-if 30 [XHCI])
>>>>>>         Subsystem: ASMedia Technology Inc. ASM3242 USB 3.2 Host
>>>>>> Controller
>>>>>>
>>>>>> [    0.359281] xhci_hcd 0000:01:00.0: xHCI Host Controller
>>>>>> [    0.359283] xhci_hcd 0000:01:00.0: new USB bus registered,
>>>>>> assigned
>>>>>> bus
>>>>>> number 2
>>>>>> [    0.359285] xhci_hcd 0000:01:00.0: Host supports USB 3.2 Enhanced
>>>>>> SuperSpeed
>>>>>>
>>>>>> [ 1191.734123] usb 4-1: new SuperSpeed USB device number 2 using
>>>>>> xhci_hcd
>>>>>> [ 1191.794767] usb-storage 4-1:1.0: USB Mass Storage device detected
>>>>>> [ 1191.795049] scsi host9: usb-storage 4-1:1.0
>>>>>> [ 1051.051274] scsi 9:0:0:0: Direct-Access     Realtek  USB 3.2
>>>>>> Device
>>>>>> 1.00 PQ: 0 ANSI: 6
>>>>>> [ 1051.051442] sd 9:0:0:0: Attached scsi generic sg0 type 0
>>>>>> [ 1051.054461] sd 9:0:0:0: [sda] 500118192 512-byte logical blocks:
>>>>>> (256
>>>>>> GB/238 GiB)
>>>>>> [ 1051.055068] sd 9:0:0:0: [sda] Write Protect is off
>>>>>> [ 1051.055073] sd 9:0:0:0: [sda] Mode Sense: 37 00 00 08
>>>>>> [ 1051.055716] sd 9:0:0:0: [sda] Write cache: disabled, read cache:
>>>>>> enabled, doesn't support DPO or FUA
>>>>>> [ 1051.072131]  sda: sda1 sda2
>>>>>>
>>>>>> i don't have NVMe to USB 2x2 Enclosure (ASM2364 chipset), i have NVMe
>>>>>> to
>>>>>> USB 2x1 Enclosure (RTL9120B chipset), maiwo k1690, using it on
>>>>>> PciExpress
>>>>>> X4 add in card (ASM3242 chipset), it only 5Gbps speed, should be
>>>>>> 10Gbps.
>>>>>>
>>>>>
>>>>> Are you sure that your hardware can really support this?  Do you have
>>>>> the right cable and the device will support this speed?
>>>> 02:00.0 USB controller: Advanced Micro Devices, Inc. [AMD] 400 Series
>>>> Chipset USB 3.1 XHCI Controller (rev 01) (prog-if 30 [XHCI])
>>>>         Subsystem: ASMedia Technology Inc. 400 Series Chipset USB 3.1
>>>> XHCI Controller
>>>>
>>>> maiwo k1690 connect to mainboard usb3.2 gen2x1 port can 10gbps.
>>>> [ 1049.965556] usb 2-2: new SuperSpeed Plus Gen 2x1 USB device number
>>>> 2 using xhci_hcd
>>>> [ 1050.028280] usb-storage 2-2:1.0: USB Mass Storage device detected
>>>> [ 1050.028560] scsi host9: usb-storage 2-2:1.0
>>>>
>>>> pcie to usb3.2 gen2x2 asm3242 should be compatible usb3.2 gen2x1.
>>>> I don't have windows os to test them, may be 5gbps on windows yet.
>>>> Is there a way to hack them to 10Gbps on linux?
>>>>
>>>>> And most important, what kernel version are you using?
>>>> kernel 5.16 rc7.
>>>>> thanks,
>>>>>
>>>>> greg k-h
>>>>>
>>>
>>> The ASmedia host controller incorrectly reports the speed ID in the
>>> port-status mismatching with its PSI capability for SSP devices. As
>>> a result, the host/hub driver will report the wrong speed.
>>>
>>> To resolve/workaround this, the xHCI driver can capture the device speed
>>> from sublink speed notification of a SSP device. All SSP devices must
>>> send sublink speed device notification, so this method should resolve
>>> your issue.
>>>
>

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

* Re: USB 3.2 Gen 2x2 "Superspeed+20GBps" support for ASM3242
  2021-12-31  4:52                 ` youling 257
@ 2021-12-31  7:02                   ` Thinh Nguyen
  2021-12-31  7:59                     ` youling 257
  2021-12-31  8:42                     ` youling 257
  0 siblings, 2 replies; 22+ messages in thread
From: Thinh Nguyen @ 2021-12-31  7:02 UTC (permalink / raw)
  To: youling 257, Thinh Nguyen
  Cc: Greg KH, mathias.nyman, william.allentx, linux-usb

youling 257 wrote:
> 2021-12-31 11:46 GMT+08:00, Thinh Nguyen <Thinh.Nguyen@synopsys.com>:
>> Hi,
>>
>> youling 257 wrote:
>>> test this patch, cat /sys/bus/usb/devices/4-1/speed, 10000
>>> [   74.694284] usb 4-1: new SuperSpeed Plus Gen 2x1 USB device number
>>> 2 using xhci_hcd
>>> [   74.750329] usb-storage 4-1:1.0: USB Mass Storage device detected
>>>
>>> but speed, pcie to usb3.2 gen2x2, WRITE: bw=642MiB/s (673MB/s),
>>> 642MiB/s-642MiB/s (673MB/s-673MB/s), io=1000MiB (1049MB),
>>> run=1557-1557msec
>>> READ: bw=467MiB/s (490MB/s), 467MiB/s-467MiB/s (490MB/s-490MB/s),
>>> io=1000MiB (1049MB), run=2140-2140msec
>>>
>>> the mainboard usb3.2 gen2x1, WRITE: bw=838MiB/s (878MB/s),
>>> 838MiB/s-838MiB/s (878MB/s-878MB/s), io=1000MiB (1049MB),
>>> run=1194-1194msec
>>> READ: bw=753MiB/s (790MB/s), 753MiB/s-753MiB/s (790MB/s-790MB/s),
>>> io=1000MiB (1049MB), run=1328-1328msec
>>>
>>
>> Let's avoid top-post.
>>
>> Some comments:
>> 1) Just because the host is capable of gen2x2, it doesn't mean it will
>> run at gen2x2 speed. Your device can only operate up to gen2x1 speed, so
>> that's the limit. The test speed for gen2x1 above is not unreasonable.

> my device can only operate up to gen2x1 10gbps speed on window, only
> 5gbps on linux kernel 5.16rc7.

With the change I provided, you were able to run test at gen2x1, albeit
slower than expect. (i.e. write speed at 673MB/s for ASmedia host must
be SSP). The issue with device unable to operate at SSP is at least
answered.

If you're looking to find out why the performance is slow, confirm these
items first:

1) Are you using the same application to test on Linux to compare with
Windows? (Looks like you're using CrystalDiskMark for your Windows test)

2) If you're using the same application, are you using the same test
parameters and version?

3) Is your device operating in BOT or UASP in Linux? UAS Protocol is
generally faster. Newer device generally uses UASP, and I assume yours
is a newer device (check your enclosure). Make sure there's no quirk
preventing the device operating in UASP.

If all of those are checked out, you can start capturing logs so others
may look into it.

BR,
Thinh

(btw, I'll be on vacation for a week, maybe others can help while I'm away.)

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

* Re: USB 3.2 Gen 2x2 "Superspeed+20GBps" support for ASM3242
  2021-12-31  7:02                   ` Thinh Nguyen
@ 2021-12-31  7:59                     ` youling 257
  2021-12-31  8:42                     ` youling 257
  1 sibling, 0 replies; 22+ messages in thread
From: youling 257 @ 2021-12-31  7:59 UTC (permalink / raw)
  To: Thinh Nguyen; +Cc: Greg KH, mathias.nyman, william.allentx, linux-usb

2021-12-31 15:02 GMT+08:00, Thinh Nguyen <Thinh.Nguyen@synopsys.com>:
> youling 257 wrote:
>> 2021-12-31 11:46 GMT+08:00, Thinh Nguyen <Thinh.Nguyen@synopsys.com>:
>>> Hi,
>>>
>>> youling 257 wrote:
>>>> test this patch, cat /sys/bus/usb/devices/4-1/speed, 10000
>>>> [   74.694284] usb 4-1: new SuperSpeed Plus Gen 2x1 USB device number
>>>> 2 using xhci_hcd
>>>> [   74.750329] usb-storage 4-1:1.0: USB Mass Storage device detected
>>>>
>>>> but speed, pcie to usb3.2 gen2x2, WRITE: bw=642MiB/s (673MB/s),
>>>> 642MiB/s-642MiB/s (673MB/s-673MB/s), io=1000MiB (1049MB),
>>>> run=1557-1557msec
>>>> READ: bw=467MiB/s (490MB/s), 467MiB/s-467MiB/s (490MB/s-490MB/s),
>>>> io=1000MiB (1049MB), run=2140-2140msec
>>>>
>>>> the mainboard usb3.2 gen2x1, WRITE: bw=838MiB/s (878MB/s),
>>>> 838MiB/s-838MiB/s (878MB/s-878MB/s), io=1000MiB (1049MB),
>>>> run=1194-1194msec
>>>> READ: bw=753MiB/s (790MB/s), 753MiB/s-753MiB/s (790MB/s-790MB/s),
>>>> io=1000MiB (1049MB), run=1328-1328msec
>>>>
>>>
>>> Let's avoid top-post.
>>>
>>> Some comments:
>>> 1) Just because the host is capable of gen2x2, it doesn't mean it will
>>> run at gen2x2 speed. Your device can only operate up to gen2x1 speed, so
>>> that's the limit. The test speed for gen2x1 above is not unreasonable.
>
>> my device can only operate up to gen2x1 10gbps speed on window, only
>> 5gbps on linux kernel 5.16rc7.
>
> With the change I provided, you were able to run test at gen2x1, albeit
> slower than expect. (i.e. write speed at 673MB/s for ASmedia host must
> be SSP). The issue with device unable to operate at SSP is at least
> answered.
>
> If you're looking to find out why the performance is slow, confirm these
> items first:
>
> 1) Are you using the same application to test on Linux to compare with
> Windows? (Looks like you're using CrystalDiskMark for your Windows test)
linux kdiskmark, windows crystaldiskmark
> 2) If you're using the same application, are you using the same test
> parameters and version?
kdiskmark and crystaldiskmark used same parameters, seq1M Q8T1, linux
500MB/s, windows 1000MB/s.
> 3) Is your device operating in BOT or UASP in Linux? UAS Protocol is
> generally faster. Newer device generally uses UASP, and I assume yours
> is a newer device (check your enclosure). Make sure there's no quirk
> preventing the device operating in UASP.
>
> If all of those are checked out, you can start capturing logs so others
> may look into it.
>
> BR,
> Thinh
>
> (btw, I'll be on vacation for a week, maybe others can help while I'm
> away.)
>

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

* Re: USB 3.2 Gen 2x2 "Superspeed+20GBps" support for ASM3242
  2021-12-31  7:02                   ` Thinh Nguyen
  2021-12-31  7:59                     ` youling 257
@ 2021-12-31  8:42                     ` youling 257
  2022-01-13  1:41                       ` Thinh Nguyen
  1 sibling, 1 reply; 22+ messages in thread
From: youling 257 @ 2021-12-31  8:42 UTC (permalink / raw)
  To: Thinh Nguyen; +Cc: Greg KH, mathias.nyman, william.allentx, linux-usb

2021-12-31 15:02 GMT+08:00, Thinh Nguyen <Thinh.Nguyen@synopsys.com>:
> youling 257 wrote:
>> 2021-12-31 11:46 GMT+08:00, Thinh Nguyen <Thinh.Nguyen@synopsys.com>:
>>> Hi,
>>>
>>> youling 257 wrote:
>>>> test this patch, cat /sys/bus/usb/devices/4-1/speed, 10000
>>>> [   74.694284] usb 4-1: new SuperSpeed Plus Gen 2x1 USB device number
>>>> 2 using xhci_hcd
>>>> [   74.750329] usb-storage 4-1:1.0: USB Mass Storage device detected
>>>>
>>>> but speed, pcie to usb3.2 gen2x2, WRITE: bw=642MiB/s (673MB/s),
>>>> 642MiB/s-642MiB/s (673MB/s-673MB/s), io=1000MiB (1049MB),
>>>> run=1557-1557msec
>>>> READ: bw=467MiB/s (490MB/s), 467MiB/s-467MiB/s (490MB/s-490MB/s),
>>>> io=1000MiB (1049MB), run=2140-2140msec
>>>>
>>>> the mainboard usb3.2 gen2x1, WRITE: bw=838MiB/s (878MB/s),
>>>> 838MiB/s-838MiB/s (878MB/s-878MB/s), io=1000MiB (1049MB),
>>>> run=1194-1194msec
>>>> READ: bw=753MiB/s (790MB/s), 753MiB/s-753MiB/s (790MB/s-790MB/s),
>>>> io=1000MiB (1049MB), run=1328-1328msec
>>>>
>>>
>>> Let's avoid top-post.
>>>
>>> Some comments:
>>> 1) Just because the host is capable of gen2x2, it doesn't mean it will
>>> run at gen2x2 speed. Your device can only operate up to gen2x1 speed, so
>>> that's the limit. The test speed for gen2x1 above is not unreasonable.
>
>> my device can only operate up to gen2x1 10gbps speed on window, only
>> 5gbps on linux kernel 5.16rc7.
>
> With the change I provided, you were able to run test at gen2x1, albeit
> slower than expect. (i.e. write speed at 673MB/s for ASmedia host must
> be SSP). The issue with device unable to operate at SSP is at least
> answered.
>
> If you're looking to find out why the performance is slow, confirm these
> items first:
>
> 1) Are you using the same application to test on Linux to compare with
> Windows? (Looks like you're using CrystalDiskMark for your Windows test)
>
> 2) If you're using the same application, are you using the same test
> parameters and version?
>
> 3) Is your device operating in BOT or UASP in Linux? UAS Protocol is
my kernel config #CONFIG_USB_UAS is not set.
> generally faster. Newer device generally uses UASP, and I assume yours
> is a newer device (check your enclosure). Make sure there's no quirk
> preventing the device operating in UASP.
CONFIG_USB_UAS=y
[  524.630081] usb 4-1: new SuperSpeed Plus Gen 2x1 USB device number
5 using xhci_hcd
[  524.747496] scsi host9: uas
[  524.757580] scsi 9:0:0:0: Direct-Access     Realtek  USB 3.2 Device
  1.00 PQ: 0 ANSI: 6
Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 20000M/x2
    |__ Port 1: Dev 2, If 0, Class=Mass Storage, Driver=uas, 10000M

windows fat32 speed, https://imgur.com/a/eq9qhKj
linux ext4 speed, https://imgur.com/a/tUAskgV

> If all of those are checked out, you can start capturing logs so others
> may look into it.
>
> BR,
> Thinh
>
> (btw, I'll be on vacation for a week, maybe others can help while I'm
> away.)
>

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

* Re: USB 3.2 Gen 2x2 "Superspeed+20GBps" support for ASM3242
  2021-12-31  1:39           ` Thinh Nguyen
  2021-12-31  3:10             ` youling 257
@ 2021-12-31  8:49             ` youling 257
  2022-01-13 17:53               ` Thinh Nguyen
  1 sibling, 1 reply; 22+ messages in thread
From: youling 257 @ 2021-12-31  8:49 UTC (permalink / raw)
  To: Thinh Nguyen; +Cc: Greg KH, mathias.nyman, william.allentx, linux-usb

please you subject a patch to linux-usb.

2021-12-31 9:39 GMT+08:00, Thinh Nguyen <Thinh.Nguyen@synopsys.com>:
> The ASmedia host controller incorrectly reports the speed ID in the
> port-status mismatching with its PSI capability for SSP devices. As
> a result, the host/hub driver will report the wrong speed.
>
> To resolve/workaround this, the xHCI driver can capture the device speed
> from sublink speed notification of a SSP device. All SSP devices must
> send sublink speed device notification, so this method should resolve
> your issue.
>
> You can apply the change below. This should resolve your issue.
>
> BR,
> Thinh
>
>
> diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
> index 9ddcc0ab4db7..6de15f004684 100644
> --- a/drivers/usb/host/xhci-mem.c
> +++ b/drivers/usb/host/xhci-mem.c
> @@ -2602,7 +2602,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
>  	 */
>  	temp = readl(&xhci->op_regs->dev_notification);
>  	temp &= ~DEV_NOTE_MASK;
> -	temp |= DEV_NOTE_FWAKE;
> +	temp |= DEV_NOTE_FWAKE | DEV_NOTE_SUBLINK_SPEED;
>  	writel(temp, &xhci->op_regs->dev_notification);
>
>  	return 0;
> diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
> index 99d9d9c88988..80081b3fd52a 100644
> --- a/drivers/usb/host/xhci-ring.c
> +++ b/drivers/usb/host/xhci-ring.c
> @@ -1860,6 +1860,8 @@ static void handle_device_notification(struct xhci_hcd
> *xhci,
>  {
>  	u32 slot_id;
>  	struct usb_device *udev;
> +	u32 type;
> +	u32 dn;
>
>  	slot_id = TRB_TO_SLOT_ID(le32_to_cpu(event->generic.field[3]));
>  	if (!xhci->devs[slot_id]) {
> @@ -1868,11 +1870,45 @@ static void handle_device_notification(struct
> xhci_hcd *xhci,
>  		return;
>  	}
>
> -	xhci_dbg(xhci, "Device Wake Notification event for slot ID %u\n",
> -			slot_id);
>  	udev = xhci->devs[slot_id]->udev;
> -	if (udev && udev->parent)
> -		usb_wakeup_notification(udev->parent, udev->portnum);
> +	type = TRB_DN_TYPE(le32_to_cpu(event->generic.field[0]));
> +
> +	switch (type) {
> +	case TRB_DN_TYPE_FUNC_WAKE:
> +		xhci_info(xhci, "Device Wake Notification event for slot ID %u\n",
> +			  slot_id);
> +		if (udev && udev->parent)
> +			usb_wakeup_notification(udev->parent, udev->portnum);
> +		break;
> +	case TRB_DN_TYPE_SUBLINK_SPEED:
> +		if (!udev)
> +			break;
> +
> +		dn = le32_to_cpu(event->generic.field[1]);
> +		udev->ssp_rate = USB_SSP_GEN_UNKNOWN;
> +
> +		if (TRB_DN_SUBLINK_SPEED_LP(dn) ==
> +		    TRB_DN_SUBLINK_SPEED_LP_SSP) {
> +			udev->speed = USB_SPEED_SUPER_PLUS;
> +
> +			if (TRB_DN_SUBLINK_SPEED_LSE(dn) !=
> +			    TRB_DN_SUBLINK_SPEED_LSE_GBPS)
> +				break;
> +
> +			if (TRB_DN_SUBLINK_SPEED_LSM(dn) == 10) {
> +				if (TRB_DN_SUBLINK_SPEED_LANES(dn))
> +					udev->ssp_rate = USB_SSP_GEN_2x2;
> +				else
> +					udev->ssp_rate = USB_SSP_GEN_2x1;
> +			} else if (TRB_DN_SUBLINK_SPEED_LSM(dn) == 5) {
> +				if (TRB_DN_SUBLINK_SPEED_LANES(dn))
> +					udev->ssp_rate = USB_SSP_GEN_1x2;
> +			}
> +		} else {
> +			udev->speed = USB_SPEED_SUPER;
> +		}
> +		break;
> +	}
>  }
>
>  /*
> diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
> index 9192465fd5f3..ce2ca67c115f 100644
> --- a/drivers/usb/host/xhci.h
> +++ b/drivers/usb/host/xhci.h
> @@ -267,6 +267,7 @@ struct xhci_op_regs {
>   * SW does need to pay attention to function wake notifications.
>   */
>  #define	DEV_NOTE_FWAKE		ENABLE_DEV_NOTE(1)
> +#define	DEV_NOTE_SUBLINK_SPEED	ENABLE_DEV_NOTE(5)
>
>  /* CRCR - Command Ring Control Register - cmd_ring bitmasks */
>  /* bit 0 is the command ring cycle state */
> @@ -1434,6 +1435,30 @@ union xhci_trb {
>  /* Get NEC firmware revision. */
>  #define	TRB_NEC_GET_FW		49
>
> +/* Get Device Notification type */
> +#define TRB_DN_TYPE(p)			(((p) >> 4) & 0xf)
> +
> +#define TRB_DN_TYPE_FUNC_WAKE		1
> +#define TRB_DN_TYPE_SUBLINK_SPEED	5
> +
> +/* Get sublink speed attributes */
> +#define TRB_DN_SUBLINK_SPEED_LSE(p)	(((p) >> 4) & 0x3)
> +#define TRB_DN_SUBLINK_SPEED_LSE_BPS	0
> +#define TRB_DN_SUBLINK_SPEED_LSE_KBPS	1
> +#define TRB_DN_SUBLINK_SPEED_LSE_MBPS	2
> +#define TRB_DN_SUBLINK_SPEED_LSE_GBPS	3
> +#define TRB_DN_SUBLINK_SPEED_ST(p)	(((p) >> 6) & 0x3)
> +#define TRB_DN_SUBLINK_SPEED_LANES(p)	(((p) >> 10) & 0xf)
> +#define TRB_DN_SUBLINK_SPEED_LP(p)	(((p) >> 14) & 0x3)
> +#define TRB_DN_SUBLINK_SPEED_LP_SS	0
> +#define TRB_DN_SUBLINK_SPEED_LP_SSP	1
> +#define TRB_DN_SUBLINK_SPEED_LSM(p)	(((p) >> 16) & 0xffff)
> +
> +#define TRB_DN_SUBLINK_SPEED_IS_SYMMETRIC(p) \
> +	(!(TRB_DN_SUBLINK_SPEED_ST(p) & BIT(0)))
> +#define TRB_DN_SUBLINK_SPEED_IS_TX(p) \
> +	(!!(TRB_DN_SUBLINK_SPEED_ST(p) & BIT(1)))
> +
>  static inline const char *xhci_trb_type_string(u8 type)
>  {
>  	switch (type) {
>
>
>
>
>

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

* Re: USB 3.2 Gen 2x2 "Superspeed+20GBps" support for ASM3242
  2021-12-31  8:42                     ` youling 257
@ 2022-01-13  1:41                       ` Thinh Nguyen
  2022-01-13  6:05                         ` youling 257
  0 siblings, 1 reply; 22+ messages in thread
From: Thinh Nguyen @ 2022-01-13  1:41 UTC (permalink / raw)
  To: youling 257, Thinh Nguyen
  Cc: Greg KH, mathias.nyman, william.allentx, linux-usb

youling 257 wrote:
> 2021-12-31 15:02 GMT+08:00, Thinh Nguyen <Thinh.Nguyen@synopsys.com>:
>> youling 257 wrote:
>>> 2021-12-31 11:46 GMT+08:00, Thinh Nguyen <Thinh.Nguyen@synopsys.com>:
>>>> Hi,
>>>>
>>>> youling 257 wrote:
>>>>> test this patch, cat /sys/bus/usb/devices/4-1/speed, 10000
>>>>> [   74.694284] usb 4-1: new SuperSpeed Plus Gen 2x1 USB device number
>>>>> 2 using xhci_hcd
>>>>> [   74.750329] usb-storage 4-1:1.0: USB Mass Storage device detected
>>>>>
>>>>> but speed, pcie to usb3.2 gen2x2, WRITE: bw=642MiB/s (673MB/s),
>>>>> 642MiB/s-642MiB/s (673MB/s-673MB/s), io=1000MiB (1049MB),
>>>>> run=1557-1557msec
>>>>> READ: bw=467MiB/s (490MB/s), 467MiB/s-467MiB/s (490MB/s-490MB/s),
>>>>> io=1000MiB (1049MB), run=2140-2140msec
>>>>>
>>>>> the mainboard usb3.2 gen2x1, WRITE: bw=838MiB/s (878MB/s),
>>>>> 838MiB/s-838MiB/s (878MB/s-878MB/s), io=1000MiB (1049MB),
>>>>> run=1194-1194msec
>>>>> READ: bw=753MiB/s (790MB/s), 753MiB/s-753MiB/s (790MB/s-790MB/s),
>>>>> io=1000MiB (1049MB), run=1328-1328msec
>>>>>
>>>>
>>>> Let's avoid top-post.
>>>>
>>>> Some comments:
>>>> 1) Just because the host is capable of gen2x2, it doesn't mean it will
>>>> run at gen2x2 speed. Your device can only operate up to gen2x1 speed, so
>>>> that's the limit. The test speed for gen2x1 above is not unreasonable.
>>
>>> my device can only operate up to gen2x1 10gbps speed on window, only
>>> 5gbps on linux kernel 5.16rc7.
>>
>> With the change I provided, you were able to run test at gen2x1, albeit
>> slower than expect. (i.e. write speed at 673MB/s for ASmedia host must
>> be SSP). The issue with device unable to operate at SSP is at least
>> answered.
>>
>> If you're looking to find out why the performance is slow, confirm these
>> items first:
>>
>> 1) Are you using the same application to test on Linux to compare with
>> Windows? (Looks like you're using CrystalDiskMark for your Windows test)
>>
>> 2) If you're using the same application, are you using the same test
>> parameters and version?
>>
>> 3) Is your device operating in BOT or UASP in Linux? UAS Protocol is

> my kernel config #CONFIG_USB_UAS is not set.

Ok.

>> generally faster. Newer device generally uses UASP, and I assume yours
>> is a newer device (check your enclosure). Make sure there's no quirk
>> preventing the device operating in UASP.
> CONFIG_USB_UAS=y
> [  524.630081] usb 4-1: new SuperSpeed Plus Gen 2x1 USB device number
> 5 using xhci_hcd
> [  524.747496] scsi host9: uas
> [  524.757580] scsi 9:0:0:0: Direct-Access     Realtek  USB 3.2 Device
>   1.00 PQ: 0 ANSI: 6
> Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 20000M/x2
>     |__ Port 1: Dev 2, If 0, Class=Mass Storage, Driver=uas, 10000M
> 
> windows fat32 speed, https://urldefense.com/v3/__https://imgur.com/a/eq9qhKj__;!!A4F2R9G_pg!OkYlXXf1Zw-EMemp22NTRgqOnOxlP-Xp95WYBJvguF9b4iyS4SX_y4Z5pAe_IaB7ZNtb$ 
> linux ext4 speed, https://urldefense.com/v3/__https://imgur.com/a/tUAskgV__;!!A4F2R9G_pg!OkYlXXf1Zw-EMemp22NTRgqOnOxlP-Xp95WYBJvguF9b4iyS4SX_y4Z5pAe_IcQVJqNn$ 
> 

I can't view the "windows" image, but it seems like it's running in high
performance in Linux as UASP device now right? (I see ~1GB/s)

BR,
Thinh

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

* Re: USB 3.2 Gen 2x2 "Superspeed+20GBps" support for ASM3242
  2022-01-13  1:41                       ` Thinh Nguyen
@ 2022-01-13  6:05                         ` youling 257
  0 siblings, 0 replies; 22+ messages in thread
From: youling 257 @ 2022-01-13  6:05 UTC (permalink / raw)
  To: Thinh Nguyen; +Cc: Greg KH, mathias.nyman, william.allentx, linux-usb

2022-01-13 9:41 GMT+08:00, Thinh Nguyen <Thinh.Nguyen@synopsys.com>:
> youling 257 wrote:
>> 2021-12-31 15:02 GMT+08:00, Thinh Nguyen <Thinh.Nguyen@synopsys.com>:
>>> youling 257 wrote:
>>>> 2021-12-31 11:46 GMT+08:00, Thinh Nguyen <Thinh.Nguyen@synopsys.com>:
>>>>> Hi,
>>>>>
>>>>> youling 257 wrote:
>>>>>> test this patch, cat /sys/bus/usb/devices/4-1/speed, 10000
>>>>>> [   74.694284] usb 4-1: new SuperSpeed Plus Gen 2x1 USB device number
>>>>>> 2 using xhci_hcd
>>>>>> [   74.750329] usb-storage 4-1:1.0: USB Mass Storage device detected
>>>>>>
>>>>>> but speed, pcie to usb3.2 gen2x2, WRITE: bw=642MiB/s (673MB/s),
>>>>>> 642MiB/s-642MiB/s (673MB/s-673MB/s), io=1000MiB (1049MB),
>>>>>> run=1557-1557msec
>>>>>> READ: bw=467MiB/s (490MB/s), 467MiB/s-467MiB/s (490MB/s-490MB/s),
>>>>>> io=1000MiB (1049MB), run=2140-2140msec
>>>>>>
>>>>>> the mainboard usb3.2 gen2x1, WRITE: bw=838MiB/s (878MB/s),
>>>>>> 838MiB/s-838MiB/s (878MB/s-878MB/s), io=1000MiB (1049MB),
>>>>>> run=1194-1194msec
>>>>>> READ: bw=753MiB/s (790MB/s), 753MiB/s-753MiB/s (790MB/s-790MB/s),
>>>>>> io=1000MiB (1049MB), run=1328-1328msec
>>>>>>
>>>>>
>>>>> Let's avoid top-post.
>>>>>
>>>>> Some comments:
>>>>> 1) Just because the host is capable of gen2x2, it doesn't mean it will
>>>>> run at gen2x2 speed. Your device can only operate up to gen2x1 speed,
>>>>> so
>>>>> that's the limit. The test speed for gen2x1 above is not unreasonable.
>>>
>>>> my device can only operate up to gen2x1 10gbps speed on window, only
>>>> 5gbps on linux kernel 5.16rc7.
>>>
>>> With the change I provided, you were able to run test at gen2x1, albeit
>>> slower than expect. (i.e. write speed at 673MB/s for ASmedia host must
>>> be SSP). The issue with device unable to operate at SSP is at least
>>> answered.
>>>
>>> If you're looking to find out why the performance is slow, confirm these
>>> items first:
>>>
>>> 1) Are you using the same application to test on Linux to compare with
>>> Windows? (Looks like you're using CrystalDiskMark for your Windows test)
>>>
>>> 2) If you're using the same application, are you using the same test
>>> parameters and version?
>>>
>>> 3) Is your device operating in BOT or UASP in Linux? UAS Protocol is
>
>> my kernel config #CONFIG_USB_UAS is not set.
>
> Ok.
>
>>> generally faster. Newer device generally uses UASP, and I assume yours
>>> is a newer device (check your enclosure). Make sure there's no quirk
>>> preventing the device operating in UASP.
>> CONFIG_USB_UAS=y
>> [  524.630081] usb 4-1: new SuperSpeed Plus Gen 2x1 USB device number
>> 5 using xhci_hcd
>> [  524.747496] scsi host9: uas
>> [  524.757580] scsi 9:0:0:0: Direct-Access     Realtek  USB 3.2 Device
>>   1.00 PQ: 0 ANSI: 6
>> Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 20000M/x2
>>     |__ Port 1: Dev 2, If 0, Class=Mass Storage, Driver=uas, 10000M
>>
>> windows fat32 speed,
>> https://urldefense.com/v3/__https://imgur.com/a/eq9qhKj__;!!A4F2R9G_pg!OkYlXXf1Zw-EMemp22NTRgqOnOxlP-Xp95WYBJvguF9b4iyS4SX_y4Z5pAe_IaB7ZNtb$
>>
>> linux ext4 speed,
>> https://urldefense.com/v3/__https://imgur.com/a/tUAskgV__;!!A4F2R9G_pg!OkYlXXf1Zw-EMemp22NTRgqOnOxlP-Xp95WYBJvguF9b4iyS4SX_y4Z5pAe_IcQVJqNn$
>>
>>
>
> I can't view the "windows" image, but it seems like it's running in high
> performance in Linux as UASP device now right? (I see ~1GB/s)

right.

> BR,
> Thinh
>

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

* Re: USB 3.2 Gen 2x2 "Superspeed+20GBps" support for ASM3242
  2021-12-31  8:49             ` youling 257
@ 2022-01-13 17:53               ` Thinh Nguyen
  0 siblings, 0 replies; 22+ messages in thread
From: Thinh Nguyen @ 2022-01-13 17:53 UTC (permalink / raw)
  To: youling 257, Thinh Nguyen, mathias.nyman
  Cc: Greg KH, william.allentx, linux-usb

youling 257 wrote:
> please you subject a patch to linux-usb.
> 
I'll take a look.

> 2021-12-31 9:39 GMT+08:00, Thinh Nguyen <Thinh.Nguyen@synopsys.com>:
>> The ASmedia host controller incorrectly reports the speed ID in the
>> port-status mismatching with its PSI capability for SSP devices. As
>> a result, the host/hub driver will report the wrong speed.
>>
>> To resolve/workaround this, the xHCI driver can capture the device speed
>> from sublink speed notification of a SSP device. All SSP devices must
>> send sublink speed device notification, so this method should resolve
>> your issue.
>>
>> You can apply the change below. This should resolve your issue.
>>
>> BR,
>> Thinh
>>
>>
>> diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
>> index 9ddcc0ab4db7..6de15f004684 100644
>> --- a/drivers/usb/host/xhci-mem.c
>> +++ b/drivers/usb/host/xhci-mem.c
>> @@ -2602,7 +2602,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
>>  	 */
>>  	temp = readl(&xhci->op_regs->dev_notification);
>>  	temp &= ~DEV_NOTE_MASK;
>> -	temp |= DEV_NOTE_FWAKE;
>> +	temp |= DEV_NOTE_FWAKE | DEV_NOTE_SUBLINK_SPEED;
>>  	writel(temp, &xhci->op_regs->dev_notification);
>>
>>  	return 0;
>> diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
>> index 99d9d9c88988..80081b3fd52a 100644
>> --- a/drivers/usb/host/xhci-ring.c
>> +++ b/drivers/usb/host/xhci-ring.c
>> @@ -1860,6 +1860,8 @@ static void handle_device_notification(struct xhci_hcd
>> *xhci,
>>  {
>>  	u32 slot_id;
>>  	struct usb_device *udev;
>> +	u32 type;
>> +	u32 dn;
>>
>>  	slot_id = TRB_TO_SLOT_ID(le32_to_cpu(event->generic.field[3]));
>>  	if (!xhci->devs[slot_id]) {
>> @@ -1868,11 +1870,45 @@ static void handle_device_notification(struct
>> xhci_hcd *xhci,
>>  		return;
>>  	}
>>
>> -	xhci_dbg(xhci, "Device Wake Notification event for slot ID %u\n",
>> -			slot_id);
>>  	udev = xhci->devs[slot_id]->udev;
>> -	if (udev && udev->parent)
>> -		usb_wakeup_notification(udev->parent, udev->portnum);
>> +	type = TRB_DN_TYPE(le32_to_cpu(event->generic.field[0]));
>> +
>> +	switch (type) {
>> +	case TRB_DN_TYPE_FUNC_WAKE:
>> +		xhci_info(xhci, "Device Wake Notification event for slot ID %u\n",
>> +			  slot_id);
>> +		if (udev && udev->parent)
>> +			usb_wakeup_notification(udev->parent, udev->portnum);
>> +		break;
>> +	case TRB_DN_TYPE_SUBLINK_SPEED:
>> +		if (!udev)
>> +			break;
>> +
>> +		dn = le32_to_cpu(event->generic.field[1]);
>> +		udev->ssp_rate = USB_SSP_GEN_UNKNOWN;
>> +
>> +		if (TRB_DN_SUBLINK_SPEED_LP(dn) ==
>> +		    TRB_DN_SUBLINK_SPEED_LP_SSP) {
>> +			udev->speed = USB_SPEED_SUPER_PLUS;
>> +
>> +			if (TRB_DN_SUBLINK_SPEED_LSE(dn) !=
>> +			    TRB_DN_SUBLINK_SPEED_LSE_GBPS)
>> +				break;
>> +
>> +			if (TRB_DN_SUBLINK_SPEED_LSM(dn) == 10) {
>> +				if (TRB_DN_SUBLINK_SPEED_LANES(dn))
>> +					udev->ssp_rate = USB_SSP_GEN_2x2;
>> +				else
>> +					udev->ssp_rate = USB_SSP_GEN_2x1;
>> +			} else if (TRB_DN_SUBLINK_SPEED_LSM(dn) == 5) {
>> +				if (TRB_DN_SUBLINK_SPEED_LANES(dn))
>> +					udev->ssp_rate = USB_SSP_GEN_1x2;
>> +			}
>> +		} else {
>> +			udev->speed = USB_SPEED_SUPER;
>> +		}
>> +		break;
>> +	}
>>  }
>>
>>  /*
>> diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
>> index 9192465fd5f3..ce2ca67c115f 100644
>> --- a/drivers/usb/host/xhci.h
>> +++ b/drivers/usb/host/xhci.h
>> @@ -267,6 +267,7 @@ struct xhci_op_regs {
>>   * SW does need to pay attention to function wake notifications.
>>   */
>>  #define	DEV_NOTE_FWAKE		ENABLE_DEV_NOTE(1)
>> +#define	DEV_NOTE_SUBLINK_SPEED	ENABLE_DEV_NOTE(5)
>>
>>  /* CRCR - Command Ring Control Register - cmd_ring bitmasks */
>>  /* bit 0 is the command ring cycle state */
>> @@ -1434,6 +1435,30 @@ union xhci_trb {
>>  /* Get NEC firmware revision. */
>>  #define	TRB_NEC_GET_FW		49
>>
>> +/* Get Device Notification type */
>> +#define TRB_DN_TYPE(p)			(((p) >> 4) & 0xf)
>> +
>> +#define TRB_DN_TYPE_FUNC_WAKE		1
>> +#define TRB_DN_TYPE_SUBLINK_SPEED	5
>> +
>> +/* Get sublink speed attributes */
>> +#define TRB_DN_SUBLINK_SPEED_LSE(p)	(((p) >> 4) & 0x3)
>> +#define TRB_DN_SUBLINK_SPEED_LSE_BPS	0
>> +#define TRB_DN_SUBLINK_SPEED_LSE_KBPS	1
>> +#define TRB_DN_SUBLINK_SPEED_LSE_MBPS	2
>> +#define TRB_DN_SUBLINK_SPEED_LSE_GBPS	3
>> +#define TRB_DN_SUBLINK_SPEED_ST(p)	(((p) >> 6) & 0x3)
>> +#define TRB_DN_SUBLINK_SPEED_LANES(p)	(((p) >> 10) & 0xf)
>> +#define TRB_DN_SUBLINK_SPEED_LP(p)	(((p) >> 14) & 0x3)
>> +#define TRB_DN_SUBLINK_SPEED_LP_SS	0
>> +#define TRB_DN_SUBLINK_SPEED_LP_SSP	1
>> +#define TRB_DN_SUBLINK_SPEED_LSM(p)	(((p) >> 16) & 0xffff)
>> +
>> +#define TRB_DN_SUBLINK_SPEED_IS_SYMMETRIC(p) \
>> +	(!(TRB_DN_SUBLINK_SPEED_ST(p) & BIT(0)))
>> +#define TRB_DN_SUBLINK_SPEED_IS_TX(p) \
>> +	(!!(TRB_DN_SUBLINK_SPEED_ST(p) & BIT(1)))
>> +
>>  static inline const char *xhci_trb_type_string(u8 type)
>>  {
>>  	switch (type) {
>>
>>
>>
>>
>>


Hi Mathias/all,

Some ASmedia hosts have issue with reporting correct port speed ID for
devices operating in SSP. We can workaround this by getting the device
speed from the device notification sublink speed instead.

The question here is whether we should check speed from device
notification (SSP only) or do we want to selectively set quirk for
ASmedia hosts only. Should we trust a device response more or the host more?

The change above that Youling tested overrides speed detected from port
status with device notification sublink speed.

Thanks,
Thinh

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

end of thread, other threads:[~2022-01-13 17:53 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-09  6:41 USB 3.2 Gen 2x2 "Superspeed+20GBps" support for ASM3242 William Allen
2021-03-09  7:27 ` Thinh Nguyen
2021-03-09 12:02   ` Mathias Nyman
2021-03-09 22:51     ` William Allen
2021-03-10  0:56       ` Thinh Nguyen
2021-03-10  1:19         ` Thinh Nguyen
2021-12-30 13:10     ` youling257
2021-12-30 13:30       ` Greg KH
2021-12-30 13:49         ` Mathias Nyman
2021-12-30 14:57         ` youling 257
2021-12-31  1:39           ` Thinh Nguyen
2021-12-31  3:10             ` youling 257
2021-12-31  3:46               ` Thinh Nguyen
2021-12-31  4:42                 ` youling 257
2021-12-31  4:52                 ` youling 257
2021-12-31  7:02                   ` Thinh Nguyen
2021-12-31  7:59                     ` youling 257
2021-12-31  8:42                     ` youling 257
2022-01-13  1:41                       ` Thinh Nguyen
2022-01-13  6:05                         ` youling 257
2021-12-31  8:49             ` youling 257
2022-01-13 17:53               ` Thinh Nguyen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.