drm/i915: preserve user forcewake over system suspend/resume
authorImre Deak <imre.deak@intel.com>
Fri, 6 Jun 2014 09:59:39 +0000 (12:59 +0300)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 13 Jun 2014 13:17:40 +0000 (15:17 +0200)
Atm, the forcewake refcount will be incorrectly set to zero during
system suspend if there is any reference held via the
i915_forcewake_user debugfs entry.

Fix this by simply not zeroing the sw counters during suspend and
restoring the original state using them. Note that the only other
places where we zeroed the counters were driver load and unload time,
where it was redundant anyway.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78059
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_drv.c
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/intel_uncore.c

index 615b62f0541d3f54d466f6521ea0987d00f7d359..5a08c86cb1abb3deffec0f33ba4b04d53d059e76 100644 (file)
@@ -600,7 +600,7 @@ static int i915_drm_thaw_early(struct drm_device *dev)
 {
        struct drm_i915_private *dev_priv = dev->dev_private;
 
-       intel_uncore_early_sanitize(dev);
+       intel_uncore_early_sanitize(dev, true);
        intel_uncore_sanitize(dev);
        intel_power_domains_init_hw(dev_priv);
 
index c565e7350c8c99094fd0250119dab9926abebc56..eea98f47f0b0b3612ade880f9943b0552fe3bb77 100644 (file)
@@ -2078,7 +2078,8 @@ extern void intel_irq_init(struct drm_device *dev);
 extern void intel_hpd_init(struct drm_device *dev);
 
 extern void intel_uncore_sanitize(struct drm_device *dev);
-extern void intel_uncore_early_sanitize(struct drm_device *dev);
+extern void intel_uncore_early_sanitize(struct drm_device *dev,
+                                       bool restore_forcewake);
 extern void intel_uncore_init(struct drm_device *dev);
 extern void intel_uncore_check_errors(struct drm_device *dev);
 extern void intel_uncore_fini(struct drm_device *dev);
index 6a73078128819e9a2ca7b6f96f7845ad54b0ab0b..11cc7926ef98bfcdfd1982d852933c455d94d4e0 100644 (file)
@@ -358,16 +358,12 @@ static void intel_uncore_forcewake_reset(struct drm_device *dev, bool restore)
                        dev_priv->uncore.fifo_count =
                                __raw_i915_read32(dev_priv, GTFIFOCTL) &
                                GT_FIFO_FREE_ENTRIES_MASK;
-       } else {
-               dev_priv->uncore.forcewake_count = 0;
-               dev_priv->uncore.fw_rendercount = 0;
-               dev_priv->uncore.fw_mediacount = 0;
        }
 
        spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
 }
 
-void intel_uncore_early_sanitize(struct drm_device *dev)
+void intel_uncore_early_sanitize(struct drm_device *dev, bool restore_forcewake)
 {
        struct drm_i915_private *dev_priv = dev->dev_private;
 
@@ -390,7 +386,7 @@ void intel_uncore_early_sanitize(struct drm_device *dev)
                __raw_i915_write32(dev_priv, GTFIFODBG,
                                   __raw_i915_read32(dev_priv, GTFIFODBG));
 
-       intel_uncore_forcewake_reset(dev, false);
+       intel_uncore_forcewake_reset(dev, restore_forcewake);
 }
 
 void intel_uncore_sanitize(struct drm_device *dev)
@@ -821,7 +817,7 @@ void intel_uncore_init(struct drm_device *dev)
        setup_timer(&dev_priv->uncore.force_wake_timer,
                    gen6_force_wake_timer, (unsigned long)dev_priv);
 
-       intel_uncore_early_sanitize(dev);
+       intel_uncore_early_sanitize(dev, false);
 
        if (IS_VALLEYVIEW(dev)) {
                dev_priv->uncore.funcs.force_wake_get = __vlv_force_wake_get;