public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Damien Lespiau <damien.lespiau@intel.com>
To: akash.goel@intel.com
Cc: ankitprasad.r.sharma@intel.com, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 3/5] drm/i915/skl: Restructured the gen6_set_rps_thresholds function
Date: Wed, 18 Feb 2015 17:58:23 +0000	[thread overview]
Message-ID: <20150218175823.GD7298@strange.ger.corp.intel.com> (raw)
In-Reply-To: <1424268078-14541-5-git-send-email-akash.goel@intel.com>

On Wed, Feb 18, 2015 at 07:31:15PM +0530, akash.goel@intel.com wrote:
> From: Akash Goel <akash.goel@intel.com>
> 
> Prior to SKL, the time period programmed in Up/Down EI & Up/Down
> threshold registers was in units of 1.28 micro seconds. But for
> SKL, the units have changed (1.333 micro seconds).
> Have generalized the implementation of gen6_set_rps_thresholds function,
> by removing the hard coding done in it as per 1.28 micro seconds.
> 
> v2: Renamed the local variables & removed superfluous comments (Chris)
> 
> Signed-off-by: Akash Goel <akash.goel@intel.com>

Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>

> ---
>  drivers/gpu/drm/i915/intel_pm.c | 68 +++++++++++++++++++----------------------
>  1 file changed, 32 insertions(+), 36 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 1df3fbd..78b4d62 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -3643,6 +3643,8 @@ static u32 gen6_rps_limits(struct drm_i915_private *dev_priv, u8 val)
>  static void gen6_set_rps_thresholds(struct drm_i915_private *dev_priv, u8 val)
>  {
>  	int new_power;
> +	u32 threshold_up = 0, threshold_down = 0; /* in % */
> +	u32 ei_up = 0, ei_down = 0;
>  
>  	new_power = dev_priv->rps.power;
>  	switch (dev_priv->rps.power) {
> @@ -3675,59 +3677,53 @@ static void gen6_set_rps_thresholds(struct drm_i915_private *dev_priv, u8 val)
>  	switch (new_power) {
>  	case LOW_POWER:
>  		/* Upclock if more than 95% busy over 16ms */
> -		I915_WRITE(GEN6_RP_UP_EI, 12500);
> -		I915_WRITE(GEN6_RP_UP_THRESHOLD, 11800);
> +		ei_up = 16000;
> +		threshold_up = 95;
>  
>  		/* Downclock if less than 85% busy over 32ms */
> -		I915_WRITE(GEN6_RP_DOWN_EI, 25000);
> -		I915_WRITE(GEN6_RP_DOWN_THRESHOLD, 21250);
> -
> -		I915_WRITE(GEN6_RP_CONTROL,
> -			   GEN6_RP_MEDIA_TURBO |
> -			   GEN6_RP_MEDIA_HW_NORMAL_MODE |
> -			   GEN6_RP_MEDIA_IS_GFX |
> -			   GEN6_RP_ENABLE |
> -			   GEN6_RP_UP_BUSY_AVG |
> -			   GEN6_RP_DOWN_IDLE_AVG);
> +		ei_down = 32000;
> +		threshold_down = 85;
>  		break;
>  
>  	case BETWEEN:
>  		/* Upclock if more than 90% busy over 13ms */
> -		I915_WRITE(GEN6_RP_UP_EI, 10250);
> -		I915_WRITE(GEN6_RP_UP_THRESHOLD, 9225);
> +		ei_up = 13000;
> +		threshold_up = 90;
>  
>  		/* Downclock if less than 75% busy over 32ms */
> -		I915_WRITE(GEN6_RP_DOWN_EI, 25000);
> -		I915_WRITE(GEN6_RP_DOWN_THRESHOLD, 18750);
> -
> -		I915_WRITE(GEN6_RP_CONTROL,
> -			   GEN6_RP_MEDIA_TURBO |
> -			   GEN6_RP_MEDIA_HW_NORMAL_MODE |
> -			   GEN6_RP_MEDIA_IS_GFX |
> -			   GEN6_RP_ENABLE |
> -			   GEN6_RP_UP_BUSY_AVG |
> -			   GEN6_RP_DOWN_IDLE_AVG);
> +		ei_down = 32000;
> +		threshold_down = 75;
>  		break;
>  
>  	case HIGH_POWER:
>  		/* Upclock if more than 85% busy over 10ms */
> -		I915_WRITE(GEN6_RP_UP_EI, 8000);
> -		I915_WRITE(GEN6_RP_UP_THRESHOLD, 6800);
> +		ei_up = 10000;
> +		threshold_up = 85;
>  
>  		/* Downclock if less than 60% busy over 32ms */
> -		I915_WRITE(GEN6_RP_DOWN_EI, 25000);
> -		I915_WRITE(GEN6_RP_DOWN_THRESHOLD, 15000);
> -
> -		I915_WRITE(GEN6_RP_CONTROL,
> -			   GEN6_RP_MEDIA_TURBO |
> -			   GEN6_RP_MEDIA_HW_NORMAL_MODE |
> -			   GEN6_RP_MEDIA_IS_GFX |
> -			   GEN6_RP_ENABLE |
> -			   GEN6_RP_UP_BUSY_AVG |
> -			   GEN6_RP_DOWN_IDLE_AVG);
> +		ei_down = 32000;
> +		threshold_down = 60;
>  		break;
>  	}
>  
> +	I915_WRITE(GEN6_RP_UP_EI,
> +		GT_INTERVAL_FROM_US(ei_up));
> +	I915_WRITE(GEN6_RP_UP_THRESHOLD,
> +		GT_INTERVAL_FROM_US((ei_up * threshold_up / 100)));
> +
> +	I915_WRITE(GEN6_RP_DOWN_EI,
> +		GT_INTERVAL_FROM_US(ei_down));
> +	I915_WRITE(GEN6_RP_DOWN_THRESHOLD,
> +		GT_INTERVAL_FROM_US((ei_down * threshold_down / 100)));
> +
> +	 I915_WRITE(GEN6_RP_CONTROL,
> +		    GEN6_RP_MEDIA_TURBO |
> +		    GEN6_RP_MEDIA_HW_NORMAL_MODE |
> +		    GEN6_RP_MEDIA_IS_GFX |
> +		    GEN6_RP_ENABLE |
> +		    GEN6_RP_UP_BUSY_AVG |
> +		    GEN6_RP_DOWN_IDLE_AVG);
> +
>  	dev_priv->rps.power = new_power;
>  	dev_priv->rps.last_adj = 0;
>  }
> -- 
> 1.9.2
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-02-18 17:58 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-18 14:01 [PATCH 2/7] drm/i915/skl: Updated the gen6_set_rps function akash.goel
2015-02-18 14:01 ` [PATCH 7/7] drm/i915/skl: Enabling processing of Turbo interrupts akash.goel
2015-02-18 14:01 ` [PATCH v2 0/7] Added missing changes for Turbo feature on SKL akash.goel
2015-02-24 14:58   ` Damien Lespiau
2015-02-18 14:01 ` [PATCH v2 1/5] drm/i915/skl: Added new macros akash.goel
2015-02-18 17:41   ` Damien Lespiau
2015-02-18 14:01 ` [PATCH v2 3/5] drm/i915/skl: Restructured the gen6_set_rps_thresholds function akash.goel
2015-02-18 17:58   ` Damien Lespiau [this message]
2015-02-18 14:01 ` [PATCH v2 4/5] drm/i915/skl: Updated the gen6_rps_limits function akash.goel
2015-02-18 14:01 ` [PATCH v2 5/5] drm/i915/skl: Updated the gen9_enable_rps function akash.goel
2015-02-18 17:10   ` shuang.he
2015-02-24 14:53   ` Damien Lespiau
2015-02-18 14:01 ` [PATCH v2 6/7] drm/i915/skl: Updated the 'i915_frequency_info' debugs function akash.goel
2015-02-18 18:12   ` Damien Lespiau
2015-02-24 16:10   ` Ville Syrjälä
2015-02-25  4:22     ` Akash Goel
2015-02-24 16:16   ` Ville Syrjälä
2015-02-23 23:29 ` [PATCH 2/7] drm/i915/skl: Updated the gen6_set_rps function Daniel Vetter
2015-02-24 15:22 ` Damien Lespiau
2015-02-24 20:55   ` Daniel Vetter

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=20150218175823.GD7298@strange.ger.corp.intel.com \
    --to=damien.lespiau@intel.com \
    --cc=akash.goel@intel.com \
    --cc=ankitprasad.r.sharma@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /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