Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH v5 01/12] drm/i915/perf: Drop wakeref on GuC RC error
Date: Wed, 15 Mar 2023 17:09:21 -0700	[thread overview]
Message-ID: <20230316000932.2525744-2-umesh.nerlige.ramappa@intel.com> (raw)
In-Reply-To: <20230316000932.2525744-1-umesh.nerlige.ramappa@intel.com>

From: Chris Wilson <chris.p.wilson@linux.intel.com>

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)

Fixes: 01e742746785 ("drm/i915/guc: Support OA when Wa_16011777198 is enabled")
Signed-off-by: Chris Wilson <chris.p.wilson@linux.intel.com>
Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
---
 drivers/gpu/drm/i915/i915_perf.c       | 14 +++++++++-----
 drivers/gpu/drm/i915/i915_perf_types.h |  6 ++++++
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
index 824a34ec0b83..283a4a3c6862 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -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.
 	 */
-	if (intel_uc_uses_guc_rc(&gt->uc) &&
-	    (IS_DG2_GRAPHICS_STEP(gt->i915, G10, STEP_A0, STEP_C0) ||
-	     IS_DG2_GRAPHICS_STEP(gt->i915, G11, STEP_A0, STEP_B0)))
+	if (stream->override_gucrc)
 		drm_WARN_ON(&gt->i915->drm,
 			    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,
 		if (ret) {
 			drm_dbg(&stream->perf->i915->drm,
 				"Unable to override gucrc mode\n");
-			goto err_config;
+			goto err_gucrc;
 		}
+
+		stream->override_gucrc = true;
 	}
 
 	ret = alloc_oa_buffer(stream);
@@ -3345,11 +3345,15 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,
 	free_oa_buffer(stream);
 
 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_engine_pm_put(stream->engine);
 
+	free_oa_configs(stream);
+
 err_config:
 	free_noa_wait(stream);
 
diff --git a/drivers/gpu/drm/i915/i915_perf_types.h b/drivers/gpu/drm/i915/i915_perf_types.h
index ca150b7af3f2..e36f046fe2b6 100644
--- a/drivers/gpu/drm/i915/i915_perf_types.h
+++ b/drivers/gpu/drm/i915/i915_perf_types.h
@@ -316,6 +316,12 @@ struct i915_perf_stream {
 	 * buffer should be checked for available data.
 	 */
 	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:1;
 };
 
 /**
-- 
2.36.1


  reply	other threads:[~2023-03-16  0:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-16  0:09 [Intel-gfx] [PATCH v5 00/12] Add OAM support for MTL Umesh Nerlige Ramappa
2023-03-16  0:09 ` Umesh Nerlige Ramappa [this message]
2023-03-16  0:09 ` [Intel-gfx] [PATCH v5 02/12] drm/i915/mtl: Synchronize i915/BIOS on C6 enabling Umesh Nerlige Ramappa
2023-03-16 16:06   ` Umesh Nerlige Ramappa
2023-03-16  0:09 ` [Intel-gfx] [PATCH v5 03/12] drm/i915/perf: Add helper to check supported OA engines Umesh Nerlige Ramappa
2023-03-16  0:09 ` [Intel-gfx] [PATCH v5 04/12] drm/i915/perf: Validate OA sseu config outside switch Umesh Nerlige Ramappa
2023-03-16  0:09 ` [Intel-gfx] [PATCH v5 05/12] drm/i915/perf: Group engines into respective OA groups Umesh Nerlige Ramappa
2023-03-16  0:09 ` [Intel-gfx] [PATCH v5 06/12] drm/i915/perf: Fail modprobe if i915_perf_init fails on OOM Umesh Nerlige Ramappa
2023-03-16  0:09 ` [Intel-gfx] [PATCH v5 07/12] drm/i915/perf: Parse 64bit report header formats correctly Umesh Nerlige Ramappa
2023-03-16  0:09 ` [Intel-gfx] [PATCH v5 08/12] drm/i915/perf: Handle non-power-of-2 reports Umesh Nerlige Ramappa
2023-03-16  0:09 ` [Intel-gfx] [PATCH v5 09/12] drm/i915/perf: Add engine class instance parameters to perf Umesh Nerlige Ramappa
2023-03-16  5:31   ` Dixit, Ashutosh
2023-03-16  0:09 ` [Intel-gfx] [PATCH v5 10/12] drm/i915/perf: Add support for OA media units Umesh Nerlige Ramappa
2023-03-16  0:09 ` [Intel-gfx] [PATCH v5 11/12] drm/i915/perf: Pass i915 object to perf revision helper Umesh Nerlige Ramappa
2023-03-16  0:09 ` [Intel-gfx] [PATCH v5 12/12] drm/i915/perf: Wa_14017512683: Disable OAM if media C6 is enabled in BIOS Umesh Nerlige Ramappa
2023-03-16  0:13 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for Add OAM support for MTL Patchwork
2023-03-16  0:14 ` [Intel-gfx] [PATCH v5 00/12] " Umesh Nerlige Ramappa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230316000932.2525744-2-umesh.nerlige.ramappa@intel.com \
    --to=umesh.nerlige.ramappa@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox