From: Pierre-Eric Pelloux-Prayer <[email protected]>
Only amdgpu_ctx_stable_pstate communicates with the hw. Signed-off-by: Pierre-Eric Pelloux-Prayer <[email protected]> Signed-off-by: Shahyan Soltani <[email protected]> --- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c index b15ed4a534f1..a87f26139496 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 <linux/nospec.h> +#include <linux/pm_runtime.h> #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; -- 2.55.0
