drm/nvc0/fifo: kick channels off during suspend
authorBen Skeggs <bskeggs@redhat.com>
Tue, 12 Apr 2011 08:51:39 +0000 (18:51 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Mon, 16 May 2011 00:49:17 +0000 (10:49 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvc0_fifo.c

index 55a4245c1a67e61d047fdf3eaa3954e38dbc0ab2..2bd0511511e4cc78114817311866e48085997c85 100644 (file)
@@ -240,6 +240,22 @@ nvc0_fifo_load_context(struct nouveau_channel *chan)
 int
 nvc0_fifo_unload_context(struct drm_device *dev)
 {
+       struct drm_nouveau_private *dev_priv = dev->dev_private;
+       int i;
+
+       for (i = 0; i < 128; i++) {
+               if (!(nv_rd32(dev, 0x003004 + (i * 4)) & 1))
+                       continue;
+
+               nv_mask(dev, 0x003004 + (i * 4), 0x00000001, 0x00000000);
+               nv_wr32(dev, 0x002634, i);
+               if (!nv_wait(dev, 0x002634, 0xffffffff, i)) {
+                       NV_INFO(dev, "PFIFO: kick ch %d failed: 0x%08x\n",
+                               i, nv_rd32(dev, 0x002634));
+                       return -EBUSY;
+               }
+       }
+
        return 0;
 }