diff mbox

[2/2] drm/i915: save/resume forcewake lock fixes

Message ID 1308761701-1751-3-git-send-email-ben@bwidawsk.net (mailing list archive)
State New, archived
Headers show

Commit Message

Ben Widawsky June 22, 2011, 4:55 p.m. UTC
The lock must be held for the saving and restoring of VGA state.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
CC: Alexander Zhaunerchyk <alex.vizor@gmail.com>
CC: Andrey Rahmatullin <wrar@wrar.name>
---
 drivers/gpu/drm/i915/i915_suspend.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

Comments

Chris Wilson June 22, 2011, 5:04 p.m. UTC | #1
On Wed, 22 Jun 2011 09:55:01 -0700, Ben Widawsky <ben@bwidawsk.net> wrote:
> The lock must be held for the saving and restoring of VGA state.
> 
> Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
> CC: Alexander Zhaunerchyk <alex.vizor@gmail.com>
> CC: Andrey Rahmatullin <wrar@wrar.name>

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
Keith Packard June 22, 2011, 5:29 p.m. UTC | #2
On Wed, 22 Jun 2011 18:04:46 +0100, Chris Wilson <chris@chris-wilson.co.uk> wrote:

> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>

I've added this to drm-intel-fixes
Andrey Rakhmatullin June 22, 2011, 5:50 p.m. UTC | #3
Tested-by: Andrey Rahmatullin <wrar@wrar.name>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c
index 60a94d2..e8152d2 100644
--- a/drivers/gpu/drm/i915/i915_suspend.c
+++ b/drivers/gpu/drm/i915/i915_suspend.c
@@ -678,6 +678,7 @@  void i915_save_display(struct drm_device *dev)
 	}
 
 	/* VGA state */
+	mutex_lock(&dev->struct_mutex);
 	dev_priv->saveVGA0 = I915_READ(VGA0);
 	dev_priv->saveVGA1 = I915_READ(VGA1);
 	dev_priv->saveVGA_PD = I915_READ(VGA_PD);
@@ -687,6 +688,7 @@  void i915_save_display(struct drm_device *dev)
 		dev_priv->saveVGACNTRL = I915_READ(VGACNTRL);
 
 	i915_save_vga(dev);
+	mutex_unlock(&dev->struct_mutex);
 }
 
 void i915_restore_display(struct drm_device *dev)
@@ -780,6 +782,8 @@  void i915_restore_display(struct drm_device *dev)
 		I915_WRITE(CPU_VGACNTRL, dev_priv->saveVGACNTRL);
 	else
 		I915_WRITE(VGACNTRL, dev_priv->saveVGACNTRL);
+
+	mutex_lock(&dev->struct_mutex);
 	I915_WRITE(VGA0, dev_priv->saveVGA0);
 	I915_WRITE(VGA1, dev_priv->saveVGA1);
 	I915_WRITE(VGA_PD, dev_priv->saveVGA_PD);
@@ -787,6 +791,7 @@  void i915_restore_display(struct drm_device *dev)
 	udelay(150);
 
 	i915_restore_vga(dev);
+	mutex_unlock(&dev->struct_mutex);
 }
 
 int i915_save_state(struct drm_device *dev)