Skip to contentSkip to conversation

drm/dp, drm/i915: 128b/132b updates

PATCH Superseded Jani Nikula 4 participants 21 messages Jan 25, 2022 – Feb 2, 2022

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#7 lore raw

PATCH 5/8 drm/i915/dp: rewrite DP 2.0 128b/132b link training based on errata

In reply to Jani Nikula

The DP 2.0 errata completely overhauls the 128b/132b link training, with no provisions for backward compatibility with the original DP 2.0 specification.

The changes are too intrusive to consider reusing the same code for both 8b/10b and 128b/132b, mainly because the LTTPR channel equalisation is done concurrently instead of serialized.

NOTES:

* It's a bit unclear when to wait for DP_INTERLANE_ALIGN_DONE and per-lane DP_LANE_SYMBOL_LOCKED. Figure xx4 in the SCR implies the LANEx_CHANNEL_EQ_DONE sequence may end with either 0x77,0x77,0x85 *or* 0x33,0x33,0x84 (for four lane configuration in DPCD 0x202..0x204) i.e. without the above bits set. Text elsewhere seems contradictory or incomplete.

* We read entire link status (6 bytes) everywhere instead of individual DPCD addresses.

* There are some subtle ambiguities or contradictions in the order of some DPCD access and TPS signal enables/disables. It's also not clear whether these are significant.

Cc Uma Shankar <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 .../drm/i915/display/intel_dp_link_training.c | 252 +++++++++++++++++-
 1 file changed, 251 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_dp_link_training.c +251 -1
index 4e507aa75a03..8bb6a296f421 100644
@@ -1102,6 +1102,250 @@ intel_dp_link_train_all_phys(struct intel_dp *intel_dp,
 	return ret;
 }
 
+
+/*
+ * 128b/132b DP LANEx_EQ_DONE Sequence (DP 2.0 E11 3.5.2.16.1)
+ */
+static bool
+intel_dp_128b132b_lane_eq(struct intel_dp *intel_dp,
+			  const struct intel_crtc_state *crtc_state)
+{
+	struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base;
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	u8 link_status[DP_LINK_STATUS_SIZE];
+	int delay_us;
+	int try, max_tries = 20;
+	unsigned long deadline;
+
+	/*
+	 * Reset signal levels. Start transmitting 128b/132b TPS1.
+	 *
+	 * Put DPRX and LTTPRs (if any) into intra-hop AUX mode by writing TPS1
+	 * in DP_TRAINING_PATTERN_SET.
+	 */
+	if (!intel_dp_reset_link_train(intel_dp, crtc_state, DP_PHY_DPRX,
+				       DP_TRAINING_PATTERN_1)) {
+		drm_err(&i915->drm,
+			"[ENCODER:%d:%s] Failed to start 128b/132b TPS1\n",
+			encoder->base.base.id, encoder->base.name);
+		return false;
+	}
+
+	delay_us = drm_dp_128b132b_read_aux_rd_interval(&intel_dp->aux);
+
+	/* Read the initial TX FFE settings. */
+	if (drm_dp_dpcd_read_link_status(&intel_dp->aux, link_status) < 0) {
+		drm_err(&i915->drm,
+			"[ENCODER:%d:%s] Failed to read TX FFE presets\n",
+			encoder->base.base.id, encoder->base.name);
+		return false;
+	}
+
+	/* Update signal levels and training set as requested. */
+	intel_dp_get_adjust_train(intel_dp, crtc_state, DP_PHY_DPRX, link_status);
+	if (!intel_dp_update_link_train(intel_dp, crtc_state, DP_PHY_DPRX)) {
+		drm_err(&i915->drm,
+			"[ENCODER:%d:%s] Failed to set initial TX FFE settings\n",
+			encoder->base.base.id, encoder->base.name);
+		return false;
+	}
+
+	/* Start transmitting 128b/132b TPS2. */
+	if (!intel_dp_set_link_train(intel_dp, crtc_state, DP_PHY_DPRX,
+				     DP_TRAINING_PATTERN_2)) {
+		drm_err(&i915->drm,
+			"[ENCODER:%d:%s] Failed to start 128b/132b TPS2\n",
+			encoder->base.base.id, encoder->base.name);
+		return false;
+	}
+
+	for (try = 0; try < max_tries; try++) {
+		usleep_range(delay_us, 2 * delay_us);
+
+		/*
+		 * The delay may get updated. The transmitter shall read the
+		 * delay before link status during link training.
+		 */
+		delay_us = drm_dp_128b132b_read_aux_rd_interval(&intel_dp->aux);
+
+		if (drm_dp_dpcd_read_link_status(&intel_dp->aux, link_status) < 0) {
+			drm_err(&i915->drm,
+				"[ENCODER:%d:%s] Failed to read link status\n",
+				encoder->base.base.id, encoder->base.name);
+			return false;
+		}
+
+		if (drm_dp_128b132b_link_training_failed(link_status)) {
+			intel_dp_dump_link_status(intel_dp, DP_PHY_DPRX, link_status);
+			drm_err(&i915->drm,
+				"[ENCODER:%d:%s] Downstream link training failure\n",
+				encoder->base.base.id, encoder->base.name);
+			return false;
+		}
+
+		if (drm_dp_128b132b_lane_channel_eq_done(link_status, crtc_state->lane_count)) {
+			drm_dbg_kms(&i915->drm,
+				    "[ENCODER:%d:%s] Lane channel eq done\n",
+				    encoder->base.base.id, encoder->base.name);
+			break;
+		}
+
+		/* Update signal levels and training set as requested. */
+		intel_dp_get_adjust_train(intel_dp, crtc_state, DP_PHY_DPRX, link_status);
+		if (!intel_dp_update_link_train(intel_dp, crtc_state, DP_PHY_DPRX)) {
+			drm_err(&i915->drm,
+				"[ENCODER:%d:%s] Failed to update TX FFE settings\n",
+				encoder->base.base.id, encoder->base.name);
+			return false;
+		}
+	}
+
+	if (try == max_tries) {
+		intel_dp_dump_link_status(intel_dp, DP_PHY_DPRX, link_status);
+		drm_err(&i915->drm,
+			"[ENCODER:%d:%s] Max loop count reached\n",
+			encoder->base.base.id, encoder->base.name);
+		return false;
+	}
+
+	/*
+	 * FIXME: This should probably be the total time budget for the complete
+	 * LANEx_EQ_DONE Sequence, including the loop above and the aux rd
+	 * intervals.
+	 */
+	deadline = jiffies + msecs_to_jiffies(400);
+	for (;;) {
+		if (drm_dp_128b132b_eq_interlane_align_done(link_status)) {
+			drm_dbg_kms(&i915->drm,
+				    "[ENCODER:%d:%s] Interlane align done\n",
+				    encoder->base.base.id, encoder->base.name);
+			break;
+		}
+
+		if (time_after(jiffies, deadline)) {
+			intel_dp_dump_link_status(intel_dp, DP_PHY_DPRX, link_status);
+			drm_err(&i915->drm,
+				"[ENCODER:%d:%s] Interlane align timeout\n",
+				encoder->base.base.id, encoder->base.name);
+			return false;
+		}
+
+		usleep_range(2000, 3000);
+
+		if (drm_dp_dpcd_read_link_status(&intel_dp->aux, link_status) < 0) {
+			drm_err(&i915->drm,
+				"[ENCODER:%d:%s] Failed to read link status\n",
+				encoder->base.base.id, encoder->base.name);
+			return false;
+		}
+
+		if (drm_dp_128b132b_link_training_failed(link_status)) {
+			intel_dp_dump_link_status(intel_dp, DP_PHY_DPRX, link_status);
+			drm_err(&i915->drm,
+				"[ENCODER:%d:%s] Downstream link training failure\n",
+				encoder->base.base.id, encoder->base.name);
+			return false;
+		}
+	}
+
+	return true;
+}
+
+/*
+ * 128b/132b DP LANEx_CDS_DONE Sequence (DP 2.0 E11 3.5.2.16.2)
+ */
+static bool
+intel_dp_128b132b_lane_cds(struct intel_dp *intel_dp,
+			   const struct intel_crtc_state *crtc_state,
+			   int lttpr_count)
+{
+	struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base;
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	u8 link_status[DP_LINK_STATUS_SIZE];
+	unsigned long deadline;
+
+	if (drm_dp_dpcd_writeb(&intel_dp->aux, DP_TRAINING_PATTERN_SET,
+			       DP_TRAINING_PATTERN_2_CDS) != 1) {
+		drm_err(&i915->drm,
+			"[ENCODER:%d:%s] Failed to start 128b/132b TPS2 CDS\n",
+			encoder->base.base.id, encoder->base.name);
+		return false;
+	}
+
+	deadline = jiffies + msecs_to_jiffies((lttpr_count + 1) * 20);
+	for (;;) {
+		usleep_range(2000, 3000);
+
+		if (drm_dp_dpcd_read_link_status(&intel_dp->aux, link_status) < 0) {
+			drm_err(&i915->drm,
+				"[ENCODER:%d:%s] Failed to read link status\n",
+				encoder->base.base.id, encoder->base.name);
+			return false;
+		}
+
+		if (drm_dp_128b132b_cds_interlane_align_done(link_status) &&
+		    drm_dp_128b132b_lane_symbol_locked(link_status, crtc_state->lane_count)) {
+			drm_dbg_kms(&i915->drm,
+				    "[ENCODER:%d:%s] CDS interlane align done\n",
+				    encoder->base.base.id, encoder->base.name);
+			break;
+		}
+
+		if (drm_dp_128b132b_link_training_failed(link_status)) {
+			intel_dp_dump_link_status(intel_dp, DP_PHY_DPRX, link_status);
+			drm_err(&i915->drm,
+				"[ENCODER:%d:%s] Downstream link training failure\n",
+				encoder->base.base.id, encoder->base.name);
+			return false;
+		}
+
+		if (time_after(jiffies, deadline)) {
+			intel_dp_dump_link_status(intel_dp, DP_PHY_DPRX, link_status);
+			drm_err(&i915->drm,
+				"[ENCODER:%d:%s] CDS timeout\n",
+				encoder->base.base.id, encoder->base.name);
+			return false;
+		}
+	}
+
+	/* FIXME: Should DP_TRAINING_PATTERN_DISABLE be written first? */
+	if (intel_dp->set_idle_link_train)
+		intel_dp->set_idle_link_train(intel_dp, crtc_state);
+
+	return true;
+}
+
+/*
+ * 128b/132b link training sequence. (DP 2.0 E11 SCR on link training.)
+ */
+static bool
+intel_dp_128b132b_link_train(struct intel_dp *intel_dp,
+			     const struct intel_crtc_state *crtc_state,
+			     int lttpr_count)
+{
+	struct intel_connector *connector = intel_dp->attached_connector;
+	struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base;
+	bool passed = false;
+
+	/*
+	 * FIXME: Validate previous LT termination by reading Intra-Hop AUX
+	 * Reply Indication by reading bit 3 of SINK_STATUS at 00205h
+	 */
+
+	if (intel_dp_128b132b_lane_eq(intel_dp, crtc_state) &&
+	    intel_dp_128b132b_lane_cds(intel_dp, crtc_state, lttpr_count))
+		passed = true;
+
+	drm_dbg_kms(&dp_to_i915(intel_dp)->drm,
+		    "[CONNECTOR:%d:%s][ENCODER:%d:%s] 128b/132b Link Training %s at link rate = %d, lane count = %d\n",
+		    connector->base.base.id, connector->base.name,
+		    encoder->base.base.id, encoder->base.name,
+		    passed ? "passed" : "failed",
+		    crtc_state->port_clock, crtc_state->lane_count);
+
+	return passed;
+}
+
 /**
  * intel_dp_start_link_train - start link training
  * @intel_dp: DP struct
@@ -1115,6 +1359,7 @@ intel_dp_link_train_all_phys(struct intel_dp *intel_dp,
 void intel_dp_start_link_train(struct intel_dp *intel_dp,
 			       const struct intel_crtc_state *crtc_state)
 {
+	static bool passed;
 	/*
 	 * TODO: Reiniting LTTPRs here won't be needed once proper connector
 	 * HW state readout is added.
@@ -1127,6 +1372,11 @@ void intel_dp_start_link_train(struct intel_dp *intel_dp,
 
 	intel_dp_prepare_link_train(intel_dp, crtc_state);
 
-	if (!intel_dp_link_train_all_phys(intel_dp, crtc_state, lttpr_count))
+	if (intel_dp_is_uhbr(crtc_state))
+		passed = intel_dp_128b132b_link_train(intel_dp, crtc_state, lttpr_count);
+	else
+		passed = intel_dp_link_train_all_phys(intel_dp, crtc_state, lttpr_count);
+
+	if (!passed)
 		intel_dp_schedule_fallback_link_training(intel_dp, crtc_state);
 }
Signature · 1 line
2.30.2
#3 lore raw

PATCH 2/8 drm/dp: add 128b/132b link status helpers from DP 2.0 E11

In reply to Jani Nikula

The DP 2.0 errata redefines link training. There are some new status bits, and some of the old ones need to be checked independently. Add helpers to do this.

Cc Uma Shankar <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/dp/drm_dp.c    | 63 ++++++++++++++++++++++++++++++++++
 include/drm/dp/drm_dp_helper.h | 19 +++++++---
 2 files changed, 77 insertions(+), 5 deletions(-)
drivers/gpu/drm/dp/drm_dp.c +63 -0
index 52c6da510142..a20b0f8f24b8 100644
@@ -144,6 +144,69 @@ u8 drm_dp_get_adjust_tx_ffe_preset(const u8 link_status[DP_LINK_STATUS_SIZE],
 }
 EXPORT_SYMBOL(drm_dp_get_adjust_tx_ffe_preset);
 
+/* DP 2.0 errata for 128b/132b */
+bool drm_dp_128b132b_lane_channel_eq_done(const u8 link_status[DP_LINK_STATUS_SIZE],
+					  int lane_count)
+{
+	u8 lane_align, lane_status;
+	int lane;
+
+	lane_align = dp_link_status(link_status, DP_LANE_ALIGN_STATUS_UPDATED);
+	if (!(lane_align & DP_INTERLANE_ALIGN_DONE))
+		return false;
+
+	for (lane = 0; lane < lane_count; lane++) {
+		lane_status = dp_get_lane_status(link_status, lane);
+		if (!(lane_status & DP_LANE_CHANNEL_EQ_DONE))
+			return false;
+	}
+	return true;
+}
+EXPORT_SYMBOL(drm_dp_128b132b_lane_channel_eq_done);
+
+/* DP 2.0 errata for 128b/132b */
+bool drm_dp_128b132b_lane_symbol_locked(const u8 link_status[DP_LINK_STATUS_SIZE],
+					int lane_count)
+{
+	u8 lane_status;
+	int lane;
+
+	for (lane = 0; lane < lane_count; lane++) {
+		lane_status = dp_get_lane_status(link_status, lane);
+		if (!(lane_status & DP_LANE_SYMBOL_LOCKED))
+			return false;
+	}
+	return true;
+}
+EXPORT_SYMBOL(drm_dp_128b132b_lane_symbol_locked);
+
+/* DP 2.0 errata for 128b/132b */
+bool drm_dp_128b132b_eq_interlane_align_done(const u8 link_status[DP_LINK_STATUS_SIZE])
+{
+	u8 status = dp_link_status(link_status, DP_LANE_ALIGN_STATUS_UPDATED);
+
+	return status & DP_128B132B_DPRX_EQ_INTERLANE_ALIGN_DONE;
+}
+EXPORT_SYMBOL(drm_dp_128b132b_eq_interlane_align_done);
+
+/* DP 2.0 errata for 128b/132b */
+bool drm_dp_128b132b_cds_interlane_align_done(const u8 link_status[DP_LINK_STATUS_SIZE])
+{
+	u8 status = dp_link_status(link_status, DP_LANE_ALIGN_STATUS_UPDATED);
+
+	return status & DP_128B132B_DPRX_CDS_INTERLANE_ALIGN_DONE;
+}
+EXPORT_SYMBOL(drm_dp_128b132b_cds_interlane_align_done);
+
+/* DP 2.0 errata for 128b/132b */
+bool drm_dp_128b132b_link_training_failed(const u8 link_status[DP_LINK_STATUS_SIZE])
+{
+	u8 status = dp_link_status(link_status, DP_LANE_ALIGN_STATUS_UPDATED);
+
+	return status & DP_128B132B_LT_FAILED;
+}
+EXPORT_SYMBOL(drm_dp_128b132b_link_training_failed);
+
 u8 drm_dp_get_adjust_request_post_cursor(const u8 link_status[DP_LINK_STATUS_SIZE],
 					 unsigned int lane)
 {
include/drm/dp/drm_dp_helper.h +14 -5
index aa73dfc817ff..c499d735b992 100644
@@ -738,11 +738,13 @@ struct drm_panel;
 			    DP_LANE_CHANNEL_EQ_DONE |	\
 			    DP_LANE_SYMBOL_LOCKED)
 
-#define DP_LANE_ALIGN_STATUS_UPDATED	    0x204
-
-#define DP_INTERLANE_ALIGN_DONE		    (1 << 0)
-#define DP_DOWNSTREAM_PORT_STATUS_CHANGED   (1 << 6)
-#define DP_LINK_STATUS_UPDATED		    (1 << 7)
+#define DP_LANE_ALIGN_STATUS_UPDATED                    0x204
+#define  DP_INTERLANE_ALIGN_DONE                        (1 << 0)
+#define  DP_128B132B_DPRX_EQ_INTERLANE_ALIGN_DONE       (1 << 2) /* 2.0 E11 */
+#define  DP_128B132B_DPRX_CDS_INTERLANE_ALIGN_DONE      (1 << 3) /* 2.0 E11 */
+#define  DP_128B132B_LT_FAILED                          (1 << 4) /* 2.0 E11 */
+#define  DP_DOWNSTREAM_PORT_STATUS_CHANGED              (1 << 6)
+#define  DP_LINK_STATUS_UPDATED                         (1 << 7)
 
 #define DP_SINK_STATUS			    0x205
 # define DP_RECEIVE_PORT_0_STATUS	    (1 << 0)
@@ -1551,6 +1553,13 @@ void drm_dp_lttpr_link_train_channel_eq_delay(const struct drm_dp_aux *aux,
 					      const u8 caps[DP_LTTPR_PHY_CAP_SIZE]);
 
 int drm_dp_128b132b_read_aux_rd_interval(struct drm_dp_aux *aux);
+bool drm_dp_128b132b_lane_channel_eq_done(const u8 link_status[DP_LINK_STATUS_SIZE],
+					  int lane_count);
+bool drm_dp_128b132b_lane_symbol_locked(const u8 link_status[DP_LINK_STATUS_SIZE],
+					int lane_count);
+bool drm_dp_128b132b_eq_interlane_align_done(const u8 link_status[DP_LINK_STATUS_SIZE]);
+bool drm_dp_128b132b_cds_interlane_align_done(const u8 link_status[DP_LINK_STATUS_SIZE]);
+bool drm_dp_128b132b_link_training_failed(const u8 link_status[DP_LINK_STATUS_SIZE]);
 
 u8 drm_dp_link_rate_to_bw_code(int link_rate);
 int drm_dp_bw_code_to_link_rate(u8 link_bw);
Signature · 1 line
2.30.2
#12 lore raw

PATCH 6/8 drm/i915/dp: add 128b/132b support to link status checks

In reply to Jani Nikula

Abstract link status check to a function that takes 128b/132b and 8b/10b into account, and use it. Also dump link status on failures.

Cc Uma Shankar <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_dp.c       | 39 ++++++++++++++-----
 .../drm/i915/display/intel_dp_link_training.c |  2 +-
 .../drm/i915/display/intel_dp_link_training.h |  4 ++
 3 files changed, 34 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/display/intel_dp.c +29 -10
index 4d4579a301f6..80fedd0e6212 100644
@@ -3628,6 +3628,32 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp)
 			    "Could not write test response to sink\n");
 }
 
+static bool intel_dp_link_ok(struct intel_dp *intel_dp,
+			     u8 link_status[DP_LINK_STATUS_SIZE])
+{
+	struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base;
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	bool uhbr = intel_dp->link_rate >= 1000000;
+	bool ok;
+
+	if (uhbr)
+		ok = drm_dp_128b132b_lane_channel_eq_done(link_status,
+							  intel_dp->lane_count);
+	else
+		ok = drm_dp_channel_eq_ok(link_status, intel_dp->lane_count);
+
+	if (ok)
+		return true;
+
+	intel_dp_dump_link_status(intel_dp, DP_PHY_DPRX, link_status);
+	drm_dbg_kms(&i915->drm,
+		    "[ENCODER:%d:%s] %s link not ok, retraining\n",
+		    encoder->base.base.id, encoder->base.name,
+		    uhbr ? "128b/132b" : "8b/10b");
+
+	return false;
+}
+
 static void
 intel_dp_mst_hpd_irq(struct intel_dp *intel_dp, u8 *esi, u8 *ack)
 {
@@ -3658,14 +3684,7 @@ static bool intel_dp_mst_link_status(struct intel_dp *intel_dp)
 		return false;
 	}
 
-	if (!drm_dp_channel_eq_ok(link_status, intel_dp->lane_count)) {
-		drm_dbg_kms(&i915->drm,
-			    "[ENCODER:%d:%s] channel EQ not ok, retraining\n",
-			    encoder->base.base.id, encoder->base.name);
-		return false;
-	}
-
-	return true;
+	return intel_dp_link_ok(intel_dp, link_status);
 }
 
 /**
@@ -3779,8 +3798,8 @@ intel_dp_needs_link_retrain(struct intel_dp *intel_dp)
 					intel_dp->lane_count))
 		return false;
 
-	/* Retrain if Channel EQ or CR not ok */
-	return !drm_dp_channel_eq_ok(link_status, intel_dp->lane_count);
+	/* Retrain if link not ok */
+	return !intel_dp_link_ok(intel_dp, link_status);
 }
 
 static bool intel_dp_has_connector(struct intel_dp *intel_dp,
drivers/gpu/drm/i915/display/intel_dp_link_training.c +1 -1
index 8bb6a296f421..1e41a560204a 100644
@@ -712,7 +712,7 @@ static bool intel_dp_adjust_request_changed(const struct intel_crtc_state *crtc_
 	return false;
 }
 
-static void
+void
 intel_dp_dump_link_status(struct intel_dp *intel_dp, enum drm_dp_phy dp_phy,
 			  const u8 link_status[DP_LINK_STATUS_SIZE])
 {
drivers/gpu/drm/i915/display/intel_dp_link_training.h +4 -0
index dbfb15705aaa..dc1556b46b85 100644
@@ -29,6 +29,10 @@ void intel_dp_start_link_train(struct intel_dp *intel_dp,
 void intel_dp_stop_link_train(struct intel_dp *intel_dp,
 			      const struct intel_crtc_state *crtc_state);
 
+void
+intel_dp_dump_link_status(struct intel_dp *intel_dp, enum drm_dp_phy dp_phy,
+			  const u8 link_status[DP_LINK_STATUS_SIZE]);
+
 /* Get the TPSx symbol type of the value programmed to DP_TRAINING_PATTERN_SET */
 static inline u8 intel_dp_training_pattern_symbol(u8 pattern)
 {
Signature · 1 line
2.30.2
#6 lore raw

PATCH 4/8 drm/i915/dp: move intel_dp_prepare_link_train() call

In reply to Jani Nikula

Call it from the higher level function, as it will be shared between two code paths.

Cc Uma Shankar <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_dp_link_training.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/display/intel_dp_link_training.c +2 -2
index 9451f336f28f..4e507aa75a03 100644
@@ -1083,8 +1083,6 @@ intel_dp_link_train_all_phys(struct intel_dp *intel_dp,
 	bool ret = true;
 	int i;
 
-	intel_dp_prepare_link_train(intel_dp, crtc_state);
-
 	for (i = lttpr_count - 1; i >= 0; i--) {
 		enum drm_dp_phy dp_phy = DP_PHY_LTTPR(i);
 
@@ -1127,6 +1125,8 @@ void intel_dp_start_link_train(struct intel_dp *intel_dp,
 		/* Still continue with enabling the port and link training. */
 		lttpr_count = 0;
 
+	intel_dp_prepare_link_train(intel_dp, crtc_state);
+
 	if (!intel_dp_link_train_all_phys(intel_dp, crtc_state, lttpr_count))
 		intel_dp_schedule_fallback_link_training(intel_dp, crtc_state);
 }
Signature · 1 line
2.30.2
#4 lore raw

PATCH 3/8 drm/dp: add some new DPCD macros from DP 2.0 E11

In reply to Jani Nikula

Add some of the new additions from DP 2.0 E11.

Cc Uma Shankar <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 include/drm/dp/drm_dp_helper.h | 2 ++
 1 file changed, 2 insertions(+)
include/drm/dp/drm_dp_helper.h +2 -0
index c499d735b992..69487bd8ed56 100644
@@ -560,6 +560,7 @@ struct drm_panel;
 # define DP_TRAINING_PATTERN_DISABLE	    0
 # define DP_TRAINING_PATTERN_1		    1
 # define DP_TRAINING_PATTERN_2		    2
+# define DP_TRAINING_PATTERN_2_CDS	    3	    /* 2.0 E11 */
 # define DP_TRAINING_PATTERN_3		    3	    /* 1.2 */
 # define DP_TRAINING_PATTERN_4              7       /* 1.4 */
 # define DP_TRAINING_PATTERN_MASK	    0x3
@@ -1350,6 +1351,7 @@ struct drm_panel;
 # define DP_PHY_REPEATER_128B132B_SUPPORTED		    (1 << 0)
 /* See DP_128B132B_SUPPORTED_LINK_RATES for values */
 #define DP_PHY_REPEATER_128B132B_RATES			    0xf0007 /* 2.0 */
+#define DP_PHY_REPEATER_EQ_DONE                             0xf0008 /* 2.0 E11 */
 
 enum drm_dp_phy {
 	DP_PHY_DPRX,
Signature · 1 line
2.30.2
#0 lore raw

cover drm/dp, drm/i915: 128b/132b updates

128b/132b updates to reflect DP 2.0 errata changes, plus some other DP updates.

Jani Nikula (8):
drm/dp: add drm_dp_128b132b_read_aux_rd_interval() drm/dp: add 128b/132b link status helpers from DP 2.0 E11 drm/dp: add some new DPCD macros from DP 2.0 E11 drm/i915/dp: move intel_dp_prepare_link_train() call drm/i915/dp: rewrite DP 2.0 128b/132b link training based on errata drm/i915/dp: add 128b/132b support to link status checks drm/i915/dp: give more time for CDS
drm/i915/mst: update slot information for 128b/132b

 drivers/gpu/drm/dp/drm_dp.c                   |  83 ++++++
 drivers/gpu/drm/i915/display/intel_dp.c       |  39 ++-
 .../drm/i915/display/intel_dp_link_training.c | 262 +++++++++++++++++-
 .../drm/i915/display/intel_dp_link_training.h |   4 +
 drivers/gpu/drm/i915/display/intel_dp_mst.c   |  29 +-
 include/drm/dp/drm_dp_helper.h                |  24 +-
 6 files changed, 420 insertions(+), 21 deletions(-)
Signature · 1 line
2.30.2
#14 lore raw

PATCH 7/8 drm/i915/dp: give more time for CDS

Try to avoid the timeout during debugging.

Cc Uma Shankar <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_dp_link_training.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/i915/display/intel_dp_link_training.c +4 -0
index 1e41a560204a..b1cf99fb3a2d 100644
@@ -1273,6 +1273,10 @@ intel_dp_128b132b_lane_cds(struct intel_dp *intel_dp,
 	}
 
 	deadline = jiffies + msecs_to_jiffies((lttpr_count + 1) * 20);
+
+	/* FIXME: Give some slack for CDS. */
+	deadline += msecs_to_jiffies(500);
+
 	for (;;) {
 		usleep_range(2000, 3000);
 
Signature · 1 line
2.30.2
#1 lore raw

PATCH 1/8 drm/dp: add drm_dp_128b132b_read_aux_rd_interval()

In reply to Jani Nikula

The DP 2.0 errata changes DP_128B132B_TRAINING_AUX_RD_INTERVAL (DPCD 0x2216) completely. Add a new function to read that. Follow-up will need to clean up existing functions.

v2: fix reversed interpretation of bit 7 meaning (Uma)

Cc Uma Shankar <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/dp/drm_dp.c    | 20 ++++++++++++++++++++
 include/drm/dp/drm_dp_helper.h |  3 +++
 2 files changed, 23 insertions(+)
drivers/gpu/drm/dp/drm_dp.c +20 -0
index 6d43325acca5..52c6da510142 100644
@@ -281,6 +281,26 @@ int drm_dp_read_channel_eq_delay(struct drm_dp_aux *aux, const u8 dpcd[DP_RECEIV
 }
 EXPORT_SYMBOL(drm_dp_read_channel_eq_delay);
 
+/* Per DP 2.0 Errata */
+int drm_dp_128b132b_read_aux_rd_interval(struct drm_dp_aux *aux)
+{
+	int unit;
+	u8 val;
+
+	if (drm_dp_dpcd_readb(aux, DP_128B132B_TRAINING_AUX_RD_INTERVAL, &val) != 1) {
+		drm_err(aux->drm_dev, "%s: failed rd interval read\n",
+			aux->name);
+		/* default to max */
+		val = DP_128B132B_TRAINING_AUX_RD_INTERVAL_MASK;
+	}
+
+	unit = (val & DP_128B132B_TRAINING_AUX_RD_INTERVAL_1MS_UNIT) ? 1 : 2;
+	val &= DP_128B132B_TRAINING_AUX_RD_INTERVAL_MASK;
+
+	return (val + 1) * unit * 1000;
+}
+EXPORT_SYMBOL(drm_dp_128b132b_read_aux_rd_interval);
+
 void drm_dp_link_train_clock_recovery_delay(const struct drm_dp_aux *aux,
 					    const u8 dpcd[DP_RECEIVER_CAP_SIZE])
 {
include/drm/dp/drm_dp_helper.h +3 -0
index 98d020835b49..aa73dfc817ff 100644
@@ -1112,6 +1112,7 @@ struct drm_panel;
 # define DP_UHBR13_5                           (1 << 2)
 
 #define DP_128B132B_TRAINING_AUX_RD_INTERVAL                    0x2216 /* 2.0 */
+# define DP_128B132B_TRAINING_AUX_RD_INTERVAL_1MS_UNIT          (1 << 7)
 # define DP_128B132B_TRAINING_AUX_RD_INTERVAL_MASK              0x7f
 # define DP_128B132B_TRAINING_AUX_RD_INTERVAL_400_US            0x00
 # define DP_128B132B_TRAINING_AUX_RD_INTERVAL_4_MS              0x01
@@ -1549,6 +1550,8 @@ void drm_dp_link_train_channel_eq_delay(const struct drm_dp_aux *aux,
 void drm_dp_lttpr_link_train_channel_eq_delay(const struct drm_dp_aux *aux,
 					      const u8 caps[DP_LTTPR_PHY_CAP_SIZE]);
 
+int drm_dp_128b132b_read_aux_rd_interval(struct drm_dp_aux *aux);
+
 u8 drm_dp_link_rate_to_bw_code(int link_rate);
 int drm_dp_bw_code_to_link_rate(u8 link_bw);
 
Signature · 1 line
2.30.2
#15 lore raw

PATCH 8/8 drm/i915/mst: update slot information for 128b/132b

In reply to Jani Nikula

128b/132b supports using 64 slots starting from 0, while 8b/10b reserves slot 0 for metadata.

Commit d6c6a76f80a1 ("drm: Update MST First Link Slot Information Based on Encoding Format") added support for updating the topology state accordingly, and commit 41724ea273cd ("drm/amd/display: Add DP 2.0 MST DM Support") started using it in the amd driver.

This feels more than a little cumbersome, especially updating the information in atomic check. For i915, add the update to MST connector .compute_config hook rather than iterating over all MST managers and connectors in global mode config .atomic_check. Fingers crossed.

v2:
- Update in .compute_config() not .atomic_check (Ville)

Cc Bhawanpreet Lakha <[email protected]>
Cc Lyude Paul <[email protected]>
Cc Uma Shankar <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_dp_mst.c | 29 +++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/display/intel_dp_mst.c +27 -2
index b8bc7d397c81..ff75e22bde5c 100644
@@ -99,6 +99,27 @@ static int intel_dp_mst_compute_link_config(struct intel_encoder *encoder,
 	return 0;
 }
 
+static void intel_dp_mst_update_slots(struct intel_encoder *encoder,
+				      struct intel_crtc_state *crtc_state,
+				      struct drm_connector_state *conn_state)
+{
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	struct intel_dp_mst_encoder *intel_mst = enc_to_mst(encoder);
+	struct intel_dp *intel_dp = &intel_mst->primary->dp;
+	struct drm_dp_mst_topology_mgr *mgr = &intel_dp->mst_mgr;
+	struct drm_dp_mst_topology_state *topology_state;
+	u8 link_coding_cap = intel_dp_is_uhbr(crtc_state) ?
+		DP_CAP_ANSI_128B132B : DP_CAP_ANSI_8B10B;
+
+	topology_state = drm_atomic_get_mst_topology_state(conn_state->state, mgr);
+	if (IS_ERR(topology_state)) {
+		drm_dbg_kms(&i915->drm, "slot update failed\n");
+		return;
+	}
+
+	drm_dp_mst_update_slots(topology_state, link_coding_cap);
+}
+
 static int intel_dp_mst_compute_config(struct intel_encoder *encoder,
 				       struct intel_crtc_state *pipe_config,
 				       struct drm_connector_state *conn_state)
@@ -155,6 +176,8 @@ static int intel_dp_mst_compute_config(struct intel_encoder *encoder,
 	if (ret)
 		return ret;
 
+	intel_dp_mst_update_slots(encoder, pipe_config, conn_state);
+
 	pipe_config->limited_color_range =
 		intel_dp_limited_color_range(pipe_config, conn_state);
 
@@ -357,6 +380,7 @@ static void intel_mst_disable_dp(struct intel_atomic_state *state,
 	struct intel_connector *connector =
 		to_intel_connector(old_conn_state->connector);
 	struct drm_i915_private *i915 = to_i915(connector->base.dev);
+	int start_slot = intel_dp_is_uhbr(old_crtc_state) ? 0 : 1;
 	int ret;
 
 	drm_dbg_kms(&i915->drm, "active links %d\n",
@@ -366,7 +390,7 @@ static void intel_mst_disable_dp(struct intel_atomic_state *state,
 
 	drm_dp_mst_reset_vcpi_slots(&intel_dp->mst_mgr, connector->port);
 
-	ret = drm_dp_update_payload_part1(&intel_dp->mst_mgr, 1);
+	ret = drm_dp_update_payload_part1(&intel_dp->mst_mgr, start_slot);
 	if (ret) {
 		drm_dbg_kms(&i915->drm, "failed to update payload %d\n", ret);
 	}
@@ -475,6 +499,7 @@ static void intel_mst_pre_enable_dp(struct intel_atomic_state *state,
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	struct intel_connector *connector =
 		to_intel_connector(conn_state->connector);
+	int start_slot = intel_dp_is_uhbr(pipe_config) ? 0 : 1;
 	int ret;
 	bool first_mst_stream;
 
@@ -509,7 +534,7 @@ static void intel_mst_pre_enable_dp(struct intel_atomic_state *state,
 
 	intel_dp->active_mst_links++;
 
-	ret = drm_dp_update_payload_part1(&intel_dp->mst_mgr, 1);
+	ret = drm_dp_update_payload_part1(&intel_dp->mst_mgr, start_slot);
 
 	/*
 	 * Before Gen 12 this is not done as part of
Signature · 1 line
2.30.2
#17 lore raw

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/dp, drm/i915: 128b/132b updates

In reply to Jani Nikula
== Series Details ==

== Series Details ==

Series: drm/dp, drm/i915: 128b/132b updates
URL : https://patchwork.freedesktop.org/series/99324/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
b47aaf278ffa drm/dp: add drm_dp_128b132b_read_aux_rd_interval()
e5a3a86f9a2a drm/dp: add 128b/132b link status helpers from DP 2.0 E11
6a17182df365 drm/dp: add some new DPCD macros from DP 2.0 E11
359fd2d968fb drm/i915/dp: move intel_dp_prepare_link_train() call
0b15ba0af330 drm/i915/dp: rewrite DP 2.0 128b/132b link training based on errata
-:46: CHECK:LINE_SPACING: Please don't use multiple blank lines
#46: FILE: drivers/gpu/drm/i915/display/intel_dp_link_training.c:1105:

+

total: 0 errors, 0 warnings, 1 checks, 269 lines checked ae473fb41e94 drm/i915/dp: add 128b/132b support to link status checks d00649fdfc8b drm/i915/dp: give more time for CDS 70912cc5c3aa drm/i915/mst: update slot information for 128b/132b

#19 lore raw

[Intel-gfx] ✓ Fi.CI.BAT: success for drm/dp, drm/i915: 128b/132b updates

In reply to Jani Nikula
== Series Details ==

== Series Details ==

Series: drm/dp, drm/i915: 128b/132b updates
URL : https://patchwork.freedesktop.org/series/99324/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_11133 -> Patchwork_22101
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/index.html

Participating hosts (47 -> 43)
------------------------------

Additional (2): fi-icl-u2 fi-kbl-guc
Missing (6): bat-adls-5 fi-hsw-4200u fi-bsw-cyan fi-ctg-p8600 fi-pnv-d510 fi-bdw-samus

Known issues
------------

Here are the changes found in Patchwork_22101 that come from known issues:

### CI changes ###

#### Possible fixes ####

* boot:
- fi-ilk-650: [FAIL][1] -> [PASS][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/fi-ilk-650/boot.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/fi-ilk-650/boot.html

### IGT changes ###

#### Issues hit ####

* igt@amdgpu/amd_cs_nop@fork-gfx0:
- fi-icl-u2: NOTRUN -> [SKIP][3] ([fdo#109315]) +17 similar issues
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/fi-icl-u2/igt@amdgpu/[email protected]

* igt@amdgpu/amd_cs_nop@nop-compute0:
- fi-ilk-650: NOTRUN -> [SKIP][4] ([fdo#109271]) +39 similar issues
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/fi-ilk-650/igt@amdgpu/[email protected]

* igt@amdgpu/amd_cs_nop@sync-fork-gfx0:
- fi-skl-6600u: NOTRUN -> [SKIP][5] ([fdo#109271]) +18 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/fi-skl-6600u/igt@amdgpu/[email protected]

* igt@gem_huc_copy@huc-copy:
- fi-icl-u2: NOTRUN -> [SKIP][6] ([i915#2190])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/fi-icl-u2/igt@[email protected]

* igt@gem_lmem_swapping@basic:
- fi-kbl-guc: NOTRUN -> [SKIP][7] ([fdo#109271] / [i915#4613]) +3 similar issues
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/fi-kbl-guc/igt@[email protected]

* igt@gem_lmem_swapping@parallel-random-engines:
- fi-icl-u2: NOTRUN -> [SKIP][8] ([i915#4613]) +3 similar issues
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/fi-icl-u2/igt@[email protected]

* igt@kms_busy@basic:
- fi-kbl-guc: NOTRUN -> [SKIP][9] ([fdo#109271] / [i915#1845])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/fi-kbl-guc/igt@[email protected]

* igt@kms_chamelium@dp-hpd-fast:
- fi-ilk-650: NOTRUN -> [SKIP][10] ([fdo#109271] / [fdo#111827]) +8 similar issues
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/fi-ilk-650/igt@[email protected]

* igt@kms_chamelium@hdmi-hpd-fast:
- fi-icl-u2: NOTRUN -> [SKIP][11] ([fdo#111827]) +8 similar issues
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/fi-icl-u2/igt@[email protected]

* igt@kms_chamelium@vga-hpd-fast:
- fi-kbl-guc: NOTRUN -> [SKIP][12] ([fdo#109271] / [fdo#111827]) +8 similar issues
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/fi-kbl-guc/igt@[email protected]

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy:
- fi-icl-u2: NOTRUN -> [SKIP][13] ([fdo#109278]) +2 similar issues
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/fi-icl-u2/igt@[email protected]

* igt@kms_force_connector_basic@force-load-detect:
- fi-icl-u2: NOTRUN -> [SKIP][14] ([fdo#109285])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/fi-icl-u2/igt@[email protected]

* igt@kms_frontbuffer_tracking@basic:
- fi-cml-u2: [PASS][15] -> [DMESG-WARN][16] ([i915#4269])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/fi-cml-u2/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/fi-cml-u2/igt@[email protected]

* igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d:
- fi-kbl-guc: NOTRUN -> [SKIP][17] ([fdo#109271] / [i915#533])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/fi-kbl-guc/igt@[email protected]

* igt@kms_pipe_crc_basic@read-crc-pipe-c:
- fi-kbl-guc: NOTRUN -> [SKIP][18] ([fdo#109271]) +40 similar issues
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/fi-kbl-guc/igt@[email protected]

* igt@prime_vgem@basic-userptr:
- fi-icl-u2: NOTRUN -> [SKIP][19] ([i915#3301])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/fi-icl-u2/igt@[email protected]

* igt@runner@aborted:
- fi-bdw-5557u: NOTRUN -> [FAIL][20] ([i915#2426] / [i915#4312])
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/fi-bdw-5557u/igt@[email protected]

#### Possible fixes ####

* igt@kms_psr@primary_page_flip:
- fi-skl-6600u: [INCOMPLETE][21] ([i915#4547] / [i915#4838]) -> [PASS][22]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/fi-skl-6600u/igt@kms_psr@primary_page_flip.html
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/fi-skl-6600u/igt@kms_psr@primary_page_flip.html

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#2426]: https://gitlab.freedesktop.org/drm/intel/issues/2426
[i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
[i915#4269]: https://gitlab.freedesktop.org/drm/intel/issues/4269
[i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
[i915#4547]: https://gitlab.freedesktop.org/drm/intel/issues/4547
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#4838]: https://gitlab.freedesktop.org/drm/intel/issues/4838
[i915#4898]: https://gitlab.freedesktop.org/drm/intel/issues/4898
[i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533

Build changes
-------------

* Linux: CI_DRM_11133 -> Patchwork_22101

CI-20190529: 20190529
CI_DRM_11133: dce7a9d0c2b41f1f83338bd7d356a99debfca2c3 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6332: 27c9c3f5181a840c777399be7681d2cadd7940cd @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_22101: 70912cc5c3aaf269a6c278bf2245766825fb72ee @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

70912cc5c3aa drm/i915/mst: update slot information for 128b/132b d00649fdfc8b drm/i915/dp: give more time for CDS
ae473fb41e94 drm/i915/dp: add 128b/132b support to link status checks 0b15ba0af330 drm/i915/dp: rewrite DP 2.0 128b/132b link training based on errata 359fd2d968fb drm/i915/dp: move intel_dp_prepare_link_train() call 6a17182df365 drm/dp: add some new DPCD macros from DP 2.0 E11 e5a3a86f9a2a drm/dp: add 128b/132b link status helpers from DP 2.0 E11 b47aaf278ffa drm/dp: add drm_dp_128b132b_read_aux_rd_interval()

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/index.html

Acked-by on v1 8/8
#16 lore raw

Re: [PATCH 8/8] drm/i915/mst: update slot information for 128b/132b

In reply to Jani Nikula

BTW - I made a ton of progress last week on getting all of this stuff moved into the atomic state :), mainly just trying to get amd hooked up with this now (and need to rebase):

https://gitlab.freedesktop.org/lyudess/linux/-/commits/wip/mst-atomic-only-v1

So we soon won't need this slots hack

Quoted 111 lines · Jani Nikula

128b/132b supports using 64 slots starting from 0, while 8b/10b reserves slot 0 for metadata.

Commit d6c6a76f80a1 ("drm: Update MST First Link Slot Information Based on Encoding Format") added support for updating the topology state accordingly, and commit 41724ea273cd ("drm/amd/display: Add DP 2.0 MST DM Support") started using it in the amd driver.

This feels more than a little cumbersome, especially updating the information in atomic check. For i915, add the update to MST connector .compute_config hook rather than iterating over all MST managers and connectors in global mode config .atomic_check. Fingers crossed.

v2:
- Update in .compute_config() not .atomic_check (Ville)

Cc Bhawanpreet Lakha <[email protected]>
Cc Lyude Paul <[email protected]>
Cc Uma Shankar <[email protected]>
Cc Ville Syrjälä <[email protected]>

---
 drivers/gpu/drm/i915/display/intel_dp_mst.c | 29 +++++++++++++++++++--

 1 file changed, 27 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -0
index b8bc7d397c81..ff75e22bde5c 100644
@@ -99,6 +99,27 @@ static int intel_dp_mst_compute_link_config(struct
 intel_encoder *encoder,
         return 0;
  }


+static void intel_dp_mst_update_slots(struct intel_encoder *encoder, +                                     struct intel_crtc_state *crtc_state, +                                     struct drm_connector_state *conn_state)

drivers/gpu/drm/i915/display/intel_dp_mst.c +10 -0
+{
+       struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+       struct intel_dp_mst_encoder *intel_mst = enc_to_mst(encoder);
+       struct intel_dp *intel_dp = &intel_mst->primary->dp;
+       struct drm_dp_mst_topology_mgr *mgr = &intel_dp->mst_mgr;
+       struct drm_dp_mst_topology_state *topology_state;
+       u8 link_coding_cap = intel_dp_is_uhbr(crtc_state) ?
+               DP_CAP_ANSI_128B132B : DP_CAP_ANSI_8B10B;
+
+       topology_state = drm_atomic_get_mst_topology_state(conn_state-
Quoted 1 line

state, mgr);

+       if (IS_ERR(topology_state)) {
+               drm_dbg_kms(&i915->drm, "slot update failed\n"); +               return;
+       }

drivers/gpu/drm/i915/display/intel_dp_mst.c +4 -0
+
+       drm_dp_mst_update_slots(topology_state, link_coding_cap);
+}
+

 static int intel_dp_mst_compute_config(struct intel_encoder *encoder, struct intel_crtc_state *pipe_config, struct drm_connector_state *conn_state)

drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -0
@@ -155,6 +176,8 @@ static int intel_dp_mst_compute_config(struct
 intel_encoder *encoder,
         if (ret)
                 return ret;


+       intel_dp_mst_update_slots(encoder, pipe_config, conn_state); +
        pipe_config->limited_color_range = intel_dp_limited_color_range(pipe_config, conn_state);

drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -0
@@ -357,6 +380,7 @@ static void intel_mst_disable_dp(struct
 intel_atomic_state *state,

        struct intel_connector *connector = to_intel_connector(old_conn_state->connector); struct drm_i915_private *i915 = to_i915(connector->base.dev); +       int start_slot = intel_dp_is_uhbr(old_crtc_state) ? 0 : 1; int ret;

        drm_dbg_kms(&i915->drm, "active links %d\n",

drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -0
@@ -366,7 +390,7 @@ static void intel_mst_disable_dp(struct
 intel_atomic_state *state,


        drm_dp_mst_reset_vcpi_slots(&intel_dp->mst_mgr, connector->port);
-       ret = drm_dp_update_payload_part1(&intel_dp->mst_mgr, 1); +       ret = drm_dp_update_payload_part1(&intel_dp->mst_mgr, start_slot); if (ret) {
                drm_dbg_kms(&i915->drm, "failed to update payload %d\n", ret);
        }

drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -0
@@ -475,6 +499,7 @@ static void intel_mst_pre_enable_dp(struct
 intel_atomic_state *state,
         struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);

        struct intel_connector *connector = to_intel_connector(conn_state->connector); +       int start_slot = intel_dp_is_uhbr(pipe_config) ? 0 : 1; int ret;
        bool first_mst_stream;

drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -0
@@ -509,7 +534,7 @@ static void intel_mst_pre_enable_dp(struct
 intel_atomic_state *state,


        intel_dp->active_mst_links++;

-       ret = drm_dp_update_payload_part1(&intel_dp->mst_mgr, 1); +       ret = drm_dp_update_payload_part1(&intel_dp->mst_mgr, start_slot);
        /*
         * Before Gen 12 this is not done as part of

Signature · 3 lines
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat
#20 lore raw

[Intel-gfx] ✗ Fi.CI.IGT: failure for drm/dp, drm/i915: 128b/132b updates

In reply to Jani Nikula
== Series Details ==

== Series Details ==

Series: drm/dp, drm/i915: 128b/132b updates
URL : https://patchwork.freedesktop.org/series/99324/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_11133_full -> Patchwork_22101_full
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_22101_full absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_22101_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

Participating hosts (10 -> 10)
------------------------------

No changes in participating hosts

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_22101_full:

### IGT changes ###

#### Possible regressions ####

* igt@gem_ctx_persistence@saturated-hostile@rcs0:
- shard-tglb: [PASS][1] -> [FAIL][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-tglb1/igt@gem_ctx_persistence@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-tglb2/igt@gem_ctx_persistence@[email protected]

* igt@i915_suspend@fence-restore-untiled:
- shard-snb: [PASS][3] -> [INCOMPLETE][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-snb7/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-snb2/igt@[email protected]

* igt@kms_vblank@pipe-a-ts-continuation-suspend:
- shard-skl: [PASS][5] -> [INCOMPLETE][6] +1 similar issue
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-skl9/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-skl4/igt@[email protected]

Known issues
------------

Here are the changes found in Patchwork_22101_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_eio@kms:
- shard-tglb: [PASS][7] -> [FAIL][8] ([i915#232])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-tglb6/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-tglb8/igt@[email protected]

* igt@gem_exec_balancer@parallel-out-fence:
- shard-iclb: [PASS][9] -> [SKIP][10] ([i915#4525]) +1 similar issue
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-iclb2/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-iclb6/igt@[email protected]

* igt@gem_exec_fair@basic-flow@rcs0:
- shard-tglb: [PASS][11] -> [FAIL][12] ([i915#2842])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-tglb8/igt@gem_exec_fair@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-tglb5/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-none-share:
- shard-snb: NOTRUN -> [SKIP][13] ([fdo#109271]) +9 similar issues
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-snb4/igt@[email protected]

* igt@gem_exec_fair@basic-none-solo@rcs0:
- shard-kbl: [PASS][14] -> [FAIL][15] ([i915#2842]) +1 similar issue
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-kbl6/igt@gem_exec_fair@[email protected]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-kbl4/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-none@vcs1:
- shard-iclb: NOTRUN -> [FAIL][16] ([i915#2842])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-iclb1/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-pace@vcs0:
- shard-kbl: NOTRUN -> [FAIL][17] ([i915#2842])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-kbl6/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-sync@rcs0:
- shard-kbl: [PASS][18] -> [SKIP][19] ([fdo#109271])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-kbl4/igt@gem_exec_fair@[email protected]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-kbl4/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-throttle@rcs0:
- shard-iclb: [PASS][20] -> [FAIL][21] ([i915#2849])
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-iclb8/igt@gem_exec_fair@[email protected]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-iclb5/igt@gem_exec_fair@[email protected]

* igt@gem_lmem_swapping@heavy-verify-multi:
- shard-skl: NOTRUN -> [SKIP][22] ([fdo#109271] / [i915#4613])
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-skl6/igt@[email protected]

* igt@gem_lmem_swapping@parallel-random-engines:
- shard-kbl: NOTRUN -> [SKIP][23] ([fdo#109271] / [i915#4613]) +1 similar issue
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-kbl6/igt@[email protected]

* igt@gem_lmem_swapping@verify-random:
- shard-apl: NOTRUN -> [SKIP][24] ([fdo#109271] / [i915#4613])
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-apl6/igt@[email protected]

* igt@gem_render_copy@x-tiled-to-vebox-y-tiled:
- shard-iclb: NOTRUN -> [SKIP][25] ([i915#768])
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-iclb2/igt@[email protected]

* igt@gem_softpin@noreloc-s3:
- shard-skl: [PASS][26] -> [INCOMPLETE][27] ([i915#4939])
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-skl9/igt@[email protected]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-skl10/igt@[email protected]

* igt@gem_userptr_blits@coherency-sync:
- shard-tglb: NOTRUN -> [SKIP][28] ([fdo#110542])
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-tglb6/igt@[email protected]
- shard-iclb: NOTRUN -> [SKIP][29] ([fdo#109290])
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-iclb2/igt@[email protected]

* igt@gem_userptr_blits@create-destroy-unsync:
- shard-tglb: NOTRUN -> [SKIP][30] ([i915#3297])
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-tglb6/igt@[email protected]

* igt@gem_userptr_blits@dmabuf-sync:
- shard-skl: NOTRUN -> [SKIP][31] ([fdo#109271] / [i915#3323])
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-skl10/igt@[email protected]

* igt@gem_userptr_blits@vma-merge:
- shard-kbl: NOTRUN -> [FAIL][32] ([i915#3318])
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-kbl6/igt@[email protected]
- shard-skl: NOTRUN -> [FAIL][33] ([i915#3318])
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-skl10/igt@[email protected]

* igt@i915_pm_rpm@dpms-mode-unset-non-lpsp:
- shard-tglb: NOTRUN -> [SKIP][34] ([fdo#111644] / [i915#1397] / [i915#2411])
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-tglb6/igt@[email protected]

* igt@i915_pm_rpm@pc8-residency:
- shard-tglb: NOTRUN -> [SKIP][35] ([fdo#109506] / [i915#2411])
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-tglb7/igt@[email protected]

* igt@kms_big_fb@linear-32bpp-rotate-270:
- shard-tglb: NOTRUN -> [SKIP][36] ([fdo#111614])
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-tglb6/igt@[email protected]

* igt@kms_big_fb@x-tiled-max-hw-stride-32bpp-rotate-0-hflip:
- shard-kbl: NOTRUN -> [SKIP][37] ([fdo#109271] / [i915#3777]) +1 similar issue
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-kbl6/igt@[email protected]

* igt@kms_big_fb@x-tiled-max-hw-stride-64bpp-rotate-0-async-flip:
- shard-tglb: [PASS][38] -> [FAIL][39] ([i915#3743])
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-tglb1/igt@[email protected]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-tglb1/igt@[email protected]

* igt@kms_big_fb@yf-tiled-32bpp-rotate-90:
- shard-tglb: NOTRUN -> [SKIP][40] ([fdo#111615])
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-tglb6/igt@[email protected]

* igt@kms_ccs@pipe-a-bad-pixel-format-y_tiled_gen12_mc_ccs:
- shard-tglb: NOTRUN -> [SKIP][41] ([i915#3689] / [i915#3886]) +1 similar issue
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-tglb6/igt@kms_ccs@pipe-a-bad-pixel-format-y_tiled_gen12_mc_ccs.html

* igt@kms_ccs@pipe-a-missing-ccs-buffer-y_tiled_gen12_mc_ccs:
- shard-kbl: NOTRUN -> [SKIP][42] ([fdo#109271] / [i915#3886]) +2 similar issues
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-kbl6/igt@kms_ccs@pipe-a-missing-ccs-buffer-y_tiled_gen12_mc_ccs.html

* igt@kms_ccs@pipe-b-crc-primary-basic-y_tiled_gen12_mc_ccs:
- shard-skl: NOTRUN -> [SKIP][43] ([fdo#109271] / [i915#3886]) +6 similar issues
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-skl10/igt@kms_ccs@pipe-b-crc-primary-basic-y_tiled_gen12_mc_ccs.html

* igt@kms_ccs@pipe-b-missing-ccs-buffer-y_tiled_gen12_mc_ccs:
- shard-iclb: NOTRUN -> [SKIP][44] ([fdo#109278] / [i915#3886])
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-iclb2/igt@kms_ccs@pipe-b-missing-ccs-buffer-y_tiled_gen12_mc_ccs.html

* igt@kms_ccs@pipe-c-ccs-on-another-bo-y_tiled_gen12_mc_ccs:
- shard-apl: NOTRUN -> [SKIP][45] ([fdo#109271] / [i915#3886]) +6 similar issues
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-apl6/igt@kms_ccs@pipe-c-ccs-on-another-bo-y_tiled_gen12_mc_ccs.html

* igt@kms_ccs@pipe-c-crc-sprite-planes-basic-yf_tiled_ccs:
- shard-tglb: NOTRUN -> [SKIP][46] ([fdo#111615] / [i915#3689])
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-tglb6/igt@kms_ccs@pipe-c-crc-sprite-planes-basic-yf_tiled_ccs.html

* igt@kms_ccs@pipe-c-random-ccs-data-y_tiled_gen12_rc_ccs:
- shard-apl: NOTRUN -> [SKIP][47] ([fdo#109271]) +65 similar issues
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-apl6/igt@kms_ccs@pipe-c-random-ccs-data-y_tiled_gen12_rc_ccs.html

* igt@kms_ccs@pipe-d-crc-primary-rotation-180-y_tiled_gen12_mc_ccs:
- shard-tglb: NOTRUN -> [SKIP][48] ([i915#3689]) +2 similar issues
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-tglb6/igt@kms_ccs@pipe-d-crc-primary-rotation-180-y_tiled_gen12_mc_ccs.html

* igt@kms_chamelium@hdmi-crc-nonplanar-formats:
- shard-snb: NOTRUN -> [SKIP][49] ([fdo#109271] / [fdo#111827]) +1 similar issue
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-snb4/igt@[email protected]

* igt@kms_chamelium@hdmi-hpd-storm:
- shard-kbl: NOTRUN -> [SKIP][50] ([fdo#109271] / [fdo#111827]) +5 similar issues
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-kbl6/igt@[email protected]

* igt@kms_chamelium@hdmi-hpd-storm-disable:
- shard-skl: NOTRUN -> [SKIP][51] ([fdo#109271] / [fdo#111827]) +17 similar issues
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-skl9/igt@[email protected]

* igt@kms_color@pipe-d-ctm-0-5:
- shard-skl: NOTRUN -> [SKIP][52] ([fdo#109271]) +211 similar issues
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-skl10/igt@[email protected]

* igt@kms_color_chamelium@pipe-b-ctm-0-5:
- shard-tglb: NOTRUN -> [SKIP][53] ([fdo#109284] / [fdo#111827]) +2 similar issues
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-tglb6/igt@[email protected]
- shard-apl: NOTRUN -> [SKIP][54] ([fdo#109271] / [fdo#111827]) +5 similar issues
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-apl6/igt@[email protected]

* igt@kms_content_protection@lic:
- shard-apl: NOTRUN -> [TIMEOUT][55] ([i915#1319])
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-apl6/igt@[email protected]

* igt@kms_cursor_crc@pipe-a-cursor-32x32-onscreen:
- shard-iclb: NOTRUN -> [SKIP][56] ([fdo#109278]) +2 similar issues
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-iclb2/igt@[email protected]

* igt@kms_cursor_crc@pipe-a-cursor-32x32-sliding:
- shard-tglb: NOTRUN -> [SKIP][57] ([i915#3319]) +1 similar issue
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-tglb6/igt@[email protected]

* igt@kms_cursor_crc@pipe-b-cursor-max-size-sliding:
- shard-tglb: NOTRUN -> [SKIP][58] ([i915#3359])
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-tglb6/igt@[email protected]

* igt@kms_cursor_crc@pipe-d-cursor-256x256-onscreen:
- shard-kbl: NOTRUN -> [SKIP][59] ([fdo#109271]) +107 similar issues
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-kbl4/igt@[email protected]

* igt@kms_cursor_crc@pipe-d-cursor-512x512-offscreen:
- shard-tglb: NOTRUN -> [SKIP][60] ([fdo#109279] / [i915#3359]) +1 similar issue
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-tglb6/igt@[email protected]

* igt@kms_cursor_legacy@pipe-d-torture-bo:
- shard-skl: NOTRUN -> [SKIP][61] ([fdo#109271] / [i915#533]) +3 similar issues
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-skl9/igt@[email protected]

* igt@kms_flip@2x-plain-flip-fb-recreate:
- shard-tglb: NOTRUN -> [SKIP][62] ([fdo#109274] / [fdo#111825]) +1 similar issue
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-tglb6/igt@[email protected]

* igt@kms_flip@plain-flip-ts-check@b-edp1:
- shard-skl: NOTRUN -> [FAIL][63] ([i915#2122])
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-skl10/igt@kms_flip@[email protected]

* igt@kms_frontbuffer_tracking@fbc-2p-pri-indfb-multidraw:
- shard-iclb: NOTRUN -> [SKIP][64] ([fdo#109280])
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-iclb2/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-suspend:
- shard-kbl: [PASS][65] -> [DMESG-WARN][66] ([i915#180]) +3 similar issues
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-kbl1/igt@[email protected]
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-kbl6/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbcpsr-2p-primscrn-spr-indfb-move:
- shard-tglb: NOTRUN -> [SKIP][67] ([fdo#109280] / [fdo#111825]) +9 similar issues
[67]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-tglb6/igt@[email protected]

* igt@kms_hdr@static-toggle-dpms:
- shard-iclb: NOTRUN -> [SKIP][68] ([i915#1187])
[68]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-iclb2/igt@[email protected]

* igt@kms_pipe_crc_basic@read-crc-pipe-d:
- shard-apl: NOTRUN -> [SKIP][69] ([fdo#109271] / [i915#533])
[69]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-apl6/igt@[email protected]

* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
- shard-apl: NOTRUN -> [DMESG-WARN][70] ([i915#180])
[70]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-apl1/igt@[email protected]

* igt@kms_plane@plane-panning-bottom-right-suspend@pipe-a-planes:
- shard-apl: [PASS][71] -> [DMESG-WARN][72] ([i915#180]) +4 similar issues
[71]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-apl3/igt@kms_plane@[email protected]
[72]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-apl7/igt@kms_plane@[email protected]

* igt@kms_plane_alpha_blend@pipe-a-alpha-7efc:
- shard-skl: NOTRUN -> [FAIL][73] ([fdo#108145] / [i915#265]) +1 similar issue
[73]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-skl10/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-c-alpha-basic:
- shard-apl: NOTRUN -> [FAIL][74] ([fdo#108145] / [i915#265]) +1 similar issue
[74]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-apl6/igt@[email protected]

* igt@kms_plane_lowres@pipe-c-tiling-x:
- shard-iclb: NOTRUN -> [SKIP][75] ([i915#3536])
[75]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-iclb2/igt@[email protected]

* igt@kms_psr2_sf@overlay-plane-update-continuous-sf:
- shard-skl: NOTRUN -> [SKIP][76] ([fdo#109271] / [i915#658]) +1 similar issue
[76]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-skl9/igt@[email protected]

* igt@kms_psr2_sf@primary-plane-update-sf-dmg-area:
- shard-kbl: NOTRUN -> [SKIP][77] ([fdo#109271] / [i915#658]) +1 similar issue
[77]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-kbl6/igt@[email protected]

* igt@kms_psr2_su@frontbuffer-xrgb8888:
- shard-iclb: [PASS][78] -> [SKIP][79] ([fdo#109642] / [fdo#111068] / [i915#658])
[78]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-iclb2/igt@[email protected]
[79]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-iclb6/igt@[email protected]

* igt@kms_psr2_su@page_flip-p010:
- shard-apl: NOTRUN -> [SKIP][80] ([fdo#109271] / [i915#658])
[80]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-apl3/igt@kms_psr2_su@page_flip-p010.html

* igt@kms_sysfs_edid_timing:
- shard-apl: NOTRUN -> [FAIL][81] ([IGT#2])
[81]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-apl3/igt@kms_sysfs_edid_timing.html

* igt@kms_vblank@pipe-d-wait-idle:
- shard-kbl: NOTRUN -> [SKIP][82] ([fdo#109271] / [i915#533]) +2 similar issues
[82]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-kbl4/igt@[email protected]

* igt@kms_writeback@writeback-pixel-formats:
- shard-tglb: NOTRUN -> [SKIP][83] ([i915#2437])
[83]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-tglb6/igt@[email protected]

* igt@perf@blocking:
- shard-skl: [PASS][84] -> [FAIL][85] ([i915#1542])
[84]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-skl8/igt@[email protected]
[85]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-skl1/igt@[email protected]

* igt@sysfs_clients@busy:
- shard-skl: NOTRUN -> [SKIP][86] ([fdo#109271] / [i915#2994]) +1 similar issue
[86]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-skl9/igt@[email protected]

#### Possible fixes ####

* igt@gem_ctx_isolation@preservation-s3@vecs0:
- shard-kbl: [DMESG-WARN][87] ([i915#180]) -> [PASS][88] +3 similar issues
[87]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-kbl4/igt@gem_ctx_isolation@[email protected]
[88]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-kbl4/igt@gem_ctx_isolation@[email protected]

* igt@gem_eio@unwedge-stress:
- shard-tglb: [TIMEOUT][89] ([i915#3063] / [i915#3648]) -> [PASS][90]
[89]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-tglb6/igt@[email protected]
[90]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-tglb7/igt@[email protected]

* igt@gem_exec_endless@dispatch@vecs0:
- shard-tglb: [INCOMPLETE][91] ([i915#3778]) -> [PASS][92]
[91]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-tglb3/igt@gem_exec_endless@[email protected]
[92]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-tglb1/igt@gem_exec_endless@[email protected]

* igt@gem_exec_fair@basic-none@vcs0:
- shard-kbl: [FAIL][93] ([i915#2842]) -> [PASS][94] +1 similar issue
[93]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-kbl6/igt@gem_exec_fair@[email protected]
[94]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-kbl1/igt@gem_exec_fair@[email protected]
- shard-apl: [FAIL][95] ([i915#2842]) -> [PASS][96]
[95]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-apl4/igt@gem_exec_fair@[email protected]
[96]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-apl2/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-pace@vecs0:
- shard-iclb: [FAIL][97] ([i915#2842]) -> [PASS][98]
[97]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-iclb1/igt@gem_exec_fair@[email protected]
[98]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-iclb3/igt@gem_exec_fair@[email protected]

* igt@gem_exec_whisper@basic-forked-all:
- shard-glk: [DMESG-WARN][99] ([i915#118]) -> [PASS][100] +1 similar issue
[99]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-glk3/igt@[email protected]
[100]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-glk5/igt@[email protected]

* igt@i915_pm_dc@dc9-dpms:
- shard-iclb: [SKIP][101] ([i915#4281]) -> [PASS][102]
[101]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-iclb3/igt@[email protected]
[102]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-iclb7/igt@[email protected]

* igt@kms_cursor_legacy@2x-long-flip-vs-cursor-atomic:
- shard-glk: [FAIL][103] ([i915#72]) -> [PASS][104]
[103]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-glk9/igt@[email protected]
[104]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-glk1/igt@[email protected]

* igt@kms_cursor_legacy@cursor-vs-flip-atomic-transitions:
- shard-iclb: [FAIL][105] -> [PASS][106]
[105]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-iclb7/igt@[email protected]
[106]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-iclb6/igt@[email protected]

* igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions:
- shard-skl: [FAIL][107] ([i915#2346]) -> [PASS][108]
[107]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-skl10/igt@[email protected]
[108]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-skl8/igt@[email protected]
- shard-tglb: [FAIL][109] ([i915#2346]) -> [PASS][110]
[109]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-tglb6/igt@[email protected]
[110]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-tglb7/igt@[email protected]

* igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size:
- shard-glk: [DMESG-WARN][111] ([i915#118] / [i915#1888] / [i915#533]) -> [PASS][112]
[111]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-glk9/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size.html
[112]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-glk1/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size.html

* igt@kms_fbcon_fbt@fbc-suspend:
- shard-kbl: [INCOMPLETE][113] ([i915#180] / [i915#636]) -> [PASS][114]
[113]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-kbl6/igt@[email protected]
[114]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-kbl6/igt@[email protected]

* igt@kms_flip@flip-vs-expired-vblank@c-edp1:
- shard-skl: [FAIL][115] ([i915#2122]) -> [PASS][116]
[115]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-skl1/igt@kms_flip@[email protected]
[116]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-skl7/igt@kms_flip@[email protected]

* igt@kms_flip@flip-vs-fences-interruptible@a-vga1:
- shard-snb: [INCOMPLETE][117] -> [PASS][118]
[117]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-snb7/igt@kms_flip@[email protected]
[118]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-snb4/igt@kms_flip@[email protected]

* igt@kms_flip_scaled_crc@flip-32bpp-ytile-to-32bpp-ytileccs-upscaling:
- shard-glk: [FAIL][119] ([i915#4911]) -> [PASS][120]
[119]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-glk8/igt@kms_flip_scaled_crc@flip-32bpp-ytile-to-32bpp-ytileccs-upscaling.html
[120]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-glk6/igt@kms_flip_scaled_crc@flip-32bpp-ytile-to-32bpp-ytileccs-upscaling.html

* igt@kms_flip_scaled_crc@flip-32bpp-ytileccs-to-64bpp-ytile-downscaling:
- shard-iclb: [SKIP][121] ([i915#3701]) -> [PASS][122]
[121]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-iclb2/igt@kms_flip_scaled_crc@flip-32bpp-ytileccs-to-64bpp-ytile-downscaling.html
[122]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-iclb6/igt@kms_flip_scaled_crc@flip-32bpp-ytileccs-to-64bpp-ytile-downscaling.html

* igt@kms_flip_scaled_crc@flip-64bpp-ytile-to-16bpp-ytile-downscaling:
- shard-tglb: [INCOMPLETE][123] -> [PASS][124]
[123]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-tglb8/igt@kms_flip_scaled_crc@flip-64bpp-ytile-to-16bpp-ytile-downscaling.html
[124]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-tglb6/igt@kms_flip_scaled_crc@flip-64bpp-ytile-to-16bpp-ytile-downscaling.html

* igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-draw-pwrite:
- shard-glk: [FAIL][125] ([i915#2546]) -> [PASS][126]
[125]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-glk9/igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-draw-pwrite.html
[126]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-glk1/igt@kms_frontbuffer_tracking@fbc-2p-primscrn-spr-indfb-draw-pwrite.html

* igt@kms_frontbuffer_tracking@fbc-rgb565-draw-pwrite:
- shard-snb: [SKIP][127] ([fdo#109271]) -> [PASS][128] +2 similar issues
[127]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-snb5/igt@[email protected]
[128]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-snb7/igt@[email protected]

* igt@kms_hdr@bpc-switch-suspend:
- shard-apl: [DMESG-WARN][129] ([i915#180]) -> [PASS][130] +5 similar issues
[129]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-apl8/igt@[email protected]
[130]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-apl6/igt@[email protected]
- shard-skl: [FAIL][131] ([i915#1188]) -> [PASS][132]
[131]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-skl8/igt@[email protected]
[132]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-skl7/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-c-constant-alpha-min:
- shard-skl: [FAIL][133] ([fdo#108145] / [i915#265]) -> [PASS][134]
[133]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-skl6/igt@[email protected]
[134]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-skl7/igt@[email protected]

* igt@kms_psr@psr2_primary_page_flip:
- shard-iclb: [SKIP][135] ([fdo#109441]) -> [PASS][136]
[135]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-iclb7/igt@kms_psr@psr2_primary_page_flip.html
[136]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-iclb2/igt@kms_psr@psr2_primary_page_flip.html

* igt@kms_setmode@basic:
- shard-glk: [FAIL][137] ([i915#31]) -> [PASS][138]
[137]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11133/shard-glk3/igt@[email protected]
[138]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/shard-glk5/igt@[email protected]

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_22101/index.html

#8 lore raw

Re: [PATCH 5/8] drm/i915/dp: rewrite DP 2.0 128b/132b link training based on errata

In reply to Jani Nikula
Quoted 140 lines · Jani Nikula

The DP 2.0 errata completely overhauls the 128b/132b link training, with no provisions for backward compatibility with the original DP 2.0 specification.

The changes are too intrusive to consider reusing the same code for both 8b/10b and 128b/132b, mainly because the LTTPR channel equalisation is done concurrently instead of serialized.

NOTES:

* It's a bit unclear when to wait for DP_INTERLANE_ALIGN_DONE and per-lane DP_LANE_SYMBOL_LOCKED. Figure xx4 in the SCR implies the LANEx_CHANNEL_EQ_DONE sequence may end with either 0x77,0x77,0x85 *or* 0x33,0x33,0x84 (for four lane configuration in DPCD 0x202..0x204) i.e. without the above bits set. Text elsewhere seems contradictory or incomplete.

* We read entire link status (6 bytes) everywhere instead of individual DPCD addresses.

* There are some subtle ambiguities or contradictions in the order of some DPCD access and TPS signal enables/disables. It's also not clear whether these are significant.

Cc Uma Shankar <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 .../drm/i915/display/intel_dp_link_training.c | 252 +++++++++++++++++-
 1 file changed, 251 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_dp_link_training.c +101 -0
index 4e507aa75a03..8bb6a296f421 100644
@@ -1102,6 +1102,250 @@ intel_dp_link_train_all_phys(struct intel_dp *intel_dp,
 	return ret;
 }
 
+
+/*
+ * 128b/132b DP LANEx_EQ_DONE Sequence (DP 2.0 E11 3.5.2.16.1)
+ */
+static bool
+intel_dp_128b132b_lane_eq(struct intel_dp *intel_dp,
+			  const struct intel_crtc_state *crtc_state)
+{
+	struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base;
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	u8 link_status[DP_LINK_STATUS_SIZE];
+	int delay_us;
+	int try, max_tries = 20;
+	unsigned long deadline;
+
+	/*
+	 * Reset signal levels. Start transmitting 128b/132b TPS1.
+	 *
+	 * Put DPRX and LTTPRs (if any) into intra-hop AUX mode by writing TPS1
+	 * in DP_TRAINING_PATTERN_SET.
+	 */
+	if (!intel_dp_reset_link_train(intel_dp, crtc_state, DP_PHY_DPRX,
+				       DP_TRAINING_PATTERN_1)) {
+		drm_err(&i915->drm,
+			"[ENCODER:%d:%s] Failed to start 128b/132b TPS1\n",
+			encoder->base.base.id, encoder->base.name);
+		return false;
+	}
+
+	delay_us = drm_dp_128b132b_read_aux_rd_interval(&intel_dp->aux);
+
+	/* Read the initial TX FFE settings. */
+	if (drm_dp_dpcd_read_link_status(&intel_dp->aux, link_status) < 0) {
+		drm_err(&i915->drm,
+			"[ENCODER:%d:%s] Failed to read TX FFE presets\n",
+			encoder->base.base.id, encoder->base.name);
+		return false;
+	}
+
+	/* Update signal levels and training set as requested. */
+	intel_dp_get_adjust_train(intel_dp, crtc_state, DP_PHY_DPRX, link_status);
+	if (!intel_dp_update_link_train(intel_dp, crtc_state, DP_PHY_DPRX)) {
+		drm_err(&i915->drm,
+			"[ENCODER:%d:%s] Failed to set initial TX FFE settings\n",
+			encoder->base.base.id, encoder->base.name);
+		return false;
+	}
+
+	/* Start transmitting 128b/132b TPS2. */
+	if (!intel_dp_set_link_train(intel_dp, crtc_state, DP_PHY_DPRX,
+				     DP_TRAINING_PATTERN_2)) {
+		drm_err(&i915->drm,
+			"[ENCODER:%d:%s] Failed to start 128b/132b TPS2\n",
+			encoder->base.base.id, encoder->base.name);
+		return false;
+	}
+
+	for (try = 0; try < max_tries; try++) {
+		usleep_range(delay_us, 2 * delay_us);
+
+		/*
+		 * The delay may get updated. The transmitter shall read the
+		 * delay before link status during link training.
+		 */
+		delay_us = drm_dp_128b132b_read_aux_rd_interval(&intel_dp->aux);
+
+		if (drm_dp_dpcd_read_link_status(&intel_dp->aux, link_status) < 0) {
+			drm_err(&i915->drm,
+				"[ENCODER:%d:%s] Failed to read link status\n",
+				encoder->base.base.id, encoder->base.name);
+			return false;
+		}
+
+		if (drm_dp_128b132b_link_training_failed(link_status)) {
+			intel_dp_dump_link_status(intel_dp, DP_PHY_DPRX, link_status);
+			drm_err(&i915->drm,
+				"[ENCODER:%d:%s] Downstream link training failure\n",
+				encoder->base.base.id, encoder->base.name);
+			return false;
+		}
+
+		if (drm_dp_128b132b_lane_channel_eq_done(link_status, crtc_state->lane_count)) {
+			drm_dbg_kms(&i915->drm,
+				    "[ENCODER:%d:%s] Lane channel eq done\n",
+				    encoder->base.base.id, encoder->base.name);
+			break;
+		}
+
+		/* Update signal levels and training set as requested. */
+		intel_dp_get_adjust_train(intel_dp, crtc_state, DP_PHY_DPRX, link_status);
+		if (!intel_dp_update_link_train(intel_dp, crtc_state, DP_PHY_DPRX)) {
+			drm_err(&i915->drm,
+				"[ENCODER:%d:%s] Failed to update TX FFE settings\n",
+				encoder->base.base.id, encoder->base.name);
+			return false;
+		}
+	}
+
+	if (try == max_tries) {
+		intel_dp_dump_link_status(intel_dp, DP_PHY_DPRX, link_status);
+		drm_err(&i915->drm,

drivers/gpu/drm/i915/display/intel_dp_link_training.c intel_dp_link_train_all_phys(struct intel_dp *intel_dp, · line 1215

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_dp_link_training.c +10 -0
+			"[ENCODER:%d:%s] Max loop count reached\n",
+			encoder->base.base.id, encoder->base.name);
+		return false;
+	}
+
+	/*
+	 * FIXME: This should probably be the total time budget for the complete
+	 * LANEx_EQ_DONE Sequence, including the loop above and the aux rd
+	 * intervals.
+	 */

That is what my spec reading skills tell me. I suspect it's just there to make sure some broken device can't specify an overly long aux rd interval and make the link training too long. 20*256ms=~5 seconds max.

I'd either drop this for now, or try to intergrate properly inte loop.

Quoted 77 lines
drivers/gpu/drm/i915/display/intel_dp_link_training.c +77 -0
+	deadline = jiffies + msecs_to_jiffies(400);
+	for (;;) {
+		if (drm_dp_128b132b_eq_interlane_align_done(link_status)) {
+			drm_dbg_kms(&i915->drm,
+				    "[ENCODER:%d:%s] Interlane align done\n",
+				    encoder->base.base.id, encoder->base.name);
+			break;
+		}
+
+		if (time_after(jiffies, deadline)) {
+			intel_dp_dump_link_status(intel_dp, DP_PHY_DPRX, link_status);
+			drm_err(&i915->drm,
+				"[ENCODER:%d:%s] Interlane align timeout\n",
+				encoder->base.base.id, encoder->base.name);
+			return false;
+		}
+
+		usleep_range(2000, 3000);
+
+		if (drm_dp_dpcd_read_link_status(&intel_dp->aux, link_status) < 0) {
+			drm_err(&i915->drm,
+				"[ENCODER:%d:%s] Failed to read link status\n",
+				encoder->base.base.id, encoder->base.name);
+			return false;
+		}
+
+		if (drm_dp_128b132b_link_training_failed(link_status)) {
+			intel_dp_dump_link_status(intel_dp, DP_PHY_DPRX, link_status);
+			drm_err(&i915->drm,
+				"[ENCODER:%d:%s] Downstream link training failure\n",
+				encoder->base.base.id, encoder->base.name);
+			return false;
+		}
+	}
+
+	return true;
+}
+
+/*
+ * 128b/132b DP LANEx_CDS_DONE Sequence (DP 2.0 E11 3.5.2.16.2)
+ */
+static bool
+intel_dp_128b132b_lane_cds(struct intel_dp *intel_dp,
+			   const struct intel_crtc_state *crtc_state,
+			   int lttpr_count)
+{
+	struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base;
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	u8 link_status[DP_LINK_STATUS_SIZE];
+	unsigned long deadline;
+
+	if (drm_dp_dpcd_writeb(&intel_dp->aux, DP_TRAINING_PATTERN_SET,
+			       DP_TRAINING_PATTERN_2_CDS) != 1) {
+		drm_err(&i915->drm,
+			"[ENCODER:%d:%s] Failed to start 128b/132b TPS2 CDS\n",
+			encoder->base.base.id, encoder->base.name);
+		return false;
+	}
+
+	deadline = jiffies + msecs_to_jiffies((lttpr_count + 1) * 20);
+	for (;;) {
+		usleep_range(2000, 3000);
+
+		if (drm_dp_dpcd_read_link_status(&intel_dp->aux, link_status) < 0) {
+			drm_err(&i915->drm,
+				"[ENCODER:%d:%s] Failed to read link status\n",
+				encoder->base.base.id, encoder->base.name);
+			return false;
+		}
+
+		if (drm_dp_128b132b_cds_interlane_align_done(link_status) &&
+		    drm_dp_128b132b_lane_symbol_locked(link_status, crtc_state->lane_count)) {
+			drm_dbg_kms(&i915->drm,
+				    "[ENCODER:%d:%s] CDS interlane align done\n",
+				    encoder->base.base.id, encoder->base.name);
+			break;
+		}

drivers/gpu/drm/i915/display/intel_dp_link_training.c intel_dp_link_train_all_phys(struct intel_dp *intel_dp, · line 1302

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_dp_link_training.c +10 -0
+
+		if (drm_dp_128b132b_link_training_failed(link_status)) {
+			intel_dp_dump_link_status(intel_dp, DP_PHY_DPRX, link_status);
+			drm_err(&i915->drm,
+				"[ENCODER:%d:%s] Downstream link training failure\n",
+				encoder->base.base.id, encoder->base.name);
+			return false;
+		}
+
+		if (time_after(jiffies, deadline)) {

This is racy. There's no telling how much time has passed since the last time we checked the status. Standard rule of timeouts:
always check one last time after the timeout has expired.

drivers/gpu/drm/i915/display/intel_dp_link_training.c intel_dp_link_train_all_phys(struct intel_dp *intel_dp, · line 1311

Quoted 9 lines
drivers/gpu/drm/i915/display/intel_dp_link_training.c +9 -0
+			intel_dp_dump_link_status(intel_dp, DP_PHY_DPRX, link_status);
+			drm_err(&i915->drm,
+				"[ENCODER:%d:%s] CDS timeout\n",
+				encoder->base.base.id, encoder->base.name);
+			return false;
+		}
+	}
+
+	/* FIXME: Should DP_TRAINING_PATTERN_DISABLE be written first? */

Not sure. The other thing missing is waiting for the intra-hop AUX indicator to go away after we exit link training.

It seems we should also block all other aux transfers during LT because of the intra-hop AUX mode. I can imagine things might get a bit confused if the LTTPRs start answering directly to AUX transfers that are intended to pass through to the DPRX.

Quoted 63 lines
drivers/gpu/drm/i915/display/intel_dp_link_training.c +44 -1
+	if (intel_dp->set_idle_link_train)
+		intel_dp->set_idle_link_train(intel_dp, crtc_state);
+
+	return true;
+}
+
+/*
+ * 128b/132b link training sequence. (DP 2.0 E11 SCR on link training.)
+ */
+static bool
+intel_dp_128b132b_link_train(struct intel_dp *intel_dp,
+			     const struct intel_crtc_state *crtc_state,
+			     int lttpr_count)
+{
+	struct intel_connector *connector = intel_dp->attached_connector;
+	struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base;
+	bool passed = false;
+
+	/*
+	 * FIXME: Validate previous LT termination by reading Intra-Hop AUX
+	 * Reply Indication by reading bit 3 of SINK_STATUS at 00205h
+	 */
+
+	if (intel_dp_128b132b_lane_eq(intel_dp, crtc_state) &&
+	    intel_dp_128b132b_lane_cds(intel_dp, crtc_state, lttpr_count))
+		passed = true;
+
+	drm_dbg_kms(&dp_to_i915(intel_dp)->drm,
+		    "[CONNECTOR:%d:%s][ENCODER:%d:%s] 128b/132b Link Training %s at link rate = %d, lane count = %d\n",
+		    connector->base.base.id, connector->base.name,
+		    encoder->base.base.id, encoder->base.name,
+		    passed ? "passed" : "failed",
+		    crtc_state->port_clock, crtc_state->lane_count);
+
+	return passed;
+}
+
 /**
  * intel_dp_start_link_train - start link training
  * @intel_dp: DP struct
@@ -1115,6 +1359,7 @@ intel_dp_link_train_all_phys(struct intel_dp *intel_dp,
 void intel_dp_start_link_train(struct intel_dp *intel_dp,
 			       const struct intel_crtc_state *crtc_state)
 {
+	static bool passed;
 	/*
 	 * TODO: Reiniting LTTPRs here won't be needed once proper connector
 	 * HW state readout is added.
@@ -1127,6 +1372,11 @@ void intel_dp_start_link_train(struct intel_dp *intel_dp,
 
 	intel_dp_prepare_link_train(intel_dp, crtc_state);
 
-	if (!intel_dp_link_train_all_phys(intel_dp, crtc_state, lttpr_count))
+	if (intel_dp_is_uhbr(crtc_state))
+		passed = intel_dp_128b132b_link_train(intel_dp, crtc_state, lttpr_count);
+	else
+		passed = intel_dp_link_train_all_phys(intel_dp, crtc_state, lttpr_count);
+
+	if (!passed)
 		intel_dp_schedule_fallback_link_training(intel_dp, crtc_state);
 }
Signature · 1 line
2.30.2
Signature · 2 lines
Ville Syrjälä
Intel
Reviewed-by on v1 1/8
#2 lore raw

Re: [PATCH 1/8] drm/dp: add drm_dp_128b132b_read_aux_rd_interval()

In reply to Jani Nikula
Quoted 9 lines · Jani Nikula

The DP 2.0 errata changes DP_128B132B_TRAINING_AUX_RD_INTERVAL (DPCD 0x2216) completely. Add a new function to read that. Follow-up will need to clean up existing functions.

v2: fix reversed interpretation of bit 7 meaning (Uma)

Cc Uma Shankar <[email protected]>
Cc Ville Syrjälä <[email protected]>
Quoted 59 lines
---
 drivers/gpu/drm/dp/drm_dp.c    | 20 ++++++++++++++++++++
 include/drm/dp/drm_dp_helper.h |  3 +++
 2 files changed, 23 insertions(+)
drivers/gpu/drm/dp/drm_dp.c +20 -0
index 6d43325acca5..52c6da510142 100644
@@ -281,6 +281,26 @@ int drm_dp_read_channel_eq_delay(struct drm_dp_aux *aux, const u8 dpcd[DP_RECEIV
 }
 EXPORT_SYMBOL(drm_dp_read_channel_eq_delay);
 
+/* Per DP 2.0 Errata */
+int drm_dp_128b132b_read_aux_rd_interval(struct drm_dp_aux *aux)
+{
+	int unit;
+	u8 val;
+
+	if (drm_dp_dpcd_readb(aux, DP_128B132B_TRAINING_AUX_RD_INTERVAL, &val) != 1) {
+		drm_err(aux->drm_dev, "%s: failed rd interval read\n",
+			aux->name);
+		/* default to max */
+		val = DP_128B132B_TRAINING_AUX_RD_INTERVAL_MASK;
+	}
+
+	unit = (val & DP_128B132B_TRAINING_AUX_RD_INTERVAL_1MS_UNIT) ? 1 : 2;
+	val &= DP_128B132B_TRAINING_AUX_RD_INTERVAL_MASK;
+
+	return (val + 1) * unit * 1000;
+}
+EXPORT_SYMBOL(drm_dp_128b132b_read_aux_rd_interval);
+
 void drm_dp_link_train_clock_recovery_delay(const struct drm_dp_aux *aux,
 					    const u8 dpcd[DP_RECEIVER_CAP_SIZE])
 {
include/drm/dp/drm_dp_helper.h +3 -0
index 98d020835b49..aa73dfc817ff 100644
@@ -1112,6 +1112,7 @@ struct drm_panel;
 # define DP_UHBR13_5                           (1 << 2)
 
 #define DP_128B132B_TRAINING_AUX_RD_INTERVAL                    0x2216 /* 2.0 */
+# define DP_128B132B_TRAINING_AUX_RD_INTERVAL_1MS_UNIT          (1 << 7)
 # define DP_128B132B_TRAINING_AUX_RD_INTERVAL_MASK              0x7f
 # define DP_128B132B_TRAINING_AUX_RD_INTERVAL_400_US            0x00
 # define DP_128B132B_TRAINING_AUX_RD_INTERVAL_4_MS              0x01
@@ -1549,6 +1550,8 @@ void drm_dp_link_train_channel_eq_delay(const struct drm_dp_aux *aux,
 void drm_dp_lttpr_link_train_channel_eq_delay(const struct drm_dp_aux *aux,
 					      const u8 caps[DP_LTTPR_PHY_CAP_SIZE]);
 
+int drm_dp_128b132b_read_aux_rd_interval(struct drm_dp_aux *aux);
+
 u8 drm_dp_link_rate_to_bw_code(int link_rate);
 int drm_dp_bw_code_to_link_rate(u8 link_bw);
 
Signature · 1 line
2.30.2
Signature · 2 lines
Ville Syrjälä
Intel
Reviewed-by on v1 3/8
#5 lore raw

Re: [PATCH 3/8] drm/dp: add some new DPCD macros from DP 2.0 E11

In reply to Jani Nikula
Quoted 5 lines · Jani Nikula

Add some of the new additions from DP 2.0 E11.

Cc Uma Shankar <[email protected]>
Cc Ville Syrjälä <[email protected]>
Quoted 17 lines
---
 include/drm/dp/drm_dp_helper.h | 2 ++
 1 file changed, 2 insertions(+)
include/drm/dp/drm_dp_helper.h +1 -0
index c499d735b992..69487bd8ed56 100644
@@ -560,6 +560,7 @@ struct drm_panel;
 # define DP_TRAINING_PATTERN_DISABLE	    0
 # define DP_TRAINING_PATTERN_1		    1
 # define DP_TRAINING_PATTERN_2		    2
+# define DP_TRAINING_PATTERN_2_CDS	    3	    /* 2.0 E11 */
 # define DP_TRAINING_PATTERN_3		    3	    /* 1.2 */
 # define DP_TRAINING_PATTERN_4              7       /* 1.4 */
 # define DP_TRAINING_PATTERN_MASK	    0x3

include/drm/dp/drm_dp_helper.h struct drm_panel; · line 1354

Quoted 4 lines
include/drm/dp/drm_dp_helper.h +1 -0
@@ -1350,6 +1351,7 @@ struct drm_panel;
 # define DP_PHY_REPEATER_128B132B_SUPPORTED		    (1 << 0)
 /* See DP_128B132B_SUPPORTED_LINK_RATES for values */
 #define DP_PHY_REPEATER_128B132B_RATES			    0xf0007 /* 2.0 */
+#define DP_PHY_REPEATER_EQ_DONE                             0xf0008 /* 2.0 E11 */

Wonder if we should look at that at some point? The spec doesn't really say so. Or maybe we should just dump it out of the link training failed?

Quoted 5 lines
include/drm/dp/drm_dp_helper.h +0 -0
 enum drm_dp_phy {
 	DP_PHY_DPRX,
Signature · 1 line
2.30.2
Signature · 2 lines
Ville Syrjälä
Intel
#10 lore raw

Re: [PATCH 5/8] drm/i915/dp: rewrite DP 2.0 128b/132b link training based on errata

In reply to Jani Nikula

On Tue, Jan 25, 2022 at 07:03:43PM +0200, Jani Nikula wrote:
<snip>

Quoted 21 lines
drivers/gpu/drm/i915/display/intel_dp_link_training.c +21 -0
+static bool
+intel_dp_128b132b_lane_cds(struct intel_dp *intel_dp,
+			   const struct intel_crtc_state *crtc_state,
+			   int lttpr_count)
+{
+	struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base;
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	u8 link_status[DP_LINK_STATUS_SIZE];
+	unsigned long deadline;
+
+	if (drm_dp_dpcd_writeb(&intel_dp->aux, DP_TRAINING_PATTERN_SET,
+			       DP_TRAINING_PATTERN_2_CDS) != 1) {
+		drm_err(&i915->drm,
+			"[ENCODER:%d:%s] Failed to start 128b/132b TPS2 CDS\n",
+			encoder->base.base.id, encoder->base.name);
+		return false;
+	}
+
+	deadline = jiffies + msecs_to_jiffies((lttpr_count + 1) * 20);
+	for (;;) {
+		usleep_range(2000, 3000);

drivers/gpu/drm/i915/display/intel_dp_link_training.c intel_dp_link_train_all_phys(struct intel_dp *intel_dp, · line 1287

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_dp_link_training.c +10 -0
+
+		if (drm_dp_dpcd_read_link_status(&intel_dp->aux, link_status) < 0) {
+			drm_err(&i915->drm,
+				"[ENCODER:%d:%s] Failed to read link status\n",
+				encoder->base.base.id, encoder->base.name);
+			return false;
+		}
+
+		if (drm_dp_128b132b_cds_interlane_align_done(link_status) &&
+		    drm_dp_128b132b_lane_symbol_locked(link_status, crtc_state->lane_count)) {

I'm thinkin we want to check for both eq done and symbol locked here, just like we do with 8b10b.

Quoted 29 lines
drivers/gpu/drm/i915/display/intel_dp_link_training.c +29 -0
+			drm_dbg_kms(&i915->drm,
+				    "[ENCODER:%d:%s] CDS interlane align done\n",
+				    encoder->base.base.id, encoder->base.name);
+			break;
+		}
+
+		if (drm_dp_128b132b_link_training_failed(link_status)) {
+			intel_dp_dump_link_status(intel_dp, DP_PHY_DPRX, link_status);
+			drm_err(&i915->drm,
+				"[ENCODER:%d:%s] Downstream link training failure\n",
+				encoder->base.base.id, encoder->base.name);
+			return false;
+		}
+
+		if (time_after(jiffies, deadline)) {
+			intel_dp_dump_link_status(intel_dp, DP_PHY_DPRX, link_status);
+			drm_err(&i915->drm,
+				"[ENCODER:%d:%s] CDS timeout\n",
+				encoder->base.base.id, encoder->base.name);
+			return false;
+		}
+	}
+
+	/* FIXME: Should DP_TRAINING_PATTERN_DISABLE be written first? */
+	if (intel_dp->set_idle_link_train)
+		intel_dp->set_idle_link_train(intel_dp, crtc_state);
+
+	return true;
+}
Signature · 2 lines
Ville Syrjälä
Intel
#13 lore raw

Re: [PATCH 6/8] drm/i915/dp: add 128b/132b support to link status checks

In reply to Jani Nikula
Quoted 21 lines · Jani Nikula

Abstract link status check to a function that takes 128b/132b and 8b/10b into account, and use it. Also dump link status on failures.

Cc Uma Shankar <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_dp.c       | 39 ++++++++++++++-----
 .../drm/i915/display/intel_dp_link_training.c |  2 +-
 .../drm/i915/display/intel_dp_link_training.h |  4 ++
 3 files changed, 34 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/display/intel_dp.c +1 -0
index 4d4579a301f6..80fedd0e6212 100644
@@ -3628,6 +3628,32 @@ static void intel_dp_handle_test_request(struct intel_dp *intel_dp)
 			    "Could not write test response to sink\n");
 }
 
+static bool intel_dp_link_ok(struct intel_dp *intel_dp,

drivers/gpu/drm/i915/display/intel_dp.c static void intel_dp_handle_test_request(struct intel_dp *intel_dp) · line 3641

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_dp.c +10 -0
+			     u8 link_status[DP_LINK_STATUS_SIZE])
+{
+	struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base;
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	bool uhbr = intel_dp->link_rate >= 1000000;
+	bool ok;
+
+	if (uhbr)
+		ok = drm_dp_128b132b_lane_channel_eq_done(link_status,
+							  intel_dp->lane_count);

That will only check the eq done bits. I think we want to keep the symbol locked checks as well.

Quoted 75 lines
drivers/gpu/drm/i915/display/intel_dp.c +18 -10
+	else
+		ok = drm_dp_channel_eq_ok(link_status, intel_dp->lane_count);
+
+	if (ok)
+		return true;
+
+	intel_dp_dump_link_status(intel_dp, DP_PHY_DPRX, link_status);
+	drm_dbg_kms(&i915->drm,
+		    "[ENCODER:%d:%s] %s link not ok, retraining\n",
+		    encoder->base.base.id, encoder->base.name,
+		    uhbr ? "128b/132b" : "8b/10b");
+
+	return false;
+}
+
 static void
 intel_dp_mst_hpd_irq(struct intel_dp *intel_dp, u8 *esi, u8 *ack)
 {
@@ -3658,14 +3684,7 @@ static bool intel_dp_mst_link_status(struct intel_dp *intel_dp)
 		return false;
 	}
 
-	if (!drm_dp_channel_eq_ok(link_status, intel_dp->lane_count)) {
-		drm_dbg_kms(&i915->drm,
-			    "[ENCODER:%d:%s] channel EQ not ok, retraining\n",
-			    encoder->base.base.id, encoder->base.name);
-		return false;
-	}
-
-	return true;
+	return intel_dp_link_ok(intel_dp, link_status);
 }
 
 /**
@@ -3779,8 +3798,8 @@ intel_dp_needs_link_retrain(struct intel_dp *intel_dp)
 					intel_dp->lane_count))
 		return false;
 
-	/* Retrain if Channel EQ or CR not ok */
-	return !drm_dp_channel_eq_ok(link_status, intel_dp->lane_count);
+	/* Retrain if link not ok */
+	return !intel_dp_link_ok(intel_dp, link_status);
 }
 
 static bool intel_dp_has_connector(struct intel_dp *intel_dp,
drivers/gpu/drm/i915/display/intel_dp_link_training.c +1 -1
index 8bb6a296f421..1e41a560204a 100644
@@ -712,7 +712,7 @@ static bool intel_dp_adjust_request_changed(const struct intel_crtc_state *crtc_
 	return false;
 }
 
-static void
+void
 intel_dp_dump_link_status(struct intel_dp *intel_dp, enum drm_dp_phy dp_phy,
 			  const u8 link_status[DP_LINK_STATUS_SIZE])
 {
drivers/gpu/drm/i915/display/intel_dp_link_training.h +4 -0
index dbfb15705aaa..dc1556b46b85 100644
@@ -29,6 +29,10 @@ void intel_dp_start_link_train(struct intel_dp *intel_dp,
 void intel_dp_stop_link_train(struct intel_dp *intel_dp,
 			      const struct intel_crtc_state *crtc_state);
 
+void
+intel_dp_dump_link_status(struct intel_dp *intel_dp, enum drm_dp_phy dp_phy,
+			  const u8 link_status[DP_LINK_STATUS_SIZE]);
+
 /* Get the TPSx symbol type of the value programmed to DP_TRAINING_PATTERN_SET */
 static inline u8 intel_dp_training_pattern_symbol(u8 pattern)
 {
Signature · 1 line
2.30.2
Signature · 2 lines
Ville Syrjälä
Intel
#9 lore raw

Re: [PATCH 5/8] drm/i915/dp: rewrite DP 2.0 128b/132b link training based on errata

In reply to Ville Syrjälä
Quoted 156 lines · Ville Syrjälä
Quoted 140 lines · Jani Nikula

The DP 2.0 errata completely overhauls the 128b/132b link training, with no provisions for backward compatibility with the original DP 2.0 specification.

The changes are too intrusive to consider reusing the same code for both 8b/10b and 128b/132b, mainly because the LTTPR channel equalisation is done concurrently instead of serialized.

NOTES:

* It's a bit unclear when to wait for DP_INTERLANE_ALIGN_DONE and per-lane DP_LANE_SYMBOL_LOCKED. Figure xx4 in the SCR implies the LANEx_CHANNEL_EQ_DONE sequence may end with either 0x77,0x77,0x85 *or* 0x33,0x33,0x84 (for four lane configuration in DPCD 0x202..0x204) i.e. without the above bits set. Text elsewhere seems contradictory or incomplete.

* We read entire link status (6 bytes) everywhere instead of individual DPCD addresses.

* There are some subtle ambiguities or contradictions in the order of some DPCD access and TPS signal enables/disables. It's also not clear whether these are significant.

Cc Uma Shankar <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 .../drm/i915/display/intel_dp_link_training.c | 252 +++++++++++++++++-
 1 file changed, 251 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_dp_link_training.c +101 -0
index 4e507aa75a03..8bb6a296f421 100644
@@ -1102,6 +1102,250 @@ intel_dp_link_train_all_phys(struct intel_dp *intel_dp,
 	return ret;
 }
 
+
+/*
+ * 128b/132b DP LANEx_EQ_DONE Sequence (DP 2.0 E11 3.5.2.16.1)
+ */
+static bool
+intel_dp_128b132b_lane_eq(struct intel_dp *intel_dp,
+			  const struct intel_crtc_state *crtc_state)
+{
+	struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base;
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	u8 link_status[DP_LINK_STATUS_SIZE];
+	int delay_us;
+	int try, max_tries = 20;
+	unsigned long deadline;
+
+	/*
+	 * Reset signal levels. Start transmitting 128b/132b TPS1.
+	 *
+	 * Put DPRX and LTTPRs (if any) into intra-hop AUX mode by writing TPS1
+	 * in DP_TRAINING_PATTERN_SET.
+	 */
+	if (!intel_dp_reset_link_train(intel_dp, crtc_state, DP_PHY_DPRX,
+				       DP_TRAINING_PATTERN_1)) {
+		drm_err(&i915->drm,
+			"[ENCODER:%d:%s] Failed to start 128b/132b TPS1\n",
+			encoder->base.base.id, encoder->base.name);
+		return false;
+	}
+
+	delay_us = drm_dp_128b132b_read_aux_rd_interval(&intel_dp->aux);
+
+	/* Read the initial TX FFE settings. */
+	if (drm_dp_dpcd_read_link_status(&intel_dp->aux, link_status) < 0) {
+		drm_err(&i915->drm,
+			"[ENCODER:%d:%s] Failed to read TX FFE presets\n",
+			encoder->base.base.id, encoder->base.name);
+		return false;
+	}
+
+	/* Update signal levels and training set as requested. */
+	intel_dp_get_adjust_train(intel_dp, crtc_state, DP_PHY_DPRX, link_status);
+	if (!intel_dp_update_link_train(intel_dp, crtc_state, DP_PHY_DPRX)) {
+		drm_err(&i915->drm,
+			"[ENCODER:%d:%s] Failed to set initial TX FFE settings\n",
+			encoder->base.base.id, encoder->base.name);
+		return false;
+	}
+
+	/* Start transmitting 128b/132b TPS2. */
+	if (!intel_dp_set_link_train(intel_dp, crtc_state, DP_PHY_DPRX,
+				     DP_TRAINING_PATTERN_2)) {
+		drm_err(&i915->drm,
+			"[ENCODER:%d:%s] Failed to start 128b/132b TPS2\n",
+			encoder->base.base.id, encoder->base.name);
+		return false;
+	}
+
+	for (try = 0; try < max_tries; try++) {
+		usleep_range(delay_us, 2 * delay_us);
+
+		/*
+		 * The delay may get updated. The transmitter shall read the
+		 * delay before link status during link training.
+		 */
+		delay_us = drm_dp_128b132b_read_aux_rd_interval(&intel_dp->aux);
+
+		if (drm_dp_dpcd_read_link_status(&intel_dp->aux, link_status) < 0) {
+			drm_err(&i915->drm,
+				"[ENCODER:%d:%s] Failed to read link status\n",
+				encoder->base.base.id, encoder->base.name);
+			return false;
+		}
+
+		if (drm_dp_128b132b_link_training_failed(link_status)) {
+			intel_dp_dump_link_status(intel_dp, DP_PHY_DPRX, link_status);
+			drm_err(&i915->drm,
+				"[ENCODER:%d:%s] Downstream link training failure\n",
+				encoder->base.base.id, encoder->base.name);
+			return false;
+		}
+
+		if (drm_dp_128b132b_lane_channel_eq_done(link_status, crtc_state->lane_count)) {
+			drm_dbg_kms(&i915->drm,
+				    "[ENCODER:%d:%s] Lane channel eq done\n",
+				    encoder->base.base.id, encoder->base.name);
+			break;
+		}
+
+		/* Update signal levels and training set as requested. */
+		intel_dp_get_adjust_train(intel_dp, crtc_state, DP_PHY_DPRX, link_status);
+		if (!intel_dp_update_link_train(intel_dp, crtc_state, DP_PHY_DPRX)) {
+			drm_err(&i915->drm,
+				"[ENCODER:%d:%s] Failed to update TX FFE settings\n",
+				encoder->base.base.id, encoder->base.name);
+			return false;
+		}
+	}
+
+	if (try == max_tries) {
+		intel_dp_dump_link_status(intel_dp, DP_PHY_DPRX, link_status);
+		drm_err(&i915->drm,

drivers/gpu/drm/i915/display/intel_dp_link_training.c intel_dp_link_train_all_phys(struct intel_dp *intel_dp, · line 1215

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_dp_link_training.c +10 -0
+			"[ENCODER:%d:%s] Max loop count reached\n",
+			encoder->base.base.id, encoder->base.name);
+		return false;
+	}
+
+	/*
+	 * FIXME: This should probably be the total time budget for the complete
+	 * LANEx_EQ_DONE Sequence, including the loop above and the aux rd
+	 * intervals.
+	 */

That is what my spec reading skills tell me. I suspect it's just there to make sure some broken device can't specify an overly long aux rd interval and make the link training too long. 20*256ms=~5 seconds max.

Quoted 1 line

I'd either drop this for now, or try to intergrate properly inte loop.

Extended it over the entire sequence.

Quoted 84 lines
Quoted 84 lines
drivers/gpu/drm/i915/display/intel_dp_link_training.c +83 -0
+	deadline = jiffies + msecs_to_jiffies(400);
+	for (;;) {
+		if (drm_dp_128b132b_eq_interlane_align_done(link_status)) {
+			drm_dbg_kms(&i915->drm,
+				    "[ENCODER:%d:%s] Interlane align done\n",
+				    encoder->base.base.id, encoder->base.name);
+			break;
+		}
+
+		if (time_after(jiffies, deadline)) {
+			intel_dp_dump_link_status(intel_dp, DP_PHY_DPRX, link_status);
+			drm_err(&i915->drm,
+				"[ENCODER:%d:%s] Interlane align timeout\n",
+				encoder->base.base.id, encoder->base.name);
+			return false;
+		}
+
+		usleep_range(2000, 3000);
+
+		if (drm_dp_dpcd_read_link_status(&intel_dp->aux, link_status) < 0) {
+			drm_err(&i915->drm,
+				"[ENCODER:%d:%s] Failed to read link status\n",
+				encoder->base.base.id, encoder->base.name);
+			return false;
+		}
+
+		if (drm_dp_128b132b_link_training_failed(link_status)) {
+			intel_dp_dump_link_status(intel_dp, DP_PHY_DPRX, link_status);
+			drm_err(&i915->drm,
+				"[ENCODER:%d:%s] Downstream link training failure\n",
+				encoder->base.base.id, encoder->base.name);
+			return false;
+		}
+	}
+
+	return true;
+}
+
+/*
+ * 128b/132b DP LANEx_CDS_DONE Sequence (DP 2.0 E11 3.5.2.16.2)
+ */
+static bool
+intel_dp_128b132b_lane_cds(struct intel_dp *intel_dp,
+			   const struct intel_crtc_state *crtc_state,
+			   int lttpr_count)
+{
+	struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base;
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	u8 link_status[DP_LINK_STATUS_SIZE];
+	unsigned long deadline;
+
+	if (drm_dp_dpcd_writeb(&intel_dp->aux, DP_TRAINING_PATTERN_SET,
+			       DP_TRAINING_PATTERN_2_CDS) != 1) {
+		drm_err(&i915->drm,
+			"[ENCODER:%d:%s] Failed to start 128b/132b TPS2 CDS\n",
+			encoder->base.base.id, encoder->base.name);
+		return false;
+	}
+
+	deadline = jiffies + msecs_to_jiffies((lttpr_count + 1) * 20);
+	for (;;) {
+		usleep_range(2000, 3000);
+
+		if (drm_dp_dpcd_read_link_status(&intel_dp->aux, link_status) < 0) {
+			drm_err(&i915->drm,
+				"[ENCODER:%d:%s] Failed to read link status\n",
+				encoder->base.base.id, encoder->base.name);
+			return false;
+		}
+
+		if (drm_dp_128b132b_cds_interlane_align_done(link_status) &&
+		    drm_dp_128b132b_lane_symbol_locked(link_status, crtc_state->lane_count)) {
+			drm_dbg_kms(&i915->drm,
+				    "[ENCODER:%d:%s] CDS interlane align done\n",
+				    encoder->base.base.id, encoder->base.name);
+			break;
+		}
+
+		if (drm_dp_128b132b_link_training_failed(link_status)) {
+			intel_dp_dump_link_status(intel_dp, DP_PHY_DPRX, link_status);
+			drm_err(&i915->drm,
+				"[ENCODER:%d:%s] Downstream link training failure\n",
+				encoder->base.base.id, encoder->base.name);
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_dp_link_training.c intel_dp_link_train_all_phys(struct intel_dp *intel_dp, · line 1225

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_dp_link_training.c +4 -0
+			return false;
+		}
+
+		if (time_after(jiffies, deadline)) {

This is racy. There's no telling how much time has passed since the last time we checked the status. Standard rule of timeouts:
always check one last time after the timeout has expired.

Right, thanks, fixed.

Quoted 13 lines

drivers/gpu/drm/i915/display/intel_dp_link_training.c intel_dp_link_train_all_phys(struct intel_dp *intel_dp, · line 1311

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_dp_link_training.c +9 -0
+			intel_dp_dump_link_status(intel_dp, DP_PHY_DPRX, link_status);
+			drm_err(&i915->drm,
+				"[ENCODER:%d:%s] CDS timeout\n",
+				encoder->base.base.id, encoder->base.name);
+			return false;
+		}
+	}
+
+	/* FIXME: Should DP_TRAINING_PATTERN_DISABLE be written first? */

Not sure. The other thing missing is waiting for the intra-hop AUX indicator to go away after we exit link training.

Hum, I guess I've missed that. I thought we should check for that before we start. (And yes, that's missing, there's another FIXME.)

Quoted 5 lines

It seems we should also block all other aux transfers during LT because of the intra-hop AUX mode. I can imagine things might get a bit confused if the LTTPRs start answering directly to AUX transfers that are intended to pass through to the DPRX.

Yeah, I've left that for the future. I haven't figured out a clean way to do it yet.

Quoted 64 lines
Quoted 64 lines
drivers/gpu/drm/i915/display/intel_dp_link_training.c +44 -1
+	if (intel_dp->set_idle_link_train)
+		intel_dp->set_idle_link_train(intel_dp, crtc_state);
+
+	return true;
+}
+
+/*
+ * 128b/132b link training sequence. (DP 2.0 E11 SCR on link training.)
+ */
+static bool
+intel_dp_128b132b_link_train(struct intel_dp *intel_dp,
+			     const struct intel_crtc_state *crtc_state,
+			     int lttpr_count)
+{
+	struct intel_connector *connector = intel_dp->attached_connector;
+	struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base;
+	bool passed = false;
+
+	/*
+	 * FIXME: Validate previous LT termination by reading Intra-Hop AUX
+	 * Reply Indication by reading bit 3 of SINK_STATUS at 00205h
+	 */
+
+	if (intel_dp_128b132b_lane_eq(intel_dp, crtc_state) &&
+	    intel_dp_128b132b_lane_cds(intel_dp, crtc_state, lttpr_count))
+		passed = true;
+
+	drm_dbg_kms(&dp_to_i915(intel_dp)->drm,
+		    "[CONNECTOR:%d:%s][ENCODER:%d:%s] 128b/132b Link Training %s at link rate = %d, lane count = %d\n",
+		    connector->base.base.id, connector->base.name,
+		    encoder->base.base.id, encoder->base.name,
+		    passed ? "passed" : "failed",
+		    crtc_state->port_clock, crtc_state->lane_count);
+
+	return passed;
+}
+
 /**
  * intel_dp_start_link_train - start link training
  * @intel_dp: DP struct
@@ -1115,6 +1359,7 @@ intel_dp_link_train_all_phys(struct intel_dp *intel_dp,
 void intel_dp_start_link_train(struct intel_dp *intel_dp,
 			       const struct intel_crtc_state *crtc_state)
 {
+	static bool passed;
 	/*
 	 * TODO: Reiniting LTTPRs here won't be needed once proper connector
 	 * HW state readout is added.
@@ -1127,6 +1372,11 @@ void intel_dp_start_link_train(struct intel_dp *intel_dp,
 
 	intel_dp_prepare_link_train(intel_dp, crtc_state);
 
-	if (!intel_dp_link_train_all_phys(intel_dp, crtc_state, lttpr_count))
+	if (intel_dp_is_uhbr(crtc_state))
+		passed = intel_dp_128b132b_link_train(intel_dp, crtc_state, lttpr_count);
+	else
+		passed = intel_dp_link_train_all_phys(intel_dp, crtc_state, lttpr_count);
+
+	if (!passed)
 		intel_dp_schedule_fallback_link_training(intel_dp, crtc_state);
 }
Signature · 1 line
2.30.2
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
#11 lore raw

Re: [PATCH 5/8] drm/i915/dp: rewrite DP 2.0 128b/132b link training based on errata

In reply to Ville Syrjälä
Quoted 28 lines · Ville Syrjälä

On Tue, Jan 25, 2022 at 07:03:43PM +0200, Jani Nikula wrote:
<snip>

Quoted 26 lines
drivers/gpu/drm/i915/display/intel_dp_link_training.c +26 -0
+static bool
+intel_dp_128b132b_lane_cds(struct intel_dp *intel_dp,
+			   const struct intel_crtc_state *crtc_state,
+			   int lttpr_count)
+{
+	struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base;
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	u8 link_status[DP_LINK_STATUS_SIZE];
+	unsigned long deadline;
+
+	if (drm_dp_dpcd_writeb(&intel_dp->aux, DP_TRAINING_PATTERN_SET,
+			       DP_TRAINING_PATTERN_2_CDS) != 1) {
+		drm_err(&i915->drm,
+			"[ENCODER:%d:%s] Failed to start 128b/132b TPS2 CDS\n",
+			encoder->base.base.id, encoder->base.name);
+		return false;
+	}
+
+	deadline = jiffies + msecs_to_jiffies((lttpr_count + 1) * 20);
+	for (;;) {
+		usleep_range(2000, 3000);
+
+		if (drm_dp_dpcd_read_link_status(&intel_dp->aux, link_status) < 0) {
+			drm_err(&i915->drm,
+				"[ENCODER:%d:%s] Failed to read link status\n",
+				encoder->base.base.id, encoder->base.name);
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_dp_link_training.c intel_dp_link_train_all_phys(struct intel_dp *intel_dp, · line 1287

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_dp_link_training.c +5 -0
+			return false;
+		}
+
+		if (drm_dp_128b132b_cds_interlane_align_done(link_status) &&
+		    drm_dp_128b132b_lane_symbol_locked(link_status, crtc_state->lane_count)) {

I'm thinkin we want to check for both eq done and symbol locked here, just like we do with 8b10b.

I guess so, although I don't think the spec explicitly calls that out.

Fixed anyway.

Quoted 30 lines
Quoted 30 lines
drivers/gpu/drm/i915/display/intel_dp_link_training.c +29 -0
+			drm_dbg_kms(&i915->drm,
+				    "[ENCODER:%d:%s] CDS interlane align done\n",
+				    encoder->base.base.id, encoder->base.name);
+			break;
+		}
+
+		if (drm_dp_128b132b_link_training_failed(link_status)) {
+			intel_dp_dump_link_status(intel_dp, DP_PHY_DPRX, link_status);
+			drm_err(&i915->drm,
+				"[ENCODER:%d:%s] Downstream link training failure\n",
+				encoder->base.base.id, encoder->base.name);
+			return false;
+		}
+
+		if (time_after(jiffies, deadline)) {
+			intel_dp_dump_link_status(intel_dp, DP_PHY_DPRX, link_status);
+			drm_err(&i915->drm,
+				"[ENCODER:%d:%s] CDS timeout\n",
+				encoder->base.base.id, encoder->base.name);
+			return false;
+		}
+	}
+
+	/* FIXME: Should DP_TRAINING_PATTERN_DISABLE be written first? */
+	if (intel_dp->set_idle_link_train)
+		intel_dp->set_idle_link_train(intel_dp, crtc_state);
+
+	return true;
+}
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center