summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
diff options
context:
space:
mode:
authorAndres Rodriguez <andresx7@gmail.com>2017-05-24 17:00:10 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-10-09 16:30:22 -0400
commitb6d8a439345e71e9b1939c4d6997e09b5be9b5e1 (patch)
tree97ca5ac8f5675a586e690687129f525687081be3 /drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
parentb8866c26ec072f1924f5cf601ebea33ca9823326 (diff)
downloadlinux-b6d8a439345e71e9b1939c4d6997e09b5be9b5e1.tar.gz
linux-b6d8a439345e71e9b1939c4d6997e09b5be9b5e1.tar.bz2
linux-b6d8a439345e71e9b1939c4d6997e09b5be9b5e1.zip
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>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
index 52388b1b52c2..d3d63f78bec9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
@@ -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: