agp/intel: Flush the chipset write buffers when changing GTT base
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 23 Dec 2010 10:40:38 +0000 (10:40 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Tue, 11 Jan 2011 20:35:41 +0000 (20:35 +0000)
Flush the chipset write buffers before and after adjusting the GTT base
register, just in case. We only modify this value upon initialisation
(boot and resume) so there should be no outstanding writes, however
there are always those persistent PGTBL_ER that keep getting reported
upon resume.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
drivers/char/agp/intel-agp.h
drivers/char/agp/intel-gtt.c

index 010e3defd6c3a13117d41e720870bccb05ebe3b1..c195bfeade117125eec0e2dbf1c6e550f4ec87f9 100644 (file)
@@ -94,6 +94,8 @@
 #define G4x_GMCH_SIZE_VT_1_5M  (0xa << 8)
 #define G4x_GMCH_SIZE_VT_2M    (0xc << 8)
 
+#define GFX_FLSH_CNTL          0x2170 /* 915+ */
+
 #define I810_DRAM_CTL          0x3000
 #define I810_DRAM_ROW_0                0x00000001
 #define I810_DRAM_ROW_0_SDRAM  0x00000001
index 356f73e0d17e9b43ae513bbb7cfb8b1c56a989b9..da8161806f39c16b2e1e4f2959aa785de4c103d7 100644 (file)
@@ -814,6 +814,12 @@ static bool intel_enable_gtt(void)
                }
        }
 
+       /* On the resume path we may be adjusting the PGTBL value, so
+        * be paranoid and flush all chipset write buffers...
+        */
+       if (INTEL_GTT_GEN >= 3)
+               writel(0, intel_private.registers+GFX_FLSH_CNTL);
+
        reg = intel_private.registers+I810_PGETBL_CTL;
        writel(intel_private.PGETBL_save, reg);
        if (HAS_PGTBL_EN && (readl(reg) & I810_PGETBL_ENABLED) == 0) {
@@ -823,6 +829,9 @@ static bool intel_enable_gtt(void)
                return false;
        }
 
+       if (INTEL_GTT_GEN >= 3)
+               writel(0, intel_private.registers+GFX_FLSH_CNTL);
+
        return true;
 }