diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c index acafa8c59cc9..2f0349233695 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c @@ -28,6 +28,7 @@ #include "amdgpu_sched.h" #include "amdgpu_ras.h" #include +#include #define to_amdgpu_ctx_entity(e) \ container_of((e), struct amdgpu_ctx_entity, entity) @@ -643,10 +644,15 @@ static int amdgpu_ctx_stable_pstate(struct amdgpu_device *adev, * context id. */ - if (set) + if (set) { + r = pm_runtime_resume_and_get(adev->dev); + if (r < 0) + return r; r = amdgpu_ctx_set_stable_pstate(ctx, *stable_pstate); - else + pm_runtime_put_autosuspend(adev->dev); + } else { *stable_pstate = amdgpu_get_stable_pstate(adev); + } amdgpu_ctx_put(ctx); return r;