From f423bfcf769d59a658709aecf4a064d6ba3866f9 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Wed, 5 Aug 2026 14:36:18 +0200 Subject: [PATCH] drm/amdgpu: use pm_runtime_resume_and_get for ctx ioctl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only amdgpu_ctx_set_stable_pstate() communicates with the hw. v3 (Shahyan): fixed typo in commit description Signed-off-by: Pierre-Eric Pelloux-Prayer Signed-off-by: Shahyan Soltani Acked-by: Christian König Signed-off-by: Alex Deucher --- 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 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;