[Intel-gfx] [PATCH 7/9] drm/i915/pmu: Use a helper to convert to MHz
Tvrtko Ursulin
tvrtko.ursulin at linux.intel.com
Thu Mar 30 13:13:52 UTC 2023
On 30/03/2023 01:41, Umesh Nerlige Ramappa wrote:
> Use a helper to convert frequency values to MHz.
>
> Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa at intel.com>
> ---
> drivers/gpu/drm/i915/i915_pmu.c | 15 +++++++--------
> 1 file changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
> index 2a5deabff088..40ce1dc00067 100644
> --- a/drivers/gpu/drm/i915/i915_pmu.c
> +++ b/drivers/gpu/drm/i915/i915_pmu.c
> @@ -636,6 +636,11 @@ static int i915_pmu_event_init(struct perf_event *event)
> return 0;
> }
>
> +static u64 read_sample_us(struct i915_pmu *pmu, unsigned int gt_id, int sample)
Maybe better as read_freq_sample_mhz? Anyway:
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Regards,
Tvrtko
> +{
> + return div_u64(read_sample(pmu, gt_id, sample), USEC_PER_SEC);
> +}
> +
> static u64 __i915_pmu_event_read(struct perf_event *event)
> {
> struct drm_i915_private *i915 =
> @@ -668,16 +673,10 @@ static u64 __i915_pmu_event_read(struct perf_event *event)
>
> switch (config) {
> case I915_PMU_ACTUAL_FREQUENCY:
> - val =
> - div_u64(read_sample(pmu, gt_id,
> - __I915_SAMPLE_FREQ_ACT),
> - USEC_PER_SEC /* to MHz */);
> + val = read_sample_us(pmu, gt_id, __I915_SAMPLE_FREQ_ACT);
> break;
> case I915_PMU_REQUESTED_FREQUENCY:
> - val =
> - div_u64(read_sample(pmu, gt_id,
> - __I915_SAMPLE_FREQ_REQ),
> - USEC_PER_SEC /* to MHz */);
> + val = read_sample_us(pmu, gt_id, __I915_SAMPLE_FREQ_REQ);
> break;
> case I915_PMU_INTERRUPTS:
> val = READ_ONCE(pmu->irq_count);
More information about the Intel-gfx
mailing list