Skip to content

Commit c65b364

Browse files
committed
drm/amdgpu/ctx: only reset stable pstate if the user changed it (v2)
Check if the requested stable pstate matches the current one before changing it. This avoids changing the stable pstate on context destroy if the user never changed it in the first place via the IOCTL. v2: compare the current and requested rather than setting a flag (Lijo) Fixes: 8cda7a4 ("drm/amdgpu/UAPI: add new CTX OP to get/set stable pstates") Reviewed-by: Lijo Lazar <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Cc: [email protected]
1 parent a56f445 commit c65b364

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ static int amdgpu_ctx_set_stable_pstate(struct amdgpu_ctx *ctx,
296296
{
297297
struct amdgpu_device *adev = ctx->adev;
298298
enum amd_dpm_forced_level level;
299+
u32 current_stable_pstate;
299300
int r;
300301

301302
mutex_lock(&adev->pm.stable_pstate_ctx_lock);
@@ -304,6 +305,10 @@ static int amdgpu_ctx_set_stable_pstate(struct amdgpu_ctx *ctx,
304305
goto done;
305306
}
306307

308+
r = amdgpu_ctx_get_stable_pstate(ctx, &current_stable_pstate);
309+
if (r || (stable_pstate == current_stable_pstate))
310+
goto done;
311+
307312
switch (stable_pstate) {
308313
case AMDGPU_CTX_STABLE_PSTATE_NONE:
309314
level = AMD_DPM_FORCED_LEVEL_AUTO;

0 commit comments

Comments
 (0)