Skip to content

Commit 973a590

Browse files
committed
Revert "drm/dp_mst: Remove single tx msg restriction."
This reverts commit 6bb0942. Unfortunately it would appear that the rumors we've heard of sideband message interleaving not being very well supported are true. On the Lenovo ThinkPad Thunderbolt 3 dock that I have, interleaved messages appear to just get dropped: [drm:drm_dp_mst_wait_tx_reply [drm_kms_helper]] timedout msg send 00000000571ddfd0 2 1 [dp_mst] txmsg cur_offset=2 cur_len=2 seqno=1 state=SENT path_msg=1 dst=00 [dp_mst] type=ENUM_PATH_RESOURCES contents: [dp_mst] port=2 DP descriptor for this hub: OUI 90-cc-24 dev-ID SYNA3 HW-rev 1.0 SW-rev 3.12 quirks 0x0008 It would seem like as well that this is a somewhat well known issue in the field. From section 5.4.2 of the DisplayPort 2.0 specification: There are MST Sink/Branch devices in the field that do not handle interleaved message transactions. To facilitate message transaction handling by downstream devices, an MST Source device shall generate message transactions in an atomic manner (i.e., the MST Source device shall not concurrently interleave multiple message transactions). Therefore, an MST Source device shall clear the Message_Sequence_No value in the Sideband_MSG_Header to 0. MST Source devices that support field policy updates by way of software should update the policy to forego the generation of interleaved message transactions. This is a bit disappointing, as features like HDCP require that we send a sideband request every ~2 seconds for each active stream. However, there isn't really anything in the specification that allows us to accurately probe for interleaved messages. If it ends up being that we -really- need this in the future, we might be able to whitelist hubs where interleaving is known to work-or maybe try some sort of heuristics. But for now, let's just play it safe and not use it. Signed-off-by: Lyude Paul <lyude@redhat.com> Fixes: 6bb0942 ("drm/dp_mst: Remove single tx msg restriction.") Cc: Wayne Lin <Wayne.Lin@amd.com> Cc: Sean Paul <seanpaul@chromium.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200423164225.680178-1-lyude@redhat.com Reviewed-by: Sean Paul <sean@poorly.run>
1 parent 776d588 commit 973a590

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

‎drivers/gpu/drm/drm_dp_mst_topology.c‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,6 +1205,8 @@ static int drm_dp_mst_wait_tx_reply(struct drm_dp_mst_branch *mstb,
12051205
txmsg->state == DRM_DP_SIDEBAND_TX_SENT) {
12061206
mstb->tx_slots[txmsg->seqno] = NULL;
12071207
}
1208+
mgr->is_waiting_for_dwn_reply = false;
1209+
12081210
}
12091211
out:
12101212
if (unlikely(ret == -EIO) && drm_debug_enabled(DRM_UT_DP)) {
@@ -1214,6 +1216,7 @@ static int drm_dp_mst_wait_tx_reply(struct drm_dp_mst_branch *mstb,
12141216
}
12151217
mutex_unlock(&mgr->qlock);
12161218

1219+
drm_dp_mst_kick_tx(mgr);
12171220
return ret;
12181221
}
12191222

@@ -2789,9 +2792,11 @@ static void process_single_down_tx_qlock(struct drm_dp_mst_topology_mgr *mgr)
27892792
ret = process_single_tx_qlock(mgr, txmsg, false);
27902793
if (ret == 1) {
27912794
/* txmsg is sent it should be in the slots now */
2795+
mgr->is_waiting_for_dwn_reply = true;
27922796
list_del(&txmsg->next);
27932797
} else if (ret) {
27942798
DRM_DEBUG_KMS("failed to send msg in q %d\n", ret);
2799+
mgr->is_waiting_for_dwn_reply = false;
27952800
list_del(&txmsg->next);
27962801
if (txmsg->seqno != -1)
27972802
txmsg->dst->tx_slots[txmsg->seqno] = NULL;
@@ -2831,7 +2836,8 @@ static void drm_dp_queue_down_tx(struct drm_dp_mst_topology_mgr *mgr,
28312836
drm_dp_mst_dump_sideband_msg_tx(&p, txmsg);
28322837
}
28332838

2834-
if (list_is_singular(&mgr->tx_msg_downq))
2839+
if (list_is_singular(&mgr->tx_msg_downq) &&
2840+
!mgr->is_waiting_for_dwn_reply)
28352841
process_single_down_tx_qlock(mgr);
28362842
mutex_unlock(&mgr->qlock);
28372843
}
@@ -3823,13 +3829,17 @@ static int drm_dp_mst_handle_down_rep(struct drm_dp_mst_topology_mgr *mgr)
38233829
mutex_lock(&mgr->qlock);
38243830
txmsg->state = DRM_DP_SIDEBAND_TX_RX;
38253831
mstb->tx_slots[seqno] = NULL;
3832+
mgr->is_waiting_for_dwn_reply = false;
38263833
mutex_unlock(&mgr->qlock);
38273834

38283835
wake_up_all(&mgr->tx_waitq);
38293836

38303837
return 0;
38313838

38323839
out_clear_reply:
3840+
mutex_lock(&mgr->qlock);
3841+
mgr->is_waiting_for_dwn_reply = false;
3842+
mutex_unlock(&mgr->qlock);
38333843
if (msg)
38343844
memset(msg, 0, sizeof(struct drm_dp_sideband_msg_rx));
38353845
out:
@@ -4682,7 +4692,7 @@ static void drm_dp_tx_work(struct work_struct *work)
46824692
struct drm_dp_mst_topology_mgr *mgr = container_of(work, struct drm_dp_mst_topology_mgr, tx_work);
46834693

46844694
mutex_lock(&mgr->qlock);
4685-
if (!list_empty(&mgr->tx_msg_downq))
4695+
if (!list_empty(&mgr->tx_msg_downq) && !mgr->is_waiting_for_dwn_reply)
46864696
process_single_down_tx_qlock(mgr);
46874697
mutex_unlock(&mgr->qlock);
46884698
}

‎include/drm/drm_dp_mst_helper.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,11 @@ struct drm_dp_mst_topology_mgr {
592592
*/
593593
bool payload_id_table_cleared : 1;
594594

595+
/**
596+
* @is_waiting_for_dwn_reply: whether we're waiting for a down reply.
597+
*/
598+
bool is_waiting_for_dwn_reply : 1;
599+
595600
/**
596601
* @mst_primary: Pointer to the primary/first branch device.
597602
*/

0 commit comments

Comments
 (0)