[PATCH 007/108] drm/i915/dp_link_training: Flush commits in debugfs entries

Imre Deak
2026-04-28T12:52:57Z

Flush pending connector commits before accessing the link training state
from debugfs. Access to connector state - like the link training state -
that may be updated from an asynchronous commit tail must hold the
connection mutex and wait for the tail to complete. The commit tail
cannot hold the connection mutex, so all other accessors must wait for
it explicitly.

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
.../drm/i915/display/intel_dp_link_training.c | 23 +++++++++++++++++++
1 file changed, 23 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_training.c b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
index 653b974e925c2..6dfb6b8db235e 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_link_training.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
@@ -1866,8 +1866,11 @@ static int i915_dp_force_link_rate_show(struct seq_file *m, void *data)
if (err)
return err;

+ intel_dp_flush_connector_commits(connector);
+
if (intel_dp->link.active)
current_rate = intel_dp->link_rate;
+
force_rate = intel_dp->link.force_rate;

drm_modeset_unlock(&display->drm->mode_config.connection_mutex);
@@ -1939,6 +1942,8 @@ static ssize_t i915_dp_force_link_rate_write(struct file *file,
if (err)
return err;

+ intel_dp_flush_connector_commits(connector);
+
intel_dp_reset_link_params(intel_dp);
intel_dp->link.force_rate = rate;

@@ -1964,6 +1969,8 @@ static int i915_dp_force_lane_count_show(struct seq_file *m, void *data)
if (err)
return err;

+ intel_dp_flush_connector_commits(connector);
+
if (intel_dp->link.active)
current_lane_count = intel_dp->lane_count;
force_lane_count = intel_dp->link.force_lane_count;
@@ -2041,6 +2048,8 @@ static ssize_t i915_dp_force_lane_count_write(struct file *file,
if (err)
return err;

+ intel_dp_flush_connector_commits(connector);
+
intel_dp_reset_link_params(intel_dp);
intel_dp->link.force_lane_count = lane_count;

@@ -2063,6 +2072,8 @@ static int i915_dp_max_link_rate_show(void *data, u64 *val)
if (err)
return err;

+ intel_dp_flush_connector_commits(connector);
+
*val = intel_dp->link.max_rate;

drm_modeset_unlock(&display->drm->mode_config.connection_mutex);
@@ -2082,6 +2093,8 @@ static int i915_dp_max_lane_count_show(void *data, u64 *val)
if (err)
return err;

+ intel_dp_flush_connector_commits(connector);
+
*val = intel_dp->link.max_lane_count;

drm_modeset_unlock(&display->drm->mode_config.connection_mutex);
@@ -2101,6 +2114,8 @@ static int i915_dp_force_link_training_failure_show(void *data, u64 *val)
if (err)
return err;

+ intel_dp_flush_connector_commits(connector);
+
*val = intel_dp->link.force_train_failure;

drm_modeset_unlock(&display->drm->mode_config.connection_mutex);
@@ -2122,6 +2137,8 @@ static int i915_dp_force_link_training_failure_write(void *data, u64 val)
if (err)
return err;

+ intel_dp_flush_connector_commits(connector);
+
intel_dp->link.force_train_failure = val;

drm_modeset_unlock(&display->drm->mode_config.connection_mutex);
@@ -2143,6 +2160,8 @@ static int i915_dp_force_link_retrain_show(void *data, u64 *val)
if (err)
return err;

+ intel_dp_flush_connector_commits(connector);
+
*val = intel_dp->link.force_retrain;

drm_modeset_unlock(&display->drm->mode_config.connection_mutex);
@@ -2161,6 +2180,8 @@ static int i915_dp_force_link_retrain_write(void *data, u64 val)
if (err)
return err;

+ intel_dp_flush_connector_commits(connector);
+
intel_dp->link.force_retrain = val;

drm_modeset_unlock(&display->drm->mode_config.connection_mutex);
@@ -2184,6 +2205,8 @@ static int i915_dp_link_retrain_disabled_show(struct seq_file *m, void *data)
if (err)
return err;

+ intel_dp_flush_connector_commits(connector);
+
seq_printf(m, "%s\n", str_yes_no(intel_dp->link.retrain_disabled));

drm_modeset_unlock(&display->drm->mode_config.connection_mutex);
--
2.49.1