public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: ville.syrjala@linux.intel.com
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 3/4] drm/i915: Simplify vlv/chv rc6 residency calculation
Date: Mon, 28 Sep 2015 22:37:52 +0300	[thread overview]
Message-ID: <1443469072.3990.22.camel@intel.com> (raw)
In-Reply-To: <1443126560-26006-4-git-send-email-ville.syrjala@linux.intel.com>

On Thu, 2015-09-24 at 23:29 +0300, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> We have the czclk freqeuency in dev_priv now, so let's just use it
                   ^frequency
> when converting the rc6 counters to milliseconds. This elimiantes
                                                        ^eliminates
> a bunch of hairy code that essentially tries to extract the czclk
> frequency using yet another method.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Imre Deak <imre.deak@intel.com>

> ---
>  drivers/gpu/drm/i915/i915_sysfs.c | 31 +++----------------------------
>  1 file changed, 3 insertions(+), 28 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c
> index 55bd04c..74086eb 100644
> --- a/drivers/gpu/drm/i915/i915_sysfs.c
> +++ b/drivers/gpu/drm/i915/i915_sysfs.c
> @@ -39,7 +39,7 @@ static u32 calc_residency(struct drm_device *dev, const u32 reg)
>  {
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	u64 raw_time; /* 32b value may overflow during fixed point math */
> -	u64 units = 128ULL, div = 100000ULL, bias = 100ULL;
> +	u64 units = 128ULL, div = 100000ULL;
>  	u32 ret;
>  
>  	if (!intel_enable_rc6(dev))
> @@ -49,41 +49,16 @@ static u32 calc_residency(struct drm_device *dev, const u32 reg)
>  
>  	/* On VLV and CHV, residency time is in CZ units rather than 1.28us */
>  	if (IS_VALLEYVIEW(dev)) {
> -		u32 clk_reg, czcount_30ns;
> -
> -		if (IS_CHERRYVIEW(dev))
> -			clk_reg = CHV_CLK_CTL1;
> -		else
> -			clk_reg = VLV_CLK_CTL2;
> -
> -		czcount_30ns = I915_READ(clk_reg) >> CLK_CTL2_CZCOUNT_30NS_SHIFT;
> -
> -		if (!czcount_30ns) {
> -			WARN(!czcount_30ns, "bogus CZ count value");
> -			ret = 0;
> -			goto out;
> -		}
> -
> -		if (IS_CHERRYVIEW(dev) && czcount_30ns == 1) {
> -			/* Special case for 320Mhz */
> -			div = 10000000ULL;
> -			units = 3125ULL;
> -		} else {
> -			czcount_30ns += 1;
> -			div = 1000000ULL;
> -			units = DIV_ROUND_UP_ULL(30ULL * bias, czcount_30ns);
> -		}
> +		units = 1;
> +		div = dev_priv->czclk_freq;
>  
>  		if (I915_READ(VLV_COUNTER_CONTROL) & VLV_COUNT_RANGE_HIGH)
>  			units <<= 8;
> -
> -		div = div * bias;
>  	}
>  
>  	raw_time = I915_READ(reg) * units;
>  	ret = DIV_ROUND_UP_ULL(raw_time, div);
>  
> -out:
>  	intel_runtime_pm_put(dev_priv);
>  	return ret;
>  }


_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-09-28 19:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-24 20:29 [PATCH 0/4] drm/i915: Read czclk from cck on vlv/chv ville.syrjala
2015-09-24 20:29 ` [PATCH 1/4] drm/i915: Renaming CCK related reg definitions ville.syrjala
2015-09-24 20:29 ` [PATCH 2/4] drm/i915: Read czclk from CCK on vlv/chv ville.syrjala
2015-09-28 19:31   ` Imre Deak
2015-09-28 20:29     ` Ville Syrjälä
2015-09-24 20:29 ` [PATCH 3/4] drm/i915: Simplify vlv/chv rc6 residency calculation ville.syrjala
2015-09-28 19:37   ` Imre Deak [this message]
2015-09-28 20:31     ` Ville Syrjälä
2015-09-28 20:43   ` [PATCH v2 " ville.syrjala
2015-09-24 20:29 ` [PATCH 4/4] drm/i915: Use czclk_freq in vlv c0 residency calculations ville.syrjala
2015-09-28 20:47   ` Imre Deak
2015-09-28 21:46     ` Imre Deak
2015-09-29  9:08       ` Daniel Vetter
2015-09-29 12:29     ` Ville Syrjälä

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=1443469072.3990.22.camel@intel.com \
    --to=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.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