Skip to contentSkip to conversation

drm/i915/cx0: Add step for programming msgbus timer

PATCH Superseded Gustavo Sousa 3 participants 5 messages Sep 11, 2023 – Sep 12, 2023

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915/cx0: Add step for programming msgbus timer

There was a recent update in the BSpec adding an extra step to the PLL enable sequence, which is for programming the msgbus timer. Since we also touch PHY registers during hw readout, let's do the programming when starting a transaction rather than only when doing the PLL enable sequence.

The BSpec isn't clear about whether the programming should be done for owned PHY lanes or only PHY lane 0. Let's program the timer for owned PHY lanes for now. We can revisit this once we get clarification from the BSpec.

This might be the missing step that was causing the timeouts that we have recently seen during C20 SRAM register programming sequences. With this in place, we shouldn't need the logic to bump the timer thresholds, since now we have a documented value that should be set peform programming the registers. As such, let's also remove intel_cx0_bus_check_and_bump_timer(), but keep the part that checks if hardware really detected a timeout, which might be useful debugging information.

---
 drivers/gpu/drm/i915/display/intel_cx0_phy.c  | 88 +++++++++----------
 .../gpu/drm/i915/display/intel_cx0_phy_regs.h |  2 +-
 2 files changed, 42 insertions(+), 48 deletions(-)
drivers/gpu/drm/i915/display/intel_cx0_phy.c +41 -47
index e6d3027c821d..1b0a868845b7 100644
@@ -29,8 +29,6 @@
 #define INTEL_CX0_LANE1		BIT(1)
 #define INTEL_CX0_BOTH_LANES	(INTEL_CX0_LANE1 | INTEL_CX0_LANE0)
 
-#define INTEL_CX0_MSGBUS_TIMER_BUMPED_VAL	0x200
-
 bool intel_is_c10phy(struct drm_i915_private *i915, enum phy phy)
 {
 	if (DISPLAY_VER_FULL(i915) == IP_VER(14, 0) && phy < PHY_C)
@@ -73,19 +71,39 @@ assert_dc_off(struct drm_i915_private *i915)
 	drm_WARN_ON(&i915->drm, !enabled);
 }
 
+static void intel_cx0_program_msgbus_timer(struct intel_encoder *encoder)
+{
+	int lane;
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	u8 owned_lane_mask = intel_cx0_get_owned_lane_mask(i915, encoder);
+
+	for_each_cx0_lane_in_mask(owned_lane_mask, lane)
+		intel_de_rmw(i915,
+			     XELPDP_PORT_MSGBUS_TIMER(encoder->port, lane),
+			     XELPDP_PORT_MSGBUS_TIMER_VAL_MASK,
+			     XELPDP_PORT_MSGBUS_TIMER_VAL);
+}
+
 /*
  * Prepare HW for CX0 phy transactions.
  *
  * It is required that PSR and DC5/6 are disabled before any CX0 message
  * bus transaction is executed.
+ *
+ * We also do the msgbus timer programming here to ensure that the timer
+ * is already programmed before any access to the msgbus.
  */
 static intel_wakeref_t intel_cx0_phy_transaction_begin(struct intel_encoder *encoder)
 {
+	intel_wakeref_t wakeref;
 	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
 	struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
 
 	intel_psr_pause(intel_dp);
-	return intel_display_power_get(i915, POWER_DOMAIN_DC_OFF);
+	wakeref = intel_display_power_get(i915, POWER_DOMAIN_DC_OFF);
+	intel_cx0_program_msgbus_timer(encoder);
+
+	return wakeref;
 }
 
 static void intel_cx0_phy_transaction_end(struct intel_encoder *encoder, intel_wakeref_t wakeref)
@@ -121,42 +139,6 @@ static void intel_cx0_bus_reset(struct drm_i915_private *i915, enum port port, i
 	intel_clear_response_ready_flag(i915, port, lane);
 }
 
-/*
- * Check if there was a timeout detected by the hardware in the message bus
- * and bump the threshold if so.
- */
-static void intel_cx0_bus_check_and_bump_timer(struct drm_i915_private *i915,
-					       enum port port, int lane)
-{
-	enum phy phy = intel_port_to_phy(i915, port);
-	i915_reg_t reg;
-	u32 val;
-	u32 timer_val;
-
-	reg = XELPDP_PORT_MSGBUS_TIMER(port, lane);
-	val = intel_de_read(i915, reg);
-
-	if (!(val & XELPDP_PORT_MSGBUS_TIMER_TIMED_OUT)) {
-		drm_warn(&i915->drm,
-			 "PHY %c lane %d: hardware did not detect a timeout\n",
-			 phy_name(phy), lane);
-		return;
-	}
-
-	timer_val = REG_FIELD_GET(XELPDP_PORT_MSGBUS_TIMER_VAL_MASK, val);
-
-	if (timer_val == INTEL_CX0_MSGBUS_TIMER_BUMPED_VAL)
-		return;
-
-	val &= ~XELPDP_PORT_MSGBUS_TIMER_VAL_MASK;
-	val |= XELPDP_PORT_MSGBUS_TIMER_VAL(INTEL_CX0_MSGBUS_TIMER_BUMPED_VAL);
-
-	drm_dbg_kms(&i915->drm,
-		    "PHY %c lane %d: increasing msgbus timer threshold to %#x\n",
-		    phy_name(phy), lane, INTEL_CX0_MSGBUS_TIMER_BUMPED_VAL);
-	intel_de_write(i915, reg, val);
-}
-
 static int intel_cx0_wait_for_ack(struct drm_i915_private *i915, enum port port,
 				  int command, int lane, u32 *val)
 {
@@ -170,7 +152,13 @@ static int intel_cx0_wait_for_ack(struct drm_i915_private *i915, enum port port,
 					 XELPDP_MSGBUS_TIMEOUT_SLOW, val)) {
 		drm_dbg_kms(&i915->drm, "PHY %c Timeout waiting for message ACK. Status: 0x%x\n",
 			    phy_name(phy), *val);
-		intel_cx0_bus_check_and_bump_timer(i915, port, lane);
+
+		if (!(intel_de_read(i915, XELPDP_PORT_MSGBUS_TIMER(port, lane)) &
+		      XELPDP_PORT_MSGBUS_TIMER_TIMED_OUT))
+			drm_warn(&i915->drm,
+				 "PHY %c Hardware did not detect a timeout\n",
+				 phy_name(phy));
+
 		intel_cx0_bus_reset(i915, port, lane);
 		return -ETIMEDOUT;
 	}
@@ -2737,39 +2725,45 @@ static void intel_cx0pll_enable(struct intel_encoder *encoder,
 	intel_cx0_powerdown_change_sequence(i915, encoder->port, INTEL_CX0_BOTH_LANES,
 					    CX0_P2_STATE_READY);
 
-	/* 4. Program PHY internal PLL internal registers. */
+	/*
+	 * 4. Program PORT_MSGBUS_TIMER register's Message Bus Timer field to 0xA000.
+	 *    (This is done inside intel_cx0_phy_transaction_begin(), since we would need
+	 *    the right timer thresholds for readouts too.)
+	 */
+
+	/* 5. Program PHY internal PLL internal registers. */
 	if (intel_is_c10phy(i915, phy))
 		intel_c10_pll_program(i915, crtc_state, encoder);
 	else
 		intel_c20_pll_program(i915, crtc_state, encoder);
 
 	/*
-	 * 5. Program the enabled and disabled owned PHY lane
+	 * 6. Program the enabled and disabled owned PHY lane
 	 * transmitters over message bus
 	 */
 	intel_cx0_program_phy_lane(i915, encoder, crtc_state->lane_count, lane_reversal);
 
 	/*
-	 * 6. Follow the Display Voltage Frequency Switching - Sequence
+	 * 7. Follow the Display Voltage Frequency Switching - Sequence
 	 * Before Frequency Change. We handle this step in bxt_set_cdclk().
 	 */
 
 	/*
-	 * 7. Program DDI_CLK_VALFREQ to match intended DDI
+	 * 8. Program DDI_CLK_VALFREQ to match intended DDI
 	 * clock frequency.
 	 */
 	intel_de_write(i915, DDI_CLK_VALFREQ(encoder->port),
 		       crtc_state->port_clock);
 
 	/*
-	 * 8. Set PORT_CLOCK_CTL register PCLK PLL Request
+	 * 9. Set PORT_CLOCK_CTL register PCLK PLL Request
 	 * LN<Lane for maxPCLK> to "1" to enable PLL.
 	 */
 	intel_de_rmw(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
 		     intel_cx0_get_pclk_pll_request(INTEL_CX0_BOTH_LANES),
 		     intel_cx0_get_pclk_pll_request(maxpclk_lane));
 
-	/* 9. Poll on PORT_CLOCK_CTL PCLK PLL Ack LN<Lane for maxPCLK> == "1". */
+	/* 10. Poll on PORT_CLOCK_CTL PCLK PLL Ack LN<Lane for maxPCLK> == "1". */
 	if (__intel_de_wait_for_register(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
 					 intel_cx0_get_pclk_pll_ack(INTEL_CX0_BOTH_LANES),
 					 intel_cx0_get_pclk_pll_ack(maxpclk_lane),
@@ -2778,7 +2772,7 @@ static void intel_cx0pll_enable(struct intel_encoder *encoder,
 			 phy_name(phy), XELPDP_PCLK_PLL_ENABLE_TIMEOUT_US);
 
 	/*
-	 * 10. Follow the Display Voltage Frequency Switching Sequence After
+	 * 11. Follow the Display Voltage Frequency Switching Sequence After
 	 * Frequency Change. We handle this step in bxt_set_cdclk().
 	 */
 
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +1 -1
index b2db4cc366d6..adf8f4ce0d49 100644
@@ -121,7 +121,7 @@
 										 _XELPDP_PORT_MSGBUS_TIMER_LN0_USBC2) + (lane) * 4)
 #define   XELPDP_PORT_MSGBUS_TIMER_TIMED_OUT		REG_BIT(31)
 #define   XELPDP_PORT_MSGBUS_TIMER_VAL_MASK		REG_GENMASK(23, 0)
-#define   XELPDP_PORT_MSGBUS_TIMER_VAL(val)		REG_FIELD_PREP(XELPDP_PORT_MSGBUS_TIMER_VAL_MASK, val)
+#define   XELPDP_PORT_MSGBUS_TIMER_VAL			REG_FIELD_PREP(XELPDP_PORT_MSGBUS_TIMER_VAL_MASK, 0xa000)
 
 #define _XELPDP_PORT_CLOCK_CTL_A			0x640E0
 #define _XELPDP_PORT_CLOCK_CTL_B			0x641E0
Signature · 1 line
2.42.0
#1 lore raw

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/cx0: Add step for programming msgbus timer

== Series Details ==

== Series Details ==

Series: drm/i915/cx0: Add step for programming msgbus timer
URL : https://patchwork.freedesktop.org/series/123551/
State : warning

== Summary ==

Error: dim checkpatch failed
93e020d2353e drm/i915/cx0: Add step for programming msgbus timer -:210: WARNING:LONG_LINE: line length of 113 exceeds 100 columns #210: FILE: drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h:124:
+#define XELPDP_PORT_MSGBUS_TIMER_VAL REG_FIELD_PREP(XELPDP_PORT_MSGBUS_TIMER_VAL_MASK, 0xa000)

total: 0 errors, 1 warnings, 0 checks, 171 lines checked

#2 lore raw

[Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/cx0: Add step for programming msgbus timer

In reply to Gustavo Sousa
== Series Details ==

== Series Details ==

Series: drm/i915/cx0: Add step for programming msgbus timer
URL : https://patchwork.freedesktop.org/series/123551/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_13622 -> Patchwork_123551v1
====================================================

Summary
-------

**FAILURE**

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

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

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

Participating hosts (38 -> 39)
------------------------------

Additional (2): fi-kbl-soraka bat-dg2-9
Missing (1): fi-snb-2520m

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

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

### IGT changes ###

#### Possible regressions ####

* igt@i915_selftest@live@perf:
- fi-kbl-soraka: NOTRUN -> [ABORT][1]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123551v1/fi-kbl-soraka/igt@i915_selftest@[email protected]

#### Warnings ####

* igt@kms_force_connector_basic@force-connector-state:
- bat-adlp-11: [SKIP][2] ([i915#4093]) -> [FAIL][3]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13622/bat-adlp-11/igt@[email protected]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123551v1/bat-adlp-11/igt@[email protected]

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

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

### IGT changes ###

#### Issues hit ####

* igt@gem_exec_suspend@basic-s0@smem:
- bat-dg2-9: NOTRUN -> [INCOMPLETE][4] ([i915#8797] / [i915#9275])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123551v1/bat-dg2-9/igt@gem_exec_suspend@[email protected]

* igt@gem_huc_copy@huc-copy:
- fi-kbl-soraka: NOTRUN -> [SKIP][5] ([fdo#109271] / [i915#2190])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123551v1/fi-kbl-soraka/igt@[email protected]

* igt@gem_lmem_swapping@basic:
- fi-kbl-soraka: NOTRUN -> [SKIP][6] ([fdo#109271] / [i915#4613]) +3 other tests skip
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123551v1/fi-kbl-soraka/igt@[email protected]

* igt@gem_mmap@basic:
- bat-dg2-9: NOTRUN -> [SKIP][7] ([i915#4083])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123551v1/bat-dg2-9/igt@[email protected]

* igt@gem_mmap_gtt@basic:
- bat-dg2-9: NOTRUN -> [SKIP][8] ([i915#4077]) +2 other tests skip
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123551v1/bat-dg2-9/igt@[email protected]

* igt@gem_render_tiled_blits@basic:
- bat-dg2-9: NOTRUN -> [SKIP][9] ([i915#4079]) +1 other test skip
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123551v1/bat-dg2-9/igt@[email protected]

* igt@i915_pm_rps@basic-api:
- bat-dg2-9: NOTRUN -> [SKIP][10] ([i915#6621])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123551v1/bat-dg2-9/igt@[email protected]

* igt@i915_selftest@live@gt_pm:
- fi-kbl-soraka: NOTRUN -> [DMESG-FAIL][11] ([i915#1886] / [i915#7913])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123551v1/fi-kbl-soraka/igt@i915_selftest@live@gt_pm.html

* igt@kms_addfb_basic@addfb25-y-tiled-small-legacy:
- bat-dg2-9: NOTRUN -> [SKIP][12] ([i915#5190])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123551v1/bat-dg2-9/igt@[email protected]

* igt@kms_addfb_basic@basic-y-tiled-legacy:
- bat-dg2-9: NOTRUN -> [SKIP][13] ([i915#4215] / [i915#5190])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123551v1/bat-dg2-9/igt@[email protected]

* igt@kms_addfb_basic@framebuffer-vs-set-tiling:
- bat-dg2-9: NOTRUN -> [SKIP][14] ([i915#4212]) +7 other tests skip
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123551v1/bat-dg2-9/igt@[email protected]

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic:
- fi-kbl-soraka: NOTRUN -> [SKIP][15] ([fdo#109271]) +8 other tests skip
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123551v1/fi-kbl-soraka/igt@[email protected]

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy:
- bat-dg2-9: NOTRUN -> [SKIP][16] ([i915#4103] / [i915#4213]) +1 other test skip
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123551v1/bat-dg2-9/igt@[email protected]

* igt@kms_flip@basic-plain-flip@d-dp6:
- bat-adlp-11: [PASS][17] -> [DMESG-WARN][18] ([i915#6868])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13622/bat-adlp-11/igt@kms_flip@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123551v1/bat-adlp-11/igt@kms_flip@[email protected]

* igt@kms_force_connector_basic@force-load-detect:
- bat-dg2-9: NOTRUN -> [SKIP][19] ([fdo#109285])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123551v1/bat-dg2-9/igt@[email protected]

* igt@kms_force_connector_basic@prune-stale-modes:
- bat-dg2-9: NOTRUN -> [SKIP][20] ([i915#5274])
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123551v1/bat-dg2-9/igt@[email protected]

* igt@kms_hdmi_inject@inject-audio:
- fi-kbl-guc: [PASS][21] -> [FAIL][22] ([IGT#3] / [i915#6121])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13622/fi-kbl-guc/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123551v1/fi-kbl-guc/igt@[email protected]

* igt@kms_psr@sprite_plane_onoff:
- bat-dg2-9: NOTRUN -> [SKIP][23] ([i915#1072]) +3 other tests skip
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123551v1/bat-dg2-9/igt@kms_psr@sprite_plane_onoff.html

* igt@kms_setmode@basic-clone-single-crtc:
- bat-dg2-9: NOTRUN -> [SKIP][24] ([i915#3555])
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123551v1/bat-dg2-9/igt@[email protected]

* igt@prime_vgem@basic-fence-flip:
- bat-dg2-9: NOTRUN -> [SKIP][25] ([i915#3708])
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123551v1/bat-dg2-9/igt@[email protected]

* igt@prime_vgem@basic-fence-mmap:
- bat-dg2-9: NOTRUN -> [SKIP][26] ([i915#3708] / [i915#4077]) +1 other test skip
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123551v1/bat-dg2-9/igt@[email protected]

* igt@prime_vgem@basic-write:
- bat-dg2-9: NOTRUN -> [SKIP][27] ([i915#3291] / [i915#3708]) +2 other tests skip
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123551v1/bat-dg2-9/igt@[email protected]

#### Possible fixes ####

* igt@i915_selftest@live@hugepages:
- bat-mtlp-8: [DMESG-WARN][28] ([i915#9121]) -> [PASS][29]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13622/bat-mtlp-8/igt@i915_selftest@[email protected]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123551v1/bat-mtlp-8/igt@i915_selftest@[email protected]

* igt@kms_pipe_crc_basic@suspend-read-crc@pipe-d-hdmi-a-2:
- bat-dg1-5: [FAIL][30] ([fdo#103375]) -> [PASS][31] +4 other tests pass
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13622/bat-dg1-5/igt@kms_pipe_crc_basic@[email protected]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_123551v1/bat-dg1-5/igt@kms_pipe_crc_basic@[email protected]

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

[IGT#3]: https://gitlab.freedesktop.org/drm/igt-gpu-tools/issues/3
[Intel XE#485]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/485
[fdo#103375]: https://bugs.freedesktop.org/show_bug.cgi?id=103375
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1886]: https://gitlab.freedesktop.org/drm/intel/issues/1886
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#3291]: https://gitlab.freedesktop.org/drm/intel/issues/3291
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
[i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
[i915#4079]: https://gitlab.freedesktop.org/drm/intel/issues/4079
[i915#4083]: https://gitlab.freedesktop.org/drm/intel/issues/4083
[i915#4093]: https://gitlab.freedesktop.org/drm/intel/issues/4093
[i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
[i915#4212]: https://gitlab.freedesktop.org/drm/intel/issues/4212
[i915#4213]: https://gitlab.freedesktop.org/drm/intel/issues/4213
[i915#4215]: https://gitlab.freedesktop.org/drm/intel/issues/4215
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#5190]: https://gitlab.freedesktop.org/drm/intel/issues/5190
[i915#5274]: https://gitlab.freedesktop.org/drm/intel/issues/5274
[i915#5354]: https://gitlab.freedesktop.org/drm/intel/issues/5354
[i915#6121]: https://gitlab.freedesktop.org/drm/intel/issues/6121
[i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
[i915#6868]: https://gitlab.freedesktop.org/drm/intel/issues/6868
[i915#7913]: https://gitlab.freedesktop.org/drm/intel/issues/7913
[i915#7952]: https://gitlab.freedesktop.org/drm/intel/issues/7952
[i915#8797]: https://gitlab.freedesktop.org/drm/intel/issues/8797
[i915#9121]: https://gitlab.freedesktop.org/drm/intel/issues/9121
[i915#9275]: https://gitlab.freedesktop.org/drm/intel/issues/9275

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

* Linux: CI_DRM_13622 -> Patchwork_123551v1

CI-20190529: 20190529
CI_DRM_13622: 84ba384a9f96d41e3ec3c331feb544e7d39be04d @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7480: a8d38db9ac258d7fd71b2cf7607e259a864f95be @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_123551v1: 84ba384a9f96d41e3ec3c331feb544e7d39be04d @ git://anongit.freedesktop.org/gfx-ci/linux

### Linux commits

2d17d81cd2c6 drm/i915/cx0: Add step for programming msgbus timer

== Logs ==

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

#3 lore raw
In reply to Gustavo Sousa
Quoted 121 lines

-----Original Message-----
From: Sousa, Gustavo <[email protected]>
Sent: Monday, September 11, 2023 7:16 PM
To: [email protected]
Cc: Kahola, Mika <[email protected]>; Taylor, Clinton A <[email protected]>
Subject: [PATCH] drm/i915/cx0: Add step for programming msgbus timer

There was a recent update in the BSpec adding an extra step to the PLL enable sequence, which is for programming the msgbus timer. Since we also touch PHY registers during hw readout, let's do the programming when starting a transaction rather than only when doing the PLL enable sequence.

The BSpec isn't clear about whether the programming should be done for owned PHY lanes or only PHY lane 0. Let's program the timer for owned PHY lanes for now. We can revisit this once we get clarification from the BSpec.

This might be the missing step that was causing the timeouts that we have recently seen during C20 SRAM register programming sequences. With this in place, we shouldn't need the logic to bump the timer thresholds, since now we have a documented value that should be set peform programming the registers. As such, let's also remove intel_cx0_bus_check_and_bump_timer(), but keep the part that checks if hardware really detected a timeout, which might be useful debugging information.

---
 drivers/gpu/drm/i915/display/intel_cx0_phy.c  | 88 +++++++++----------  .../gpu/drm/i915/display/intel_cx0_phy_regs.h |  2 +-
 2 files changed, 42 insertions(+), 48 deletions(-)
drivers/gpu/drm/i915/display/intel_cx0_phy.c +0 -2
index e6d3027c821d..1b0a868845b7 100644
@@ -29,8 +29,6 @@
 #define INTEL_CX0_LANE1		BIT(1)
 #define INTEL_CX0_BOTH_LANES	(INTEL_CX0_LANE1 | INTEL_CX0_LANE0)
 
-#define INTEL_CX0_MSGBUS_TIMER_BUMPED_VAL	0x200
-
 bool intel_is_c10phy(struct drm_i915_private *i915, enum phy phy)  {
 	if (DISPLAY_VER_FULL(i915) == IP_VER(14, 0) && phy < PHY_C) @@ -73,19 +71,39 @@ assert_dc_off(struct
 drm_i915_private *i915)
drivers/gpu/drm/i915/display/intel_cx0_phy.c +22 -1
 	drm_WARN_ON(&i915->drm, !enabled);
 }
 
+static void intel_cx0_program_msgbus_timer(struct intel_encoder
+*encoder) {
+	int lane;
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	u8 owned_lane_mask = intel_cx0_get_owned_lane_mask(i915, encoder);
+
+	for_each_cx0_lane_in_mask(owned_lane_mask, lane)
+		intel_de_rmw(i915,
+			     XELPDP_PORT_MSGBUS_TIMER(encoder->port, lane),
+			     XELPDP_PORT_MSGBUS_TIMER_VAL_MASK,
+			     XELPDP_PORT_MSGBUS_TIMER_VAL);
+}
+
 /*
  * Prepare HW for CX0 phy transactions.
  *
  * It is required that PSR and DC5/6 are disabled before any CX0 message
  * bus transaction is executed.
+ *
+ * We also do the msgbus timer programming here to ensure that the
+ timer
+ * is already programmed before any access to the msgbus.
  */
 static intel_wakeref_t intel_cx0_phy_transaction_begin(struct intel_encoder *encoder)  {
+	intel_wakeref_t wakeref;
 	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
 	struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
 
 	intel_psr_pause(intel_dp);
-	return intel_display_power_get(i915, POWER_DOMAIN_DC_OFF);
+	wakeref = intel_display_power_get(i915, POWER_DOMAIN_DC_OFF);
+	intel_cx0_program_msgbus_timer(encoder);
+
+	return wakeref;
 }
 
 static void intel_cx0_phy_transaction_end(struct intel_encoder *encoder, intel_wakeref_t wakeref) @@ -121,42 +139,6 @@

static void intel_cx0_bus_reset(struct drm_i915_private *i915, enum port port, i

drivers/gpu/drm/i915/display/intel_cx0_phy.c +0 -36
 	intel_clear_response_ready_flag(i915, port, lane);  }
 
-/*
- * Check if there was a timeout detected by the hardware in the message bus
- * and bump the threshold if so.
- */
-static void intel_cx0_bus_check_and_bump_timer(struct drm_i915_private *i915,
-					       enum port port, int lane)
-{
-	enum phy phy = intel_port_to_phy(i915, port);
-	i915_reg_t reg;
-	u32 val;
-	u32 timer_val;
-
-	reg = XELPDP_PORT_MSGBUS_TIMER(port, lane);
-	val = intel_de_read(i915, reg);
-
-	if (!(val & XELPDP_PORT_MSGBUS_TIMER_TIMED_OUT)) {
-		drm_warn(&i915->drm,
-			 "PHY %c lane %d: hardware did not detect a timeout\n",
-			 phy_name(phy), lane);
-		return;
-	}
-
-	timer_val = REG_FIELD_GET(XELPDP_PORT_MSGBUS_TIMER_VAL_MASK, val);
-
-	if (timer_val == INTEL_CX0_MSGBUS_TIMER_BUMPED_VAL)
-		return;
-
-	val &= ~XELPDP_PORT_MSGBUS_TIMER_VAL_MASK;
-	val |= XELPDP_PORT_MSGBUS_TIMER_VAL(INTEL_CX0_MSGBUS_TIMER_BUMPED_VAL);
-
-	drm_dbg_kms(&i915->drm,
-		    "PHY %c lane %d: increasing msgbus timer threshold to %#x\n",
-		    phy_name(phy), lane, INTEL_CX0_MSGBUS_TIMER_BUMPED_VAL);
-	intel_de_write(i915, reg, val);
-}
-
 static int intel_cx0_wait_for_ack(struct drm_i915_private *i915, enum port port,
 				  int command, int lane, u32 *val)
 {
@@ -170,7 +152,13 @@ static int intel_cx0_wait_for_ack(struct drm_i915_private *i915, enum port port,
 					 XELPDP_MSGBUS_TIMEOUT_SLOW, val)) {

drivers/gpu/drm/i915/display/intel_cx0_phy.c static int intel_cx0_wait_for_ack(struct drm_i915_private *i915, enum port port, · line 161

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +7 -1
 		drm_dbg_kms(&i915->drm, "PHY %c Timeout waiting for message ACK. Status: 0x%x\n",
 			    phy_name(phy), *val);
-		intel_cx0_bus_check_and_bump_timer(i915, port, lane);
+
+		if (!(intel_de_read(i915, XELPDP_PORT_MSGBUS_TIMER(port, lane)) &
+		      XELPDP_PORT_MSGBUS_TIMER_TIMED_OUT))
+			drm_warn(&i915->drm,
+				 "PHY %c Hardware did not detect a timeout\n",
+				 phy_name(phy));
+

drm_warn() seems a bit exaggerated here as we are informing only about not detecting timeout. Dbg message here might be sufficient. This is something that we could leave out as well. We already have information about the timeouts if these happen.

-Mika-

Quoted 83 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +14 -7
 		intel_cx0_bus_reset(i915, port, lane);
 		return -ETIMEDOUT;
 	}
@@ -2737,39 +2725,45 @@ static void intel_cx0pll_enable(struct intel_encoder *encoder,
 	intel_cx0_powerdown_change_sequence(i915, encoder->port, INTEL_CX0_BOTH_LANES,
 					    CX0_P2_STATE_READY);
 
-	/* 4. Program PHY internal PLL internal registers. */
+	/*
+	 * 4. Program PORT_MSGBUS_TIMER register's Message Bus Timer field to 0xA000.
+	 *    (This is done inside intel_cx0_phy_transaction_begin(), since we would need
+	 *    the right timer thresholds for readouts too.)
+	 */
+
+	/* 5. Program PHY internal PLL internal registers. */
 	if (intel_is_c10phy(i915, phy))
 		intel_c10_pll_program(i915, crtc_state, encoder);
 	else
 		intel_c20_pll_program(i915, crtc_state, encoder);
 
 	/*
-	 * 5. Program the enabled and disabled owned PHY lane
+	 * 6. Program the enabled and disabled owned PHY lane
 	 * transmitters over message bus
 	 */
 	intel_cx0_program_phy_lane(i915, encoder, crtc_state->lane_count, lane_reversal);
 
 	/*
-	 * 6. Follow the Display Voltage Frequency Switching - Sequence
+	 * 7. Follow the Display Voltage Frequency Switching - Sequence
 	 * Before Frequency Change. We handle this step in bxt_set_cdclk().
 	 */
 
 	/*
-	 * 7. Program DDI_CLK_VALFREQ to match intended DDI
+	 * 8. Program DDI_CLK_VALFREQ to match intended DDI
 	 * clock frequency.
 	 */
 	intel_de_write(i915, DDI_CLK_VALFREQ(encoder->port),
 		       crtc_state->port_clock);
 
 	/*
-	 * 8. Set PORT_CLOCK_CTL register PCLK PLL Request
+	 * 9. Set PORT_CLOCK_CTL register PCLK PLL Request
 	 * LN<Lane for maxPCLK> to "1" to enable PLL.
 	 */
 	intel_de_rmw(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
 		     intel_cx0_get_pclk_pll_request(INTEL_CX0_BOTH_LANES),
 		     intel_cx0_get_pclk_pll_request(maxpclk_lane));
 
-	/* 9. Poll on PORT_CLOCK_CTL PCLK PLL Ack LN<Lane for maxPCLK> == "1". */
+	/* 10. Poll on PORT_CLOCK_CTL PCLK PLL Ack LN<Lane for maxPCLK> ==
+"1". */
 	if (__intel_de_wait_for_register(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
 					 intel_cx0_get_pclk_pll_ack(INTEL_CX0_BOTH_LANES),
 					 intel_cx0_get_pclk_pll_ack(maxpclk_lane),
@@ -2778,7 +2772,7 @@ static void intel_cx0pll_enable(struct intel_encoder *encoder,
 			 phy_name(phy), XELPDP_PCLK_PLL_ENABLE_TIMEOUT_US);
 
 	/*
-	 * 10. Follow the Display Voltage Frequency Switching Sequence After
+	 * 11. Follow the Display Voltage Frequency Switching Sequence After
 	 * Frequency Change. We handle this step in bxt_set_cdclk().
 	 */
 
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +1 -1
index b2db4cc366d6..adf8f4ce0d49 100644
@@ -121,7 +121,7 @@
 
 _XELPDP_PORT_MSGBUS_TIMER_LN0_USBC2) + (lane) * 4)
 #define   XELPDP_PORT_MSGBUS_TIMER_TIMED_OUT		REG_BIT(31)
 #define   XELPDP_PORT_MSGBUS_TIMER_VAL_MASK		REG_GENMASK(23, 0)
-#define   XELPDP_PORT_MSGBUS_TIMER_VAL(val)		REG_FIELD_PREP(XELPDP_PORT_MSGBUS_TIMER_VAL_MASK,
 val)
+#define   XELPDP_PORT_MSGBUS_TIMER_VAL			REG_FIELD_PREP(XELPDP_PORT_MSGBUS_TIMER_VAL_MASK,
 0xa000)

#define _XELPDP_PORT_CLOCK_CTL_A 0x640E0
#define _XELPDP_PORT_CLOCK_CTL_B 0x641E0
--
2.42.0

#4 lore raw

Quoting Kahola, Mika (2023-09-12 09:26:59-03:00)

Quoted 125 lines
Quoted 125 lines

-----Original Message-----
From: Sousa, Gustavo <[email protected]>
Sent: Monday, September 11, 2023 7:16 PM
To: [email protected]
Cc: Kahola, Mika <[email protected]>; Taylor, Clinton A <[email protected]>
Subject: [PATCH] drm/i915/cx0: Add step for programming msgbus timer

There was a recent update in the BSpec adding an extra step to the PLL enable sequence, which is for programming the msgbus timer. Since we also touch PHY registers during hw readout, let's do the programming when starting a transaction rather than only when doing the PLL enable sequence.

The BSpec isn't clear about whether the programming should be done for owned PHY lanes or only PHY lane 0. Let's program the timer for owned PHY lanes for now. We can revisit this once we get clarification from the BSpec.

This might be the missing step that was causing the timeouts that we have recently seen during C20 SRAM register programming sequences. With this in place, we shouldn't need the logic to bump the timer thresholds, since now we have a documented value that should be set peform programming the registers. As such, let's also remove intel_cx0_bus_check_and_bump_timer(), but keep the part that checks if hardware really detected a timeout, which might be useful debugging information.

---
 drivers/gpu/drm/i915/display/intel_cx0_phy.c  | 88 +++++++++----------  .../gpu/drm/i915/display/intel_cx0_phy_regs.h |  2 +-
 2 files changed, 42 insertions(+), 48 deletions(-)
drivers/gpu/drm/i915/display/intel_cx0_phy.c +0 -2
index e6d3027c821d..1b0a868845b7 100644
@@ -29,8 +29,6 @@
 #define INTEL_CX0_LANE1                BIT(1)
 #define INTEL_CX0_BOTH_LANES        (INTEL_CX0_LANE1 | INTEL_CX0_LANE0)
 
-#define INTEL_CX0_MSGBUS_TIMER_BUMPED_VAL        0x200
-
 bool intel_is_c10phy(struct drm_i915_private *i915, enum phy phy)  {
         if (DISPLAY_VER_FULL(i915) == IP_VER(14, 0) && phy < PHY_C) @@ -73,19 +71,39 @@ assert_dc_off(struct
 drm_i915_private *i915)
         drm_WARN_ON(&i915->drm, !enabled);

}

drivers/gpu/drm/i915/display/intel_cx0_phy.c +22 -1
+static void intel_cx0_program_msgbus_timer(struct intel_encoder
+*encoder) {
+        int lane;
+        struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+        u8 owned_lane_mask = intel_cx0_get_owned_lane_mask(i915, encoder);
+
+        for_each_cx0_lane_in_mask(owned_lane_mask, lane)
+                intel_de_rmw(i915,
+                             XELPDP_PORT_MSGBUS_TIMER(encoder->port, lane),
+                             XELPDP_PORT_MSGBUS_TIMER_VAL_MASK,
+                             XELPDP_PORT_MSGBUS_TIMER_VAL);
+}
+
 /*
  * Prepare HW for CX0 phy transactions.
  *
  * It is required that PSR and DC5/6 are disabled before any CX0 message
  * bus transaction is executed.
+ *
+ * We also do the msgbus timer programming here to ensure that the
+ timer
+ * is already programmed before any access to the msgbus.
  */
 static intel_wakeref_t intel_cx0_phy_transaction_begin(struct intel_encoder *encoder)  {
+        intel_wakeref_t wakeref;
         struct drm_i915_private *i915 = to_i915(encoder->base.dev);
         struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
 
         intel_psr_pause(intel_dp);
-        return intel_display_power_get(i915, POWER_DOMAIN_DC_OFF);
+        wakeref = intel_display_power_get(i915, POWER_DOMAIN_DC_OFF);
+        intel_cx0_program_msgbus_timer(encoder);
+
+        return wakeref;
 }
 
 static void intel_cx0_phy_transaction_end(struct intel_encoder *encoder, intel_wakeref_t wakeref) @@ -121,42 +139,6 @@

static void intel_cx0_bus_reset(struct drm_i915_private *i915, enum port port, i

         intel_clear_response_ready_flag(i915, port, lane);  }
drivers/gpu/drm/i915/display/intel_cx0_phy.c +1 -37
-/*
- * Check if there was a timeout detected by the hardware in the message bus
- * and bump the threshold if so.
- */
-static void intel_cx0_bus_check_and_bump_timer(struct drm_i915_private *i915,
-                                               enum port port, int lane)
-{
-        enum phy phy = intel_port_to_phy(i915, port);
-        i915_reg_t reg;
-        u32 val;
-        u32 timer_val;
-
-        reg = XELPDP_PORT_MSGBUS_TIMER(port, lane);
-        val = intel_de_read(i915, reg);
-
-        if (!(val & XELPDP_PORT_MSGBUS_TIMER_TIMED_OUT)) {
-                drm_warn(&i915->drm,
-                         "PHY %c lane %d: hardware did not detect a timeout\n",
-                         phy_name(phy), lane);
-                return;
-        }
-
-        timer_val = REG_FIELD_GET(XELPDP_PORT_MSGBUS_TIMER_VAL_MASK, val);
-
-        if (timer_val == INTEL_CX0_MSGBUS_TIMER_BUMPED_VAL)
-                return;
-
-        val &= ~XELPDP_PORT_MSGBUS_TIMER_VAL_MASK;
-        val |= XELPDP_PORT_MSGBUS_TIMER_VAL(INTEL_CX0_MSGBUS_TIMER_BUMPED_VAL);
-
-        drm_dbg_kms(&i915->drm,
-                    "PHY %c lane %d: increasing msgbus timer threshold to %#x\n",
-                    phy_name(phy), lane, INTEL_CX0_MSGBUS_TIMER_BUMPED_VAL);
-        intel_de_write(i915, reg, val);
-}
-
 static int intel_cx0_wait_for_ack(struct drm_i915_private *i915, enum port port,
                                   int command, int lane, u32 *val)
 {
@@ -170,7 +152,13 @@ static int intel_cx0_wait_for_ack(struct drm_i915_private *i915, enum port port,
                                          XELPDP_MSGBUS_TIMEOUT_SLOW, val)) {
                 drm_dbg_kms(&i915->drm, "PHY %c Timeout waiting for message ACK. Status: 0x%x\n",
                             phy_name(phy), *val);
-                intel_cx0_bus_check_and_bump_timer(i915, port, lane);
+
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_cx0_phy.c static int intel_cx0_wait_for_ack(struct drm_i915_private *i915, enum port port, · line 161

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +6 -0
+                if (!(intel_de_read(i915, XELPDP_PORT_MSGBUS_TIMER(port, lane)) &
+                      XELPDP_PORT_MSGBUS_TIMER_TIMED_OUT))
+                        drm_warn(&i915->drm,
+                                 "PHY %c Hardware did not detect a timeout\n",
+                                 phy_name(phy));
+

drm_warn() seems a bit exaggerated here as we are informing only about not detecting timeout.

Okay. I'll send a new version changing it to use drm_dbg_kms(). Thanks!

Quoted 2 lines

Dbg message here might be sufficient. This is something that we could leave out as well. We already have information about the timeouts if these happen.

I think querying the hardware might give us helpful debugging info in future issues. A scenario that comes to mind is that we might *think* a timeout happened, but the hardware might disagree, which could be indicative that the hardware is somehow misconfigured or that we somehow are not waiting enough.

--
Gustavo Sousa

Quoted 87 lines

-Mika-

Quoted 83 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +14 -7
                 intel_cx0_bus_reset(i915, port, lane);
                 return -ETIMEDOUT;
         }
@@ -2737,39 +2725,45 @@ static void intel_cx0pll_enable(struct intel_encoder *encoder,
         intel_cx0_powerdown_change_sequence(i915, encoder->port, INTEL_CX0_BOTH_LANES,
                                             CX0_P2_STATE_READY);
 
-        /* 4. Program PHY internal PLL internal registers. */
+        /*
+         * 4. Program PORT_MSGBUS_TIMER register's Message Bus Timer field to 0xA000.
+         *    (This is done inside intel_cx0_phy_transaction_begin(), since we would need
+         *    the right timer thresholds for readouts too.)
+         */
+
+        /* 5. Program PHY internal PLL internal registers. */
         if (intel_is_c10phy(i915, phy))
                 intel_c10_pll_program(i915, crtc_state, encoder);
         else
                 intel_c20_pll_program(i915, crtc_state, encoder);
 
         /*
-         * 5. Program the enabled and disabled owned PHY lane
+         * 6. Program the enabled and disabled owned PHY lane
          * transmitters over message bus
          */
         intel_cx0_program_phy_lane(i915, encoder, crtc_state->lane_count, lane_reversal);
 
         /*
-         * 6. Follow the Display Voltage Frequency Switching - Sequence
+         * 7. Follow the Display Voltage Frequency Switching - Sequence
          * Before Frequency Change. We handle this step in bxt_set_cdclk().
          */
 
         /*
-         * 7. Program DDI_CLK_VALFREQ to match intended DDI
+         * 8. Program DDI_CLK_VALFREQ to match intended DDI
          * clock frequency.
          */
         intel_de_write(i915, DDI_CLK_VALFREQ(encoder->port),
                        crtc_state->port_clock);
 
         /*
-         * 8. Set PORT_CLOCK_CTL register PCLK PLL Request
+         * 9. Set PORT_CLOCK_CTL register PCLK PLL Request
          * LN<Lane for maxPCLK> to "1" to enable PLL.
          */
         intel_de_rmw(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
                      intel_cx0_get_pclk_pll_request(INTEL_CX0_BOTH_LANES),
                      intel_cx0_get_pclk_pll_request(maxpclk_lane));
 
-        /* 9. Poll on PORT_CLOCK_CTL PCLK PLL Ack LN<Lane for maxPCLK> == "1". */
+        /* 10. Poll on PORT_CLOCK_CTL PCLK PLL Ack LN<Lane for maxPCLK> ==
+"1". */
         if (__intel_de_wait_for_register(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),
                                          intel_cx0_get_pclk_pll_ack(INTEL_CX0_BOTH_LANES),
                                          intel_cx0_get_pclk_pll_ack(maxpclk_lane),
@@ -2778,7 +2772,7 @@ static void intel_cx0pll_enable(struct intel_encoder *encoder,
                          phy_name(phy), XELPDP_PCLK_PLL_ENABLE_TIMEOUT_US);
 
         /*
-         * 10. Follow the Display Voltage Frequency Switching Sequence After
+         * 11. Follow the Display Voltage Frequency Switching Sequence After
          * Frequency Change. We handle this step in bxt_set_cdclk().
          */
 
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +1 -1
index b2db4cc366d6..adf8f4ce0d49 100644
@@ -121,7 +121,7 @@
 
 _XELPDP_PORT_MSGBUS_TIMER_LN0_USBC2) + (lane) * 4)
 #define   XELPDP_PORT_MSGBUS_TIMER_TIMED_OUT                REG_BIT(31)
 #define   XELPDP_PORT_MSGBUS_TIMER_VAL_MASK                REG_GENMASK(23, 0)
-#define   XELPDP_PORT_MSGBUS_TIMER_VAL(val)                REG_FIELD_PREP(XELPDP_PORT_MSGBUS_TIMER_VAL_MASK,
 val)
+#define   XELPDP_PORT_MSGBUS_TIMER_VAL                        REG_FIELD_PREP(XELPDP_PORT_MSGBUS_TIMER_VAL_MASK,
 0xa000)

#define _XELPDP_PORT_CLOCK_CTL_A 0x640E0
#define _XELPDP_PORT_CLOCK_CTL_B 0x641E0
--
2.42.0