]> git.ipfire.org Git - thirdparty/linux.git/blobdiff - drivers/gpu/drm/i915/i915_perf.c
Merge tag 'drm-next-2020-06-02' of git://anongit.freedesktop.org/drm/drm
[thirdparty/linux.git] / drivers / gpu / drm / i915 / i915_perf.c
index f35712d04ba499667e5a4f0ae7a3e4b00cd78683..75c60c2afb7ea280d4fcbea3dcdaed96d73bb2c1 100644 (file)
@@ -3415,10 +3415,10 @@ i915_perf_open_ioctl_locked(struct i915_perf *perf,
        /* Similar to perf's kernel.perf_paranoid_cpu sysctl option
         * we check a dev.i915.perf_stream_paranoid sysctl option
         * to determine if it's ok to access system wide OA counters
-        * without CAP_SYS_ADMIN privileges.
+        * without CAP_PERFMON or CAP_SYS_ADMIN privileges.
         */
        if (privileged_op &&
-           i915_perf_stream_paranoid && !capable(CAP_SYS_ADMIN)) {
+           i915_perf_stream_paranoid && !perfmon_capable()) {
                DRM_DEBUG("Insufficient privileges to open i915 perf stream\n");
                ret = -EACCES;
                goto err_ctx;
@@ -3612,9 +3612,8 @@ static int read_properties_unlocked(struct i915_perf *perf,
                        } else
                                oa_freq_hz = 0;
 
-                       if (oa_freq_hz > i915_oa_max_sample_rate &&
-                           !capable(CAP_SYS_ADMIN)) {
-                               DRM_DEBUG("OA exponent would exceed the max sampling frequency (sysctl dev.i915.oa_max_sample_rate) %uHz without root privileges\n",
+                       if (oa_freq_hz > i915_oa_max_sample_rate && !perfmon_capable()) {
+                               DRM_DEBUG("OA exponent would exceed the max sampling frequency (sysctl dev.i915.oa_max_sample_rate) %uHz without CAP_PERFMON or CAP_SYS_ADMIN privileges\n",
                                          i915_oa_max_sample_rate);
                                return -EACCES;
                        }
@@ -4000,7 +3999,7 @@ int i915_perf_add_config_ioctl(struct drm_device *dev, void *data,
                return -EINVAL;
        }
 
-       if (i915_perf_stream_paranoid && !capable(CAP_SYS_ADMIN)) {
+       if (i915_perf_stream_paranoid && !perfmon_capable()) {
                DRM_DEBUG("Insufficient privileges to add i915 OA config\n");
                return -EACCES;
        }
@@ -4147,7 +4146,7 @@ int i915_perf_remove_config_ioctl(struct drm_device *dev, void *data,
                return -ENOTSUPP;
        }
 
-       if (i915_perf_stream_paranoid && !capable(CAP_SYS_ADMIN)) {
+       if (i915_perf_stream_paranoid && !perfmon_capable()) {
                DRM_DEBUG("Insufficient privileges to remove i915 OA config\n");
                return -EACCES;
        }