Limit the link training clock recovery loop to 10 failed attempts at LANEx_CR_DONE per DP 1.4 spec. Some USB-C MST hubs cause us to get stuck in this loop on hot-plugging indefinitely as drm_dp_clock_recovery_ok() never returns true and none of the other conditions occur. Signed-off-by: Nathan Ciobanu <nathan.d.ciobanu@xxxxxxxxxxxxxxx> --- drivers/gpu/drm/i915/intel_dp_link_training.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_dp_link_training.c b/drivers/gpu/drm/i915/intel_dp_link_training.c index 4da6e33c7fa1..66c1a70343ba 100644 --- a/drivers/gpu/drm/i915/intel_dp_link_training.c +++ b/drivers/gpu/drm/i915/intel_dp_link_training.c @@ -129,7 +129,7 @@ static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp) intel_dp_link_training_clock_recovery(struct intel_dp *intel_dp) { uint8_t voltage; - int voltage_tries, max_vswing_tries; + int voltage_tries, max_vswing_tries, cr_tries; uint8_t link_config[2]; uint8_t link_bw, rate_select; @@ -172,6 +172,7 @@ static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp) voltage_tries = 1; max_vswing_tries = 0; + cr_tries = 0; for (;;) { uint8_t link_status[DP_LINK_STATUS_SIZE]; @@ -215,6 +216,11 @@ static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp) if (intel_dp_link_max_vswing_reached(intel_dp)) ++max_vswing_tries; + if (cr_tries == 9) { + DRM_ERROR("Failed clock recovery 10 times, giving up!\n"); + return false; + } + ++cr_tries; } } -- 1.9.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx