Message ID | 20230330004103.1295413-8-umesh.nerlige.ramappa@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Add MTL PMU support for multi-gt | expand |
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@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@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);
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) +{ + 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);
Use a helper to convert frequency values to MHz. Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com> --- drivers/gpu/drm/i915/i915_pmu.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)