Re: [PATCH 3/4] drm/i915: Add helpers for managing rps thresholds

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Tvrtko,

On Mon, May 22, 2023 at 12:59:27PM +0100, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
> 
> In preparation for exposing via sysfs add helpers for managing rps
> thresholds.
> 
> v2:
>  * Force sw and hw re-programming on threshold change.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
> Cc: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/gt/intel_rps.c | 54 +++++++++++++++++++++++++++++
>  drivers/gpu/drm/i915/gt/intel_rps.h |  4 +++
>  2 files changed, 58 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_rps.c b/drivers/gpu/drm/i915/gt/intel_rps.c
> index 333abc8f7ecb..afde601a6111 100644
> --- a/drivers/gpu/drm/i915/gt/intel_rps.c
> +++ b/drivers/gpu/drm/i915/gt/intel_rps.c
> @@ -16,7 +16,9 @@
>  #include "intel_gt.h"
>  #include "intel_gt_clock_utils.h"
>  #include "intel_gt_irq.h"
> +#include "intel_gt_pm.h"
>  #include "intel_gt_pm_irq.h"
> +#include "intel_gt_print.h"
>  #include "intel_gt_regs.h"
>  #include "intel_mchbar_regs.h"
>  #include "intel_pcode.h"
> @@ -2574,6 +2576,58 @@ int intel_rps_set_min_frequency(struct intel_rps *rps, u32 val)
>  		return set_min_freq(rps, val);
>  }
>  
> +u8 intel_rps_get_up_threshold(struct intel_rps *rps)
> +{
> +	return rps->power.up_threshold;
> +}
> +
> +static int rps_set_threshold(struct intel_rps *rps, u8 *threshold, u8 val)
> +{
> +	int ret;
> +
> +	if (val > 100)
> +		return -EINVAL;
> +
> +	ret = mutex_lock_interruptible(&rps->lock);
> +	if (ret)
> +		return ret;
> +
> +	if (*threshold == val)
> +		goto out_unlock;
> +
> +	*threshold = val;
> +
> +	/* Force reset. */
> +	rps->last_freq = -1;
> +	mutex_lock(&rps->power.mutex);
> +	rps->power.mode = -1;
> +	mutex_unlock(&rps->power.mutex);
> +
> +	intel_rps_set(rps, clamp(rps->cur_freq,
> +				 rps->min_freq_softlimit,
> +				 rps->max_freq_softlimit));

why are you resetting here?

Andi



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux