@@ -1413,14 +1413,6 @@ static inline int mi_set_context(struct i915_request *rq, u32 flags)
1413
1413
int len ;
1414
1414
u32 * cs ;
1415
1415
1416
- flags |= MI_MM_SPACE_GTT ;
1417
- if (IS_HASWELL (i915 ))
1418
- /* These flags are for resource streamer on HSW+ */
1419
- flags |= HSW_MI_RS_SAVE_STATE_EN | HSW_MI_RS_RESTORE_STATE_EN ;
1420
- else
1421
- /* We need to save the extended state for powersaving modes */
1422
- flags |= MI_SAVE_EXT_STATE_EN | MI_RESTORE_EXT_STATE_EN ;
1423
-
1424
1416
len = 4 ;
1425
1417
if (IS_GEN (i915 , 7 ))
1426
1418
len += 2 + (num_engines ? 4 * num_engines + 6 : 0 );
@@ -1589,22 +1581,21 @@ static int switch_context(struct i915_request *rq)
1589
1581
}
1590
1582
1591
1583
if (ce -> state ) {
1592
- u32 hw_flags ;
1584
+ u32 flags ;
1593
1585
1594
1586
GEM_BUG_ON (rq -> engine -> id != RCS0 );
1595
1587
1596
- /*
1597
- * The kernel context(s) is treated as pure scratch and is not
1598
- * expected to retain any state (as we sacrifice it during
1599
- * suspend and on resume it may be corrupted). This is ok,
1600
- * as nothing actually executes using the kernel context; it
1601
- * is purely used for flushing user contexts.
1602
- */
1603
- hw_flags = 0 ;
1604
- if (i915_gem_context_is_kernel (rq -> gem_context ))
1605
- hw_flags = MI_RESTORE_INHIBIT ;
1588
+ /* For resource streamer on HSW+ and power context elsewhere */
1589
+ BUILD_BUG_ON (HSW_MI_RS_SAVE_STATE_EN != MI_SAVE_EXT_STATE_EN );
1590
+ BUILD_BUG_ON (HSW_MI_RS_RESTORE_STATE_EN != MI_RESTORE_EXT_STATE_EN );
1591
+
1592
+ flags = MI_SAVE_EXT_STATE_EN | MI_MM_SPACE_GTT ;
1593
+ if (!i915_gem_context_is_kernel (rq -> gem_context ))
1594
+ flags |= MI_RESTORE_EXT_STATE_EN ;
1595
+ else
1596
+ flags |= MI_RESTORE_INHIBIT ;
1606
1597
1607
- ret = mi_set_context (rq , hw_flags );
1598
+ ret = mi_set_context (rq , flags );
1608
1599
if (ret )
1609
1600
return ret ;
1610
1601
}
0 commit comments