intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
To: "José Roberto de Souza" <jose.souza@intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 8/9] drm/i915/dp: Improve intel_dp_aux_is_busy()
Date: Tue, 08 May 2018 15:10:36 -0700	[thread overview]
Message-ID: <1525817436.3123.16.camel@intel.com> (raw)
In-Reply-To: <20180418224311.16577-8-jose.souza@intel.com>

On Wed, 2018-04-18 at 15:43 -0700, José Roberto de Souza wrote:
> - Doing earlier return when not busy
> - using u32 instead of uint32_t
> - counting from 3 to 0 as it is is the most common in the driver
Hmm. I see more instances that increment the loop variable than the
opposite.

> - using DRM_WARN() instead of WARN()
Why? WARN and WARN_ON's are common afaict

> - adding aux port name to the debug message
Sounds like a good idea.

> - nuking last_status, it is one static variable to all DP ports
> also 2 different aux transactions with the same message size would
> have the same ch_ctl value, if really desired to reduce the number
> of debug messages it should be implemented a per aux ch last_status
Makes sense to do this.

> - no need to sleep in the last try
> - sleeping for 1 aux ch transaction time
Was this determined based on the clock speed or is it in the spec? I
see numbers for timeout, nothing for the transaction itself.


This patch mixes up functional changes with non-functional ones. I'd
prefer you split these changes.


> 
> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
> Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> ---
> 
> New patch in this series.
> 
>  drivers/gpu/drm/i915/intel_dp.c | 23 ++++++++---------------
>  1 file changed, 8 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c
> b/drivers/gpu/drm/i915/intel_dp.c
> index a11465c62950..258e23961456 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -1068,28 +1068,21 @@ static bool intel_dp_aux_is_busy(struct
> intel_dp *intel_dp)
>  	struct drm_i915_private *dev_priv =
>  			to_i915(intel_dig_port->base.base.dev);
>  	i915_reg_t ch_ctl;
> -	uint32_t status;
> -	int try;
> +	u32 status;
> +	unsigned int try;
>  
>  	ch_ctl = intel_dp->aux_ch_ctl_reg(intel_dp);
>  
> -	for (try = 0; try < 3; try++) {
> +	for (try = 3; try; try--) {
>  		status = I915_READ_NOTRACE(ch_ctl);
>  		if ((status & DP_AUX_CH_CTL_SEND_BUSY) == 0)
> -			break;
> -		msleep(1);
> +			return false;
> +		if (try > 1)
> +			usleep_range(400, 500);
>  	}
>  
> -	if (try == 3) {
> -		static u32 last_status = -1;
> -		const u32 status = I915_READ(ch_ctl);
> -
> -		if (status != last_status) {
> -			WARN(1, "dp_aux_ch not started status
> 0x%08x\n",
> -			     status);
> -			last_status = status;
> -		}
> -	}
> +	DRM_WARN("DP aux %c is busy 0x%08x\n",
> +		 aux_ch_name(intel_dp->aux_ch), status);
>  
>  	return true;
>  }
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-05-08 21:45 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-18 22:43 [PATCH v2 1/9] drm/i915/psr: Move specific HSW+ WARN_ON to HSW+ function José Roberto de Souza
2018-04-18 22:43 ` [PATCH v2 2/9] drm/i915/psr: Move PSR exit specific code to hardware specific function José Roberto de Souza
2018-05-16  0:42   ` Dhinakaran Pandiyan
2018-04-18 22:43 ` [PATCH v2 3/9] drm/i915/psr: Remove intel_crtc_state parameter from disable() José Roberto de Souza
2018-04-19 11:18   ` Ville Syrjälä
2018-04-18 22:43 ` [PATCH v2 4/9] drm/i915/psr: Begin to handle PSR/PSR2 errors set by sink José Roberto de Souza
2018-04-26 22:29   ` Dhinakaran Pandiyan
2018-04-30 23:02     ` Souza, Jose
2018-04-18 22:43 ` [PATCH v2 5/9] drm/i915/psr: Handle PSR RFB storage error José Roberto de Souza
2018-04-26 22:37   ` Dhinakaran Pandiyan
2018-04-30 23:28     ` Souza, Jose
2018-05-08 22:16       ` Dhinakaran Pandiyan
2018-04-18 22:43 ` [PATCH v2 6/9] drm/i915/psr/bdw+: Enable CRC check in the static frame on the sink side José Roberto de Souza
2018-04-20 21:16   ` Rodrigo Vivi
2018-04-25 21:02     ` Souza, Jose
2018-05-16  0:38   ` Dhinakaran Pandiyan
2018-04-18 22:43 ` [PATCH v2 7/9] drm/i915/dp: Move code to check if aux ch is busy to a function José Roberto de Souza
2018-04-26 22:51   ` Dhinakaran Pandiyan
2018-04-30 23:39     ` Souza, Jose
2018-05-08 21:29       ` Pandiyan, Dhinakaran
2018-04-18 22:43 ` [PATCH v2 8/9] drm/i915/dp: Improve intel_dp_aux_is_busy() José Roberto de Souza
2018-05-08 22:10   ` Dhinakaran Pandiyan [this message]
2018-04-18 22:43 ` [PATCH v2 9/9] drm/i915/dp: Avoid concurrent access when HW is using aux ch José Roberto de Souza
2018-04-18 22:48 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [v2,1/9] drm/i915/psr: Move specific HSW+ WARN_ON to HSW+ function Patchwork
2018-04-18 22:51 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-04-18 23:09 ` ✓ Fi.CI.BAT: success " Patchwork
2018-04-19  0:53 ` ✗ Fi.CI.IGT: failure " Patchwork
2018-04-26  0:41 ` [PATCH v2 1/9] " Dhinakaran Pandiyan
2018-04-30 22:54   ` Souza, Jose

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=1525817436.3123.16.camel@intel.com \
    --to=dhinakaran.pandiyan@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jose.souza@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;
as well as URLs for NNTP newsgroup(s).