Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: [PATCH v3 3/5] drm/i915/dp: Fix link training interrupted by a short HPD pulse
Date: Wed, 26 Feb 2025 19:19:21 +0200	[thread overview]
Message-ID: <20250226171924.2646997-4-imre.deak@intel.com> (raw)
In-Reply-To: <20250226171924.2646997-1-imre.deak@intel.com>

During Display Port link training the handling of HPD pulses should be
prevented, as that handling can interfere with the link training:

- Accessing DPCD registers outside the range of link training registers
  are not allowed by the Standard (see DP Standard v2.1, 3.5.2.16.1,
  3.6.6.1). The pulse handler reads the DPRX capability registers, which
  are outside of the allowed range.
- Switching of the LTTPR transparent/non-transparent mode may reset the
  LTTPRs on the link, thus aborting any ongoing link training. The pulse
  handler does set the LTTPR mode, thus it could unexpectedly abort the
  ongoing link training.

Block/unblock the HPD pulse handling for the duration of the link
training to prevent the above DPCD register accesses / LTTPR mode
change.

Apart from the above scenarios, there are other ways a non-link training
DPCD register could be accessed during link training: via the DRM AUX
device node, or via DPCD register probing (as performed by
drm_dp_dpcd_probe()). These will be addressed by a follow-up change.

v2: Rebase on the intel_hpd_suspend/resume -> intel_hpd_block/unblock()
    rename change.

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

diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_training.c b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
index 66fcd90f00282..ce0601a4f0e20 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_link_training.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
@@ -1109,6 +1109,8 @@ intel_dp_128b132b_intra_hop(struct intel_dp *intel_dp,
 void intel_dp_stop_link_train(struct intel_dp *intel_dp,
 			      const struct intel_crtc_state *crtc_state)
 {
+	struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base;
+
 	intel_dp->link_trained = true;
 
 	intel_dp_disable_dpcd_training_pattern(intel_dp, DP_PHY_DPRX);
@@ -1119,6 +1121,8 @@ void intel_dp_stop_link_train(struct intel_dp *intel_dp,
 	    wait_for(intel_dp_128b132b_intra_hop(intel_dp, crtc_state) == 0, 500)) {
 		lt_dbg(intel_dp, DP_PHY_DPRX, "128b/132b intra-hop not clearing\n");
 	}
+
+	intel_hpd_unblock(encoder);
 }
 
 static bool
@@ -1601,7 +1605,11 @@ void intel_dp_start_link_train(struct intel_atomic_state *state,
 	 * non-transparent mode. During an earlier LTTPR detection this
 	 * could've been prevented by an active link.
 	 */
-	int lttpr_count = intel_dp_init_lttpr_and_dprx_caps(intel_dp);
+	int lttpr_count;
+
+	intel_hpd_block(encoder);
+
+	lttpr_count = intel_dp_init_lttpr_and_dprx_caps(intel_dp);
 
 	if (lttpr_count < 0)
 		/* Still continue with enabling the port and link training. */
-- 
2.44.2


  parent reply	other threads:[~2025-02-26 17:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-26 17:19 [PATCH v3 0/5] drm/dp: Fix link training interrupted by HPD pulse Imre Deak
2025-02-26 17:19 ` [PATCH v3 1/5] drm/i915/hpd: Let an HPD pin be in the disabled state when handling missed IRQs Imre Deak
2025-02-26 17:19 ` [PATCH v3 2/5] drm/i915/hpd: Add support for blocking the IRQ handling on an HPD pin Imre Deak
2025-02-26 17:35   ` [PATCH v4 " Imre Deak
2025-02-28 17:25     ` Ville Syrjälä
2025-02-28 20:04       ` Imre Deak
2025-02-26 17:19 ` Imre Deak [this message]
2025-02-26 17:19 ` [PATCH v3 4/5] drm/i915/dp: Queue a link check after link training is complete Imre Deak
2025-02-26 17:19 ` [PATCH v3 5/5] drm/i915/crt: Use intel_hpd_block/unblock() instead of intel_hpd_disable/enable() Imre Deak
2025-02-26 19:23 ` ✓ CI.Patch_applied: success for drm/dp: Fix link training interrupted by HPD pulse (rev5) Patchwork
2025-02-26 19:23 ` ✓ CI.checkpatch: " Patchwork
2025-02-26 19:24 ` ✓ CI.KUnit: " Patchwork
2025-02-26 19:41 ` ✓ CI.Build: " Patchwork
2025-02-26 19:43 ` ✓ CI.Hooks: " Patchwork
2025-02-26 19:45 ` ✗ CI.checksparse: warning " Patchwork
2025-02-26 20:04 ` ✓ Xe.CI.BAT: success " Patchwork
2025-02-26 21:17 ` ✗ Xe.CI.Full: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250226171924.2646997-4-imre.deak@intel.com \
    --to=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox