thunderbolt: Add the new USB4 v2 notification types
authorMika Westerberg <mika.westerberg@linux.intel.com>
Fri, 23 Dec 2022 08:45:51 +0000 (10:45 +0200)
committerMika Westerberg <mika.westerberg@linux.intel.com>
Fri, 16 Jun 2023 06:53:28 +0000 (09:53 +0300)
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>
drivers/thunderbolt/ctl.c
drivers/thunderbolt/tb.c
drivers/thunderbolt/tb_msgs.h

index 3a213322ec7a9dae5082bdfe5de970494c30f015..d997a4c545f7965e799dcb4ef06b1cee3491306b 100644 (file)
@@ -409,6 +409,13 @@ static int tb_async_error(const struct ctl_pkg *pkg)
        case TB_CFG_ERROR_HEC_ERROR_DETECTED:
        case TB_CFG_ERROR_FLOW_CONTROL_ERROR:
        case TB_CFG_ERROR_DP_BW:
+       case TB_CFG_ERROR_ROP_CMPLT:
+       case TB_CFG_ERROR_POP_CMPLT:
+       case TB_CFG_ERROR_PCIE_WAKE:
+       case TB_CFG_ERROR_DP_CON_CHANGE:
+       case TB_CFG_ERROR_DPTX_DISCOVERY:
+       case TB_CFG_ERROR_LINK_RECOVERY:
+       case TB_CFG_ERROR_ASYM_LINK:
                return true;
 
        default:
@@ -758,6 +765,27 @@ int tb_cfg_ack_notification(struct tb_ctl *ctl, u64 route,
        case TB_CFG_ERROR_DP_BW:
                name = "DP_BW";
                break;
+       case TB_CFG_ERROR_ROP_CMPLT:
+               name = "router operation completion";
+               break;
+       case TB_CFG_ERROR_POP_CMPLT:
+               name = "port operation completion";
+               break;
+       case TB_CFG_ERROR_PCIE_WAKE:
+               name = "PCIe wake";
+               break;
+       case TB_CFG_ERROR_DP_CON_CHANGE:
+               name = "DP connector change";
+               break;
+       case TB_CFG_ERROR_DPTX_DISCOVERY:
+               name = "DPTX discovery";
+               break;
+       case TB_CFG_ERROR_LINK_RECOVERY:
+               name = "link recovery";
+               break;
+       case TB_CFG_ERROR_ASYM_LINK:
+               name = "asymmetric link";
+               break;
        default:
                name = "unknown";
                break;
index 440693f561a46dcfce00b0d49f7582aa5d7ef2e6..f18cb5a52f0b635c10be73c841eafea692dc8adf 100644 (file)
@@ -1952,17 +1952,26 @@ static void tb_queue_dp_bandwidth_request(struct tb *tb, u64 route, u8 port)
 static void tb_handle_notification(struct tb *tb, u64 route,
                                   const struct cfg_error_pkg *error)
 {
-       if (tb_cfg_ack_notification(tb->ctl, route, error))
-               tb_warn(tb, "could not ack notification on %llx\n", route);
 
        switch (error->error) {
+       case TB_CFG_ERROR_PCIE_WAKE:
+       case TB_CFG_ERROR_DP_CON_CHANGE:
+       case TB_CFG_ERROR_DPTX_DISCOVERY:
+               if (tb_cfg_ack_notification(tb->ctl, route, error))
+                       tb_warn(tb, "could not ack notification on %llx\n",
+                               route);
+               break;
+
        case TB_CFG_ERROR_DP_BW:
+               if (tb_cfg_ack_notification(tb->ctl, route, error))
+                       tb_warn(tb, "could not ack notification on %llx\n",
+                               route);
                tb_queue_dp_bandwidth_request(tb, route, error->port);
                break;
 
        default:
-               /* Ack is enough */
-               return;
+               /* Ignore for now */
+               break;
        }
 }
 
index 3234bff0789952b196e8371e45dff5acfaf99e31..cd750e4b3440514b28587becc054a467c4b12217 100644 (file)
@@ -30,6 +30,13 @@ enum tb_cfg_error {
        TB_CFG_ERROR_FLOW_CONTROL_ERROR = 13,
        TB_CFG_ERROR_LOCK = 15,
        TB_CFG_ERROR_DP_BW = 32,
+       TB_CFG_ERROR_ROP_CMPLT = 33,
+       TB_CFG_ERROR_POP_CMPLT = 34,
+       TB_CFG_ERROR_PCIE_WAKE = 35,
+       TB_CFG_ERROR_DP_CON_CHANGE = 36,
+       TB_CFG_ERROR_DPTX_DISCOVERY = 37,
+       TB_CFG_ERROR_LINK_RECOVERY = 38,
+       TB_CFG_ERROR_ASYM_LINK = 39,
 };
 
 /* common header */