diff mbox series

[11/11] drm/i915/perf: Wa_14017512683: Disable OAM if media C6 is enabled in BIOS

Message ID 20230323225901.3743681-12-umesh.nerlige.ramappa@intel.com (mailing list archive)
State New, archived
Headers show
Series Add OAM support for MTL | expand

Commit Message

Umesh Nerlige Ramappa March 23, 2023, 10:59 p.m. UTC
OAM does not work with media C6 enabled on some steppings of MTL.
Disable OAM if we detect that media C6 was enabled in bios.

v2: (Ashutosh)
- Remove drm_notice from the driver load path
- Log a drm_err when opening an OAM stream on affected steppings

v3:
- Initialize the engine group even if mc6 is enabled (Ashutosh)
- Checkpatch fix

Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
---
 drivers/gpu/drm/i915/i915_perf.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

Comments

Matt Roper July 18, 2023, 7:49 p.m. UTC | #1
On Thu, Mar 23, 2023 at 03:59:01PM -0700, Umesh Nerlige Ramappa wrote:
> OAM does not work with media C6 enabled on some steppings of MTL.

I just stumbled across this while looking at something else, but
14017512683 isn't a valid workaround number; that's just a per-platform
identifier associated with Wa_18023884638.  The actual Wa_18023884638
applies not only to MTL, but also to DG2 which it looks like we're not
handling below.


Matt

> Disable OAM if we detect that media C6 was enabled in bios.
> 
> v2: (Ashutosh)
> - Remove drm_notice from the driver load path
> - Log a drm_err when opening an OAM stream on affected steppings
> 
> v3:
> - Initialize the engine group even if mc6 is enabled (Ashutosh)
> - Checkpatch fix
> 
> Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
> Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_perf.c | 31 +++++++++++++++++++++++++++++++
>  1 file changed, 31 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
> index 18afa76653b7..c035dbb84c9b 100644
> --- a/drivers/gpu/drm/i915/i915_perf.c
> +++ b/drivers/gpu/drm/i915/i915_perf.c
> @@ -209,6 +209,7 @@
>  #include "gt/intel_gt_regs.h"
>  #include "gt/intel_lrc.h"
>  #include "gt/intel_lrc_reg.h"
> +#include "gt/intel_rc6.h"
>  #include "gt/intel_ring.h"
>  #include "gt/uc/intel_guc_slpc.h"
>  
> @@ -4223,6 +4224,19 @@ static int read_properties_unlocked(struct i915_perf *perf,
>  		return -EINVAL;
>  	}
>  
> +	/*
> +	 * Wa_14017512683: mtl[a0..c0): Use of OAM must be preceded with Media
> +	 * C6 disable in BIOS. Fail if Media C6 is enabled on steppings where OAM
> +	 * does not work as expected.
> +	 */
> +	if (IS_MTL_MEDIA_STEP(props->engine->i915, STEP_A0, STEP_C0) &&
> +	    props->engine->oa_group->type == TYPE_OAM &&
> +	    intel_check_bios_c6_setup(&props->engine->gt->rc6)) {
> +		drm_dbg(&perf->i915->drm,
> +			"OAM requires media C6 to be disabled in BIOS\n");
> +		return -EINVAL;
> +	}
> +
>  	i = array_index_nospec(props->oa_format, I915_OA_FORMAT_MAX);
>  	f = &perf->oa_formats[i];
>  	if (!engine_supports_oa_format(props->engine, f->type)) {
> @@ -5316,6 +5330,23 @@ int i915_perf_ioctl_version(struct drm_i915_private *i915)
>  	 *
>  	 * 7: Add support for video decode and enhancement classes.
>  	 */
> +
> +	/*
> +	 * Wa_14017512683: mtl[a0..c0): Use of OAM must be preceded with Media
> +	 * C6 disable in BIOS. If Media C6 is enabled in BIOS, return version 6
> +	 * to indicate that OA media is not supported.
> +	 */
> +	if (IS_MTL_MEDIA_STEP(i915, STEP_A0, STEP_C0)) {
> +		struct intel_gt *gt;
> +		int i;
> +
> +		for_each_gt(gt, i915, i) {
> +			if (gt->type == GT_MEDIA &&
> +			    intel_check_bios_c6_setup(&gt->rc6))
> +				return 6;
> +		}
> +	}
> +
>  	return 7;
>  }
>  
> -- 
> 2.36.1
>
Dixit, Ashutosh July 19, 2023, 12:20 a.m. UTC | #2
On Tue, 18 Jul 2023 12:49:47 -0700, Matt Roper wrote:
>

Hi Matt,

> On Thu, Mar 23, 2023 at 03:59:01PM -0700, Umesh Nerlige Ramappa wrote:
> > OAM does not work with media C6 enabled on some steppings of MTL.
>
> I just stumbled across this while looking at something else, but
> 14017512683 isn't a valid workaround number; that's just a per-platform
> identifier associated with Wa_18023884638.  The actual Wa_18023884638
> applies not only to MTL, but also to DG2 which it looks like we're not
> handling below.

Thanks for letting us know about this. You're right, all our (our team's)
WA numbers are a complete horror show, we'll need to do something about it.

Ashutosh
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
index 18afa76653b7..c035dbb84c9b 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -209,6 +209,7 @@ 
 #include "gt/intel_gt_regs.h"
 #include "gt/intel_lrc.h"
 #include "gt/intel_lrc_reg.h"
+#include "gt/intel_rc6.h"
 #include "gt/intel_ring.h"
 #include "gt/uc/intel_guc_slpc.h"
 
@@ -4223,6 +4224,19 @@  static int read_properties_unlocked(struct i915_perf *perf,
 		return -EINVAL;
 	}
 
+	/*
+	 * Wa_14017512683: mtl[a0..c0): Use of OAM must be preceded with Media
+	 * C6 disable in BIOS. Fail if Media C6 is enabled on steppings where OAM
+	 * does not work as expected.
+	 */
+	if (IS_MTL_MEDIA_STEP(props->engine->i915, STEP_A0, STEP_C0) &&
+	    props->engine->oa_group->type == TYPE_OAM &&
+	    intel_check_bios_c6_setup(&props->engine->gt->rc6)) {
+		drm_dbg(&perf->i915->drm,
+			"OAM requires media C6 to be disabled in BIOS\n");
+		return -EINVAL;
+	}
+
 	i = array_index_nospec(props->oa_format, I915_OA_FORMAT_MAX);
 	f = &perf->oa_formats[i];
 	if (!engine_supports_oa_format(props->engine, f->type)) {
@@ -5316,6 +5330,23 @@  int i915_perf_ioctl_version(struct drm_i915_private *i915)
 	 *
 	 * 7: Add support for video decode and enhancement classes.
 	 */
+
+	/*
+	 * Wa_14017512683: mtl[a0..c0): Use of OAM must be preceded with Media
+	 * C6 disable in BIOS. If Media C6 is enabled in BIOS, return version 6
+	 * to indicate that OA media is not supported.
+	 */
+	if (IS_MTL_MEDIA_STEP(i915, STEP_A0, STEP_C0)) {
+		struct intel_gt *gt;
+		int i;
+
+		for_each_gt(gt, i915, i) {
+			if (gt->type == GT_MEDIA &&
+			    intel_check_bios_c6_setup(&gt->rc6))
+				return 6;
+		}
+	}
+
 	return 7;
 }