[Intel-gfx] [PATCH 1/2] drm/i915/rps: Add frequency translation helpers

Chris Wilson chris at chris-wilson.co.uk
Mon Dec 9 23:25:52 UTC 2019


Quoting Andi Shyti (2019-12-09 22:35:55)
> From: Andi Shyti <andi.shyti at intel.com>
> 
> Add two helpers that for reading the actual GT's frequency. The
> two helpers are:
> 
>  - intel_cagf_read: reads the frequency and returns it not
>    normalized
> 
>  - intel_cagf_freq_read: provides the frequency in Hz.
> 
> Use the above helpers in sysfs and debugfs.
> 
> Signed-off-by: Andi Shyti <andi.shyti at 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 08a38a3b90b0..72c3dd976e32 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_cagf_read(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_cagf_freq_read(struct intel_rps *rps)
> +{
> +       return intel_gpu_freq(rps, intel_cagf_read(rps));

Thinking about this far too much, this should be something along the
lines of
	intel_rps_read_actual_frequency(struct intel_rps *rps)
since it operates on the intel_rps object and
	intel_rps_read_cagf()
-Chris


More information about the Intel-gfx mailing list