drm/dp_mst: Skip CSN if topology probing is not done yet
authorjsg <jsg@openbsd.org>
Thu, 15 Aug 2024 03:22:41 +0000 (03:22 +0000)
committerjsg <jsg@openbsd.org>
Thu, 15 Aug 2024 03:22:41 +0000 (03:22 +0000)
From Wayne Lin
28c060cd370d2718345452f4182cba115b7367e8 in linux-6.6.y/6.6.46
ddf983488c3e8d30d5c2e2b315ae7d9cd87096ed in mainline linux

sys/dev/pci/drm/display/drm_dp_mst_topology.c

index 2b77d44..92511c4 100644 (file)
@@ -4034,6 +4034,7 @@ static int drm_dp_mst_handle_up_req(struct drm_dp_mst_topology_mgr *mgr)
        if (up_req->msg.req_type == DP_CONNECTION_STATUS_NOTIFY) {
                const struct drm_dp_connection_status_notify *conn_stat =
                        &up_req->msg.u.conn_stat;
+               bool handle_csn;
 
                drm_dbg_kms(mgr->dev, "Got CSN: pn: %d ldps:%d ddps: %d mcs: %d ip: %d pdt: %d\n",
                            conn_stat->port_number,
@@ -4042,6 +4043,16 @@ static int drm_dp_mst_handle_up_req(struct drm_dp_mst_topology_mgr *mgr)
                            conn_stat->message_capability_status,
                            conn_stat->input_port,
                            conn_stat->peer_device_type);
+
+               mutex_lock(&mgr->probe_lock);
+               handle_csn = mgr->mst_primary->link_address_sent;
+               mutex_unlock(&mgr->probe_lock);
+
+               if (!handle_csn) {
+                       drm_dbg_kms(mgr->dev, "Got CSN before finish topology probing. Skip it.");
+                       kfree(up_req);
+                       goto out;
+               }
        } else if (up_req->msg.req_type == DP_RESOURCE_STATUS_NOTIFY) {
                const struct drm_dp_resource_status_notify *res_stat =
                        &up_req->msg.u.resource_stat;