drm/i915: Enable WA batch buffers for Gen9
Subsystems (2)
PATCH 1/4 drm/i915: Enable WA batch buffers for Gen9
This patch only enables support for Gen9, the actual WA will be initialized in subsequent patches.
The WARN that we use to warn user if WA batch support is not available for a particular Gen is replaced with DRM_ERROR as warning here doesn't really add much value.
--- drivers/gpu/drm/i915/intel_lrc.c | 41 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +38 -3
@@ -1269,6 +1269,26 @@ static int gen8_init_perctx_bb(struct intel_engine_cs *ring,return wa_ctx_end (wa_ctx, *offset = index,1 ); } +static int gen9_init_indirectctx_bb (struct intel_engine_cs *ring, +struct i915_wa_ctx_bb *wa_ctx, +uint32_t *const batch, +uint32_t *offset) +{ +/* FIXME: Replace me with WA */ +DRM_ERROR ("No WA available to init in indirect ctx batch buffer" ); +return -EINVAL ; +} + +static int gen9_init_perctx_bb (struct intel_engine_cs *ring, +struct i915_wa_ctx_bb *wa_ctx, +uint32_t *const batch, +uint32_t *offset) +{ +/* FIXME: Replace me with WA */ +DRM_ERROR ("No WA available to init in per ctx batch buffer" ); +return -EINVAL ; +} +static int lrc_setup_wa_ctx_obj (struct intel_engine_cs *ring,u32 size) {int ret;
@@ -1310,10 +1330,11 @@ static int intel_init_workaround_bb(struct intel_engine_cs *ring)WARN_ON (ring->id !=RCS );/* update this when WA for higher Gen are added */ -if (WARN (INTEL_INFO (ring->dev)->gen >8 , -"WA batch buffer is not initialized for Gen%d\n" , -INTEL_INFO (ring->dev)->gen)) +if (INTEL_INFO (ring->dev)->gen >9 ) { +DRM_ERROR ("WA batch buffer is not initialized for Gen%d\n" , +INTEL_INFO (ring->dev)->gen);return 0 ; + }/* some WA perform writes to scratch page, ensure it is valid */ if (ring->scratch.obj ==NULL ) {
@@ -1345,6 +1366,20 @@ static int intel_init_workaround_bb(struct intel_engine_cs *ring) &offset);if (ret) goto out; + }else if (INTEL_INFO (ring->dev)->gen ==9 ) { + ret =gen9_init_indirectctx_bb (ring, + &wa_ctx->indirect_ctx, + batch, + &offset); +if (ret) + goto out; + + ret =gen9_init_perctx_bb (ring, + &wa_ctx->per_ctx, + batch, + &offset); +if (ret) + goto out; } out:
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/4 drm/i915/gen9: Add WaDisableCtxRestoreArbitration workaround
In Indirect and Per context w/a batch buffer,
+WaDisableCtxRestoreArbitration
--- drivers/gpu/drm/i915/intel_lrc.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +24 -6
@@ -1274,9 +1274,19 @@ static int gen9_init_indirectctx_bb(struct intel_engine_cs *ring,uint32_t *const batch, uint32_t *offset) { - /* FIXME: Replace me with WA */ - DRM_ERROR("No WA available to init in indirect ctx batch buffer"); -return -EINVAL ; + struct drm_device *dev = ring->dev; +uint32_t index =wa_ctx_start (wa_ctx, *offset,CACHELINE_DWORDS ); + +/* WaDisableCtxRestoreArbitration:skl,bxt */ +if ((IS_SKYLAKE (dev) && (INTEL_REVID (dev) <=SKL_REVID_D0 )) || + (IS_BROXTON (dev) && (INTEL_REVID (dev) ==SKL_REVID_A0 ))) +wa_ctx_emit (batch,MI_ARB_ON_OFF |MI_ARB_DISABLE ); + +/* Pad to end of cacheline */ +while (index %CACHELINE_DWORDS ) +wa_ctx_emit (batch,MI_NOOP ); + +return wa_ctx_end (wa_ctx, *offset = index,CACHELINE_DWORDS ); } static int gen9_init_perctx_bb(struct intel_engine_cs *ring,
@@ -1284,9 +1294,17 @@ static int gen9_init_perctx_bb(struct intel_engine_cs *ring,uint32_t *const batch, uint32_t *offset) { - /* FIXME: Replace me with WA */ - DRM_ERROR("No WA available to init in per ctx batch buffer"); -return -EINVAL ; + struct drm_device *dev = ring->dev; +uint32_t index =wa_ctx_start (wa_ctx, *offset,CACHELINE_DWORDS ); + +/* WaDisableCtxRestoreArbitration:skl,bxt */ +if ((IS_SKYLAKE (dev) && (INTEL_REVID (dev) <=SKL_REVID_D0 )) || + (IS_BROXTON (dev) && (INTEL_REVID (dev) ==SKL_REVID_A0 ))) +wa_ctx_emit (batch,MI_ARB_ON_OFF |MI_ARB_ENABLE ); + +wa_ctx_emit (batch,MI_BATCH_BUFFER_END ); + +return wa_ctx_end (wa_ctx, *offset = index,1 ); }static int lrc_setup_wa_ctx_obj (struct intel_engine_cs *ring,u32 size)
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/4 drm/i915/gen9: Add WaFlushCoherentL3CacheLinesAtContextSwitch workaround
In reply to Arun SiluveryIn Indirect context w/a batch buffer,
+WaFlushCoherentL3CacheLinesAtContextSwitch:bdw
---
This patch depends on https://patchwork.kernel.org/patch/6715321/, which is already reviewed by Chris, temporary dependency untill it gets merged.
drivers/gpu/drm/i915/intel_lrc.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/i915/intel_lrc.c +5 -0
@@ -1282,6 +1282,11 @@ static int gen9_init_indirectctx_bb(struct intel_engine_cs *ring, (IS_BROXTON(dev) && (INTEL_REVID(dev) == SKL_REVID_A0)))wa_ctx_emit (batch,MI_ARB_ON_OFF |MI_ARB_DISABLE ); +/* WaFlushCoherentL3CacheLinesAtContextSwitch:skl,bxt */ + index =gen8_emit_flush_coherentl3_wa (ring, batch, index); +if (index <0 ) +return index; +/* Pad to end of cacheline */ while (index %CACHELINE_DWORDS )wa_ctx_emit (batch,MI_NOOP );
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/4 drm/i915/gen9: Add WaSetDisablePixMaskCammingAndRhwoInCommonSliceChicken
In reply to Arun SiluveryIn Indirect context w/a batch buffer, +WaSetDisablePixMaskCammingAndRhwoInCommonSliceChicken
--- drivers/gpu/drm/i915/intel_lrc.c | 9 +++++++++ drivers/gpu/drm/i915/intel_ringbuffer.c | 7 +++++-- 2 files changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +9 -0
@@ -1302,6 +1302,15 @@ static int gen9_init_perctx_bb(struct intel_engine_cs *ring,struct drm_device *dev = ring->dev;uint32_t index =wa_ctx_start (wa_ctx, *offset,CACHELINE_DWORDS ); +/* WaSetDisablePixMaskCammingAndRhwoInCommonSliceChicken:skl,bxt */ +if ((IS_SKYLAKE (dev) && (INTEL_REVID (dev) <=SKL_REVID_B0 )) || + (IS_BROXTON (dev) && (INTEL_REVID (dev) ==SKL_REVID_A0 ))) { +wa_ctx_emit (batch,MI_LOAD_REGISTER_IMM (1 )); +wa_ctx_emit (batch,GEN9_SLICE_COMMON_ECO_CHICKEN0 ); +wa_ctx_emit (batch,_MASKED_BIT_ENABLE (DISABLE_PIXEL_MASK_CAMMING )); +wa_ctx_emit (batch,MI_NOOP ); + } +/* WaDisableCtxRestoreArbitration:skl,bxt */ if ((IS_SKYLAKE (dev) && (INTEL_REVID (dev) <=SKL_REVID_D0 )) || (IS_BROXTON (dev) && (INTEL_REVID (dev) ==SKL_REVID_A0 )))
drivers/gpu/drm/i915/intel_ringbuffer.c +5 -2
@@ -946,8 +946,11 @@ static int gen9_init_workarounds(struct intel_engine_cs *ring)/* WaSetDisablePixMaskCammingAndRhwoInCommonSliceChicken:skl,bxt */ WA_SET_BIT_MASKED (GEN7_COMMON_SLICE_CHICKEN1 ,GEN9_RHWO_OPTIMIZATION_DISABLE ); -WA_SET_BIT_MASKED (GEN9_SLICE_COMMON_ECO_CHICKEN0 , -DISABLE_PIXEL_MASK_CAMMING ); +/* +* WA also requires GEN9_SLICE_COMMON_ECO_CHICKEN0[14] to be set, +* but that register is write only hence it is set +* in per ctx batch buffer +*/ } if ((IS_SKYLAKE(dev) && INTEL_REVID(dev) >= SKL_REVID_C0) ||
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 18 lines · Arun Siluvery
This patch only enables support for Gen9, the actual WA will be initialized in subsequent patches.
The WARN that we use to warn user if WA batch support is not available for a particular Gen is replaced with
DRM_ERRORas warning here doesn't really add much value.Cc Imre Deak <[email protected]>Signed-off-by Arun Siluvery <[email protected]>--- drivers/gpu/drm/i915/intel_lrc.c | 41 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/intel_lrc.c +0
-0
drivers/gpu/drm/i915/intel_lrc.c static int gen8_init_perctx_bb(struct intel_engine_cs *ring, · line 1277
Quoted 9 lines
drivers/gpu/drm/i915/intel_lrc.c +6
-0@@ -1269,6 +1269,26 @@ static int gen8_init_perctx_bb(struct intel_engine_cs *ring,return wa_ctx_end (wa_ctx, *offset = index,1 ); } +static int gen9_init_indirectctx_bb (struct intel_engine_cs *ring, +struct i915_wa_ctx_bb *wa_ctx, +uint32_t *const batch, +uint32_t *offset) +{ +/* FIXME: Replace me with WA */
Do the same int index = wa_ctx_begin();
wa_ctx_emit(MI_BATCH_BUFFER_END) (and MI_NOOP for perctx)
return wa_ctx_end()
you did for gen8. That way the series doesn't suddenly break halfway through (or just after the first patch) and we can check the infrastructure in situ, and the actual wa separately later. -Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 31 lines · Chris Wilson
Quoted 18 lines · Arun Siluvery
This patch only enables support for Gen9, the actual WA will be initialized in subsequent patches.
The WARN that we use to warn user if WA batch support is not available for a particular Gen is replaced with
DRM_ERRORas warning here doesn't really add much value.Cc Imre Deak <[email protected]>Signed-off-by Arun Siluvery <[email protected]>--- drivers/gpu/drm/i915/intel_lrc.c | 41 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/intel_lrc.c +0
-0drivers/gpu/drm/i915/intel_lrc.c static int gen8_init_perctx_bb(struct intel_engine_cs *ring, · line 1277
Quoted 9 lines
drivers/gpu/drm/i915/intel_lrc.c +6
-0@@ -1269,6 +1269,26 @@ static int gen8_init_perctx_bb(struct intel_engine_cs *ring,return wa_ctx_end (wa_ctx, *offset = index,1 ); } +static int gen9_init_indirectctx_bb (struct intel_engine_cs *ring, +struct i915_wa_ctx_bb *wa_ctx, +uint32_t *const batch, +uint32_t *offset) +{ +/* FIXME: Replace me with WA */ Do the same int index =
wa_ctx_begin();
Quoted 7 lines
wa_ctx_emit(MI_BATCH_BUFFER_END)(andMI_NOOPfor perctx)return
wa_ctx_end()you did for gen8. That way the series doesn't suddenly break halfway through (or just after the first patch) and we can check the infrastructure in situ, and the actual wa separately later.
(forgot to reply-all)
right, will update it along with other review comments, thanks.
regards
Arun
Quoted 2 lines
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx