Skip to content

Commit

Permalink
drm/amdgpu/navi10: add uclk activity sensor
Browse files Browse the repository at this point in the history
Query the metrics table for the current uclk activity.

Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
Alex Deucher committed Jul 9, 2019
1 parent f54eeab commit 7f963d9
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions drivers/gpu/drm/amd/powerplay/navi10_ppt.c
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,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;
Expand All @@ -894,7 +895,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;
}
Expand Down Expand Up @@ -1307,8 +1318,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:
Expand Down

0 comments on commit 7f963d9

Please sign in to comment.