[Intel-gfx] [PATCH v4 04/10] drm/i915: Always sanitize GT wakeref before restarting engines
Chris Wilson
chris at chris-wilson.co.uk
Sat Nov 4 10:44:53 UTC 2017
The first request submitted to an engine will take the prolonged GT
wakeref. If we discard that wakeref to issue a reset/suspend/etc, then
before restarting the engines, reacquire the GT's wakeref.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
drivers/gpu/drm/i915/i915_drv.c | 1 -
drivers/gpu/drm/i915/i915_gem.c | 28 +++++++++++++++++++---------
2 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index e7e9e061073b..15672d2b5589 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1673,7 +1673,6 @@ static int i915_drm_resume(struct drm_device *dev)
int ret;
disable_rpm_wakeref_asserts(dev_priv);
- intel_sanitize_gt_powersave(dev_priv);
ret = i915_ggtt_enable_hw(dev_priv);
if (ret)
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index b0691ee3be4c..cf5496d58771 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3099,13 +3099,6 @@ void i915_gem_reset(struct drm_i915_private *dev_priv)
}
i915_gem_restore_fences(dev_priv);
-
- if (dev_priv->gt.awake) {
- intel_sanitize_gt_powersave(dev_priv);
- intel_enable_gt_powersave(dev_priv);
- if (INTEL_GEN(dev_priv) >= 6)
- gen6_rps_busy(dev_priv);
- }
}
void i915_gem_reset_finish_engine(struct intel_engine_cs *engine)
@@ -4804,9 +4797,8 @@ void i915_gem_resume(struct drm_i915_private *dev_priv)
{
struct drm_device *dev = &dev_priv->drm;
- WARN_ON(dev_priv->gt.awake);
-
mutex_lock(&dev->struct_mutex);
+
i915_gem_restore_gtt_mappings(dev_priv);
i915_gem_restore_fences(dev_priv);
@@ -4874,6 +4866,24 @@ static int __i915_gem_restart_engines(void *data)
enum intel_engine_id id;
int err;
+ /*
+ * If we are holding a wakeref from a previous cycle, e.g. from
+ * before a reset, scrub the GT powersaving and reacquire. This is
+ * just to make sure that the HW matches our SW tracking,
+ * irrespective of whether or not it was preserved over the
+ * restart.
+ */
+ intel_sanitize_gt_powersave(i915);
+ if (i915->gt.awake) {
+ intel_enable_gt_powersave(i915);
+ if (INTEL_GEN(i915) >= 6)
+ gen6_rps_busy(i915);
+
+ queue_delayed_work(i915->wq,
+ &i915->gt.retire_work,
+ round_jiffies_up_relative(HZ));
+ }
+
for_each_engine(engine, i915, id) {
err = engine->init_hw(engine);
if (err)
--
2.15.0
More information about the Intel-gfx
mailing list