* [PATCH 1/3] thunderbolt: Set lane bonding bit only for downstream port
@ 2023-11-14 12:12 Mika Westerberg
2023-11-14 12:12 ` [PATCH 2/3] thunderbolt: Send uevent after asymmetric/symmetric switch Mika Westerberg
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Mika Westerberg @ 2023-11-14 12:12 UTC (permalink / raw)
To: Yehezkel Bernat, Michael Jamet, Lukas Wunner, Andreas Noever
Cc: linux-usb, Gil Fine, Pengfei Xu, Mika Westerberg
From: Gil Fine <gil.fine@linux.intel.com>
Fix the lane bonding procedure to follow the steps described in USB4
Connection Manager guide. Hence, set the lane bonding bit only for
downstream port. This is needed for certain ASMedia device, otherwise
lane bonding fails and the device disconnects.
Cc: stable@vger.kernel.org
Signed-off-by: Gil Fine <gil.fine@linux.intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
drivers/thunderbolt/switch.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c
index 1e15ffa79295..9e5cc285cc8d 100644
--- a/drivers/thunderbolt/switch.c
+++ b/drivers/thunderbolt/switch.c
@@ -1143,7 +1143,7 @@ int tb_port_lane_bonding_enable(struct tb_port *port)
* Only set bonding if the link was not already bonded. This
* avoids the lane adapter to re-enter bonding state.
*/
- if (width == TB_LINK_WIDTH_SINGLE) {
+ if (width == TB_LINK_WIDTH_SINGLE && !tb_is_upstream_port(port)) {
ret = tb_port_set_lane_bonding(port, true);
if (ret)
goto err_lane1;
--
2.42.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] thunderbolt: Send uevent after asymmetric/symmetric switch
2023-11-14 12:12 [PATCH 1/3] thunderbolt: Set lane bonding bit only for downstream port Mika Westerberg
@ 2023-11-14 12:12 ` Mika Westerberg
2023-11-14 12:12 ` [PATCH 3/3] thunderbolt: Only add device router DP IN to the head of the DP resource list Mika Westerberg
2023-11-17 11:09 ` [PATCH 1/3] thunderbolt: Set lane bonding bit only for downstream port Mika Westerberg
2 siblings, 0 replies; 4+ messages in thread
From: Mika Westerberg @ 2023-11-14 12:12 UTC (permalink / raw)
To: Yehezkel Bernat, Michael Jamet, Lukas Wunner, Andreas Noever
Cc: linux-usb, Gil Fine, Pengfei Xu, Mika Westerberg
We should send uevent to userspace whenever the link speed or width
changes but tb_switch_asym_enable() and tb_switch_asym_disable() set the
sw->link_width already so tb_switch_update_link_attributes() never
noticed the change.
Fix this so that we let tb_switch_update_link_attributes() update the
fields accordingly.
Fixes: 81af2952e606 ("thunderbolt: Add support for asymmetric link")
Reported-by: Pengfei Xu <pengfei.xu@intel.com>
Tested-by: Pengfei Xu <pengfei.xu@intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
drivers/thunderbolt/switch.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c
index 9e5cc285cc8d..44e9b09de47a 100644
--- a/drivers/thunderbolt/switch.c
+++ b/drivers/thunderbolt/switch.c
@@ -2880,6 +2880,7 @@ static int tb_switch_lane_bonding_disable(struct tb_switch *sw)
return tb_port_wait_for_link_width(down, TB_LINK_WIDTH_SINGLE, 100);
}
+/* Note updating sw->link_width done in tb_switch_update_link_attributes() */
static int tb_switch_asym_enable(struct tb_switch *sw, enum tb_link_width width)
{
struct tb_port *up, *down, *port;
@@ -2919,10 +2920,10 @@ static int tb_switch_asym_enable(struct tb_switch *sw, enum tb_link_width width)
return ret;
}
- sw->link_width = width;
return 0;
}
+/* Note updating sw->link_width done in tb_switch_update_link_attributes() */
static int tb_switch_asym_disable(struct tb_switch *sw)
{
struct tb_port *up, *down;
@@ -2957,7 +2958,6 @@ static int tb_switch_asym_disable(struct tb_switch *sw)
return ret;
}
- sw->link_width = TB_LINK_WIDTH_DUAL;
return 0;
}
--
2.42.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] thunderbolt: Only add device router DP IN to the head of the DP resource list
2023-11-14 12:12 [PATCH 1/3] thunderbolt: Set lane bonding bit only for downstream port Mika Westerberg
2023-11-14 12:12 ` [PATCH 2/3] thunderbolt: Send uevent after asymmetric/symmetric switch Mika Westerberg
@ 2023-11-14 12:12 ` Mika Westerberg
2023-11-17 11:09 ` [PATCH 1/3] thunderbolt: Set lane bonding bit only for downstream port Mika Westerberg
2 siblings, 0 replies; 4+ messages in thread
From: Mika Westerberg @ 2023-11-14 12:12 UTC (permalink / raw)
To: Yehezkel Bernat, Michael Jamet, Lukas Wunner, Andreas Noever
Cc: linux-usb, Gil Fine, Pengfei Xu, Mika Westerberg
When pairing DP IN and DP OUT adapters for DisplayPort tunneling, we
should prioritize the possible external GPU DP IN adapters to take
advantage of the its capabilities. However the commit in question did
this for host router DP IN adapters too and that changes ordering of the
initial DP IN resources in such way that resuming from suspend may end
up using different resource and that may confuse the user.
Fix this so that we only put DP IN adapters of device routers to the top
of the resource list and leave host routers as is.
Fixes: 274baf695b08 ("thunderbolt: Add DP IN added last in the head of the list of DP resources")
Reported-by: Pengfei Xu <pengfei.xu@intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
drivers/thunderbolt/tb.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
index 5acdeb766860..fd49f86e0353 100644
--- a/drivers/thunderbolt/tb.c
+++ b/drivers/thunderbolt/tb.c
@@ -213,7 +213,17 @@ static void tb_add_dp_resources(struct tb_switch *sw)
if (!tb_switch_query_dp_resource(sw, port))
continue;
- list_add(&port->list, &tcm->dp_resources);
+ /*
+ * If DP IN on device router exist, position it at the
+ * beginning of the DP resources list, so that it is used
+ * before DP IN of the host router. This way external GPU(s)
+ * will be prioritized when pairing DP IN to a DP OUT.
+ */
+ if (tb_route(sw))
+ list_add(&port->list, &tcm->dp_resources);
+ else
+ list_add_tail(&port->list, &tcm->dp_resources);
+
tb_port_dbg(port, "DP IN resource available\n");
}
}
--
2.42.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/3] thunderbolt: Set lane bonding bit only for downstream port
2023-11-14 12:12 [PATCH 1/3] thunderbolt: Set lane bonding bit only for downstream port Mika Westerberg
2023-11-14 12:12 ` [PATCH 2/3] thunderbolt: Send uevent after asymmetric/symmetric switch Mika Westerberg
2023-11-14 12:12 ` [PATCH 3/3] thunderbolt: Only add device router DP IN to the head of the DP resource list Mika Westerberg
@ 2023-11-17 11:09 ` Mika Westerberg
2 siblings, 0 replies; 4+ messages in thread
From: Mika Westerberg @ 2023-11-17 11:09 UTC (permalink / raw)
To: Yehezkel Bernat, Michael Jamet, Lukas Wunner, Andreas Noever
Cc: linux-usb, Gil Fine, Pengfei Xu
On Tue, Nov 14, 2023 at 02:12:01PM +0200, Mika Westerberg wrote:
> From: Gil Fine <gil.fine@linux.intel.com>
>
> Fix the lane bonding procedure to follow the steps described in USB4
> Connection Manager guide. Hence, set the lane bonding bit only for
> downstream port. This is needed for certain ASMedia device, otherwise
> lane bonding fails and the device disconnects.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Gil Fine <gil.fine@linux.intel.com>
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
All 3 patches applied to thunderbolt.git/fixes.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-11-17 11:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-14 12:12 [PATCH 1/3] thunderbolt: Set lane bonding bit only for downstream port Mika Westerberg
2023-11-14 12:12 ` [PATCH 2/3] thunderbolt: Send uevent after asymmetric/symmetric switch Mika Westerberg
2023-11-14 12:12 ` [PATCH 3/3] thunderbolt: Only add device router DP IN to the head of the DP resource list Mika Westerberg
2023-11-17 11:09 ` [PATCH 1/3] thunderbolt: Set lane bonding bit only for downstream port Mika Westerberg
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.