All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Andi Shyti <andi@etezian.org>,
	Intel GFX <intel-gfx@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH v3 1/2] drm/i915/rps: Add frequency translation helpers
Date: Fri, 13 Dec 2019 12:48:11 +0000	[thread overview]
Message-ID: <157624129148.6987.5205739599575127739@skylake-alporthouse-com> (raw)
In-Reply-To: <20191213124549.28412-2-andi@etezian.org>

Quoting Andi Shyti (2019-12-13 12:45:48)
> From: Andi Shyti <andi.shyti@intel.com>
> 
> Add two helpers that for reading the actual GT's frequency. The
> two helpers are:
> 
>  - intel_rps_read_cagf: reads the frequency and returns it not
>    normalized
> 
>  - intel_rps_read_actual_frequency: provides the frequency in Hz.
> 
> Use the above helpers in sysfs and debugfs.
> 
> Signed-off-by: Andi Shyti <andi.shyti@intel.com>
> ---
>  drivers/gpu/drm/i915/gt/intel_rps.c | 22 ++++++++++++++++++++++
>  drivers/gpu/drm/i915/gt/intel_rps.h |  2 ++
>  drivers/gpu/drm/i915/i915_debugfs.c | 21 +++++----------------
>  drivers/gpu/drm/i915/i915_sysfs.c   | 14 ++------------
>  4 files changed, 31 insertions(+), 28 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_rps.c b/drivers/gpu/drm/i915/gt/intel_rps.c
> index 106c9fce9d6c..05ec4bcbd6ef 100644
> --- a/drivers/gpu/drm/i915/gt/intel_rps.c
> +++ b/drivers/gpu/drm/i915/gt/intel_rps.c
> @@ -1682,6 +1682,28 @@ u32 intel_get_cagf(struct intel_rps *rps, u32 rpstat)
>         return  cagf;
>  }
>  
> +u32 intel_rps_read_cagf(struct intel_rps *rps)
> +{
> +       struct drm_i915_private *i915 = rps_to_i915(rps);
> +       u32 freq;
> +
> +       if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915)) {
> +               vlv_punit_get(i915);
> +               freq = vlv_punit_read(i915, PUNIT_REG_GPU_FREQ_STS);
> +               vlv_punit_put(i915);
> +
> +               return (freq >> 8) & 0xff;
> +       }
> +
> +       return intel_get_cagf(rps, intel_uncore_read(rps_to_gt(rps)->uncore,
> +                                                    GEN6_RPSTAT1));
> +}
> +
> +u32 intel_rps_read_actual_frequency(struct intel_rps *rps)
> +{

I'd go one step further and put the wakeref in here as well?
(Grabbing a wakeref we already have isn't much of a cost, and this is
debug so not critical.)

> +       return intel_gpu_freq(rps, intel_rps_read_cagf(rps));

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-12-13 21:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-13 12:45 [Intel-gfx] [PATCH v3 0/2] Some debugfs enhancements Andi Shyti
2019-12-13 12:45 ` [Intel-gfx] [PATCH v3 1/2] drm/i915/rps: Add frequency translation helpers Andi Shyti
2019-12-13 12:48   ` Chris Wilson [this message]
2019-12-13 12:45 ` [Intel-gfx] [PATCH v3 2/2] drm/i915/gt: Move power management debug files into a gt aware debugfs Andi Shyti
2019-12-13 12:52   ` Chris Wilson
2019-12-13 14:44     ` Andi Shyti
2019-12-13 14:59       ` Chris Wilson
2019-12-13 17:00 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Some debugfs enhancements (rev3) Patchwork
2019-12-13 17:01 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2019-12-13 17:29 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork

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=157624129148.6987.5205739599575127739@skylake-alporthouse-com \
    --to=chris@chris-wilson.co.uk \
    --cc=andi@etezian.org \
    --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.