Skip to content

Commit 98fa06e

Browse files
bhadanednyaneshwarmattrope
authored andcommitted
drm/i915: Add Wa_18022495364
Invalidate instruction and State cache bit using INDIRECT_CTX on every gpu context switch for gen12. The goal of this workaround is to actually perform an explicit invalidation of that cache (by re-writing the register) during every GPU context switch, which is accomplished via a "workaround batchbuffer" that's attached to the context via INDIRECT_CTX. (Matt Roper) Please refer [1] for more reviews and comment on the same patch [1] https://patchwork.freedesktop.org/series/123377/ v2: - Remove extra parentheses from the condition (Lucas) - Align spacing and new line (Lucas) v3: - Fix commit message. v4: - Only Gen12 changes are kept and Remove DG2+ condition (Matt Roper) - Fix the commit message for r-b (Matt Roper) - Rename the register bit in define v5: - Move out this workaround from golden context init (Matt Roper) - Use INDIRECT_CTX to set bit on each GPU context switch (Matt Roper) v6: - Change IP Version base condition for Gen12 (Matt Roper) - Made imperative form of commit version messages (Suraj) - s/Added/Add in patch header (Suraj) v7: - In version descriptions s/Ropper/Roper (Matt Atwood) BSpec: 11354 Cc: Lucas De Marchi <lucas.demarchi@intel.com> Cc: Matt Roper <matthew.d.roper@intel.com> Cc: Suraj Kandpal <suraj.kandpal@intel.com> Cc: Matt Atwood <matthew.s.atwood@intel.com> Signed-off-by: Dnyaneshwar Bhadane <dnyaneshwar.bhadane@intel.com> Reviewed-by: Matt Roper <matthew.d.roper@intel.com> Signed-off-by: Matt Roper <matthew.d.roper@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230914202000.1069884-1-dnyaneshwar.bhadane@intel.com
1 parent c92ec50 commit 98fa06e

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

drivers/gpu/drm/i915/gt/intel_gt_regs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@
164164
#define GEN9_CSFE_CHICKEN1_RCS _MMIO(0x20d4)
165165
#define GEN9_PREEMPT_GPGPU_SYNC_SWITCH_DISABLE (1 << 2)
166166
#define GEN11_ENABLE_32_PLANE_MODE (1 << 7)
167+
#define GEN12_CS_DEBUG_MODE2 _MMIO(0x20d8)
168+
#define INSTRUCTION_STATE_CACHE_INVALIDATE REG_BIT(6)
167169

168170
#define GEN7_FF_SLICE_CS_CHICKEN1 _MMIO(0x20e0)
169171
#define GEN9_FFSC_PERCTX_PREEMPT_CTRL (1 << 14)

drivers/gpu/drm/i915/gt/intel_lrc.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,6 +1333,15 @@ dg2_emit_draw_watermark_setting(u32 *cs)
13331333
return cs;
13341334
}
13351335

1336+
static u32 *
1337+
gen12_invalidate_state_cache(u32 *cs)
1338+
{
1339+
*cs++ = MI_LOAD_REGISTER_IMM(1);
1340+
*cs++ = i915_mmio_reg_offset(GEN12_CS_DEBUG_MODE2);
1341+
*cs++ = _MASKED_BIT_ENABLE(INSTRUCTION_STATE_CACHE_INVALIDATE);
1342+
return cs;
1343+
}
1344+
13361345
static u32 *
13371346
gen12_emit_indirect_ctx_rcs(const struct intel_context *ce, u32 *cs)
13381347
{
@@ -1346,6 +1355,10 @@ gen12_emit_indirect_ctx_rcs(const struct intel_context *ce, u32 *cs)
13461355

13471356
cs = gen12_emit_aux_table_inv(ce->engine, cs);
13481357

1358+
/* Wa_18022495364 */
1359+
if (IS_GFX_GT_IP_RANGE(ce->engine->gt, IP_VER(12, 0), IP_VER(12, 10)))
1360+
cs = gen12_invalidate_state_cache(cs);
1361+
13491362
/* Wa_16014892111 */
13501363
if (IS_GFX_GT_IP_STEP(ce->engine->gt, IP_VER(12, 70), STEP_A0, STEP_B0) ||
13511364
IS_GFX_GT_IP_STEP(ce->engine->gt, IP_VER(12, 71), STEP_A0, STEP_B0) ||

0 commit comments

Comments
 (0)