@@ -196,10 +196,9 @@ ignore_wa_write_or(struct i915_wa_list *wal, i915_reg_t reg, u32 mask, u32 val)
196196#define WA_SET_FIELD_MASKED (addr , mask , value ) \
197197 wa_write_masked_or(wal, (addr), (mask), _MASKED_FIELD((mask), (value)))
198198
199- static void gen8_ctx_workarounds_init (struct intel_engine_cs * engine )
199+ static void gen8_ctx_workarounds_init (struct intel_engine_cs * engine ,
200+ struct i915_wa_list * wal )
200201{
201- struct i915_wa_list * wal = & engine -> ctx_wa_list ;
202-
203202 WA_SET_BIT_MASKED (INSTPM , INSTPM_FORCE_ORDERING );
204203
205204 /* WaDisableAsyncFlipPerfMode:bdw,chv */
@@ -245,12 +244,12 @@ static void gen8_ctx_workarounds_init(struct intel_engine_cs *engine)
245244 GEN6_WIZ_HASHING_16x4 );
246245}
247246
248- static void bdw_ctx_workarounds_init (struct intel_engine_cs * engine )
247+ static void bdw_ctx_workarounds_init (struct intel_engine_cs * engine ,
248+ struct i915_wa_list * wal )
249249{
250250 struct drm_i915_private * i915 = engine -> i915 ;
251- struct i915_wa_list * wal = & engine -> ctx_wa_list ;
252251
253- gen8_ctx_workarounds_init (engine );
252+ gen8_ctx_workarounds_init (engine , wal );
254253
255254 /* WaDisableThreadStallDopClockGating:bdw (pre-production) */
256255 WA_SET_BIT_MASKED (GEN8_ROW_CHICKEN , STALL_DOP_GATING_DISABLE );
@@ -273,11 +272,10 @@ static void bdw_ctx_workarounds_init(struct intel_engine_cs *engine)
273272 (IS_BDW_GT3 (i915 ) ? HDC_FENCE_DEST_SLM_DISABLE : 0 ));
274273}
275274
276- static void chv_ctx_workarounds_init (struct intel_engine_cs * engine )
275+ static void chv_ctx_workarounds_init (struct intel_engine_cs * engine ,
276+ struct i915_wa_list * wal )
277277{
278- struct i915_wa_list * wal = & engine -> ctx_wa_list ;
279-
280- gen8_ctx_workarounds_init (engine );
278+ gen8_ctx_workarounds_init (engine , wal );
281279
282280 /* WaDisableThreadStallDopClockGating:chv */
283281 WA_SET_BIT_MASKED (GEN8_ROW_CHICKEN , STALL_DOP_GATING_DISABLE );
@@ -286,10 +284,10 @@ static void chv_ctx_workarounds_init(struct intel_engine_cs *engine)
286284 WA_SET_BIT_MASKED (HIZ_CHICKEN , CHV_HZ_8X8_MODE_IN_1X );
287285}
288286
289- static void gen9_ctx_workarounds_init (struct intel_engine_cs * engine )
287+ static void gen9_ctx_workarounds_init (struct intel_engine_cs * engine ,
288+ struct i915_wa_list * wal )
290289{
291290 struct drm_i915_private * i915 = engine -> i915 ;
292- struct i915_wa_list * wal = & engine -> ctx_wa_list ;
293291
294292 if (HAS_LLC (i915 )) {
295293 /* WaCompressedResourceSamplerPbeMediaNewHashMode:skl,kbl
@@ -384,10 +382,10 @@ static void gen9_ctx_workarounds_init(struct intel_engine_cs *engine)
384382 WA_SET_BIT_MASKED (GEN9_WM_CHICKEN3 , GEN9_FACTOR_IN_CLR_VAL_HIZ );
385383}
386384
387- static void skl_tune_iz_hashing (struct intel_engine_cs * engine )
385+ static void skl_tune_iz_hashing (struct intel_engine_cs * engine ,
386+ struct i915_wa_list * wal )
388387{
389388 struct drm_i915_private * i915 = engine -> i915 ;
390- struct i915_wa_list * wal = & engine -> ctx_wa_list ;
391389 u8 vals [3 ] = { 0 , 0 , 0 };
392390 unsigned int i ;
393391
@@ -424,17 +422,17 @@ static void skl_tune_iz_hashing(struct intel_engine_cs *engine)
424422 GEN9_IZ_HASHING (0 , vals [0 ]));
425423}
426424
427- static void skl_ctx_workarounds_init (struct intel_engine_cs * engine )
425+ static void skl_ctx_workarounds_init (struct intel_engine_cs * engine ,
426+ struct i915_wa_list * wal )
428427{
429- gen9_ctx_workarounds_init (engine );
430- skl_tune_iz_hashing (engine );
428+ gen9_ctx_workarounds_init (engine , wal );
429+ skl_tune_iz_hashing (engine , wal );
431430}
432431
433- static void bxt_ctx_workarounds_init (struct intel_engine_cs * engine )
432+ static void bxt_ctx_workarounds_init (struct intel_engine_cs * engine ,
433+ struct i915_wa_list * wal )
434434{
435- struct i915_wa_list * wal = & engine -> ctx_wa_list ;
436-
437- gen9_ctx_workarounds_init (engine );
435+ gen9_ctx_workarounds_init (engine , wal );
438436
439437 /* WaDisableThreadStallDopClockGating:bxt */
440438 WA_SET_BIT_MASKED (GEN8_ROW_CHICKEN ,
@@ -445,12 +443,12 @@ static void bxt_ctx_workarounds_init(struct intel_engine_cs *engine)
445443 GEN8_SBE_DISABLE_REPLAY_BUF_OPTIMIZATION );
446444}
447445
448- static void kbl_ctx_workarounds_init (struct intel_engine_cs * engine )
446+ static void kbl_ctx_workarounds_init (struct intel_engine_cs * engine ,
447+ struct i915_wa_list * wal )
449448{
450449 struct drm_i915_private * i915 = engine -> i915 ;
451- struct i915_wa_list * wal = & engine -> ctx_wa_list ;
452450
453- gen9_ctx_workarounds_init (engine );
451+ gen9_ctx_workarounds_init (engine , wal );
454452
455453 /* WaToEnableHwFixForPushConstHWBug:kbl */
456454 if (IS_KBL_REVID (i915 , KBL_REVID_C0 , REVID_FOREVER ))
@@ -462,22 +460,20 @@ static void kbl_ctx_workarounds_init(struct intel_engine_cs *engine)
462460 GEN7_SBE_SS_CACHE_DISPATCH_PORT_SHARING_DISABLE );
463461}
464462
465- static void glk_ctx_workarounds_init (struct intel_engine_cs * engine )
463+ static void glk_ctx_workarounds_init (struct intel_engine_cs * engine ,
464+ struct i915_wa_list * wal )
466465{
467- struct i915_wa_list * wal = & engine -> ctx_wa_list ;
468-
469- gen9_ctx_workarounds_init (engine );
466+ gen9_ctx_workarounds_init (engine , wal );
470467
471468 /* WaToEnableHwFixForPushConstHWBug:glk */
472469 WA_SET_BIT_MASKED (COMMON_SLICE_CHICKEN2 ,
473470 GEN8_SBE_DISABLE_REPLAY_BUF_OPTIMIZATION );
474471}
475472
476- static void cfl_ctx_workarounds_init (struct intel_engine_cs * engine )
473+ static void cfl_ctx_workarounds_init (struct intel_engine_cs * engine ,
474+ struct i915_wa_list * wal )
477475{
478- struct i915_wa_list * wal = & engine -> ctx_wa_list ;
479-
480- gen9_ctx_workarounds_init (engine );
476+ gen9_ctx_workarounds_init (engine , wal );
481477
482478 /* WaToEnableHwFixForPushConstHWBug:cfl */
483479 WA_SET_BIT_MASKED (COMMON_SLICE_CHICKEN2 ,
@@ -488,10 +484,10 @@ static void cfl_ctx_workarounds_init(struct intel_engine_cs *engine)
488484 GEN7_SBE_SS_CACHE_DISPATCH_PORT_SHARING_DISABLE );
489485}
490486
491- static void cnl_ctx_workarounds_init (struct intel_engine_cs * engine )
487+ static void cnl_ctx_workarounds_init (struct intel_engine_cs * engine ,
488+ struct i915_wa_list * wal )
492489{
493490 struct drm_i915_private * i915 = engine -> i915 ;
494- struct i915_wa_list * wal = & engine -> ctx_wa_list ;
495491
496492 /* WaForceContextSaveRestoreNonCoherent:cnl */
497493 WA_SET_BIT_MASKED (CNL_HDC_CHICKEN0 ,
@@ -528,10 +524,10 @@ static void cnl_ctx_workarounds_init(struct intel_engine_cs *engine)
528524 WA_SET_BIT_MASKED (GEN8_ROW_CHICKEN , DISABLE_EARLY_EOT );
529525}
530526
531- static void icl_ctx_workarounds_init (struct intel_engine_cs * engine )
527+ static void icl_ctx_workarounds_init (struct intel_engine_cs * engine ,
528+ struct i915_wa_list * wal )
532529{
533530 struct drm_i915_private * i915 = engine -> i915 ;
534- struct i915_wa_list * wal = & engine -> ctx_wa_list ;
535531
536532 /* Wa_1604370585:icl (pre-prod)
537533 * Formerly known as WaPushConstantDereferenceHoldDisable
@@ -573,31 +569,36 @@ static void icl_ctx_workarounds_init(struct intel_engine_cs *engine)
573569 GEN9_PREEMPT_GPGPU_THREAD_GROUP_LEVEL );
574570}
575571
576- void intel_engine_init_ctx_wa (struct intel_engine_cs * engine )
572+ static void
573+ __intel_engine_init_ctx_wa (struct intel_engine_cs * engine ,
574+ struct i915_wa_list * wal ,
575+ const char * name )
577576{
578577 struct drm_i915_private * i915 = engine -> i915 ;
579- struct i915_wa_list * wal = & engine -> ctx_wa_list ;
580578
581- wa_init_start (wal , "context" );
579+ if (engine -> class != RENDER_CLASS )
580+ return ;
581+
582+ wa_init_start (wal , name );
582583
583584 if (IS_GEN (i915 , 11 ))
584- icl_ctx_workarounds_init (engine );
585+ icl_ctx_workarounds_init (engine , wal );
585586 else if (IS_CANNONLAKE (i915 ))
586- cnl_ctx_workarounds_init (engine );
587+ cnl_ctx_workarounds_init (engine , wal );
587588 else if (IS_COFFEELAKE (i915 ))
588- cfl_ctx_workarounds_init (engine );
589+ cfl_ctx_workarounds_init (engine , wal );
589590 else if (IS_GEMINILAKE (i915 ))
590- glk_ctx_workarounds_init (engine );
591+ glk_ctx_workarounds_init (engine , wal );
591592 else if (IS_KABYLAKE (i915 ))
592- kbl_ctx_workarounds_init (engine );
593+ kbl_ctx_workarounds_init (engine , wal );
593594 else if (IS_BROXTON (i915 ))
594- bxt_ctx_workarounds_init (engine );
595+ bxt_ctx_workarounds_init (engine , wal );
595596 else if (IS_SKYLAKE (i915 ))
596- skl_ctx_workarounds_init (engine );
597+ skl_ctx_workarounds_init (engine , wal );
597598 else if (IS_CHERRYVIEW (i915 ))
598- chv_ctx_workarounds_init (engine );
599+ chv_ctx_workarounds_init (engine , wal );
599600 else if (IS_BROADWELL (i915 ))
600- bdw_ctx_workarounds_init (engine );
601+ bdw_ctx_workarounds_init (engine , wal );
601602 else if (INTEL_GEN (i915 ) < 8 )
602603 return ;
603604 else
@@ -606,6 +607,11 @@ void intel_engine_init_ctx_wa(struct intel_engine_cs *engine)
606607 wa_init_finish (wal );
607608}
608609
610+ void intel_engine_init_ctx_wa (struct intel_engine_cs * engine )
611+ {
612+ __intel_engine_init_ctx_wa (engine , & engine -> ctx_wa_list , "context" );
613+ }
614+
609615int intel_engine_emit_ctx_wa (struct i915_request * rq )
610616{
611617 struct i915_wa_list * wal = & rq -> engine -> ctx_wa_list ;
@@ -1338,7 +1344,7 @@ wa_list_srm(struct i915_request *rq,
13381344 return 0 ;
13391345}
13401346
1341- static int engine_wa_list_verify (struct intel_engine_cs * engine ,
1347+ static int engine_wa_list_verify (struct intel_context * ce ,
13421348 const struct i915_wa_list * const wal ,
13431349 const char * from )
13441350{
@@ -1352,11 +1358,11 @@ static int engine_wa_list_verify(struct intel_engine_cs *engine,
13521358 if (!wal -> count )
13531359 return 0 ;
13541360
1355- vma = create_scratch (& engine -> i915 -> ggtt .vm , wal -> count );
1361+ vma = create_scratch (& ce -> engine -> i915 -> ggtt .vm , wal -> count );
13561362 if (IS_ERR (vma ))
13571363 return PTR_ERR (vma );
13581364
1359- rq = i915_request_create ( engine -> kernel_context );
1365+ rq = intel_context_create_request ( ce );
13601366 if (IS_ERR (rq )) {
13611367 err = PTR_ERR (rq );
13621368 goto err_vma ;
@@ -1394,7 +1400,9 @@ static int engine_wa_list_verify(struct intel_engine_cs *engine,
13941400int intel_engine_verify_workarounds (struct intel_engine_cs * engine ,
13951401 const char * from )
13961402{
1397- return engine_wa_list_verify (engine , & engine -> wa_list , from );
1403+ return engine_wa_list_verify (engine -> kernel_context ,
1404+ & engine -> wa_list ,
1405+ from );
13981406}
13991407
14001408#if IS_ENABLED (CONFIG_DRM_I915_SELFTEST )
0 commit comments