Skip to contentSkip to conversation

drm/i915: fix i915_frequency_info on BDW

PATCH Applied Paulo Zanoni 3 participants 5 messages Aug 1, 2014 – Aug 25, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: fix i915_frequency_info on BDW

From: Paulo Zanoni <[email protected]>

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

---
 drivers/gpu/drm/i915/i915_debugfs.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +15 -5
index 9e737b7..17bd20ff 100644
@@ -1024,6 +1024,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 */
@@ -1061,12 +1062,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);
Signature · 1 line
2.0.1
#1 lore raw
Quoted 33 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

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

---
 drivers/gpu/drm/i915/i915_debugfs.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +1 -0
index 9e737b7..17bd20ff 100644
@@ -1024,6 +1024,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 */
drivers/gpu/drm/i915/i915_debugfs.c +2 -0
@@ -1061,12 +1062,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);

drivers/gpu/drm/i915/i915_debugfs.c static int i915_frequency_info(struct seq_file *m, · line 1077

Quoted 10 lines
drivers/gpu/drm/i915/i915_debugfs.c +9 -0
+                       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));
 

Why do we care only about GT(2) interrupt reg?
What about other 0, 1 and 3 regs?

Could this explain GT3 failures?

Quoted 21 lines
drivers/gpu/drm/i915/i915_debugfs.c +3 -5
+                       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);

--
2.0.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 2 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

2014-08-15 13:50 GMT-03:00 Rodrigo Vivi <[email protected]>:

Quoted 36 lines · Paulo Zanoni
Quoted 32 lines

From: Paulo Zanoni <[email protected]>

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

---
 drivers/gpu/drm/i915/i915_debugfs.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +1 -0
index 9e737b7..17bd20ff 100644
@@ -1024,6 +1024,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 */
drivers/gpu/drm/i915/i915_debugfs.c +0 -0
@@ -1061,12 +1062,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);
 
Quoted 15 lines

drivers/gpu/drm/i915/i915_debugfs.c static int i915_frequency_info(struct seq_file *m, void *unused) · line 1075

Quoted 11 lines
drivers/gpu/drm/i915/i915_debugfs.c +11 -0
+               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));

Why do we care only about GT(2) interrupt reg?
What about other 0, 1 and 3 regs?

Because, as far as I could see, the GEN8_GT(2) register is the one that seems to be equivalent to the old GEN6_PM register in terms of the functionality debugged by this function: it is the one that contains all the RPS stuff. Another thing that influenced me to take this decision was that, for example, snb_update_pm_irq() touches GEN6_PM, while bdw_update_pm_irq() touches only GEN8_GT(2). But I'm not a great user of this code, so maybe we do want more interrupts. OTOH, if we want all, there's always i915_interrupt_info.

Quoted 2 lines

Could this explain GT3 failures?

Which GT3 failures? I don't understand why you ask this.

Quoted 30 lines
Quoted 18 lines
drivers/gpu/drm/i915/i915_debugfs.c +3 -5
+                       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);
--
2.0.1

Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Rodrigo Vivi
Blog: http://blog.vivi.eng.br

Signature · 1 line
Paulo Zanoni
Reviewed-by
#3 lore raw
Quoted 54 lines · Paulo Zanoni

2014-08-15 13:50 GMT-03:00 Rodrigo Vivi <[email protected]>:

Quoted 30 lines · Paulo Zanoni
Quoted 26 lines

From: Paulo Zanoni <[email protected]>

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

---
 drivers/gpu/drm/i915/i915_debugfs.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +1 -0
index 9e737b7..17bd20ff 100644
@@ -1024,6 +1024,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;
 
Quoted 2 lines

drivers/gpu/drm/i915/i915_debugfs.c static int i915_frequency_info(struct seq_file

Quoted 2 lines
                /* RPSTAT1 is in the GT power well */
drivers/gpu/drm/i915/i915_debugfs.c +0 -0
@@ -1061,12 +1062,21 @@ static int i915_frequency_info(struct seq_file

*m,

Quoted 17 lines
Quoted 5 lines
drivers/gpu/drm/i915/i915_debugfs.c +1 -0
 void *unused)
                gen6_gt_force_wake_put(dev_priv, FORCEWAKE_ALL);
                mutex_unlock(&dev->struct_mutex);
 
+               if (IS_GEN6(dev) || IS_GEN7(dev)) {

drivers/gpu/drm/i915/i915_debugfs.c static int i915_frequency_info(struct seq_file *m, void *unused) · line 1075

Quoted 10 lines
drivers/gpu/drm/i915/i915_debugfs.c +10 -0
+                       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));
Quoted 2 lines

Why do we care only about GT(2) interrupt reg?
What about other 0, 1 and 3 regs?

Quoted 9 lines

Because, as far as I could see, the GEN8_GT(2) register is the one that seems to be equivalent to the old GEN6_PM register in terms of the functionality debugged by this function: it is the one that contains all the RPS stuff. Another thing that influenced me to take this decision was that, for example, snb_update_pm_irq() touches GEN6_PM, while bdw_update_pm_irq() touches only GEN8_GT(2). But I'm not a great user of this code, so maybe we do want more interrupts. OTOH, if we want all, there's always i915_interrupt_info.

Yeah, makes sense.

Quoted 6 lines
Quoted 3 lines

Could this explain GT3 failures?

Which GT3 failures? I don't understand why you ask this.

forget about the gt3 on this, and thanks for the ideas!

Quoted 38 lines
Quoted 14 lines
Quoted 4 lines
drivers/gpu/drm/i915/i915_debugfs.c +1 -0
+                       pm_mask = I915_READ(GEN6_PMINTRMSK);

drivers/gpu/drm/i915/i915_debugfs.c static int i915_frequency_info(struct seq_file *m, void *unused)

Quoted 10 lines
drivers/gpu/drm/i915/i915_debugfs.c +2 -5
+               }
                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);

Quoted 13 lines
Quoted 9 lines

seq_printf(m, "Render p-state ratio: %d\n",
(gt_perf_status & 0xff00) >> 8);
--
2.0.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Quoted 4 lines

--
Rodrigo Vivi
Blog: http://blog.vivi.eng.br

--
Paulo Zanoni

Signature · 2 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw
Quoted 66 lines · Rodrigo Vivi
Quoted 54 lines · Paulo Zanoni

2014-08-15 13:50 GMT-03:00 Rodrigo Vivi <[email protected]>:

Quoted 30 lines · Paulo Zanoni
Quoted 26 lines

From: Paulo Zanoni <[email protected]>

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

---
 drivers/gpu/drm/i915/i915_debugfs.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +1 -0
index 9e737b7..17bd20ff 100644
@@ -1024,6 +1024,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;
 
Quoted 2 lines

drivers/gpu/drm/i915/i915_debugfs.c static int i915_frequency_info(struct seq_file

Quoted 2 lines
                /* RPSTAT1 is in the GT power well */
drivers/gpu/drm/i915/i915_debugfs.c +0 -0
@@ -1061,12 +1062,21 @@ static int i915_frequency_info(struct seq_file

*m,

Quoted 17 lines
Quoted 5 lines
drivers/gpu/drm/i915/i915_debugfs.c +1 -0
 void *unused)
                gen6_gt_force_wake_put(dev_priv, FORCEWAKE_ALL);
                mutex_unlock(&dev->struct_mutex);
 
+               if (IS_GEN6(dev) || IS_GEN7(dev)) {

drivers/gpu/drm/i915/i915_debugfs.c static int i915_frequency_info(struct seq_file *m, void *unused) · line 1075

Quoted 10 lines
drivers/gpu/drm/i915/i915_debugfs.c +10 -0
+                       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));
Quoted 2 lines

Why do we care only about GT(2) interrupt reg?
What about other 0, 1 and 3 regs?

Quoted 9 lines

Because, as far as I could see, the GEN8_GT(2) register is the one that seems to be equivalent to the old GEN6_PM register in terms of the functionality debugged by this function: it is the one that contains all the RPS stuff. Another thing that influenced me to take this decision was that, for example, snb_update_pm_irq() touches GEN6_PM, while bdw_update_pm_irq() touches only GEN8_GT(2). But I'm not a great user of this code, so maybe we do want more interrupts. OTOH, if we want all, there's always i915_interrupt_info.

Quoted 3 lines

Yeah, makes sense.

Queued for -next, thanks for the patch.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch