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: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 5/7] drm/i915/skl: Updated the gen9_enable_rps function
Date: Tue, 17 Feb 2015 15:47:02 +0000	[thread overview]
Message-ID: <20150217154701.GF18727@strange.ger.corp.intel.com> (raw)
In-Reply-To: <1423234598-14781-6-git-send-email-akash.goel@intel.com>

On Fri, Feb 06, 2015 at 08:26:36PM +0530, akash.goel@intel.com wrote:
> From: Akash Goel <akash.goel@intel.com>
> 
> On SKL, GT frequency is programmed in units of 16.66 MHZ units compared
> to 50 MHZ for older platforms. Also the time value specified for Up/Down EI &
> Up/Down thresholds are expressed in units of 1.33 us, compared to 1.28
> us for older platforms. So updated the gen9_enable_rps function as per that.
> 
> Signed-off-by: Akash Goel <akash.goel@intel.com>

The function was following exactly what is in the PM programming guide,
so it should be correct, not sure we want to change that. Your version
looks more readable though. 

I think I'd rather keep the close to the PM guide, but others may
disagree.

-- 
Damien

> ---
>  drivers/gpu/drm/i915/intel_pm.c | 41 ++++++++++++++++++++++++++++++++---------
>  1 file changed, 32 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index db24b48..865df1f 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -4037,27 +4037,50 @@ static void gen6_init_rps_frequencies(struct drm_device *dev)
>  static void gen9_enable_rps(struct drm_device *dev)
>  {
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> +	u32 threshold_up_pct, threshold_down_pct;
> +	u32 ei_up, ei_down;
>  
>  	intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL);
>  
>  	gen6_init_rps_frequencies(dev);
>  
> -	I915_WRITE(GEN6_RPNSWREQ, 0xc800000);
> -	I915_WRITE(GEN6_RC_VIDEO_FREQ, 0xc800000);
> +	/* Program defaults and thresholds for RPS*/
> +	I915_WRITE(GEN6_RPNSWREQ,
> +		GEN9_FREQUENCY(dev_priv->rps.rp1_freq * GEN9_FREQ_SCALER));
> +	I915_WRITE(GEN6_RC_VIDEO_FREQ,
> +		GEN9_FREQUENCY(dev_priv->rps.rp1_freq * GEN9_FREQ_SCALER));
> +
> +	ei_up = 84480; /* 84.48ms */
> +	ei_down = 448000;
> +	threshold_up_pct = 90; /* x% */
> +	threshold_down_pct = 70;
> +
> +	I915_WRITE(GEN6_RP_UP_EI,
> +		GT_FREQ_FROM_PERIOD(ei_up, dev));
> +	I915_WRITE(GEN6_RP_UP_THRESHOLD,
> +		GT_FREQ_FROM_PERIOD((ei_up * threshold_up_pct / 100), dev));
> +
> +	I915_WRITE(GEN6_RP_DOWN_EI,
> +		GT_FREQ_FROM_PERIOD(ei_down, dev));
> +	I915_WRITE(GEN6_RP_DOWN_THRESHOLD,
> +		GT_FREQ_FROM_PERIOD((ei_down * threshold_down_pct / 100), dev));
> +
> +	/* 1 second timeout*/
> +	I915_WRITE(GEN6_RP_DOWN_TIMEOUT, GT_FREQ_FROM_PERIOD(1000000, dev));
> +
> +	I915_WRITE(GEN6_RP_INTERRUPT_LIMITS,
> +		(dev_priv->rps.max_freq_softlimit * GEN9_FREQ_SCALER) << 23 |
> +		(dev_priv->rps.min_freq_softlimit * GEN9_FREQ_SCALER) << 14);
>  
> -	I915_WRITE(GEN6_RP_DOWN_TIMEOUT, 0xf4240);
> -	I915_WRITE(GEN6_RP_INTERRUPT_LIMITS, 0x12060000);
> -	I915_WRITE(GEN6_RP_UP_THRESHOLD, 0xe808);
> -	I915_WRITE(GEN6_RP_DOWN_THRESHOLD, 0x3bd08);
> -	I915_WRITE(GEN6_RP_UP_EI, 0x101d0);
> -	I915_WRITE(GEN6_RP_DOWN_EI, 0x55730);
>  	I915_WRITE(GEN6_RP_IDLE_HYSTERSIS, 0xa);
> -	I915_WRITE(GEN6_PMINTRMSK, 0x6);
>  	I915_WRITE(GEN6_RP_CONTROL, GEN6_RP_MEDIA_TURBO |
>  		   GEN6_RP_MEDIA_HW_MODE | GEN6_RP_MEDIA_IS_GFX |
>  		   GEN6_RP_ENABLE | GEN6_RP_UP_BUSY_AVG |
>  		   GEN6_RP_DOWN_IDLE_AVG);
>  
> +	dev_priv->rps.power = HIGH_POWER; /* force a reset */
> +	gen6_set_rps(dev_priv->dev, dev_priv->rps.min_freq_softlimit);
> +
>  	gen6_enable_rps_interrupts(dev);
>  
>  	intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
> -- 
> 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-17 15:47 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-06 14:56 [PATCH 0/7] Added missing changes for Turbo feature on SKL akash.goel
2015-02-06 14:56 ` [PATCH 1/7] drm/i915/skl: Added new macros akash.goel
2015-02-16 19:05   ` Damien Lespiau
2015-02-17 14:40   ` Damien Lespiau
2015-02-17 15:20     ` Goel, Akash
2015-02-17 15:26       ` Damien Lespiau
2015-02-17 15:32         ` Goel, Akash
2015-02-23 16:21           ` Daniel Vetter
2015-02-23 16:22             ` Damien Lespiau
2015-02-06 14:56 ` [PATCH 2/7] drm/i915/skl: Updated the gen6_set_rps function akash.goel
2015-02-17 14:31   ` Damien Lespiau
2015-02-17 15:08     ` Damien Lespiau
2015-02-06 14:56 ` [PATCH 3/7] drm/i915/skl: Restructured the gen6_set_rps_thresholds function akash.goel
2015-02-06 15:48   ` Chris Wilson
2015-02-09  4:51     ` Akash Goel
2015-02-06 14:56 ` [PATCH 4/7] drm/i915/skl: Updated the gen6_rps_limits function akash.goel
2015-02-06 15:43   ` Chris Wilson
2015-02-09  4:56     ` Akash Goel
2015-02-09 11:03       ` Chris Wilson
2015-02-09 11:33         ` Akash Goel
2015-02-17 14:44   ` Damien Lespiau
2015-02-17 15:01     ` Damien Lespiau
2015-02-17 15:10       ` Damien Lespiau
2015-02-06 14:56 ` [PATCH 5/7] drm/i915/skl: Updated the gen9_enable_rps function akash.goel
2015-02-17 15:47   ` Damien Lespiau [this message]
2015-02-18  4:59     ` Akash Goel
2015-02-06 14:56 ` [PATCH 6/7] drm/i915/skl: Updated the 'i915_frequency_info' debugs function akash.goel
2015-02-17 15:38   ` Damien Lespiau
2015-02-18  6:47     ` Akash Goel
2015-02-06 14:56 ` [PATCH 7/7] drm/i915/skl: Enabling processing of Turbo interrupts akash.goel
2015-02-06 19:40   ` shuang.he
2015-02-17 15:38   ` Damien Lespiau
2015-02-17 15:51 ` [PATCH 0/7] Added missing changes for Turbo feature on SKL Damien Lespiau

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=20150217154701.GF18727@strange.ger.corp.intel.com \
    --to=damien.lespiau@intel.com \
    --cc=akash.goel@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