* [PATCH] drm/amdgpu/powerplay/smu10: refactor AMDGPU_PP_SENSOR_GPU_LOAD
@ 2021-03-19 7:04 Shirish S
2021-03-19 18:27 ` Alex Deucher
0 siblings, 1 reply; 2+ messages in thread
From: Shirish S @ 2021-03-19 7:04 UTC (permalink / raw)
To: Alex Deucher, amd-gfx; +Cc: Shirish S
refactor AMDGPU_PP_SENSOR_GPU_LOAD to ensure code consistency with other
commands
Signed-off-by: Shirish S <shirish.s@amd.com>
---
.../gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c
index f5d59fa3a030..f5fe540cd536 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c
@@ -1297,19 +1297,18 @@ static int smu10_read_sensor(struct pp_hwmgr *hwmgr, int idx,
*size = 4;
break;
case AMDGPU_PP_SENSOR_GPU_LOAD:
- if (has_gfx_busy) {
+ if (!has_gfx_busy)
+ ret = -EOPNOTSUPP;
+ else {
ret = smum_send_msg_to_smc(hwmgr,
PPSMC_MSG_GetGfxBusy,
&activity_percent);
if (!ret)
- activity_percent = activity_percent > 100 ? 100 : activity_percent;
+ *((uint32_t *)value) = min(activity_percent, (u32)100);
else
- return -EIO;
- *((uint32_t *)value) = activity_percent;
- return 0;
- } else {
- return -EOPNOTSUPP;
+ ret = -EIO;
}
+ break;
default:
ret = -EOPNOTSUPP;
break;
--
2.17.1
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/amdgpu/powerplay/smu10: refactor AMDGPU_PP_SENSOR_GPU_LOAD
2021-03-19 7:04 [PATCH] drm/amdgpu/powerplay/smu10: refactor AMDGPU_PP_SENSOR_GPU_LOAD Shirish S
@ 2021-03-19 18:27 ` Alex Deucher
0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2021-03-19 18:27 UTC (permalink / raw)
To: Shirish S; +Cc: Alex Deucher, amd-gfx list
On Fri, Mar 19, 2021 at 3:04 AM Shirish S <shirish.s@amd.com> wrote:
>
> refactor AMDGPU_PP_SENSOR_GPU_LOAD to ensure code consistency with other
> commands
>
> Signed-off-by: Shirish S <shirish.s@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
> ---
> .../gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c
> index f5d59fa3a030..f5fe540cd536 100644
> --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c
> +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c
> @@ -1297,19 +1297,18 @@ static int smu10_read_sensor(struct pp_hwmgr *hwmgr, int idx,
> *size = 4;
> break;
> case AMDGPU_PP_SENSOR_GPU_LOAD:
> - if (has_gfx_busy) {
> + if (!has_gfx_busy)
> + ret = -EOPNOTSUPP;
> + else {
> ret = smum_send_msg_to_smc(hwmgr,
> PPSMC_MSG_GetGfxBusy,
> &activity_percent);
> if (!ret)
> - activity_percent = activity_percent > 100 ? 100 : activity_percent;
> + *((uint32_t *)value) = min(activity_percent, (u32)100);
> else
> - return -EIO;
> - *((uint32_t *)value) = activity_percent;
> - return 0;
> - } else {
> - return -EOPNOTSUPP;
> + ret = -EIO;
> }
> + break;
> default:
> ret = -EOPNOTSUPP;
> break;
> --
> 2.17.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-03-19 18:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-19 7:04 [PATCH] drm/amdgpu/powerplay/smu10: refactor AMDGPU_PP_SENSOR_GPU_LOAD Shirish S
2021-03-19 18:27 ` Alex Deucher
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.