From: Takashi Iwai <tiwai@suse.de>
Subject: drm/i915: Fix S4 resume breakage
Patch-mainline: Submitted, suggested on ML
References: bsc#984629,bsc#984632

We've seen S4 resume breakage on many Intel machines with SP2 kernel,
where typically the machine gets a memory corruption or kernel Oops /
panic.  This problem was seen even on the upstream kernel, and through
the bisection, it was pointed to be a side-effect of the commit:
  4c436d55b279bbc6b02aac02e7dc683fc09f884e
    drm/i915: Enable Resource Streamer state save/restore on MI_SET_CONTEXT

This patch fixes the regression by forcibly calling the GPU reset
at prerequiste of PM S4 restore, as was suggested by the i915
upstream dev.

Signed-off-by: Takashi Iwai <tiwai@suse.de>

---
 drivers/gpu/drm/i915/i915_drv.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1138,6 +1138,8 @@ static int i915_pm_thaw(struct device *d
 /* restore: called after loading the hibernation image. */
 static int i915_pm_restore_early(struct device *dev)
 {
+	/* for avoiding the memory corruption at S4 resume (bsc#984624) */
+	intel_gpu_reset(dev_to_i915(dev)->dev);
 	return i915_pm_resume_early(dev);
 }
 
