Commit dc9fb09c authored by Chris Wilson's avatar Chris Wilson Committed by Daniel Vetter

drm/i915: Rebalance runtime pm vs forcewake

Calling intel_runtime_pm_put() is illegal from a soft-irq context, so
revert the crude hack

commit aa0b3b5b
Author: Paulo Zanoni <paulo.r.zanoni@intel.com>
Date:   Tue Apr 1 14:55:07 2014 -0300

    drm/i915: don't schedule force_wake_timer at gen6_read

and apply the single line corrective instead.

v2: assert forcewake is off after the forcewake_reset (Paulo)

References: https://bugs.freedesktop.org/show_bug.cgi?id=80913
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarMika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: Deepak S <deepak.s@linux.intel.com> (v1)
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 6d3d8274
...@@ -1365,8 +1365,6 @@ static int intel_runtime_suspend(struct device *device) ...@@ -1365,8 +1365,6 @@ static int intel_runtime_suspend(struct device *device)
if (WARN_ON_ONCE(!HAS_RUNTIME_PM(dev))) if (WARN_ON_ONCE(!HAS_RUNTIME_PM(dev)))
return -ENODEV; return -ENODEV;
assert_force_wake_inactive(dev_priv);
DRM_DEBUG_KMS("Suspending device\n"); DRM_DEBUG_KMS("Suspending device\n");
/* /*
...@@ -1405,6 +1403,7 @@ static int intel_runtime_suspend(struct device *device) ...@@ -1405,6 +1403,7 @@ static int intel_runtime_suspend(struct device *device)
} }
del_timer_sync(&dev_priv->gpu_error.hangcheck_timer); del_timer_sync(&dev_priv->gpu_error.hangcheck_timer);
intel_uncore_forcewake_reset(dev, false);
dev_priv->pm.suspended = true; dev_priv->pm.suspended = true;
/* /*
...@@ -1432,6 +1431,8 @@ static int intel_runtime_suspend(struct device *device) ...@@ -1432,6 +1431,8 @@ static int intel_runtime_suspend(struct device *device)
intel_opregion_notify_adapter(dev, PCI_D3hot); intel_opregion_notify_adapter(dev, PCI_D3hot);
} }
assert_force_wake_inactive(dev_priv);
DRM_DEBUG_KMS("Device suspended\n"); DRM_DEBUG_KMS("Device suspended\n");
return 0; return 0;
} }
......
...@@ -449,8 +449,6 @@ static void gen6_force_wake_timer(unsigned long arg) ...@@ -449,8 +449,6 @@ static void gen6_force_wake_timer(unsigned long arg)
if (--dev_priv->uncore.forcewake_count == 0) if (--dev_priv->uncore.forcewake_count == 0)
dev_priv->uncore.funcs.force_wake_put(dev_priv, FORCEWAKE_ALL); dev_priv->uncore.funcs.force_wake_put(dev_priv, FORCEWAKE_ALL);
spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags); spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
intel_runtime_pm_put(dev_priv);
} }
void intel_uncore_forcewake_reset(struct drm_device *dev, bool restore) void intel_uncore_forcewake_reset(struct drm_device *dev, bool restore)
...@@ -586,7 +584,6 @@ void gen6_gt_force_wake_get(struct drm_i915_private *dev_priv, int fw_engine) ...@@ -586,7 +584,6 @@ void gen6_gt_force_wake_get(struct drm_i915_private *dev_priv, int fw_engine)
void gen6_gt_force_wake_put(struct drm_i915_private *dev_priv, int fw_engine) void gen6_gt_force_wake_put(struct drm_i915_private *dev_priv, int fw_engine)
{ {
unsigned long irqflags; unsigned long irqflags;
bool delayed = false;
if (!dev_priv->uncore.funcs.force_wake_put) if (!dev_priv->uncore.funcs.force_wake_put)
return; return;
...@@ -603,21 +600,19 @@ void gen6_gt_force_wake_put(struct drm_i915_private *dev_priv, int fw_engine) ...@@ -603,21 +600,19 @@ void gen6_gt_force_wake_put(struct drm_i915_private *dev_priv, int fw_engine)
goto out; goto out;
} }
spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
WARN_ON(!dev_priv->uncore.forcewake_count); WARN_ON(!dev_priv->uncore.forcewake_count);
if (--dev_priv->uncore.forcewake_count == 0) { if (--dev_priv->uncore.forcewake_count == 0) {
dev_priv->uncore.forcewake_count++; dev_priv->uncore.forcewake_count++;
delayed = true;
mod_timer_pinned(&dev_priv->uncore.force_wake_timer, mod_timer_pinned(&dev_priv->uncore.force_wake_timer,
jiffies + 1); jiffies + 1);
} }
spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags); spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
out: out:
if (!delayed) intel_runtime_pm_put(dev_priv);
intel_runtime_pm_put(dev_priv);
} }
void assert_force_wake_inactive(struct drm_i915_private *dev_priv) void assert_force_wake_inactive(struct drm_i915_private *dev_priv)
...@@ -774,12 +769,11 @@ gen6_read##x(struct drm_i915_private *dev_priv, off_t reg, bool trace) { \ ...@@ -774,12 +769,11 @@ gen6_read##x(struct drm_i915_private *dev_priv, off_t reg, bool trace) { \
NEEDS_FORCE_WAKE((dev_priv), (reg))) { \ NEEDS_FORCE_WAKE((dev_priv), (reg))) { \
dev_priv->uncore.funcs.force_wake_get(dev_priv, \ dev_priv->uncore.funcs.force_wake_get(dev_priv, \
FORCEWAKE_ALL); \ FORCEWAKE_ALL); \
val = __raw_i915_read##x(dev_priv, reg); \ dev_priv->uncore.forcewake_count++; \
dev_priv->uncore.funcs.force_wake_put(dev_priv, \ mod_timer_pinned(&dev_priv->uncore.force_wake_timer, \
FORCEWAKE_ALL); \ jiffies + 1); \
} else { \
val = __raw_i915_read##x(dev_priv, reg); \
} \ } \
val = __raw_i915_read##x(dev_priv, reg); \
hsw_unclaimed_reg_debug(dev_priv, reg, true, false); \ hsw_unclaimed_reg_debug(dev_priv, reg, true, false); \
REG_READ_FOOTER; \ REG_READ_FOOTER; \
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment