diff options
-rw-r--r-- | sys/dev/pci/drm/amd/amdgpu/amdgpu_ctx.c | 2 | ||||
-rw-r--r-- | sys/dev/pci/drm/i915/gem/i915_gem_context.c | 4 | ||||
-rw-r--r-- | sys/dev/pci/drm/include/linux/capability.h | 13 |
3 files changed, 10 insertions, 9 deletions
diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_ctx.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_ctx.c index e6305db6e44..c542d759091 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_ctx.c +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_ctx.c @@ -52,10 +52,8 @@ static int amdgpu_ctx_priority_permit(struct drm_file *filp, if (priority <= DRM_SCHED_PRIORITY_NORMAL) return 0; -#ifdef notyet if (capable(CAP_SYS_NICE)) return 0; -#endif if (drm_is_current_master(filp)) return 0; diff --git a/sys/dev/pci/drm/i915/gem/i915_gem_context.c b/sys/dev/pci/drm/i915/gem/i915_gem_context.c index 5a183dfecab..8329d5accce 100644 --- a/sys/dev/pci/drm/i915/gem/i915_gem_context.c +++ b/sys/dev/pci/drm/i915/gem/i915_gem_context.c @@ -2020,12 +2020,8 @@ static int set_priority(struct i915_gem_context *ctx, priority < I915_CONTEXT_MIN_USER_PRIORITY) return -EINVAL; -#ifdef notyet if (priority > I915_CONTEXT_DEFAULT_PRIORITY && !capable(CAP_SYS_NICE)) -#else - if (priority > I915_CONTEXT_DEFAULT_PRIORITY) -#endif return -EPERM; ctx->sched.priority = I915_USER_PRIORITY(priority); diff --git a/sys/dev/pci/drm/include/linux/capability.h b/sys/dev/pci/drm/include/linux/capability.h index db938d1bc96..00511a0bfcd 100644 --- a/sys/dev/pci/drm/include/linux/capability.h +++ b/sys/dev/pci/drm/include/linux/capability.h @@ -9,11 +9,18 @@ #include <machine/cpu.h> #define CAP_SYS_ADMIN 0x1 -static inline int +#define CAP_SYS_NICE 0x2 + +static inline bool capable(int cap) { - KASSERT(cap == CAP_SYS_ADMIN); - return suser(curproc) == 0; + switch (cap) { + case CAP_SYS_ADMIN: + case CAP_SYS_NICE: + return suser(curproc) == 0; + default: + panic("unhandled capability"); + } } #endif |