drm/i915: fix i915_frequency_info on BDW
authorPaulo Zanoni <paulo.r.zanoni@intel.com>
Fri, 1 Aug 2014 21:14:48 +0000 (18:14 -0300)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 3 Sep 2014 08:54:14 +0000 (10:54 +0200)
The GEN6_PM* registers don't exist on BDW anymore, so when we read
this file we trigger unclaimed register errors. The equivalent BDW
register for PMs is GEN8_GT_I*R(2), so use it.

Testcase: igt/pm_rpm/debugfs-read
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_debugfs.c

index 6c82bdaa0822699f221174dcc3e6a50556918632..b2c4cf8a246178653ad00d2192d1534fd33b1058 100644 (file)
@@ -1030,6 +1030,7 @@ static int i915_frequency_info(struct seq_file *m, void *unused)
                u32 rpstat, cagf, reqf;
                u32 rpupei, rpcurup, rpprevup;
                u32 rpdownei, rpcurdown, rpprevdown;
+               u32 pm_ier, pm_imr, pm_isr, pm_iir, pm_mask;
                int max_freq;
 
                /* RPSTAT1 is in the GT power well */
@@ -1067,12 +1068,21 @@ static int i915_frequency_info(struct seq_file *m, void *unused)
                gen6_gt_force_wake_put(dev_priv, FORCEWAKE_ALL);
                mutex_unlock(&dev->struct_mutex);
 
+               if (IS_GEN6(dev) || IS_GEN7(dev)) {
+                       pm_ier = I915_READ(GEN6_PMIER);
+                       pm_imr = I915_READ(GEN6_PMIMR);
+                       pm_isr = I915_READ(GEN6_PMISR);
+                       pm_iir = I915_READ(GEN6_PMIIR);
+                       pm_mask = I915_READ(GEN6_PMINTRMSK);
+               } else {
+                       pm_ier = I915_READ(GEN8_GT_IER(2));
+                       pm_imr = I915_READ(GEN8_GT_IMR(2));
+                       pm_isr = I915_READ(GEN8_GT_ISR(2));
+                       pm_iir = I915_READ(GEN8_GT_IIR(2));
+                       pm_mask = I915_READ(GEN6_PMINTRMSK);
+               }
                seq_printf(m, "PM IER=0x%08x IMR=0x%08x ISR=0x%08x IIR=0x%08x, MASK=0x%08x\n",
-                          I915_READ(GEN6_PMIER),
-                          I915_READ(GEN6_PMIMR),
-                          I915_READ(GEN6_PMISR),
-                          I915_READ(GEN6_PMIIR),
-                          I915_READ(GEN6_PMINTRMSK));
+                          pm_ier, pm_imr, pm_isr, pm_iir, pm_mask);
                seq_printf(m, "GT_PERF_STATUS: 0x%08x\n", gt_perf_status);
                seq_printf(m, "Render p-state ratio: %d\n",
                           (gt_perf_status & 0xff00) >> 8);