drm/i915/dg2: Add per-context control for Wa_22013059131
Subsystems (4)
PATCH v4 1/1 drm/i915/dg2: Add per-context control for Wa_22013059131
Wa_22013059131 sets FORCE_1_SUB_MESSAGE_PER_FRAGMENT in LSC_CHICKEN_BIT_0 at engine init, but this is known to cause GPU hangs in certain workloads. Add I915_CONTEXT_PARAM_WA_22013059131 so userspace that handles the workaround itself (e.g. by limiting SLM size) can set it to 1 to let the kernel know bit 15 programming is not needed for that context.
LSC_CHICKEN_BIT_0 is not context-saved by hardware, so the kernel restores the correct value on every context switch via the indirect context batchbuffer to avoid leaking state between contexts. The old unconditional application of Wa22013059131 in intel_workarounds.c is removed.
v4:
- Add a link of the userspace using this API
v3:
- Kernel-internal context will not change workaround settings
Bspec: 54833
--- drivers/gpu/drm/i915/gem/i915_gem_context.c | 12 +++++ .../gpu/drm/i915/gem/i915_gem_context_types.h | 1 + drivers/gpu/drm/i915/gt/intel_context_types.h | 1 + drivers/gpu/drm/i915/gt/intel_lrc.c | 44 ++++++++++++++++++- drivers/gpu/drm/i915/gt/intel_workarounds.c | 10 ++--- include/uapi/drm/i915_drm.h | 10 +++++ 6 files changed, 72 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_context.c +12 -0
@@ -911,6 +911,15 @@ static int set_proto_ctx_param(struct drm_i915_file_private *fpriv, ret = -EINVAL ;break ; +case I915_CONTEXT_PARAM_WA_22013059131 : +if (args->size) + ret = -EINVAL ; +else if (args->value) + pc->user_flags |=BIT (UCONTEXT_WA_22013059131 ); +else + pc->user_flags &= ~BIT (UCONTEXT_WA_22013059131 ); +break ; +case I915_CONTEXT_PARAM_RECOVERABLE :if (args->size) ret = -EINVAL ;
@@ -1003,6 +1012,9 @@ static int intel_context_set_gem(struct intel_context *ce,if (test_bit (UCONTEXT_LOW_LATENCY , &ctx->user_flags))__set_bit (CONTEXT_LOW_LATENCY , &ce->flags); +if (test_bit (UCONTEXT_WA_22013059131 , &ctx->user_flags)) +__set_bit (CONTEXT_WA_22013059131 , &ce->flags); +return ret; }
drivers/gpu/drm/i915/gem/i915_gem_context_types.h +1 -0
@@ -338,6 +338,7 @@ struct i915_gem_context {#define UCONTEXT_RECOVERABLE 3#define UCONTEXT_PERSISTENCE 4#define UCONTEXT_LOW_LATENCY 5 +#define UCONTEXT_WA_22013059131 6/** * @flags: small set of booleans
drivers/gpu/drm/i915/gt/intel_context_types.h +1 -0
@@ -133,6 +133,7 @@ struct intel_context {#define CONTEXT_EXITING 13#define CONTEXT_LOW_LATENCY 14#define CONTEXT_OWN_STATE 15 +#define CONTEXT_WA_22013059131 16struct {u64 timeout_us;
drivers/gpu/drm/i915/gt/intel_lrc.c +43 -1
62 lines not on this page · raw message
drivers/gpu/drm/i915/gt/intel_workarounds.c +5 -5
@@ -2840,7 +2840,11 @@ general_render_compute_wa_init(struct intel_engine_cs *engine, struct i915_wa_liif (IS_GFX_GT_IP_STEP (gt,IP_VER (12 ,70 ),STEP_A0 ,STEP_B0 ) ||IS_GFX_GT_IP_STEP (gt,IP_VER (12 ,71 ),STEP_A0 ,STEP_B0 ) ||IS_DG2 (i915)) { -/* Wa_22014226127 */ +/* +* Wa_22014226127: Note that this workaround also needs to be +* re-applied in intel_lrc.c when LSC_CHICKEN_BIT_0 is +* re-written for Wa_22013059131. +*/ wa_mcr_write_or (wal,LSC_CHICKEN_BIT_0 ,DISABLE_D8_D16_COASLESCE ); }
@@ -2867,10 +2871,6 @@ general_render_compute_wa_init(struct intel_engine_cs *engine, struct i915_wa_liMAXREQS_PER_BANK , REG_FIELD_PREP(MAXREQS_PER_BANK, 2)); -/* Wa_22013059131:dg2 */ -wa_mcr_write_or (wal,LSC_CHICKEN_BIT_0 , -FORCE_1_SUB_MESSAGE_PER_FRAGMENT ); -/* * Wa_22012654132 *
include/uapi/drm/i915_drm.h +10 -0
@@ -2172,6 +2172,16 @@ struct drm_i915_gem_context_param {* Note that this is a debug API not available on production kernel builds. */ #define I915_CONTEXT_PARAM_CONTEXT_IMAGE 0xf + +/* +* I915_CONTEXT_PARAM_WA_22013059131: +* +* Default value 0 means the kernel programs Wa_22013059131 for this context. +* Set to 1 to inform the kernel that userspace is taking responsibility for +* applying the preferred workaround implementation, so the kernel programming +* of LSC_CHICKEN_BIT_0 bit 15 is not needed for this context. DG2-G11 only. +*/ +#define I915_CONTEXT_PARAM_WA_22013059131 0x10/* Must be kept compact -- no holes and well documented */ /** @value: Context parameter value to be set or queried */
Signature · 1 line
2.43.0
Patchwork
CI✓ i915.CI.BAT: success for drm/i915/dg2: Add per-context control for Wa_22013059131 (rev4)
== Series Details ==
== Series Details ==
Series: drm/i915/dg2: Add per-context control for Wa_22013059131 (rev4)
URL : https://patchwork.freedesktop.org/series/164198/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_18653 -> Patchwork_164198v4
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_164198v4/index.html
Participating hosts (42 -> 40)
------------------------------
Missing (2): bat-dg2-13 fi-snb-2520m
Changes
-------
No changes found
Build changes
-------------
* Linux: CI_DRM_18653 -> Patchwork_164198v4
CI-20190529: 20190529
CI_DRM_18653: 724e06af260b571e2d970d4a806ae3d620ff0b7a @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_8956: 8956
Patchwork_164198v4: 724e06af260b571e2d970d4a806ae3d620ff0b7a @ git://anongit.freedesktop.org/gfx-ci/linux
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_164198v4/index.html
Joonas Lahtinen
maintainerQuoting Jia Yao (2026-06-09 21:30:02)
Quoted 11 lines
Wa_22013059131setsFORCE_1_SUB_MESSAGE_PER_FRAGMENTinLSC_CHICKEN_BIT_0at engine init, but this is known to cause GPU hangs in certain workloads. AddI915_CONTEXT_PARAM_WA_22013059131so userspace that handles the workaround itself (e.g. by limiting SLM size) can set it to 1 to let the kernel know bit 15 programming is not needed for that context.
LSC_CHICKEN_BIT_0is not context-saved by hardware, so the kernel restores the correct value on every context switch via the indirect context batchbuffer to avoid leaking state between contexts. The old unconditional application of Wa22013059131 inintel_workarounds.cis removed.
Quoted 8 lines
v4:
- Add a link of the userspace using this APIv3:
- Kernel-internal context will not change workaround settingsBspec: 54833
Fixes 645cc0b9d972 ("drm/i915/dg2: Add initial gt/ctx/engine workarounds")
This is not a fixup to be backported to older kernels, this is a new feature, so please drop this. It'll cause unnecessary noise.
Quoted 2 lines
Definitely not for stable for above reasons.
Regards, Joonas