Re: [Intel-gfx] [PATCH 2/8] drm/i915/xelpg: Call Xe_LPG workaround functions based on IP version
Quoting Matt Roper (2023-07-18 19:27:56-03:00) >Although some of our Xe_LPG workarounds were already being applied based >on IP version correctly, others were matching on MTL as a base platform, >which is incorrect. Although MTL is the only platform right now that >uses Xe_LPG IP, this may not always be the case. If a future platform >re-uses this graphics IP, the same workarounds should be applied, even >if it isn't a "MTL" platform. > >We were also incorrectly applying Xe_LPG workarounds/tuning to the >Xe_LPM+ media IP in one or two places; we should make sure that we don't >try to apply graphics workarounds to the media GT and vice versa where >they don't belong. A new helper macro GT_GRAPHICS_RANGE() is added to >help ensure this is handled properly -- it checks both the graphics >version range and that the code isn't operating on a media GT. > >Note that many of the stepping-based workarounds are still incorrectly >checking for a MTL base platform; that will be remedied in a later >patch. > >Signed-off-by: Matt Roper >--- > drivers/gpu/drm/i915/gt/intel_workarounds.c | 40 +++-- > drivers/gpu/drm/i915/i915_drv.h | 5 +++ > 2 files changed, 26 insertions(+), 19 deletions(-) > >diff --git a/drivers/gpu/drm/i915/gt/intel_workarounds.c >b/drivers/gpu/drm/i915/gt/intel_workarounds.c >index b177c588698b..2a5bf50962ad 100644 >--- a/drivers/gpu/drm/i915/gt/intel_workarounds.c >+++ b/drivers/gpu/drm/i915/gt/intel_workarounds.c >@@ -805,8 +805,8 @@ static void dg2_ctx_workarounds_init(struct >intel_engine_cs *engine, > wa_masked_en(wal, CACHE_MODE_1, MSAA_OPTIMIZATION_REDUC_DISABLE); > } > >-static void mtl_ctx_gt_tuning_init(struct intel_engine_cs *engine, >- struct i915_wa_list *wal) >+static void xelpg_ctx_gt_tuning_init(struct intel_engine_cs *engine, >+ struct i915_wa_list *wal) > { > struct drm_i915_private *i915 = engine->i915; > >@@ -817,12 +817,12 @@ static void mtl_ctx_gt_tuning_init(struct >intel_engine_cs *engine, > wa_add(wal, DRAW_WATERMARK, VERT_WM_VAL, 0x3FF, 0, false); > } > >-static void mtl_ctx_workarounds_init(struct intel_engine_cs *engine, >- struct i915_wa_list *wal) >+static void xelpg_ctx_workarounds_init(struct intel_engine_cs *engine, >+ struct i915_wa_list *wal) > { > struct drm_i915_private *i915 = engine->i915; > >-mtl_ctx_gt_tuning_init(engine, wal); >+xelpg_ctx_gt_tuning_init(engine, wal); > > if (IS_MTL_GRAPHICS_STEP(i915, M, STEP_A0, STEP_B0) || > IS_MTL_GRAPHICS_STEP(i915, P, STEP_A0, STEP_B0)) { >@@ -931,8 +931,8 @@ __intel_engine_init_ctx_wa(struct intel_engine_cs *engine, > if (engine->class != RENDER_CLASS) > goto done; > >-if (IS_METEORLAKE(i915)) >-mtl_ctx_workarounds_init(engine, wal); >+if (GT_GRAPHICS_RANGE(engine->gt, IP_VER(12, 70), IP_VER(12, 71))) >+xelpg_ctx_workarounds_init(engine, wal); > else if (IS_PONTEVECCHIO(i915)) > ; /* noop; none at this time */ > else if (IS_DG2(i915)) >@@ -1790,10 +1790,8 @@ xelpmp_gt_workarounds_init(struct intel_gt *gt, struct >i915_wa_list *wal) > */ > static void gt_tuning_settings(struct intel_gt *gt, struct i915_wa_list *wal) > { >-if (IS_METEORLAKE(gt->i915)) { >-if (gt->type != GT_MEDIA) >-wa_mcr_write_or(wal, XEHP_L3SCQREG7, >BLEND_FILL_CACHING_OPT_DIS); >- >+if (GT_GRAPHICS_RANGE(gt, IP_VER(12, 70), IP_VER(12, 71))) { >+wa_mcr_write_or(wal, XEHP_L3SCQREG7, >BLEND_FILL_CACHING_OPT_DIS); > wa_mcr_write_or(wal, XEHP_SQCM, EN_32B_ACCESS); > } > >@@ -1817,7 +1815,7 @@ gt_init_workarounds(struct intel_gt *gt, struct >i915_wa_list *wal) > gt_tuning_settings(gt, wal); > > if (gt->type == GT_MEDIA) { >-if (MEDIA_VER(i915) >= 13) >+if (MEDIA_VER(i915) == 13) This looks a bit unrelated to the commit message. I would add a short note for this or make it a different patch. > xelpmp_gt_workarounds_init(gt, wal); > else > MISSING_CASE(MEDIA_VER(i915)); >@@ -1825,7 +1823,7 @@ gt_init_workarounds(struct intel_gt *gt, struct >i915_wa_list *wal) > return; > } > >-if (GRAPHICS_VER_FULL(i915) >= IP_VER(12, 70)) >+if (GT_GRAPHICS_RANGE(gt, IP_VER(12, 70), IP_VER(12, 71))) > xelpg_gt_workarounds_init(gt, wal); > else if (IS_PONTEVECCHIO(i915)) > pvc_gt_workarounds_init(gt, wal); >@@ -2293,7 +2291,7 @@ static void pvc_whitelist_build(struct intel_engine_cs >*engine) > blacklist_trtt(engine); > } > >-static void mtl_whitelist_build(struct intel_engine_cs *engine) >+static void
[Intel-gfx] [PATCH 2/8] drm/i915/xelpg: Call Xe_LPG workaround functions based on IP version
Although some of our Xe_LPG workarounds were already being applied based on IP version correctly, others were matching on MTL as a base platform, which is incorrect. Although MTL is the only platform right now that uses Xe_LPG IP, this may not always be the case. If a future platform re-uses this graphics IP, the same workarounds should be applied, even if it isn't a "MTL" platform. We were also incorrectly applying Xe_LPG workarounds/tuning to the Xe_LPM+ media IP in one or two places; we should make sure that we don't try to apply graphics workarounds to the media GT and vice versa where they don't belong. A new helper macro GT_GRAPHICS_RANGE() is added to help ensure this is handled properly -- it checks both the graphics version range and that the code isn't operating on a media GT. Note that many of the stepping-based workarounds are still incorrectly checking for a MTL base platform; that will be remedied in a later patch. Signed-off-by: Matt Roper --- drivers/gpu/drm/i915/gt/intel_workarounds.c | 40 +++-- drivers/gpu/drm/i915/i915_drv.h | 5 +++ 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/intel_workarounds.c b/drivers/gpu/drm/i915/gt/intel_workarounds.c index b177c588698b..2a5bf50962ad 100644 --- a/drivers/gpu/drm/i915/gt/intel_workarounds.c +++ b/drivers/gpu/drm/i915/gt/intel_workarounds.c @@ -805,8 +805,8 @@ static void dg2_ctx_workarounds_init(struct intel_engine_cs *engine, wa_masked_en(wal, CACHE_MODE_1, MSAA_OPTIMIZATION_REDUC_DISABLE); } -static void mtl_ctx_gt_tuning_init(struct intel_engine_cs *engine, - struct i915_wa_list *wal) +static void xelpg_ctx_gt_tuning_init(struct intel_engine_cs *engine, +struct i915_wa_list *wal) { struct drm_i915_private *i915 = engine->i915; @@ -817,12 +817,12 @@ static void mtl_ctx_gt_tuning_init(struct intel_engine_cs *engine, wa_add(wal, DRAW_WATERMARK, VERT_WM_VAL, 0x3FF, 0, false); } -static void mtl_ctx_workarounds_init(struct intel_engine_cs *engine, -struct i915_wa_list *wal) +static void xelpg_ctx_workarounds_init(struct intel_engine_cs *engine, + struct i915_wa_list *wal) { struct drm_i915_private *i915 = engine->i915; - mtl_ctx_gt_tuning_init(engine, wal); + xelpg_ctx_gt_tuning_init(engine, wal); if (IS_MTL_GRAPHICS_STEP(i915, M, STEP_A0, STEP_B0) || IS_MTL_GRAPHICS_STEP(i915, P, STEP_A0, STEP_B0)) { @@ -931,8 +931,8 @@ __intel_engine_init_ctx_wa(struct intel_engine_cs *engine, if (engine->class != RENDER_CLASS) goto done; - if (IS_METEORLAKE(i915)) - mtl_ctx_workarounds_init(engine, wal); + if (GT_GRAPHICS_RANGE(engine->gt, IP_VER(12, 70), IP_VER(12, 71))) + xelpg_ctx_workarounds_init(engine, wal); else if (IS_PONTEVECCHIO(i915)) ; /* noop; none at this time */ else if (IS_DG2(i915)) @@ -1790,10 +1790,8 @@ xelpmp_gt_workarounds_init(struct intel_gt *gt, struct i915_wa_list *wal) */ static void gt_tuning_settings(struct intel_gt *gt, struct i915_wa_list *wal) { - if (IS_METEORLAKE(gt->i915)) { - if (gt->type != GT_MEDIA) - wa_mcr_write_or(wal, XEHP_L3SCQREG7, BLEND_FILL_CACHING_OPT_DIS); - + if (GT_GRAPHICS_RANGE(gt, IP_VER(12, 70), IP_VER(12, 71))) { + wa_mcr_write_or(wal, XEHP_L3SCQREG7, BLEND_FILL_CACHING_OPT_DIS); wa_mcr_write_or(wal, XEHP_SQCM, EN_32B_ACCESS); } @@ -1817,7 +1815,7 @@ gt_init_workarounds(struct intel_gt *gt, struct i915_wa_list *wal) gt_tuning_settings(gt, wal); if (gt->type == GT_MEDIA) { - if (MEDIA_VER(i915) >= 13) + if (MEDIA_VER(i915) == 13) xelpmp_gt_workarounds_init(gt, wal); else MISSING_CASE(MEDIA_VER(i915)); @@ -1825,7 +1823,7 @@ gt_init_workarounds(struct intel_gt *gt, struct i915_wa_list *wal) return; } - if (GRAPHICS_VER_FULL(i915) >= IP_VER(12, 70)) + if (GT_GRAPHICS_RANGE(gt, IP_VER(12, 70), IP_VER(12, 71))) xelpg_gt_workarounds_init(gt, wal); else if (IS_PONTEVECCHIO(i915)) pvc_gt_workarounds_init(gt, wal); @@ -2293,7 +2291,7 @@ static void pvc_whitelist_build(struct intel_engine_cs *engine) blacklist_trtt(engine); } -static void mtl_whitelist_build(struct intel_engine_cs *engine) +static void xelpg_whitelist_build(struct intel_engine_cs *engine) { struct i915_wa_list *w = >whitelist; @@ -2315,8 +2313,10 @@ void intel_engine_init_whitelist(struct intel_engine_cs *engine) wa_init_start(w, engine->gt, "whitelist", engine->name); - if (IS_METEORLAKE(i915)) -