On Thu, Jan 12, 2023 at 11:25 AM Alex Deucher <alexander.deucher@xxxxxxx> wrote: > > The metrics interface exposes the socket power in W, but > apparently RN systems exposed the power as mW. See > commit 137aac26a2ed ("drm/amdgpu/smu12: fix power reporting on renoir"). > So leave RN as mW and use W for CZN/BCL. Just saw that Jesse is working on a proper patch that fixes this for real based on the firmware versions. So let's take that instead. Alex > > Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/2321 > Fixes: 137aac26a2ed ("drm/amdgpu/smu12: fix power reporting on renoir") > Cc: jesse.zhang@xxxxxxx > Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx> > --- > drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c > index 85e22210963f..77308d481c54 100644 > --- a/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c > +++ b/drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c > @@ -1196,7 +1196,10 @@ static int renoir_get_smu_metrics_data(struct smu_context *smu, > *value = metrics->AverageUvdActivity / 100; > break; > case METRICS_AVERAGE_SOCKETPOWER: > - *value = (metrics->CurrentSocketPower << 8) / 1000; > + if (smu->adev->ip_versions[MP1_HWIP][0] == IP_VERSION(12, 0, 0)) > + *value = (metrics->CurrentSocketPower << 8) / 1000; /* mW */ > + else > + *value = metrics->CurrentSocketPower << 8; /* W */ > break; > case METRICS_TEMPERATURE_EDGE: > *value = (metrics->GfxTemperature / 100) * > -- > 2.39.0 >