All of lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: Bob Paauwe <bob.j.paauwe@intel.com>
Cc: intel-gfx <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH] drm/i915: Update rps frequencies for BXT
Date: Fri, 26 Jun 2015 15:52:42 +0300	[thread overview]
Message-ID: <1435323162.20855.21.camel@intel.com> (raw)
In-Reply-To: <1435269247-31910-1-git-send-email-bob.j.paauwe@intel.com>

On to, 2015-06-25 at 14:54 -0700, Bob Paauwe wrote:
> Broxton is using a different register and different bit ordering
> for rps status capabilities.
> 
> Also GT perf freqency register is different for Broxton so update
> that.
> 
> Signed-off-by: Bob Paauwe <bob.j.paauwe@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_debugfs.c | 21 ++++++++++++++++-----
>  drivers/gpu/drm/i915/i915_reg.h     |  2 ++
>  drivers/gpu/drm/i915/intel_pm.c     | 16 ++++++++++++----
>  3 files changed, 30 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index f3b8062..8a2a456a 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -1132,9 +1132,9 @@ static int i915_frequency_info(struct seq_file *m, void *unused)
>  			   (rgvstat & MEMSTAT_PSTATE_MASK) >> MEMSTAT_PSTATE_SHIFT);
>  	} else if (IS_GEN6(dev) || (IS_GEN7(dev) && !IS_VALLEYVIEW(dev)) ||
>  		   IS_BROADWELL(dev) || IS_GEN9(dev)) {
> -		u32 gt_perf_status = I915_READ(GEN6_GT_PERF_STATUS);
> -		u32 rp_state_limits = I915_READ(GEN6_RP_STATE_LIMITS);
> -		u32 rp_state_cap = I915_READ(GEN6_RP_STATE_CAP);
> +		u32 rp_state_limits;
> +		u32 gt_perf_status;
> +		u32 rp_state_cap;
>  		u32 rpmodectl, rpinclimit, rpdeclimit;
>  		u32 rpstat, cagf, reqf;
>  		u32 rpupei, rpcurup, rpprevup;
> @@ -1142,6 +1142,15 @@ static int i915_frequency_info(struct seq_file *m, void *unused)
>  		u32 pm_ier, pm_imr, pm_isr, pm_iir, pm_mask;
>  		int max_freq;
>  
> +		rp_state_limits = I915_READ(GEN6_RP_STATE_LIMITS);
> +		if (IS_BROXTON(dev)) {
> +			rp_state_cap = I915_READ(BXT_RP_STATE_CAP);
> +			gt_perf_status = I915_READ(BXT_GT_PERF_STATUS);
> +		} else {
> +			rp_state_cap = I915_READ(GEN6_RP_STATE_CAP);
> +			gt_perf_status = I915_READ(GEN6_GT_PERF_STATUS);
> +		}
> +
>  		/* RPSTAT1 is in the GT power well */
>  		ret = mutex_lock_interruptible(&dev->struct_mutex);
>  		if (ret)
> @@ -1229,7 +1238,8 @@ static int i915_frequency_info(struct seq_file *m, void *unused)
>  		seq_printf(m, "Down threshold: %d%%\n",
>  			   dev_priv->rps.down_threshold);
>  
> -		max_freq = (rp_state_cap & 0xff0000) >> 16;
> +		max_freq = (IS_BROXTON(dev) ? rp_state_cap >> 0 :
> +			    rp_state_cap >> 16) & 0xff;
>  		max_freq *= (IS_SKYLAKE(dev) ? GEN9_FREQ_SCALER : 1);
>  		seq_printf(m, "Lowest (RPN) frequency: %dMHz\n",
>  			   intel_gpu_freq(dev_priv, max_freq));
> @@ -1239,7 +1249,8 @@ static int i915_frequency_info(struct seq_file *m, void *unused)
>  		seq_printf(m, "Nominal (RP1) frequency: %dMHz\n",
>  			   intel_gpu_freq(dev_priv, max_freq));
>  
> -		max_freq = rp_state_cap & 0xff;
> +		max_freq = (IS_BROXTON(dev) ? rp_state_cap >> 16 :
> +			    rp_state_cap >> 0) & 0xff;
>  		max_freq *= (IS_SKYLAKE(dev) ? GEN9_FREQ_SCALER : 1);
>  		seq_printf(m, "Max non-overclocked (RP0) frequency: %dMHz\n",
>  			   intel_gpu_freq(dev_priv, max_freq));
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index fa9ccb87..17b5ca2 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -2734,8 +2734,10 @@ enum skl_disp_power_wells {
>  #define GEN6_GT_THREAD_STATUS_CORE_MASK 0x7
>  
>  #define GEN6_GT_PERF_STATUS	(MCHBAR_MIRROR_BASE_SNB + 0x5948)
> +#define BXT_GT_PERF_STATUS      (MCHBAR_MIRROR_BASE_SNB + 0x7070)

Nitpick: the format in GT_PERF_STATUS is the same on SKL and BXT so you
could have redefined GEN6_GT_PERF_STATUS to be a wrapper macro similar
to what you did in v1 of this patch.

>  #define GEN6_RP_STATE_LIMITS	(MCHBAR_MIRROR_BASE_SNB + 0x5994)
>  #define GEN6_RP_STATE_CAP	(MCHBAR_MIRROR_BASE_SNB + 0x5998)
> +#define BXT_RP_STATE_CAP        0x138170
>  
>  #define INTERVAL_1_28_US(us)	(((us) * 100) >> 7)
>  #define INTERVAL_1_33_US(us)	(((us) * 3)   >> 2)
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 32ff034..213da42 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -4288,13 +4288,21 @@ static void gen6_init_rps_frequencies(struct drm_device *dev)
>  	u32 ddcc_status = 0;
>  	int ret;
>  
> -	rp_state_cap = I915_READ(GEN6_RP_STATE_CAP);
>  	/* All of these values are in units of 50MHz */

On SKL/BXT the unit is 16.66MHz, so the above comment could be
clarified.

>  	dev_priv->rps.cur_freq		= 0;
>  	/* static values from HW: RP0 > RP1 > RPn (min_freq) */
> -	dev_priv->rps.rp0_freq		= (rp_state_cap >>  0) & 0xff;
> -	dev_priv->rps.rp1_freq		= (rp_state_cap >>  8) & 0xff;
> -	dev_priv->rps.min_freq		= (rp_state_cap >> 16) & 0xff;
> +	if (IS_BROXTON(dev)) {
> +		rp_state_cap = I915_READ(BXT_RP_STATE_CAP);
> +		dev_priv->rps.rp0_freq = (rp_state_cap >> 16) & 0xff;
> +		dev_priv->rps.rp1_freq = (rp_state_cap >>  8) & 0xff;
> +		dev_priv->rps.min_freq = (rp_state_cap >>  0) & 0xff;
> +	} else {
> +		rp_state_cap = I915_READ(GEN6_RP_STATE_CAP);
> +		dev_priv->rps.rp0_freq = (rp_state_cap >>  0) & 0xff;
> +		dev_priv->rps.rp1_freq = (rp_state_cap >>  8) & 0xff;
> +		dev_priv->rps.min_freq = (rp_state_cap >> 16) & 0xff;
> +	}
> +

Nitpick: this could be factored out to a separate function returning
rpn,rp0,rp1 which could be also used then in i915_frequency_info.

All the above can be addressed as a follow-up, so this patch looks ok to
me:
Reviewed-by: Imre Deak <imre.deak@intel.com>

>  	if (IS_SKYLAKE(dev)) {
>  		/* Store the frequency values in 16.66 MHZ units, which is
>  		   the natural hardware unit for SKL */


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

  reply	other threads:[~2015-06-26 12:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-25 21:54 [PATCH] drm/i915: Update rps frequencies for BXT Bob Paauwe
2015-06-26 12:52 ` Imre Deak [this message]
2015-06-28  0:54 ` shuang.he

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=1435323162.20855.21.camel@intel.com \
    --to=imre.deak@intel.com \
    --cc=bob.j.paauwe@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.