Commit 5c95b2d5 authored by Chris Wilson's avatar Chris Wilson Committed by Jani Nikula

drm/i915/perf: Drop wakeref on GuC RC error

If we fail to adjust the GuC run-control on opening the perf stream,
make sure we unwind the wakeref just taken.

v2: Retain old goto label names (Ashutosh)
v3: Drop bitfield boolean

Fixes: 01e74274 ("drm/i915/guc: Support OA when Wa_16011777198 is enabled")
Signed-off-by: default avatarChris Wilson <chris.p.wilson@linux.intel.com>
Reviewed-by: default avatarAshutosh Dixit <ashutosh.dixit@intel.com>
Signed-off-by: default avatarUmesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230323225901.3743681-2-umesh.nerlige.ramappa@intel.com
(cherry picked from commit 2810ac6c)
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
parent 3413881e
...@@ -1592,9 +1592,7 @@ static void i915_oa_stream_destroy(struct i915_perf_stream *stream) ...@@ -1592,9 +1592,7 @@ static void i915_oa_stream_destroy(struct i915_perf_stream *stream)
/* /*
* Wa_16011777198:dg2: Unset the override of GUCRC mode to enable rc6. * Wa_16011777198:dg2: Unset the override of GUCRC mode to enable rc6.
*/ */
if (intel_uc_uses_guc_rc(&gt->uc) && if (stream->override_gucrc)
(IS_DG2_GRAPHICS_STEP(gt->i915, G10, STEP_A0, STEP_C0) ||
IS_DG2_GRAPHICS_STEP(gt->i915, G11, STEP_A0, STEP_B0)))
drm_WARN_ON(&gt->i915->drm, drm_WARN_ON(&gt->i915->drm,
intel_guc_slpc_unset_gucrc_mode(&gt->uc.guc.slpc)); intel_guc_slpc_unset_gucrc_mode(&gt->uc.guc.slpc));
...@@ -3305,8 +3303,10 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream, ...@@ -3305,8 +3303,10 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,
if (ret) { if (ret) {
drm_dbg(&stream->perf->i915->drm, drm_dbg(&stream->perf->i915->drm,
"Unable to override gucrc mode\n"); "Unable to override gucrc mode\n");
goto err_config; goto err_gucrc;
} }
stream->override_gucrc = true;
} }
ret = alloc_oa_buffer(stream); ret = alloc_oa_buffer(stream);
...@@ -3345,11 +3345,15 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream, ...@@ -3345,11 +3345,15 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,
free_oa_buffer(stream); free_oa_buffer(stream);
err_oa_buf_alloc: err_oa_buf_alloc:
free_oa_configs(stream); if (stream->override_gucrc)
intel_guc_slpc_unset_gucrc_mode(&gt->uc.guc.slpc);
err_gucrc:
intel_uncore_forcewake_put(stream->uncore, FORCEWAKE_ALL); intel_uncore_forcewake_put(stream->uncore, FORCEWAKE_ALL);
intel_engine_pm_put(stream->engine); intel_engine_pm_put(stream->engine);
free_oa_configs(stream);
err_config: err_config:
free_noa_wait(stream); free_noa_wait(stream);
......
...@@ -316,6 +316,12 @@ struct i915_perf_stream { ...@@ -316,6 +316,12 @@ struct i915_perf_stream {
* buffer should be checked for available data. * buffer should be checked for available data.
*/ */
u64 poll_oa_period; u64 poll_oa_period;
/**
* @override_gucrc: GuC RC has been overridden for the perf stream,
* and we need to restore the default configuration on release.
*/
bool override_gucrc;
}; };
/** /**
......
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