mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-29 15:43:59 +08:00
drm/scheduler: Remove priority macro INVALID (v2)
Remove DRM_SCHED_PRIORITY_INVALID. We no longer carry around an invalid priority and cut it off at the source. Backwards compatibility behaviour of AMDGPU CTX IOCTL passing in garbage for context priority from user space and then mapping that to DRM_SCHED_PRIORITY_NORMAL is preserved. v2: Revert "res" --> "r" and "prio" --> "priority". Signed-off-by: Luben Tuikov <luben.tuikov@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
e2d732fdb7
commit
9af5e21dac
@ -388,13 +388,12 @@ int amdgpu_ctx_ioctl(struct drm_device *dev, void *data,
|
||||
struct amdgpu_device *adev = dev->dev_private;
|
||||
struct amdgpu_fpriv *fpriv = filp->driver_priv;
|
||||
|
||||
r = 0;
|
||||
id = args->in.ctx_id;
|
||||
priority = amdgpu_to_sched_priority(args->in.priority);
|
||||
r = amdgpu_to_sched_priority(args->in.priority, &priority);
|
||||
|
||||
/* For backwards compatibility reasons, we need to accept
|
||||
* ioctls with garbage in the priority field */
|
||||
if (priority == DRM_SCHED_PRIORITY_INVALID)
|
||||
if (r == -EINVAL)
|
||||
priority = DRM_SCHED_PRIORITY_NORMAL;
|
||||
|
||||
switch (args->in.op) {
|
||||
|
@ -32,24 +32,32 @@
|
||||
|
||||
#include "amdgpu_vm.h"
|
||||
|
||||
enum drm_sched_priority amdgpu_to_sched_priority(int amdgpu_priority)
|
||||
int amdgpu_to_sched_priority(int amdgpu_priority,
|
||||
enum drm_sched_priority *prio)
|
||||
{
|
||||
switch (amdgpu_priority) {
|
||||
case AMDGPU_CTX_PRIORITY_VERY_HIGH:
|
||||
return DRM_SCHED_PRIORITY_HIGH;
|
||||
*prio = DRM_SCHED_PRIORITY_HIGH;
|
||||
break;
|
||||
case AMDGPU_CTX_PRIORITY_HIGH:
|
||||
return DRM_SCHED_PRIORITY_HIGH;
|
||||
*prio = DRM_SCHED_PRIORITY_HIGH;
|
||||
break;
|
||||
case AMDGPU_CTX_PRIORITY_NORMAL:
|
||||
return DRM_SCHED_PRIORITY_NORMAL;
|
||||
*prio = DRM_SCHED_PRIORITY_NORMAL;
|
||||
break;
|
||||
case AMDGPU_CTX_PRIORITY_LOW:
|
||||
case AMDGPU_CTX_PRIORITY_VERY_LOW:
|
||||
return DRM_SCHED_PRIORITY_MIN;
|
||||
*prio = DRM_SCHED_PRIORITY_MIN;
|
||||
break;
|
||||
case AMDGPU_CTX_PRIORITY_UNSET:
|
||||
return DRM_SCHED_PRIORITY_UNSET;
|
||||
*prio = DRM_SCHED_PRIORITY_UNSET;
|
||||
break;
|
||||
default:
|
||||
WARN(1, "Invalid context priority %d\n", amdgpu_priority);
|
||||
return DRM_SCHED_PRIORITY_INVALID;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int amdgpu_sched_process_priority_override(struct amdgpu_device *adev,
|
||||
@ -119,9 +127,20 @@ int amdgpu_sched_ioctl(struct drm_device *dev, void *data,
|
||||
enum drm_sched_priority priority;
|
||||
int r;
|
||||
|
||||
priority = amdgpu_to_sched_priority(args->in.priority);
|
||||
if (priority == DRM_SCHED_PRIORITY_INVALID)
|
||||
/* First check the op, then the op's argument.
|
||||
*/
|
||||
switch (args->in.op) {
|
||||
case AMDGPU_SCHED_OP_PROCESS_PRIORITY_OVERRIDE:
|
||||
case AMDGPU_SCHED_OP_CONTEXT_PRIORITY_OVERRIDE:
|
||||
break;
|
||||
default:
|
||||
DRM_ERROR("Invalid sched op specified: %d\n", args->in.op);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
r = amdgpu_to_sched_priority(args->in.priority, &priority);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
switch (args->in.op) {
|
||||
case AMDGPU_SCHED_OP_PROCESS_PRIORITY_OVERRIDE:
|
||||
@ -136,7 +155,8 @@ int amdgpu_sched_ioctl(struct drm_device *dev, void *data,
|
||||
priority);
|
||||
break;
|
||||
default:
|
||||
DRM_ERROR("Invalid sched op specified: %d\n", args->in.op);
|
||||
/* Impossible.
|
||||
*/
|
||||
r = -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
@ -30,7 +30,8 @@ enum drm_sched_priority;
|
||||
struct drm_device;
|
||||
struct drm_file;
|
||||
|
||||
enum drm_sched_priority amdgpu_to_sched_priority(int amdgpu_priority);
|
||||
int amdgpu_to_sched_priority(int amdgpu_priority,
|
||||
enum drm_sched_priority *prio);
|
||||
int amdgpu_sched_ioctl(struct drm_device *dev, void *data,
|
||||
struct drm_file *filp);
|
||||
|
||||
|
@ -43,7 +43,6 @@ enum drm_sched_priority {
|
||||
DRM_SCHED_PRIORITY_KERNEL,
|
||||
|
||||
DRM_SCHED_PRIORITY_COUNT,
|
||||
DRM_SCHED_PRIORITY_INVALID = -1,
|
||||
DRM_SCHED_PRIORITY_UNSET = -2
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user