From: Gil Dekel <gildekel@chromium.org>
To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Cc: seanpaul@chromium.org, Gil Dekel <gildekel@chromium.org>
Subject: [Intel-gfx] [PATCH v2 3/6] drm/dp_mst: Add drm_dp_set_mst_topology_link_status()
Date: Thu, 24 Aug 2023 00:31:06 -0400 [thread overview]
Message-ID: <20230824043240.323564-4-gildekel@chromium.org> (raw)
In-Reply-To: <20230824043240.323564-1-gildekel@chromium.org>
Unlike SST, MST can support multiple displays connected to a single
connector. However, this also means that if the DisplayPort link to the
top-level MST branch device becomes unstable, then every single branch
device has an unstable link.
Since there are multiple downstream ports per connector, setting the
link status of the parent mstb's port to BAD is not enough. All of the
downstream mstb ports must also have their link status set to BAD.
This aligns to how the DP link status logic in DRM works. We notify
userspace that all of the mstb ports need retraining and apply new lower
bandwidth constraints to all future atomic commits on the topology that
follow.
Since any driver supporting MST needs to figure out which connectors
live downstream on an MST topology and update their link status in order
to retrain MST links properly, we add the
drm_dp_set_mst_topology_link_status() helper. This helper simply marks
the link status of all connectors living in that topology as bad. We
will make use of this helper in i915 later in this series.
Credit: this patch is a refactor of Lyude Pual's original patch:
https://patchwork.kernel.org/project/dri-devel/patch/20180308232421.14049-5-lyude@redhat.com/
Signed-off-by: Gil Dekel <gildekel@chromium.org>
---
drivers/gpu/drm/display/drm_dp_mst_topology.c | 39 +++++++++++++++++++
include/drm/display/drm_dp_mst_helper.h | 3 ++
2 files changed, 42 insertions(+)
diff --git a/drivers/gpu/drm/display/drm_dp_mst_topology.c b/drivers/gpu/drm/display/drm_dp_mst_topology.c
index ed96cfcfa304..17cbadfb6ccb 100644
--- a/drivers/gpu/drm/display/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c
@@ -3566,6 +3566,45 @@ int drm_dp_get_vc_payload_bw(const struct drm_dp_mst_topology_mgr *mgr,
}
EXPORT_SYMBOL(drm_dp_get_vc_payload_bw);
+/**
+ * drm_dp_set_mst_topology_link_status() - set all downstream MST ports' link status
+ * @mgr: MST topology manager to set state for
+ * @status: The new status to set the MST topology to
+ *
+ * Set all downstream ports' link-status within the topology to the given status.
+ */
+void drm_dp_set_mst_topology_link_status(struct drm_dp_mst_topology_mgr *mgr,
+ enum drm_link_status status)
+{
+ struct drm_dp_mst_port *port;
+ struct drm_dp_mst_branch *rmstb;
+ struct drm_dp_mst_branch *mstb =
+ drm_dp_mst_topology_get_mstb_validated(mgr, mgr->mst_primary);
+
+ list_for_each_entry_reverse(port, &mstb->ports, next) {
+ struct drm_connector *connector = port->connector;
+
+ if (connector) {
+ mutex_lock(&connector->dev->mode_config.mutex);
+ drm_dbg_kms(
+ connector->dev,
+ "[MST-CONNECTOR:%d:%s] link status %d -> %d\n",
+ connector->base.id, connector->name,
+ connector->state->link_status, status);
+ connector->state->link_status = status;
+ mutex_unlock(&connector->dev->mode_config.mutex);
+ }
+
+ rmstb = drm_dp_mst_topology_get_mstb_validated(mstb->mgr,
+ port->mstb);
+ if (rmstb) {
+ drm_dp_set_mst_topology_link_status(rmstb->mgr, status);
+ drm_dp_mst_topology_put_mstb(rmstb);
+ }
+ }
+}
+EXPORT_SYMBOL(drm_dp_set_mst_topology_link_status);
+
/**
* drm_dp_read_mst_cap() - check whether or not a sink supports MST
* @aux: The DP AUX channel to use
diff --git a/include/drm/display/drm_dp_mst_helper.h b/include/drm/display/drm_dp_mst_helper.h
index ed5c9660563c..855d488bf364 100644
--- a/include/drm/display/drm_dp_mst_helper.h
+++ b/include/drm/display/drm_dp_mst_helper.h
@@ -832,6 +832,9 @@ struct edid *drm_dp_mst_get_edid(struct drm_connector *connector,
int drm_dp_get_vc_payload_bw(const struct drm_dp_mst_topology_mgr *mgr,
int link_rate, int link_lane_count);
+void drm_dp_set_mst_topology_link_status(struct drm_dp_mst_topology_mgr *mgr,
+ enum drm_link_status status);
+
int drm_dp_calc_pbn_mode(int clock, int bpp, bool dsc);
void drm_dp_mst_update_slots(struct drm_dp_mst_topology_state *mst_state, uint8_t link_encoding_cap);
--
Gil Dekel, Software Engineer, Google / ChromeOS Display and Graphics
next prev parent reply other threads:[~2023-08-24 4:33 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-18 16:59 [Intel-gfx] [PATCH 0/3] Define a final failure state when link training fails Gil Dekel
2023-08-18 16:59 ` [Intel-gfx] [PATCH 1/3] drm/i915/dp_link_training: Add a final failing state to link training fallback Gil Dekel
2023-08-18 18:25 ` Manasi Navare
2023-08-18 16:59 ` [Intel-gfx] [PATCH 2/3] drm/i915/dp_link_training: Add a final failing state to link training fallback for MST Gil Dekel
2023-08-18 16:59 ` [Intel-gfx] [PATCH 3/3] drm/i915/dp_link_training: Emit a link-status=Bad uevent with trigger property Gil Dekel
2023-08-18 18:09 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Define a final failure state when link training fails Patchwork
2023-08-18 18:09 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-08-18 18:27 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2023-08-24 4:31 ` [Intel-gfx] [PATCH v2 0/6] drm/i915/dp_link_training: " Gil Dekel
2023-08-24 4:31 ` [Intel-gfx] [PATCH v2 1/6] drm/i915/dp_link_training: Add a final failing state to link training fallback Gil Dekel
2023-08-24 4:31 ` [Intel-gfx] [PATCH v2 2/6] drm/i915/dp_link_training: Add a final failing state to link training fallback for MST Gil Dekel
2023-08-24 4:31 ` Gil Dekel [this message]
2023-08-24 4:31 ` [Intel-gfx] [PATCH v2 4/6] drm/i915: Move DP modeset_retry_work into intel_dp Gil Dekel
2023-08-24 4:31 ` [Intel-gfx] [PATCH v2 5/6] drm/i915/dp_link_training: Set all downstream MST ports to BAD before retrying Gil Dekel
2023-08-24 4:31 ` [Intel-gfx] [PATCH v2 6/6] drm/i915/dp_link_training: Emit a link-status=Bad uevent with trigger property Gil Dekel
2023-08-24 9:56 ` [Intel-gfx] [PATCH v2 0/6] drm/i915/dp_link_training: Define a final failure state when link training fails Jani Nikula
2023-08-24 6:24 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230824043240.323564-4-gildekel@chromium.org \
--to=gildekel@chromium.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=seanpaul@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox