]> git.hungrycats.org Git - linux/commitdiff
drm/amdgpu: Clarify odd behaviour of AMDGPU_CTX_OP_GET_STABLE_PSTATE
authorTvrtko Ursulin <tvrtko.ursulin@igalia.com>
Mon, 1 Jun 2026 14:08:28 +0000 (15:08 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 17 Jun 2026 20:32:02 +0000 (16:32 -0400)
AMDGPU_CTX_OP_GET_STABLE_PSTATE is an unusual uapi - it will check whether
the context id exist, but otherwise does nothing with it. In other words,
the uapi has historically been implemented as being able to query the
global device state, as long as the caller supplies a random valid context
id.

Lets just document this and later figure out if it can be changed to
either more permissive (don't check context id), or more restrictive
(only allow queries from contexts which have overriden the performance
state).

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c

index 047b83ce86d32d8b584347883591a756d03164ee..b15ed4a534f17c302ba2ad5e99f35f7b68518b59 100644 (file)
@@ -635,6 +635,14 @@ static int amdgpu_ctx_stable_pstate(struct amdgpu_device *adev,
        if (!ctx)
                return -EINVAL;
 
+       /*
+        * The get path is odd in this uapi - it will check whether the context
+        * id exist, but otherwise does nothing with it. In other words, the
+        * uapi has historically been implemented as being able to query the
+        * global device state, as long as the caller supplies a random valid
+        * context id.
+        */
+
        if (set)
                r = amdgpu_ctx_set_stable_pstate(ctx, *stable_pstate);
        else