diff options
author | Keith Packard <keithp@keithp.com> | 2012-01-06 11:48:38 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2012-01-19 12:28:53 -0800 |
commit | c937504e2b96af3b281b1ef859e063ef4af656c1 (patch) | |
tree | 16c90e4028f09fb52bedc27d7b4fe0b15eb5d742 /drivers/gpu | |
parent | 286fed412a134e76be55899bc628c6fa59cb70da (diff) | |
download | linux-c937504e2b96af3b281b1ef859e063ef4af656c1.tar.gz linux-c937504e2b96af3b281b1ef859e063ef4af656c1.tar.bz2 linux-c937504e2b96af3b281b1ef859e063ef4af656c1.zip |
drm/i915: Hold gt_lock across forcewake register reads
Along with the previous patch to make the reset operation protected by
the gt_lock as well, this ensures that all register read operations
will occur with the forcewake hardware enabled. As an added bonus,
this makes read operations more efficient by taking the spinlock only
once per read instead of twice.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 062d1d27f704..308f81913562 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -954,9 +954,14 @@ MODULE_LICENSE("GPL and additional rights"); u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg) { \ u##x val = 0; \ if (NEEDS_FORCE_WAKE((dev_priv), (reg))) { \ - gen6_gt_force_wake_get(dev_priv); \ + unsigned long irqflags; \ + spin_lock_irqsave(&dev_priv->gt_lock, irqflags); \ + if (dev_priv->forcewake_count == 0) \ + dev_priv->display.force_wake_get(dev_priv); \ val = read##y(dev_priv->regs + reg); \ - gen6_gt_force_wake_put(dev_priv); \ + if (dev_priv->forcewake_count == 0) \ + dev_priv->display.force_wake_put(dev_priv); \ + spin_unlock_irqrestore(&dev_priv->gt_lock, irqflags); \ } else { \ val = read##y(dev_priv->regs + reg); \ } \ |