@@ -237,7 +237,8 @@ static void execlists_init_reg_state(u32 *reg_state,
237
237
bool close );
238
238
static void
239
239
__execlists_update_reg_state (const struct intel_context * ce ,
240
- const struct intel_engine_cs * engine );
240
+ const struct intel_engine_cs * engine ,
241
+ u32 head );
241
242
242
243
static void mark_eio (struct i915_request * rq )
243
244
{
@@ -1186,12 +1187,11 @@ static void reset_active(struct i915_request *rq,
1186
1187
head = rq -> tail ;
1187
1188
else
1188
1189
head = active_request (ce -> timeline , rq )-> head ;
1189
- ce -> ring -> head = intel_ring_wrap (ce -> ring , head );
1190
- intel_ring_update_space (ce -> ring );
1190
+ head = intel_ring_wrap (ce -> ring , head );
1191
1191
1192
1192
/* Scrub the context image to prevent replaying the previous batch */
1193
1193
restore_default_state (ce , engine );
1194
- __execlists_update_reg_state (ce , engine );
1194
+ __execlists_update_reg_state (ce , engine , head );
1195
1195
1196
1196
/* We've switched away, so this should be a no-op, but intent matters */
1197
1197
ce -> lrc_desc |= CTX_DESC_FORCE_RESTORE ;
@@ -2863,16 +2863,17 @@ static void execlists_context_unpin(struct intel_context *ce)
2863
2863
2864
2864
static void
2865
2865
__execlists_update_reg_state (const struct intel_context * ce ,
2866
- const struct intel_engine_cs * engine )
2866
+ const struct intel_engine_cs * engine ,
2867
+ u32 head )
2867
2868
{
2868
2869
struct intel_ring * ring = ce -> ring ;
2869
2870
u32 * regs = ce -> lrc_reg_state ;
2870
2871
2871
- GEM_BUG_ON (!intel_ring_offset_valid (ring , ring -> head ));
2872
+ GEM_BUG_ON (!intel_ring_offset_valid (ring , head ));
2872
2873
GEM_BUG_ON (!intel_ring_offset_valid (ring , ring -> tail ));
2873
2874
2874
2875
regs [CTX_RING_START ] = i915_ggtt_offset (ring -> vma );
2875
- regs [CTX_RING_HEAD ] = ring -> head ;
2876
+ regs [CTX_RING_HEAD ] = head ;
2876
2877
regs [CTX_RING_TAIL ] = ring -> tail ;
2877
2878
2878
2879
/* RPCS */
@@ -2901,7 +2902,7 @@ __execlists_context_pin(struct intel_context *ce,
2901
2902
2902
2903
ce -> lrc_desc = lrc_descriptor (ce , engine ) | CTX_DESC_FORCE_RESTORE ;
2903
2904
ce -> lrc_reg_state = vaddr + LRC_STATE_PN * PAGE_SIZE ;
2904
- __execlists_update_reg_state (ce , engine );
2905
+ __execlists_update_reg_state (ce , engine , ce -> ring -> tail );
2905
2906
2906
2907
return 0 ;
2907
2908
}
@@ -2942,7 +2943,7 @@ static void execlists_context_reset(struct intel_context *ce)
2942
2943
/* Scrub away the garbage */
2943
2944
execlists_init_reg_state (ce -> lrc_reg_state ,
2944
2945
ce , ce -> engine , ce -> ring , true);
2945
- __execlists_update_reg_state (ce , ce -> engine );
2946
+ __execlists_update_reg_state (ce , ce -> engine , ce -> ring -> tail );
2946
2947
2947
2948
ce -> lrc_desc |= CTX_DESC_FORCE_RESTORE ;
2948
2949
}
@@ -3497,6 +3498,7 @@ static void __execlists_reset(struct intel_engine_cs *engine, bool stalled)
3497
3498
struct intel_engine_execlists * const execlists = & engine -> execlists ;
3498
3499
struct intel_context * ce ;
3499
3500
struct i915_request * rq ;
3501
+ u32 head ;
3500
3502
3501
3503
mb (); /* paranoia: read the CSB pointers from after the reset */
3502
3504
clflush (execlists -> csb_write );
@@ -3524,15 +3526,15 @@ static void __execlists_reset(struct intel_engine_cs *engine, bool stalled)
3524
3526
3525
3527
if (i915_request_completed (rq )) {
3526
3528
/* Idle context; tidy up the ring so we can restart afresh */
3527
- ce -> ring -> head = intel_ring_wrap (ce -> ring , rq -> tail );
3529
+ head = intel_ring_wrap (ce -> ring , rq -> tail );
3528
3530
goto out_replay ;
3529
3531
}
3530
3532
3531
3533
/* Context has requests still in-flight; it should not be idle! */
3532
3534
GEM_BUG_ON (i915_active_is_idle (& ce -> active ));
3533
3535
rq = active_request (ce -> timeline , rq );
3534
- ce -> ring -> head = intel_ring_wrap (ce -> ring , rq -> head );
3535
- GEM_BUG_ON (ce -> ring -> head == ce -> ring -> tail );
3536
+ head = intel_ring_wrap (ce -> ring , rq -> head );
3537
+ GEM_BUG_ON (head == ce -> ring -> tail );
3536
3538
3537
3539
/*
3538
3540
* If this request hasn't started yet, e.g. it is waiting on a
@@ -3577,10 +3579,9 @@ static void __execlists_reset(struct intel_engine_cs *engine, bool stalled)
3577
3579
3578
3580
out_replay :
3579
3581
ENGINE_TRACE (engine , "replay {head:%04x, tail:%04x}\n" ,
3580
- ce -> ring -> head , ce -> ring -> tail );
3581
- intel_ring_update_space (ce -> ring );
3582
+ head , ce -> ring -> tail );
3582
3583
__execlists_reset_reg_state (ce , engine );
3583
- __execlists_update_reg_state (ce , engine );
3584
+ __execlists_update_reg_state (ce , engine , head );
3584
3585
ce -> lrc_desc |= CTX_DESC_FORCE_RESTORE ; /* paranoid: GPU was reset! */
3585
3586
3586
3587
unwind :
@@ -5223,10 +5224,7 @@ void intel_lr_context_reset(struct intel_engine_cs *engine,
5223
5224
restore_default_state (ce , engine );
5224
5225
5225
5226
/* Rerun the request; its payload has been neutered (if guilty). */
5226
- ce -> ring -> head = head ;
5227
- intel_ring_update_space (ce -> ring );
5228
-
5229
- __execlists_update_reg_state (ce , engine );
5227
+ __execlists_update_reg_state (ce , engine , head );
5230
5228
}
5231
5229
5232
5230
bool
0 commit comments