Commit d3df66fd authored by Luben Tuikov's avatar Luben Tuikov

drm/amdgpu: Remove redundant call to priority_is_valid()

Remove a redundant call to amdgpu_ctx_priority_is_valid() from
amdgpu_ctx_priority_permit(), which is called from amdgpu_ctx_init() which is
called from amdgpu_ctx_alloc() which is called from amdgpu_ctx_ioctl(), where
we've called amdgpu_ctx_priority_is_valid() already first thing in the
function.

Cc: Alex Deucher <Alexander.Deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Signed-off-by: default avatarLuben Tuikov <luben.tuikov@amd.com>
Acked-by: default avatarChristian König <christian.koenig@amd.com>
Link: https://lore.kernel.org/r/20231018010359.30393-1-luben.tuikov@amd.com
parent 3d887d51
...@@ -55,6 +55,10 @@ bool amdgpu_ctx_priority_is_valid(int32_t ctx_prio) ...@@ -55,6 +55,10 @@ bool amdgpu_ctx_priority_is_valid(int32_t ctx_prio)
return true; return true;
default: default:
case AMDGPU_CTX_PRIORITY_UNSET: case AMDGPU_CTX_PRIORITY_UNSET:
/* UNSET priority is not valid and we don't carry that
* around, but set it to NORMAL in the only place this
* function is called, amdgpu_ctx_ioctl().
*/
return false; return false;
} }
} }
...@@ -95,9 +99,6 @@ amdgpu_ctx_to_drm_sched_prio(int32_t ctx_prio) ...@@ -95,9 +99,6 @@ amdgpu_ctx_to_drm_sched_prio(int32_t ctx_prio)
static int amdgpu_ctx_priority_permit(struct drm_file *filp, static int amdgpu_ctx_priority_permit(struct drm_file *filp,
int32_t priority) int32_t priority)
{ {
if (!amdgpu_ctx_priority_is_valid(priority))
return -EINVAL;
/* NORMAL and below are accessible by everyone */ /* NORMAL and below are accessible by everyone */
if (priority <= AMDGPU_CTX_PRIORITY_NORMAL) if (priority <= AMDGPU_CTX_PRIORITY_NORMAL)
return 0; return 0;
...@@ -632,8 +633,6 @@ static int amdgpu_ctx_query2(struct amdgpu_device *adev, ...@@ -632,8 +633,6 @@ static int amdgpu_ctx_query2(struct amdgpu_device *adev,
return 0; return 0;
} }
static int amdgpu_ctx_stable_pstate(struct amdgpu_device *adev, static int amdgpu_ctx_stable_pstate(struct amdgpu_device *adev,
struct amdgpu_fpriv *fpriv, uint32_t id, struct amdgpu_fpriv *fpriv, uint32_t id,
bool set, u32 *stable_pstate) bool set, u32 *stable_pstate)
...@@ -676,8 +675,10 @@ int amdgpu_ctx_ioctl(struct drm_device *dev, void *data, ...@@ -676,8 +675,10 @@ int amdgpu_ctx_ioctl(struct drm_device *dev, void *data,
id = args->in.ctx_id; id = args->in.ctx_id;
priority = args->in.priority; priority = args->in.priority;
/* For backwards compatibility reasons, we need to accept /* For backwards compatibility, we need to accept ioctls with garbage
* ioctls with garbage in the priority field */ * in the priority field. Garbage values in the priority field, result
* in the priority being set to NORMAL.
*/
if (!amdgpu_ctx_priority_is_valid(priority)) if (!amdgpu_ctx_priority_is_valid(priority))
priority = AMDGPU_CTX_PRIORITY_NORMAL; priority = AMDGPU_CTX_PRIORITY_NORMAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment