diff options
author | Andres Rodriguez <andresx7@gmail.com> | 2017-06-26 16:17:13 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-10-09 16:30:24 -0400 |
commit | 52c6a62c64fac03a434cdacf6ef671c6a9e9000f (patch) | |
tree | ff79a90d966d6eeeccee08fdc93d428c8e4553d5 /drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | |
parent | c23be4ae1d50e8d93f805de7ae3e8ea49a4ad781 (diff) |
drm/amdgpu: add interface for editing a foreign process's priority v3
The AMDGPU_SCHED_OP_PROCESS_PRIORITY_OVERRIDE ioctls are used to set
the priority of a different process in the current system.
When a request is dropped, the process's contexts will be
restored to the priority specified at context creation time.
A request can be dropped by setting the override priority to
AMDGPU_CTX_PRIORITY_UNSET.
An fd is used to identify the remote process. This is simpler than
passing a pid number, which is vulnerable to re-use, etc.
This functionality is limited to DRM_MASTER since abuse of this
interface can have a negative impact on the system's performance.
v2: removed unused output structure
v3: change refcounted interface for a regular set operation
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.c | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c index d2ef24f4b56d..a78b03f65c69 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <drm/drmP.h> | 25 | #include <drm/drmP.h> |
26 | #include <drm/drm_auth.h> | 26 | #include <drm/drm_auth.h> |
27 | #include "amdgpu.h" | 27 | #include "amdgpu.h" |
28 | #include "amdgpu_sched.h" | ||
28 | 29 | ||
29 | static int amdgpu_ctx_priority_permit(struct drm_file *filp, | 30 | static int amdgpu_ctx_priority_permit(struct drm_file *filp, |
30 | enum amd_sched_priority priority) | 31 | enum amd_sched_priority priority) |
@@ -220,26 +221,6 @@ static int amdgpu_ctx_query(struct amdgpu_device *adev, | |||
220 | return 0; | 221 | return 0; |
221 | } | 222 | } |
222 | 223 | ||
223 | static enum amd_sched_priority amdgpu_to_sched_priority(int amdgpu_priority) | ||
224 | { | ||
225 | switch (amdgpu_priority) { | ||
226 | case AMDGPU_CTX_PRIORITY_HIGH_HW: | ||
227 | return AMD_SCHED_PRIORITY_HIGH_HW; | ||
228 | case AMDGPU_CTX_PRIORITY_HIGH_SW: | ||
229 | return AMD_SCHED_PRIORITY_HIGH_SW; | ||
230 | case AMDGPU_CTX_PRIORITY_NORMAL: | ||
231 | return AMD_SCHED_PRIORITY_NORMAL; | ||
232 | case AMDGPU_CTX_PRIORITY_LOW_SW: | ||
233 | case AMDGPU_CTX_PRIORITY_LOW_HW: | ||
234 | return AMD_SCHED_PRIORITY_LOW; | ||
235 | case AMDGPU_CTX_PRIORITY_UNSET: | ||
236 | return AMD_SCHED_PRIORITY_UNSET; | ||
237 | default: | ||
238 | WARN(1, "Invalid context priority %d\n", amdgpu_priority); | ||
239 | return AMD_SCHED_PRIORITY_INVALID; | ||
240 | } | ||
241 | } | ||
242 | |||
243 | int amdgpu_ctx_ioctl(struct drm_device *dev, void *data, | 224 | int amdgpu_ctx_ioctl(struct drm_device *dev, void *data, |
244 | struct drm_file *filp) | 225 | struct drm_file *filp) |
245 | { | 226 | { |