Commit 6f280b13 authored by Umesh Nerlige Ramappa's avatar Umesh Nerlige Ramappa Committed by Chris Wilson

drm/i915/perf: Fix OA context id overlap with idle context id

Engine context pinned in perf OA was set to same context id as
the idle context. Set the context id to an unused value.

Clear the sw context id field in lrc descriptor before ORing with
ce->tag (Chris)

Closes: https://gitlab.freedesktop.org/drm/intel/issues/756Signed-off-by: default avatarUmesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20200124013701.40609-1-umesh.nerlige.ramappa@intel.com
parent e5429340
...@@ -1211,12 +1211,12 @@ __execlists_schedule_in(struct i915_request *rq) ...@@ -1211,12 +1211,12 @@ __execlists_schedule_in(struct i915_request *rq)
if (IS_ENABLED(CONFIG_DRM_I915_DEBUG_GEM)) if (IS_ENABLED(CONFIG_DRM_I915_DEBUG_GEM))
execlists_check_context(ce, engine); execlists_check_context(ce, engine);
ce->lrc_desc &= ~GENMASK_ULL(47, 37);
if (ce->tag) { if (ce->tag) {
/* Use a fixed tag for OA and friends */ /* Use a fixed tag for OA and friends */
ce->lrc_desc |= (u64)ce->tag << 32; ce->lrc_desc |= (u64)ce->tag << 32;
} else { } else {
/* We don't need a strict matching tag, just different values */ /* We don't need a strict matching tag, just different values */
ce->lrc_desc &= ~GENMASK_ULL(47, 37);
ce->lrc_desc |= ce->lrc_desc |=
(u64)(++engine->context_tag % NUM_CONTEXT_TAG) << (u64)(++engine->context_tag % NUM_CONTEXT_TAG) <<
GEN11_SW_CTX_ID_SHIFT; GEN11_SW_CTX_ID_SHIFT;
......
...@@ -1323,7 +1323,13 @@ static int oa_get_render_ctx_id(struct i915_perf_stream *stream) ...@@ -1323,7 +1323,13 @@ static int oa_get_render_ctx_id(struct i915_perf_stream *stream)
case 12: { case 12: {
stream->specific_ctx_id_mask = stream->specific_ctx_id_mask =
((1U << GEN11_SW_CTX_ID_WIDTH) - 1) << (GEN11_SW_CTX_ID_SHIFT - 32); ((1U << GEN11_SW_CTX_ID_WIDTH) - 1) << (GEN11_SW_CTX_ID_SHIFT - 32);
stream->specific_ctx_id = stream->specific_ctx_id_mask; /*
* Pick an unused context id
* 0 - (NUM_CONTEXT_TAG - 1) are used by other contexts
* GEN12_MAX_CONTEXT_HW_ID (0x7ff) is used by idle context
*/
stream->specific_ctx_id = (GEN12_MAX_CONTEXT_HW_ID - 1) << (GEN11_SW_CTX_ID_SHIFT - 32);
BUILD_BUG_ON((GEN12_MAX_CONTEXT_HW_ID - 1) < NUM_CONTEXT_TAG);
break; break;
} }
...@@ -1331,7 +1337,7 @@ static int oa_get_render_ctx_id(struct i915_perf_stream *stream) ...@@ -1331,7 +1337,7 @@ static int oa_get_render_ctx_id(struct i915_perf_stream *stream)
MISSING_CASE(INTEL_GEN(ce->engine->i915)); MISSING_CASE(INTEL_GEN(ce->engine->i915));
} }
ce->tag = stream->specific_ctx_id_mask; ce->tag = stream->specific_ctx_id;
DRM_DEBUG_DRIVER("filtering on ctx_id=0x%x ctx_id_mask=0x%x\n", DRM_DEBUG_DRIVER("filtering on ctx_id=0x%x ctx_id_mask=0x%x\n",
stream->specific_ctx_id, stream->specific_ctx_id,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment