drm/i915/perf: Do not parse context image for HSW
Subsystems (2)
PATCH 1/1 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.
--- drivers/gpu/drm/i915/i915_perf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_perf.c +5 -1
@@ -1383,6 +1383,9 @@ static u32 oa_context_image_offset(struct intel_context *ce, u32 reg)u32 offset, len = (ce->engine->context_size -PAGE_SIZE ) /4 ;u32 *state = ce->lrc_reg_state; + if (drm_WARN_ON(&ce->engine->i915->drm, state == NULL) +return U32_MAX ; +for (offset =0 ; offset < len; ) {if (IS_MI_LRI_CMD (state[offset])) {/*
@@ -1447,7 +1450,8 @@ static int oa_get_render_ctx_id(struct i915_perf_stream *stream)if (IS_ERR (ce))return PTR_ERR (ce); -if (engine_supports_mi_query (stream->engine)) { +if (engine_supports_mi_query (stream->engine) && +HAS_LOGICAL_RING_CONTEXTS (stream->perf->i915)) {/* * We are enabling perf query here. If we don't find the context * offset here, just return an error.
Signature · 1 line
2.36.1
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/i915/perf: Do not parse context image for HSW
== Series Details ==
== Series Details ==
Series: drm/i915/perf: Do not parse context image for HSW
URL : https://patchwork.freedesktop.org/series/111231/
State : failure
== Summary ==
Error: make failed
CALL scripts/checksyscalls.sh
DESCEND objtool
CC [M] drivers/gpu/drm/i915/i915_perf.odrivers/gpu/drm/i915/i915_perf.c: In function ‘oa_context_image_offset’:drivers/gpu/drm/i915/i915_perf.c:1387:3: error: expected ‘)’ before ‘return’
return U32_MAX;
^~~~~~drivers/gpu/drm/i915/i915_perf.c:1386:5: note: to match this ‘(’
if (drm_WARN_ON(&ce->engine->i915->drm, state == NULL)
^
drivers/gpu/drm/i915/i915_perf.c:1406:1: error: expected expression before ‘}’ token
}
^drivers/gpu/drm/i915/i915_perf.c:1383:14: error: unused variable ‘len’ [-Werror=unused-variable]
u32 offset, len = (ce->engine->context_size - PAGE_SIZE) / 4;
^~~
drivers/gpu/drm/i915/i915_perf.c:1383:6: error: unused variable ‘offset’ [-Werror=unused-variable]
u32 offset, len = (ce->engine->context_size - PAGE_SIZE) / 4;
^~~~~~drivers/gpu/drm/i915/i915_perf.c:1406:1: error: no return statement in function returning non-void [-Werror=return-type]
}
^
At top level:drivers/gpu/drm/i915/i915_perf.c:1363:13: error: ‘oa_find_reg_in_lri’ defined but not used [-Werror=unused-function]
static bool oa_find_reg_in_lri(u32 *state, u32 reg, u32 *offset, u32 end)
^~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errorsscripts/Makefile.build:250: recipe for target 'drivers/gpu/drm/i915/i915_perf.o' failed make[5]: *** [drivers/gpu/drm/i915/i915_perf.o] Error 1 scripts/Makefile.build:500: recipe for target 'drivers/gpu/drm/i915' failed make[4]: *** [drivers/gpu/drm/i915] Error 2scripts/Makefile.build:500: recipe for target 'drivers/gpu/drm' failed make[3]: *** [drivers/gpu/drm] Error 2scripts/Makefile.build:500: recipe for target 'drivers/gpu' failed make[2]: *** [drivers/gpu] Error 2scripts/Makefile.build:500: recipe for target 'drivers' failed
make[1]: *** [drivers] Error 2
Makefile:1992: recipe for target '.' failed
make: *** [.] Error 2