Skip to content

Commit d4d4c6f

Browse files
unerligerodrigovivi
authored andcommitted
drm/i915/perf: Do not parse context image for HSW
An earlier commit introduced a mechanism to parse the context image to find the OA context control offset. This resulted in an NPD on haswell when gem_context was passed into i915_perf_open_ioctl params. Haswell does not support logical ring contexts, so ensure that the context image is parsed only for platforms with logical ring contexts and also validate lrc_reg_state. v2: Fix build failure v3: Fix checkpatch error Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/7432 Fixes: a5c3a3c ("drm/i915/perf: Determine gen12 oa ctx offset at runtime") Signed-off-by: Umesh Nerlige Ramappa <[email protected]> Reviewed-by: Ashutosh Dixit <[email protected]> Signed-off-by: John Harrison <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit 95c713d) Signed-off-by: Rodrigo Vivi <[email protected]>
1 parent 449a0ef commit d4d4c6f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/gpu/drm/i915/i915_perf.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1383,6 +1383,9 @@ static u32 oa_context_image_offset(struct intel_context *ce, u32 reg)
13831383
u32 offset, len = (ce->engine->context_size - PAGE_SIZE) / 4;
13841384
u32 *state = ce->lrc_reg_state;
13851385

1386+
if (drm_WARN_ON(&ce->engine->i915->drm, !state))
1387+
return U32_MAX;
1388+
13861389
for (offset = 0; offset < len; ) {
13871390
if (IS_MI_LRI_CMD(state[offset])) {
13881391
/*
@@ -1447,7 +1450,8 @@ static int oa_get_render_ctx_id(struct i915_perf_stream *stream)
14471450
if (IS_ERR(ce))
14481451
return PTR_ERR(ce);
14491452

1450-
if (engine_supports_mi_query(stream->engine)) {
1453+
if (engine_supports_mi_query(stream->engine) &&
1454+
HAS_LOGICAL_RING_CONTEXTS(stream->perf->i915)) {
14511455
/*
14521456
* We are enabling perf query here. If we don't find the context
14531457
* offset here, just return an error.

0 commit comments

Comments
 (0)