aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Khlebnikov <khlebnikov@openvz.org>2013-07-17 02:22:58 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-08-04 04:51:10 -0400
commitf4332be72bc7a2095a21057e9db2c38bd44486b2 (patch)
tree8c48b19b7ec1a2bd406e3556f2100bca7cd3fbc2
parent1177b868c8b99fa8e4d88ef8b9542741b0d60055 (diff)
drm/i915: fix long-standing SNB regression in power consumption after resume v2
commit 7dcd2677ea912573d9ed4bcd629b0023b2d11505 upstream. This patch fixes regression in power consumtion of sandy bridge gpu, which exists since v3.6 Sometimes after resuming from s2ram gpu starts thinking that it's extremely busy. After that it never reaches rc6 state. Bug exists since kernel v3.6: commit b4ae3f22d238617ca11610b29fde16cf8c0bc6e0 Author: Jesse Barnes <jbarnes@virtuousgeek.org> Date: Thu Jun 14 11:04:48 2012 -0700 drm/i915: load boot context at driver init time For some reason RC6 is already enabled at the beginning of resuming process. Following initliaztion breaks some internal state and confuses RPS engine. This patch disables RC6 at the beginnig of resume and initialization. I've rearranged initialization sequence, because intel_disable_gt_powersave() needs initialized force_wake_get/put and some locks from the dev_priv. Note: The culprit in the initialization sequence seems to be the write to MBCTL added in the above mentioned commit. The first version of this patch just held a forcewake reference across the clock gating init functions, which seems to have been enought to gather quite a few positive test reports. But since that smelled a bit like ad-hoc duct-tape v2 now just disables rps/rc6 across the entire hw setup. [danvet: Add note about v1 vs. v2 of this patch and use standard layout for the commit citation. Also add the tested-bys from v1 and a cc: stable.] References https://bugs.freedesktop.org/show_bug.cgi?id=54089 References https://bugzilla.kernel.org/show_bug.cgi?id=58971 References https://patchwork.kernel.org/patch/2827634/ (patch v1) Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org> Tested-by: Alexander Kaltsas <alexkaltsas@gmail.com> (v1) Tested-by: rocko <rockorequin@hotmail.com> (v1) Tested-by: JohnMB <johnmbryant@sky.com> (v1) Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c16
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c5
2 files changed, 11 insertions, 10 deletions
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 3b315ba85a3e..d1ee611d213d 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1511,6 +1511,13 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
1511 dev_priv->dev = dev; 1511 dev_priv->dev = dev;
1512 dev_priv->info = info; 1512 dev_priv->info = info;
1513 1513
1514 spin_lock_init(&dev_priv->irq_lock);
1515 spin_lock_init(&dev_priv->gpu_error.lock);
1516 spin_lock_init(&dev_priv->rps.lock);
1517 mutex_init(&dev_priv->dpio_lock);
1518 mutex_init(&dev_priv->rps.hw_lock);
1519 mutex_init(&dev_priv->modeset_restore_lock);
1520
1514 i915_dump_device_info(dev_priv); 1521 i915_dump_device_info(dev_priv);
1515 1522
1516 if (i915_get_bridge_dev(dev)) { 1523 if (i915_get_bridge_dev(dev)) {
@@ -1602,6 +1609,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
1602 1609
1603 intel_irq_init(dev); 1610 intel_irq_init(dev);
1604 intel_gt_init(dev); 1611 intel_gt_init(dev);
1612 intel_gt_reset(dev);
1605 1613
1606 /* Try to make sure MCHBAR is enabled before poking at it */ 1614 /* Try to make sure MCHBAR is enabled before poking at it */
1607 intel_setup_mchbar(dev); 1615 intel_setup_mchbar(dev);
@@ -1626,14 +1634,6 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
1626 if (!IS_I945G(dev) && !IS_I945GM(dev)) 1634 if (!IS_I945G(dev) && !IS_I945GM(dev))
1627 pci_enable_msi(dev->pdev); 1635 pci_enable_msi(dev->pdev);
1628 1636
1629 spin_lock_init(&dev_priv->irq_lock);
1630 spin_lock_init(&dev_priv->gpu_error.lock);
1631 spin_lock_init(&dev_priv->rps.lock);
1632 mutex_init(&dev_priv->dpio_lock);
1633
1634 mutex_init(&dev_priv->rps.hw_lock);
1635 mutex_init(&dev_priv->modeset_restore_lock);
1636
1637 dev_priv->num_plane = 1; 1637 dev_priv->num_plane = 1;
1638 if (IS_VALLEYVIEW(dev)) 1638 if (IS_VALLEYVIEW(dev))
1639 dev_priv->num_plane = 2; 1639 dev_priv->num_plane = 2;
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 0392c288324b..60d57affc748 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -4497,6 +4497,9 @@ void intel_gt_reset(struct drm_device *dev)
4497 if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev)) 4497 if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev))
4498 __gen6_gt_force_wake_mt_reset(dev_priv); 4498 __gen6_gt_force_wake_mt_reset(dev_priv);
4499 } 4499 }
4500
4501 /* BIOS often leaves RC6 enabled, but disable it for hw init */
4502 intel_disable_gt_powersave(dev);
4500} 4503}
4501 4504
4502void intel_gt_init(struct drm_device *dev) 4505void intel_gt_init(struct drm_device *dev)
@@ -4505,8 +4508,6 @@ void intel_gt_init(struct drm_device *dev)
4505 4508
4506 spin_lock_init(&dev_priv->gt_lock); 4509 spin_lock_init(&dev_priv->gt_lock);
4507 4510
4508 intel_gt_reset(dev);
4509
4510 if (IS_VALLEYVIEW(dev)) { 4511 if (IS_VALLEYVIEW(dev)) {
4511 dev_priv->gt.force_wake_get = vlv_force_wake_get; 4512 dev_priv->gt.force_wake_get = vlv_force_wake_get;
4512 dev_priv->gt.force_wake_put = vlv_force_wake_put; 4513 dev_priv->gt.force_wake_put = vlv_force_wake_put;