[SRU][R][PATCH 09/22] drm/i915/dp: Don't clobber the encoder state in the HPD IRQ handler

Werner Sembach wse at tuxedocomputers.com
Tue Aug 4 22:18:35 UTC 2026


From: Imre Deak <imre.deak at intel.com>

The intel_dp_get_dpcd() function called from an HPD IRQ handler reads
out the DPRX capabilities from the sink and updates these in the
intel_dp encoder state. Since the IRQ handler can run in parallel with
the encoder/connector detection (intel_dp_detect()) which also calls
intel_dp_get_dpcd(), the encoder state can get corrupted, since the two
updates happen in a racy way.

Fix the above by checking only for any change in the sink count value in
the HPD IRQ handler, without updating the encoder state.

Note that any state change in the sink requiring an update of the
encoder state is handled via the sink's SINK_COUNT change,
RX_CAPS_CHANGED, DOWNSTREAM_PORT_STATUS_CHANGED signaling, which all
should result in a full connector detection.

Reviewed-by: Luca Coelho <luciano.coelho at intel.com>
Signed-off-by: Imre Deak <imre.deak at intel.com>
Link: https://patch.msgid.link/20260225164618.1261368-8-imre.deak@intel.com
Signed-off-by: Werner Sembach <wse at tuxedocomputers.com>
---
 drivers/gpu/drm/i915/display/intel_dp.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index 97656a49db93b..e2bdbe30c1830 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -5735,9 +5735,7 @@ static bool intel_dp_check_link_service_irq(struct intel_dp *intel_dp)
 static bool
 intel_dp_short_pulse(struct intel_dp *intel_dp)
 {
-	u8 old_sink_count = intel_dp->sink_count;
 	bool reprobe_needed = false;
-	bool ret;
 
 	intel_dp_test_reset(intel_dp);
 
@@ -5747,12 +5745,10 @@ intel_dp_short_pulse(struct intel_dp *intel_dp)
 	 * the value that was stored earlier or dpcd read failed
 	 * we need to do full detection
 	 */
-	ret = intel_dp_get_dpcd(intel_dp);
-
-	if ((old_sink_count != intel_dp->sink_count) || !ret) {
+	if (intel_dp_has_sink_count(intel_dp) &&
+	    drm_dp_read_sink_count(&intel_dp->aux) != intel_dp->sink_count)
 		/* No need to proceed if we are going to do full detect */
 		return false;
-	}
 
 	intel_dp_check_device_service_irq(intel_dp);
 	reprobe_needed = intel_dp_check_link_service_irq(intel_dp);
-- 
2.43.0




More information about the kernel-team mailing list