Message ID | 20191118222432.65399-1-umesh.nerlige.ramappa@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v3,1/2] drm/i915/perf: Allow non-privileged access when OA buffer is not sampled | expand |
On 19/11/2019 00:24, Umesh Nerlige Ramappa wrote: > SAMPLE_OA_REPORT enables sampling of OA reports from the OA buffer. > Since reports from OA buffer had system wide visibility, collecting > samples from the OA buffer was a privileged operation on previous > platforms. Prior to TGL, it was also necessary to sample the OA buffer > to normalize reports from MI REPORT PERF COUNT. > > TGL has a dedicated OAR unit to sample perf reports for a specific > render context. This removes the necessity to sample OA buffer. > > - If not sampling the OA buffer, allow non-privileged access. An earlier > patch allows the non-privilege access: > https://patchwork.freedesktop.org/patch/337716/?series=68582&rev=1 > - Clear up the path for non-privileged access in this patch > > Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> > --- > drivers/gpu/drm/i915/i915_perf.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c > index 608e6c3f3c1a..ca58502a67d8 100644 > --- a/drivers/gpu/drm/i915/i915_perf.c > +++ b/drivers/gpu/drm/i915/i915_perf.c > @@ -2720,7 +2720,8 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream, > return -EINVAL; > } > > - if (!(props->sample_flags & SAMPLE_OA_REPORT)) { > + if (!(props->sample_flags & SAMPLE_OA_REPORT) && > + (INTEL_GEN(perf->i915) < 12 || !stream->ctx)) { > DRM_DEBUG("Only OA report sampling supported\n"); > return -EINVAL; > } > @@ -2752,7 +2753,7 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream, > > format_size = perf->oa_formats[props->oa_format].size; > > - stream->sample_flags |= SAMPLE_OA_REPORT; > + stream->sample_flags = props->sample_flags; > stream->sample_size += format_size; > > stream->oa_buffer.format_size = format_size;
diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c index 608e6c3f3c1a..ca58502a67d8 100644 --- a/drivers/gpu/drm/i915/i915_perf.c +++ b/drivers/gpu/drm/i915/i915_perf.c @@ -2720,7 +2720,8 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream, return -EINVAL; } - if (!(props->sample_flags & SAMPLE_OA_REPORT)) { + if (!(props->sample_flags & SAMPLE_OA_REPORT) && + (INTEL_GEN(perf->i915) < 12 || !stream->ctx)) { DRM_DEBUG("Only OA report sampling supported\n"); return -EINVAL; } @@ -2752,7 +2753,7 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream, format_size = perf->oa_formats[props->oa_format].size; - stream->sample_flags |= SAMPLE_OA_REPORT; + stream->sample_flags = props->sample_flags; stream->sample_size += format_size; stream->oa_buffer.format_size = format_size;
SAMPLE_OA_REPORT enables sampling of OA reports from the OA buffer. Since reports from OA buffer had system wide visibility, collecting samples from the OA buffer was a privileged operation on previous platforms. Prior to TGL, it was also necessary to sample the OA buffer to normalize reports from MI REPORT PERF COUNT. TGL has a dedicated OAR unit to sample perf reports for a specific render context. This removes the necessity to sample OA buffer. - If not sampling the OA buffer, allow non-privileged access. An earlier patch allows the non-privilege access: https://patchwork.freedesktop.org/patch/337716/?series=68582&rev=1 - Clear up the path for non-privileged access in this patch Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com> --- drivers/gpu/drm/i915/i915_perf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)