From 2c94e96c81599a2f48a0af13a4d83a249601403d Mon Sep 17 00:00:00 2001 From: Mika Kuoppala Date: Tue, 3 Feb 2015 18:04:39 +0200 Subject: [PATCH] drm/i915: Take runtime pm reference on hangcheck_info We read the current seqno from ring. Take runtime reference so that we have power when we access the hardware. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88911 Signed-off-by: Mika Kuoppala --- drivers/gpu/drm/i915/i915_debugfs.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 211d494..5b71920 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -1223,15 +1223,22 @@ out: static int i915_hangcheck_info(struct seq_file *m, void *unused) { struct drm_info_node *node = m->private; - struct drm_i915_private *dev_priv = to_i915(node->minor->dev); + struct drm_device *dev = node->minor->dev; + struct drm_i915_private *dev_priv = dev->dev_private; struct intel_engine_cs *ring; - int i; + int i, ret; if (!i915.enable_hangcheck) { seq_printf(m, "Hangcheck disabled\n"); return 0; } + ret = mutex_lock_interruptible(&dev->struct_mutex); + if (ret) + return ret; + + intel_runtime_pm_get(dev_priv); + if (delayed_work_pending(&dev_priv->gpu_error.hangcheck_work)) { seq_printf(m, "Hangcheck active, fires in %dms\n", jiffies_to_msecs(dev_priv->gpu_error.hangcheck_work.timer.expires - @@ -1252,6 +1259,9 @@ static int i915_hangcheck_info(struct seq_file *m, void *unused) (long long)ring->hangcheck.max_acthd); } + intel_runtime_pm_put(dev_priv); + mutex_unlock(&dev->struct_mutex); + return 0; } -- 1.9.1