From: Imre Deak <imre.d...@gmail.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. Signed-off-by: Imre Deak <imre.d...@gmail.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 7d8421649be0d..2592afb96ab58 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -5464,9 +5464,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); @@ -5476,12 +5474,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.44.2