Skip to content

Commit 235d019

Browse files
committed
thunderbolt: Add the new USB4 v2 notification types
USB4 v2 spec adds a bunch of new notifications that the connection manager can use instead of polling. While we do not use these yet we need to ack the ones routers expect to be acked. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
1 parent e111fb9 commit 235d019

3 files changed

Lines changed: 48 additions & 4 deletions

File tree

drivers/thunderbolt/ctl.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,13 @@ static int tb_async_error(const struct ctl_pkg *pkg)
409409
case TB_CFG_ERROR_HEC_ERROR_DETECTED:
410410
case TB_CFG_ERROR_FLOW_CONTROL_ERROR:
411411
case TB_CFG_ERROR_DP_BW:
412+
case TB_CFG_ERROR_ROP_CMPLT:
413+
case TB_CFG_ERROR_POP_CMPLT:
414+
case TB_CFG_ERROR_PCIE_WAKE:
415+
case TB_CFG_ERROR_DP_CON_CHANGE:
416+
case TB_CFG_ERROR_DPTX_DISCOVERY:
417+
case TB_CFG_ERROR_LINK_RECOVERY:
418+
case TB_CFG_ERROR_ASYM_LINK:
412419
return true;
413420

414421
default:
@@ -758,6 +765,27 @@ int tb_cfg_ack_notification(struct tb_ctl *ctl, u64 route,
758765
case TB_CFG_ERROR_DP_BW:
759766
name = "DP_BW";
760767
break;
768+
case TB_CFG_ERROR_ROP_CMPLT:
769+
name = "router operation completion";
770+
break;
771+
case TB_CFG_ERROR_POP_CMPLT:
772+
name = "port operation completion";
773+
break;
774+
case TB_CFG_ERROR_PCIE_WAKE:
775+
name = "PCIe wake";
776+
break;
777+
case TB_CFG_ERROR_DP_CON_CHANGE:
778+
name = "DP connector change";
779+
break;
780+
case TB_CFG_ERROR_DPTX_DISCOVERY:
781+
name = "DPTX discovery";
782+
break;
783+
case TB_CFG_ERROR_LINK_RECOVERY:
784+
name = "link recovery";
785+
break;
786+
case TB_CFG_ERROR_ASYM_LINK:
787+
name = "asymmetric link";
788+
break;
761789
default:
762790
name = "unknown";
763791
break;

drivers/thunderbolt/tb.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1952,17 +1952,26 @@ static void tb_queue_dp_bandwidth_request(struct tb *tb, u64 route, u8 port)
19521952
static void tb_handle_notification(struct tb *tb, u64 route,
19531953
const struct cfg_error_pkg *error)
19541954
{
1955-
if (tb_cfg_ack_notification(tb->ctl, route, error))
1956-
tb_warn(tb, "could not ack notification on %llx\n", route);
19571955

19581956
switch (error->error) {
1957+
case TB_CFG_ERROR_PCIE_WAKE:
1958+
case TB_CFG_ERROR_DP_CON_CHANGE:
1959+
case TB_CFG_ERROR_DPTX_DISCOVERY:
1960+
if (tb_cfg_ack_notification(tb->ctl, route, error))
1961+
tb_warn(tb, "could not ack notification on %llx\n",
1962+
route);
1963+
break;
1964+
19591965
case TB_CFG_ERROR_DP_BW:
1966+
if (tb_cfg_ack_notification(tb->ctl, route, error))
1967+
tb_warn(tb, "could not ack notification on %llx\n",
1968+
route);
19601969
tb_queue_dp_bandwidth_request(tb, route, error->port);
19611970
break;
19621971

19631972
default:
1964-
/* Ack is enough */
1965-
return;
1973+
/* Ignore for now */
1974+
break;
19661975
}
19671976
}
19681977

drivers/thunderbolt/tb_msgs.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ enum tb_cfg_error {
3030
TB_CFG_ERROR_FLOW_CONTROL_ERROR = 13,
3131
TB_CFG_ERROR_LOCK = 15,
3232
TB_CFG_ERROR_DP_BW = 32,
33+
TB_CFG_ERROR_ROP_CMPLT = 33,
34+
TB_CFG_ERROR_POP_CMPLT = 34,
35+
TB_CFG_ERROR_PCIE_WAKE = 35,
36+
TB_CFG_ERROR_DP_CON_CHANGE = 36,
37+
TB_CFG_ERROR_DPTX_DISCOVERY = 37,
38+
TB_CFG_ERROR_LINK_RECOVERY = 38,
39+
TB_CFG_ERROR_ASYM_LINK = 39,
3340
};
3441

3542
/* common header */

0 commit comments

Comments
 (0)