drm/i915: Implement GPU reset for g33
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 21 Nov 2014 19:54:28 +0000 (21:54 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 3 Dec 2014 08:29:38 +0000 (09:29 +0100)
g33 seems to sit somewhere between the 915/945/965 style and the
g4x style. The bits look like g4x, but we still need to do a full
reset including display.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_drv.c
drivers/gpu/drm/i915/intel_uncore.c

index 44abd7b0051d905e010042553be3b48d13754876..5066fd105512dcf43eda4d0b8d59cb9ee0ba851d 100644 (file)
@@ -881,8 +881,8 @@ int i915_reset(struct drm_device *dev)
                if (INTEL_INFO(dev)->gen > 5)
                        intel_reset_gt_powersave(dev);
 
-               if ((IS_GEN3(dev) && !IS_G33(dev)) ||
-                   (IS_GEN4(dev) && !IS_G4X(dev))) {
+
+               if (IS_GEN3(dev) || (IS_GEN4(dev) && !IS_G4X(dev))) {
                        intel_runtime_pm_disable_interrupts(dev_priv);
                        intel_runtime_pm_enable_interrupts(dev_priv);
 
index 68dc320585876e3d80a9a60a85b0e144305f0a96..cf8ecc01deb40e3978f6470bb82880b6a2054a83 100644 (file)
@@ -1369,6 +1369,14 @@ static int g4x_reset_complete(struct drm_device *dev)
        return (gdrst & GRDOM_RESET_ENABLE) == 0;
 }
 
+static int g33_do_reset(struct drm_device *dev)
+{
+       /* FIXME spec says to turn off all planes and wait 1 usec before reset */
+
+       pci_write_config_byte(dev->pdev, I915_GDRST, GRDOM_RESET_ENABLE);
+       return wait_for(g4x_reset_complete(dev), 500);
+}
+
 static int g4x_do_reset(struct drm_device *dev)
 {
        struct drm_i915_private *dev_priv = dev->dev_private;
@@ -1452,7 +1460,9 @@ int intel_gpu_reset(struct drm_device *dev)
                return ironlake_do_reset(dev);
        else if (IS_G4X(dev))
                return g4x_do_reset(dev);
-       else if (IS_GEN4(dev) || (IS_GEN3(dev) &&  !IS_G33(dev)))
+       else if (IS_G33(dev))
+               return g33_do_reset(dev);
+       else if (INTEL_INFO(dev)->gen >= 3)
                return i915_do_reset(dev);
        else
                return -ENODEV;