Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
To: Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Nathan Ciobanu <nathan.d.ciobanu@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915/dp: Give up link training clock recovery after 10 failed attempts
Date: Fri, 13 Jul 2018 15:23:41 -0700	[thread overview]
Message-ID: <1531520621.7606.50.camel@intel.com> (raw)
In-Reply-To: <20180713212203.GG21149@intel.com>

On Fri, 2018-07-13 at 14:22 -0700, Rodrigo Vivi wrote:
> On Fri, Jul 13, 2018 at 10:32:15AM -0700, Nathan Ciobanu wrote:
> > 
> > Limit the link training clock recovery loop to 10 failed attempts
> > at
> > LANEx_CR_DONE per DP 1.4 spec.
> Where exactly in the spec?
> 
> > 
> > Some USB-C MST hubs cause us to get
> > stuck in this loop on hot-plugging indefinitely as

Also include the information (the vswing toggling part) about why it is
stuck in the loop. 

> > drm_dp_clock_recovery_ok() never returns true and none of the
> > other conditions occur.
> Although it seems really bad situation that we need to avoid...
> 
> > 
> > 
> > Signed-off-by: Nathan Ciobanu <nathan.d.ciobanu@linux.intel.com>
> > ---
> >  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;
> If I understood correctly this is a global thing for the for(;;)
> right?
> 
> Shouldn't we make then like a:
> 
> - for(;;)
> + for(cr_tries = 0; cr_tries < 10; cr_tries++)
> 	{
> 	}
> 
> + DRM_ERROR("Failed clock recovery 10 times, giving up!\n"); 
> + return false;
> }
> 
> Thanks,
> Rodrigo.
> 
> > 
> >  	}
> >  }
> >  
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-07-13 21:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-13 17:32 [PATCH] drm/i915/dp: Give up link training clock recovery after 10 failed attempts Nathan Ciobanu
2018-07-13 18:25 ` ✓ Fi.CI.BAT: success for " Patchwork
2018-07-13 21:22 ` [PATCH] " Rodrigo Vivi
2018-07-13 22:23   ` Dhinakaran Pandiyan [this message]
2018-07-13 22:18     ` Manasi Navare
2018-07-13 23:17       ` Nathan Ciobanu
2018-07-13 22:49   ` Nathan Ciobanu

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=1531520621.7606.50.camel@intel.com \
    --to=dhinakaran.pandiyan@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=nathan.d.ciobanu@linux.intel.com \
    --cc=rodrigo.vivi@intel.com \
    /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