提交 d1ebd816 编写于 作者: B Ben Widawsky 提交者: Keith Packard

drm/i915: forcewake struct mutex locking fixes

Found by the new strict checking for the mutex being held whilst
manipulating the forcewake status.
Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: NKeith Packard <keithp@keithp.com>
上级 fcca7926
...@@ -853,6 +853,7 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused) ...@@ -853,6 +853,7 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused)
struct drm_info_node *node = (struct drm_info_node *) m->private; struct drm_info_node *node = (struct drm_info_node *) m->private;
struct drm_device *dev = node->minor->dev; struct drm_device *dev = node->minor->dev;
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
int ret;
if (IS_GEN5(dev)) { if (IS_GEN5(dev)) {
u16 rgvswctl = I915_READ16(MEMSWCTL); u16 rgvswctl = I915_READ16(MEMSWCTL);
...@@ -874,6 +875,10 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused) ...@@ -874,6 +875,10 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused)
int max_freq; int max_freq;
/* RPSTAT1 is in the GT power well */ /* RPSTAT1 is in the GT power well */
ret = mutex_lock_interruptible(&dev->struct_mutex);
if (ret)
return ret;
gen6_gt_force_wake_get(dev_priv); gen6_gt_force_wake_get(dev_priv);
rpstat = I915_READ(GEN6_RPSTAT1); rpstat = I915_READ(GEN6_RPSTAT1);
...@@ -884,6 +889,9 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused) ...@@ -884,6 +889,9 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused)
rpcurdown = I915_READ(GEN6_RP_CUR_DOWN); rpcurdown = I915_READ(GEN6_RP_CUR_DOWN);
rpprevdown = I915_READ(GEN6_RP_PREV_DOWN); rpprevdown = I915_READ(GEN6_RP_PREV_DOWN);
gen6_gt_force_wake_put(dev_priv);
mutex_unlock(&dev->struct_mutex);
seq_printf(m, "GT_PERF_STATUS: 0x%08x\n", gt_perf_status); seq_printf(m, "GT_PERF_STATUS: 0x%08x\n", gt_perf_status);
seq_printf(m, "RPSTAT1: 0x%08x\n", rpstat); seq_printf(m, "RPSTAT1: 0x%08x\n", rpstat);
seq_printf(m, "Render p-state ratio: %d\n", seq_printf(m, "Render p-state ratio: %d\n",
...@@ -918,8 +926,6 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused) ...@@ -918,8 +926,6 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused)
max_freq = rp_state_cap & 0xff; max_freq = rp_state_cap & 0xff;
seq_printf(m, "Max non-overclocked (RP0) frequency: %dMHz\n", seq_printf(m, "Max non-overclocked (RP0) frequency: %dMHz\n",
max_freq * 50); max_freq * 50);
gen6_gt_force_wake_put(dev_priv);
} else { } else {
seq_printf(m, "no P-state info available\n"); seq_printf(m, "no P-state info available\n");
} }
......
...@@ -2585,7 +2585,11 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc) ...@@ -2585,7 +2585,11 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc)
ironlake_pch_enable(crtc); ironlake_pch_enable(crtc);
intel_crtc_load_lut(crtc); intel_crtc_load_lut(crtc);
mutex_lock(&dev->struct_mutex);
intel_update_fbc(dev); intel_update_fbc(dev);
mutex_unlock(&dev->struct_mutex);
intel_crtc_update_cursor(crtc, true); intel_crtc_update_cursor(crtc, true);
} }
...@@ -2681,8 +2685,11 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc) ...@@ -2681,8 +2685,11 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc)
intel_crtc->active = false; intel_crtc->active = false;
intel_update_watermarks(dev); intel_update_watermarks(dev);
mutex_lock(&dev->struct_mutex);
intel_update_fbc(dev); intel_update_fbc(dev);
intel_clear_scanline_wait(dev); intel_clear_scanline_wait(dev);
mutex_unlock(&dev->struct_mutex);
} }
static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode) static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode)
...@@ -6973,6 +6980,7 @@ void gen6_enable_rps(struct drm_i915_private *dev_priv) ...@@ -6973,6 +6980,7 @@ void gen6_enable_rps(struct drm_i915_private *dev_priv)
* userspace... * userspace...
*/ */
I915_WRITE(GEN6_RC_STATE, 0); I915_WRITE(GEN6_RC_STATE, 0);
mutex_lock(&dev_priv->dev->struct_mutex);
gen6_gt_force_wake_get(dev_priv); gen6_gt_force_wake_get(dev_priv);
/* disable the counters and set deterministic thresholds */ /* disable the counters and set deterministic thresholds */
...@@ -7075,6 +7083,7 @@ void gen6_enable_rps(struct drm_i915_private *dev_priv) ...@@ -7075,6 +7083,7 @@ void gen6_enable_rps(struct drm_i915_private *dev_priv)
I915_WRITE(GEN6_PMINTRMSK, 0); I915_WRITE(GEN6_PMINTRMSK, 0);
gen6_gt_force_wake_put(dev_priv); gen6_gt_force_wake_put(dev_priv);
mutex_unlock(&dev_priv->dev->struct_mutex);
} }
void intel_enable_clock_gating(struct drm_device *dev) void intel_enable_clock_gating(struct drm_device *dev)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册