Re: [PATCH v4] thunderbolt: Disable Gen 4 Recovery on Asymmetric Transitions

Mika Westerberg
2025-02-03T08:42:29Z

Hi,

On Fri, Jan 31, 2025 at 01:41:27AM +0000, Mohammad Rahimi wrote:
> Updates the Connection Manager to disable the Gen 4 Link Recovery
> flow before transitioning from a Symmetric Link to an Asymmetric
> Link, as specified in recent changes to the USB4 v2 specification.
>
> According to the "USB4 2.0 ENGINEERING CHANGE NOTICE FORM"
> published in September 2024, the rationale for this change is:
>
> "Since the default value of the Target Asymmetric Link might be
> different than Symmetric Link and Gen 4 Link Recovery flow checks
> this field to make sure it matched the actual Negotiated Link Width,
> we’re removing the condition for a Disconnect in the Gen 4 Link
> Recovery flow when Target Asymmetric Link doesn’t match the actual
> Link width and adding a Connection Manager note to Disable Gen 4 Link
> Recovery flow before doing Asymmetric Transitions."
>
> Signed-off-by: Mohammad Rahimi <rahimi.mhmmd@gmail.com>

I did some minor modifications and applied to thunderbolt.git/next. Please
let me know if I missed something.

I tested on Intel reference hardware as well but on those link recovery is
already disabled so it pretty much does nothing. Below are the steps that I
followed:

1. Boot with "thunderbolt.asym_threshold=10000" so that the driver switches
links to asymmetric already upon first DP connect.

2. Connect USB4 v2 hub.
3. Check link and PORT_CS_19:

# tblist -v
Domain 0 Route 0: 8087:5781 Intel Barlow Host Router
Type: Router
UUID: c9680000...
Generation: USB4
NVM version: 56.81

Domain 0 Route 1: 8087:1234 Intel Barlow HUB Router
Type: Router
Speed (Rx/Tx): 80/80 Gb/s
Authorized: No
UUID: e9688780...
Generation: USB4
NVM version: 56.81

# tbdump -r 0 -a 1 -vv -N 1 PORT_CS_19
0x00d3 0x0004000e 0b00000000 00000100 00000000 00001110 .... PORT_CS_19
[00:00] 0x0 Downstream Port Reset (DPR)
[01:01] 0x1 Request RS-FEC Gen 2 (RS2)
[02:02] 0x1 Request RS-FEC Gen 3 (RS3)
[03:03] 0x1 USB4 Port is Configured (PC)
[04:04] 0x0 USB4 Port is Inter-Domain (PID)
[16:16] 0x0 Enable Wake on Connect
[17:17] 0x0 Enable Wake on Disconnect
[18:18] 0x1 Enable Wake on USB4 Wake
[19:19] 0x0 Enable Wake on Inter-Domain
[24:24] 0x0 StartAsymmetricFlow
[30:30] 0x0 Initiate Gen 4 Link Recovery (ILR)
[31:31] 0x0 Enable Gen 4 Link Recovery (ELR)

# tbdump -r 1 -a 1 -vv -N 1 PORT_CS_19
0x00d3 0x0004000e 0b00000000 00000100 00000000 00001110 .... PORT_CS_19
[00:00] 0x0 Downstream Port Reset (DPR)
[01:01] 0x1 Request RS-FEC Gen 2 (RS2)
[02:02] 0x1 Request RS-FEC Gen 3 (RS3)
[03:03] 0x1 USB4 Port is Configured (PC)
[04:04] 0x0 USB4 Port is Inter-Domain (PID)
[16:16] 0x0 Enable Wake on Connect
[17:17] 0x0 Enable Wake on Disconnect
[18:18] 0x1 Enable Wake on USB4 Wake
[19:19] 0x0 Enable Wake on Inter-Domain
[24:24] 0x0 StartAsymmetricFlow
[30:30] 0x0 Initiate Gen 4 Link Recovery (ILR)
[31:31] 0x0 Enable Gen 4 Link Recovery (ELR)

3. Connect monitor to USB4 v2 hub.
4. Check link and PORT_CS_19.

# tblist -v
Domain 0 Route 0: 8087:5781 Intel Barlow Host Router
Type: Router
UUID: c9680000...
Generation: USB4
NVM version: 56.81

Domain 0 Route 1: 8087:1234 Intel Barlow HUB Router
Type: Router
Speed (Rx/Tx): 120/40 Gb/s
Authorized: No
UUID: e9688780...
Generation: USB4
NVM version: 56.81

# tbdump -r 0 -a 1 -vv -N 1 PORT_CS_19
0x00d3 0x0004000e 0b00000000 00000100 00000000 00001110 .... PORT_CS_19
[00:00] 0x0 Downstream Port Reset (DPR)
[01:01] 0x1 Request RS-FEC Gen 2 (RS2)
[02:02] 0x1 Request RS-FEC Gen 3 (RS3)
[03:03] 0x1 USB4 Port is Configured (PC)
[04:04] 0x0 USB4 Port is Inter-Domain (PID)
[16:16] 0x0 Enable Wake on Connect
[17:17] 0x0 Enable Wake on Disconnect
[18:18] 0x1 Enable Wake on USB4 Wake
[19:19] 0x0 Enable Wake on Inter-Domain
[24:24] 0x0 StartAsymmetricFlow
[30:30] 0x0 Initiate Gen 4 Link Recovery (ILR)
[31:31] 0x0 Enable Gen 4 Link Recovery (ELR)

# tbdump -r 1 -a 1 -vv -N 1 PORT_CS_19
0x00d3 0x0004000e 0b00000000 00000100 00000000 00001110 .... PORT_CS_19
[00:00] 0x0 Downstream Port Reset (DPR)
[01:01] 0x1 Request RS-FEC Gen 2 (RS2)
[02:02] 0x1 Request RS-FEC Gen 3 (RS3)
[03:03] 0x1 USB4 Port is Configured (PC)
[04:04] 0x0 USB4 Port is Inter-Domain (PID)
[16:16] 0x0 Enable Wake on Connect
[17:17] 0x0 Enable Wake on Disconnect
[18:18] 0x1 Enable Wake on USB4 Wake
[19:19] 0x0 Enable Wake on Inter-Domain
[24:24] 0x0 StartAsymmetricFlow
[30:30] 0x0 Initiate Gen 4 Link Recovery (ILR)
[31:31] 0x0 Enable Gen 4 Link Recovery (ELR)