drm/i915: Add support for GPU reset on gen6.
authorEric Anholt <eric@anholt.net>
Thu, 18 Nov 2010 01:31:14 +0000 (09:31 +0800)
committerChris Wilson <chris@chris-wilson.co.uk>
Mon, 22 Nov 2010 09:02:07 +0000 (09:02 +0000)
This has proven sufficient to recover from a hang of the GPU using the
gem_bad_blit test while at the KMS console then starting X.  When
attempting the same during an X session, the timer doesn't appear to
trigger.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
drivers/gpu/drm/i915/i915_drv.c
drivers/gpu/drm/i915/i915_reg.h

index 99b574050fde4f3cf6c3cb97bf9687761958cc22..8c5541950b8dc51b579a71f8e0eba194f67107cd 100644 (file)
@@ -405,6 +405,14 @@ static int ironlake_do_reset(struct drm_device *dev, u8 flags)
        return wait_for(I915_READ(MCHBAR_MIRROR_BASE + ILK_GDSR) & 0x1, 500);
 }
 
+static int gen6_do_reset(struct drm_device *dev, u8 flags)
+{
+       struct drm_i915_private *dev_priv = dev->dev_private;
+
+       I915_WRITE(GEN6_GDRST, GEN6_GRDOM_FULL);
+       return wait_for((I915_READ(GEN6_GDRST) & GEN6_GRDOM_FULL) == 0, 500);
+}
+
 /**
  * i965_reset - reset chip after a hang
  * @dev: drm device to reset
@@ -439,6 +447,9 @@ int i915_reset(struct drm_device *dev, u8 flags)
        if (get_seconds() - dev_priv->last_gpu_reset < 5) {
                DRM_ERROR("GPU hanging too fast, declaring wedged!\n");
        } else switch (INTEL_INFO(dev)->gen) {
+       case 6:
+               ret = gen6_do_reset(dev, flags);
+               break;
        case 5:
                ret = ironlake_do_reset(dev, flags);
                break;
index ec2a8b07ba5beb87b6f3bf5422e75d74af24445f..c668b2fb7e3d5e01cf28a99edf50fa1ebf256247 100644 (file)
 #define  GRDOM_RENDER  (1<<2)
 #define  GRDOM_MEDIA   (3<<2)
 
+#define GEN6_GDRST     0x941c
+#define  GEN6_GRDOM_FULL               (1 << 0)
+#define  GEN6_GRDOM_RENDER             (1 << 1)
+#define  GEN6_GRDOM_MEDIA              (1 << 2)
+#define  GEN6_GRDOM_BLT                        (1 << 3)
+
 /* VGA stuff */
 
 #define VGA_ST01_MDA 0x3ba