Re: [PATCH] drm/i915/gt: Use rc6.supported flag from intel_gt for rc6_enable sysfs

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

 



On Tue, Jan 09, 2024 at 05:03:00PM -0800, Juan Escamilla wrote:
> Currently if rc6 is supported, it gets enabled and the sysfs files for
> rc6_enable_show and rc6_enable_dev_show uses masks to check information
> from drm_i915_private.
> 
> However rc6_support functions take more variables and conditions into
> consideration and thus these masks are not enough for most of the modern
> hardware and it is simpley lyting to the user.
> 
> Let's fix it by at least use the rc6.supported flag from intel_gt
> information.
> 
> Signed-off-by: Juan Escamilla <jcescami@xxxxxxxx>


Reviewed-by: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>
and pushing this right now, thanks for your patch

> ---
>  drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c | 18 ++----------------
>  1 file changed, 2 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c b/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
> index f0dea54880af..2d3c4dab6d21 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
> +++ b/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
> @@ -176,27 +176,13 @@ static u32 get_residency(struct intel_gt *gt, enum intel_rc6_res_type id)
>  	return DIV_ROUND_CLOSEST_ULL(res, 1000);
>  }
>  
> -static u8 get_rc6_mask(struct intel_gt *gt)
> -{
> -	u8 mask = 0;
> -
> -	if (HAS_RC6(gt->i915))
> -		mask |= BIT(0);
> -	if (HAS_RC6p(gt->i915))
> -		mask |= BIT(1);
> -	if (HAS_RC6pp(gt->i915))
> -		mask |= BIT(2);
> -
> -	return mask;
> -}
> -
>  static ssize_t rc6_enable_show(struct kobject *kobj,
>  			       struct kobj_attribute *attr,
>  			       char *buff)
>  {
>  	struct intel_gt *gt = intel_gt_sysfs_get_drvdata(kobj, attr->attr.name);
>  
> -	return sysfs_emit(buff, "%x\n", get_rc6_mask(gt));
> +	return sysfs_emit(buff, "%x\n", gt->rc6.supported);
>  }
>  
>  static ssize_t rc6_enable_dev_show(struct device *dev,
> @@ -205,7 +191,7 @@ static ssize_t rc6_enable_dev_show(struct device *dev,
>  {
>  	struct intel_gt *gt = intel_gt_sysfs_get_drvdata(&dev->kobj, attr->attr.name);
>  
> -	return sysfs_emit(buff, "%x\n", get_rc6_mask(gt));
> +	return sysfs_emit(buff, "%x\n", gt->rc6.supported);
>  }
>  
>  static u32 __rc6_residency_ms_show(struct intel_gt *gt)
> -- 
> 2.43.0
> 



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

  Powered by Linux