diff mbox series

[2/3] drm/i915/selftests: Add helper function measure_power

Message ID 20220923110043.789178-3-riana.tauro@intel.com (mailing list archive)
State New, archived
Headers show
Series Add SLPC selftest live_slpc_power | expand

Commit Message

Riana Tauro Sept. 23, 2022, 11 a.m. UTC
move the power measurement and the triangle filter
to a different function. No functional changes.

Signed-off-by: Riana Tauro <riana.tauro@intel.com>
---
 drivers/gpu/drm/i915/gt/selftest_rps.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

Comments

Vinay Belgaumkar Sept. 26, 2022, 3:57 p.m. UTC | #1
On 9/23/2022 4:00 AM, Riana Tauro wrote:
> move the power measurement and the triangle filter
> to a different function. No functional changes.
>
> Signed-off-by: Riana Tauro <riana.tauro@intel.com>

LGTM,

Reviewed-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>

> ---
>   drivers/gpu/drm/i915/gt/selftest_rps.c | 12 +++++++++---
>   1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/selftest_rps.c b/drivers/gpu/drm/i915/gt/selftest_rps.c
> index cfb4708dd62e..99a372486fb7 100644
> --- a/drivers/gpu/drm/i915/gt/selftest_rps.c
> +++ b/drivers/gpu/drm/i915/gt/selftest_rps.c
> @@ -1107,21 +1107,27 @@ static u64 __measure_power(int duration_ms)
>   	return div64_u64(1000 * 1000 * dE, dt);
>   }
>   
> -static u64 measure_power_at(struct intel_rps *rps, int *freq)
> +static u64 measure_power(struct intel_rps *rps, int *freq)
>   {
>   	u64 x[5];
>   	int i;
>   
> -	*freq = rps_set_check(rps, *freq);
>   	for (i = 0; i < 5; i++)
>   		x[i] = __measure_power(5);
> -	*freq = (*freq + read_cagf(rps)) / 2;
> +
> +	*freq = (*freq + intel_rps_read_actual_frequency(rps)) / 2;
>   
>   	/* A simple triangle filter for better result stability */
>   	sort(x, 5, sizeof(*x), cmp_u64, NULL);
>   	return div_u64(x[1] + 2 * x[2] + x[3], 4);
>   }
>   
> +static u64 measure_power_at(struct intel_rps *rps, int *freq)
> +{
> +	*freq = rps_set_check(rps, *freq);
> +	return measure_power(rps, freq);
> +}
> +
>   int live_rps_power(void *arg)
>   {
>   	struct intel_gt *gt = arg;
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/selftest_rps.c b/drivers/gpu/drm/i915/gt/selftest_rps.c
index cfb4708dd62e..99a372486fb7 100644
--- a/drivers/gpu/drm/i915/gt/selftest_rps.c
+++ b/drivers/gpu/drm/i915/gt/selftest_rps.c
@@ -1107,21 +1107,27 @@  static u64 __measure_power(int duration_ms)
 	return div64_u64(1000 * 1000 * dE, dt);
 }
 
-static u64 measure_power_at(struct intel_rps *rps, int *freq)
+static u64 measure_power(struct intel_rps *rps, int *freq)
 {
 	u64 x[5];
 	int i;
 
-	*freq = rps_set_check(rps, *freq);
 	for (i = 0; i < 5; i++)
 		x[i] = __measure_power(5);
-	*freq = (*freq + read_cagf(rps)) / 2;
+
+	*freq = (*freq + intel_rps_read_actual_frequency(rps)) / 2;
 
 	/* A simple triangle filter for better result stability */
 	sort(x, 5, sizeof(*x), cmp_u64, NULL);
 	return div_u64(x[1] + 2 * x[2] + x[3], 4);
 }
 
+static u64 measure_power_at(struct intel_rps *rps, int *freq)
+{
+	*freq = rps_set_check(rps, *freq);
+	return measure_power(rps, freq);
+}
+
 int live_rps_power(void *arg)
 {
 	struct intel_gt *gt = arg;