Skip to contentSkip to conversation

thunderbolt: Add only on-board retimers when !CONFIG_USB4_DEBUGFS_MARGINING

PATCH In review Mika Westerberg 2 participants 3 messages Oct 28, 2024 – Oct 29, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thunderbolt: Add only on-board retimers when !CONFIG_USB4_DEBUGFS_MARGINING

Normally there is no need to enumerate retimers on the other side of the cable. This is only needed in special cases where user wants to run receiver lane margining against the downstream facing port of a retimer. Furthermore this might confuse the userspace tools such as fwupd because it cannot read the information it expects from these retimers.

Fix this by changing the retimer enumeration code to add only on-board retimers when CONFIG_USB4_DEBUGFS_MARGINING is not enabled.

Fixes ff6ab055e070 ("thunderbolt: Add receiver lane margining support for retimers")

---
Hi AceLan,

I changed the patch slightly. I wonder if you could try it again?

Thanks!

 drivers/thunderbolt/retimer.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/thunderbolt/retimer.c +2 -0
index 7db9869a9f3f..89d2919d0193 100644
@@ -532,6 +532,8 @@ int tb_retimer_scan(struct tb_port *port, bool add)
 	}
 
 	ret = 0;
+	if (!IS_ENABLED(CONFIG_USB4_DEBUGFS_MARGINING))
+		max = min(last_idx, max);
 
 	/* Add retimers if they do not exist already */
 	for (i = 1; i <= max; i++) {
Signature · 1 line
2.45.2
Tested-by on v1 1/1
#1 lore raw
Quoted 14 lines · Mika Westerberg

Normally there is no need to enumerate retimers on the other side of the cable. This is only needed in special cases where user wants to run receiver lane margining against the downstream facing port of a retimer. Furthermore this might confuse the userspace tools such as fwupd because it cannot read the information it expects from these retimers.

Fix this by changing the retimer enumeration code to add only on-board retimers when CONFIG_USB4_DEBUGFS_MARGINING is not enabled.

Fixes ff6ab055e070 ("thunderbolt: Add receiver lane margining support for retimers")
Quoted 4 lines

---
Hi AceLan,

I changed the patch slightly. I wonder if you could try it again?

Yes, this revision also fixes the issue.
Thanks.

Quoted 22 lines

Thanks!

 drivers/thunderbolt/retimer.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/thunderbolt/retimer.c +2 -0
index 7db9869a9f3f..89d2919d0193 100644
@@ -532,6 +532,8 @@ int tb_retimer_scan(struct tb_port *port, bool add)
 	}
 
 	ret = 0;
+	if (!IS_ENABLED(CONFIG_USB4_DEBUGFS_MARGINING))
+		max = min(last_idx, max);
 
 	/* Add retimers if they do not exist already */
 	for (i = 1; i <= max; i++) {
Signature · 1 line
2.45.2
author Applied
#2 lore raw
Quoted 18 lines · Chia-Lin Kao (AceLan)
Quoted 17 lines · Mika Westerberg

Normally there is no need to enumerate retimers on the other side of the cable. This is only needed in special cases where user wants to run receiver lane margining against the downstream facing port of a retimer. Furthermore this might confuse the userspace tools such as fwupd because it cannot read the information it expects from these retimers.

Fix this by changing the retimer enumeration code to add only on-board retimers when CONFIG_USB4_DEBUGFS_MARGINING is not enabled.

Fixes ff6ab055e070 ("thunderbolt: Add receiver lane margining support for retimers")

---
Hi AceLan,

Quoted 5 lines
Quoted 1 line

I changed the patch slightly. I wonder if you could try it again?

Yes, this revision also fixes the issue.
Thanks.

Thanks for testing!

Applied to thunderbolt.git/fixes.