[PATCH 1/2] drm/amdgpu/navi10: add uclk activity sensor

Quan, Evan Evan.Quan at amd.com
Tue Jul 9 04:58:53 UTC 2019


Reviewed-by: Evan Quan <evan.quan at amd.com>

> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of Alex
> Deucher
> Sent: Thursday, July 04, 2019 10:58 AM
> To: amd-gfx at lists.freedesktop.org
> Cc: Deucher, Alexander <Alexander.Deucher at amd.com>
> Subject: [PATCH 1/2] drm/amdgpu/navi10: add uclk activity sensor
> 
> Query the metrics table for the current uclk activity.
> 
> Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
> ---
>  drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
> b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
> index e00397f84b2f..5794f7cef1c8 100644
> --- a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
> +++ b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
> @@ -869,6 +869,7 @@ static int navi10_get_gpu_power(struct smu_context
> *smu, uint32_t *value)  }
> 
>  static int navi10_get_current_activity_percent(struct smu_context *smu,
> +					       enum amd_pp_sensors sensor,
>  					       uint32_t *value)
>  {
>  	int ret = 0;
> @@ -884,7 +885,17 @@ static int navi10_get_current_activity_percent(struct
> smu_context *smu,
>  	if (ret)
>  		return ret;
> 
> -	*value = metrics.AverageGfxActivity;
> +	switch (sensor) {
> +	case AMDGPU_PP_SENSOR_GPU_LOAD:
> +		*value = metrics.AverageGfxActivity;
> +		break;
> +	case AMDGPU_PP_SENSOR_MEM_LOAD:
> +		*value = metrics.AverageUclkActivity;
> +		break;
> +	default:
> +		pr_err("Invalid sensor for retrieving clock activity\n");
> +		return -EINVAL;
> +	}
> 
>  	return 0;
>  }
> @@ -1260,8 +1271,9 @@ static int navi10_read_sensor(struct smu_context
> *smu,
>  		*(uint32_t *)data = pptable->FanMaximumRpm;
>  		*size = 4;
>  		break;
> +	case AMDGPU_PP_SENSOR_MEM_LOAD:
>  	case AMDGPU_PP_SENSOR_GPU_LOAD:
> -		ret = navi10_get_current_activity_percent(smu, (uint32_t
> *)data);
> +		ret = navi10_get_current_activity_percent(smu, sensor,
> (uint32_t
> +*)data);
>  		*size = 4;
>  		break;
>  	case AMDGPU_PP_SENSOR_GPU_POWER:
> --
> 2.20.1
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list