mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/
synced 2026-04-23 17:02:06 -04:00
drm/amdgpu: make amdgpu_to_sched_priority detect invalid parameters
Returning invalid priorities as _NORMAL is a backwards compatibility quirk of amdgpu_ctx_ioctl(). Move this detail one layer up where it belongs. Signed-off-by: Andres Rodriguez <andresx7@gmail.com> Acked-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
b8866c26ec
commit
b6d8a43934
@@ -232,7 +232,7 @@ static enum amd_sched_priority amdgpu_to_sched_priority(int amdgpu_priority)
|
||||
return AMD_SCHED_PRIORITY_LOW;
|
||||
default:
|
||||
WARN(1, "Invalid context priority %d\n", amdgpu_priority);
|
||||
return AMD_SCHED_PRIORITY_NORMAL;
|
||||
return AMD_SCHED_PRIORITY_INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,8 +251,10 @@ int amdgpu_ctx_ioctl(struct drm_device *dev, void *data,
|
||||
id = args->in.ctx_id;
|
||||
priority = amdgpu_to_sched_priority(args->in.priority);
|
||||
|
||||
if (priority >= AMD_SCHED_PRIORITY_MAX)
|
||||
return -EINVAL;
|
||||
/* For backwards compatibility reasons, we need to accept
|
||||
* ioctls with garbage in the priority field */
|
||||
if (priority == AMD_SCHED_PRIORITY_INVALID)
|
||||
priority = AMD_SCHED_PRIORITY_NORMAL;
|
||||
|
||||
switch (args->in.op) {
|
||||
case AMDGPU_CTX_OP_ALLOC_CTX:
|
||||
|
||||
Reference in New Issue
Block a user