Skip to content

Commit c236d49

Browse files
author
Herton R. Krzesinski
committed
Merge: thunderbolt: Fix DP tunneling out of resource
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/2027 ## BUGZILLA Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2107603 ## UPSTREAM STATUS Upstream Status: Patch has been accepted on kernel/git/torvalds/linux.git ## CONFLICTS None ## BUILD INFORMATION Build Info: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=50536258 ## TESTING Functional testing: TBD Smoke test: ~~~ # uname -r 5.14.0-258.rh2107603.el9.x86_64 # cat /etc/redhat-release Red Hat Enterprise Linux release 9.1 (Plow) # rpm -q --changelog kernel-5.14.0-258.rh2107603.el9.x86_64 | head -n2 * Mon Feb 06 2023 Desnes Nunes <desnesn@redhat.com> [5.14.0-258.rh2107603.el9] - thunderbolt: Add DP OUT resource when DP tunnel is discovered (Desnes Nunes) # lscpu | grep -m2 -e "Arch\|Model name:" Architecture: x86_64 Model name: AMD EPYC 7742 64-Core Processor # dmidecode | grep -A3 '^System Information' System Information Manufacturer: HP Product Name: ProLiant DL320e Gen8 v2 Version: Not Specified ~~~ ## DESCRIPTION This fixes the discovery of a DP tunnel by adding the new tunnelled DP OUT port accordingly to the dp_resource list Signed-off-by: Desnes Nunes <desnesn@redhat.com> Approved-by: Dean Nelson <dnelson@redhat.com> Approved-by: David Arcari <darcari@redhat.com> Approved-by: Torez Smith <torez@redhat.com> Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
2 parents 7005a1f + 1ab7750 commit c236d49

File tree

1 file changed

+28
-0
lines changed
  • drivers/thunderbolt

1 file changed

+28
-0
lines changed

drivers/thunderbolt/tb.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,32 @@ static void tb_remove_dp_resources(struct tb_switch *sw)
105105
}
106106
}
107107

108+
static void tb_discover_dp_resource(struct tb *tb, struct tb_port *port)
109+
{
110+
struct tb_cm *tcm = tb_priv(tb);
111+
struct tb_port *p;
112+
113+
list_for_each_entry(p, &tcm->dp_resources, list) {
114+
if (p == port)
115+
return;
116+
}
117+
118+
tb_port_dbg(port, "DP %s resource available discovered\n",
119+
tb_port_is_dpin(port) ? "IN" : "OUT");
120+
list_add_tail(&port->list, &tcm->dp_resources);
121+
}
122+
123+
static void tb_discover_dp_resources(struct tb *tb)
124+
{
125+
struct tb_cm *tcm = tb_priv(tb);
126+
struct tb_tunnel *tunnel;
127+
128+
list_for_each_entry(tunnel, &tcm->tunnel_list, list) {
129+
if (tb_tunnel_is_dp(tunnel))
130+
tb_discover_dp_resource(tb, tunnel->dst_port);
131+
}
132+
}
133+
108134
static void tb_switch_discover_tunnels(struct tb_switch *sw,
109135
struct list_head *list,
110136
bool alloc_hopids)
@@ -1446,6 +1472,8 @@ static int tb_start(struct tb *tb)
14461472
tb_scan_switch(tb->root_switch);
14471473
/* Find out tunnels created by the boot firmware */
14481474
tb_discover_tunnels(tb);
1475+
/* Add DP resources from the DP tunnels created by the boot firmware */
1476+
tb_discover_dp_resources(tb);
14491477
/*
14501478
* If the boot firmware did not create USB 3.x tunnels create them
14511479
* now for the whole topology.

0 commit comments

Comments
 (0)