]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/i915/dp: Don't clobber the encoder state in the HPD IRQ handler
authorImre Deak <imre.deak@intel.com>
Wed, 25 Feb 2026 16:46:05 +0000 (18:46 +0200)
committerImre Deak <imre.deak@intel.com>
Tue, 3 Mar 2026 15:49:05 +0000 (17:49 +0200)
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@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://patch.msgid.link/20260225164618.1261368-8-imre.deak@intel.com
drivers/gpu/drm/i915/display/intel_dp.c

index 73703cd6e1cc879e3716948302966ebf8991cad5..7a89f26f2db74effa1af46d4001e19a858afebe2 100644 (file)
@@ -5856,9 +5856,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);
 
@@ -5868,12 +5866,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);