Skip to content

Commit 9776f47

Browse files
committed
drm/i915: Flush all writes before suspend
As we have already suspended the device, this should be a no-op except for marking that all writes are indeed complete. The downside is that we then have to walk all the lists of objects for what should be a no-op (in some cases they will be mmio read to ensure the GGTT writes are indeed flushed, and clflushes to ensure that cpu writes are in memory). It seems prudent and the safer course for us to ensure all writes are flushed to memory before suspend. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Cc: Mika Kuoppala <mika.kuoppala@intel.com> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180601144125.18026-1-chris@chris-wilson.co.uk
1 parent 0a59952 commit 9776f47

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

drivers/gpu/drm/i915/i915_gem.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5071,6 +5071,13 @@ int i915_gem_suspend(struct drm_i915_private *dev_priv)
50715071

50725072
void i915_gem_suspend_late(struct drm_i915_private *i915)
50735073
{
5074+
struct drm_i915_gem_object *obj;
5075+
struct list_head *phases[] = {
5076+
&i915->mm.unbound_list,
5077+
&i915->mm.bound_list,
5078+
NULL
5079+
}, **phase;
5080+
50745081
/*
50755082
* Neither the BIOS, ourselves or any other kernel
50765083
* expects the system to be in execlists mode on startup,
@@ -5091,6 +5098,13 @@ void i915_gem_suspend_late(struct drm_i915_private *i915)
50915098
* machine in an unusable condition.
50925099
*/
50935100

5101+
mutex_lock(&i915->drm.struct_mutex);
5102+
for (phase = phases; *phase; phase++) {
5103+
list_for_each_entry(obj, *phase, mm.link)
5104+
WARN_ON(i915_gem_object_set_to_gtt_domain(obj, false));
5105+
}
5106+
mutex_unlock(&i915->drm.struct_mutex);
5107+
50945108
intel_uc_sanitize(i915);
50955109
i915_gem_sanitize(i915);
50965110
}

0 commit comments

Comments
 (0)