Skip to contentSkip to conversation

drm/i915/bxt: fix RC6 residency time calculation

PATCH Superseded Imre Deak 3 participants 5 messages Sep 29, 2015 – Sep 30, 2015

Subsystems (2)
lore
Share & tools
lore

Imre Deak

author
#0 lore raw

PATCH 1/1 drm/i915/bxt: fix RC6 residency time calculation

The RC6 residency time unit is 833.33ns on BXT according to the specification, so update the calculation accordingly. Use the same way as CHV/VLV to divide by the corresponding frequency, as I think this is the more natural unit for what the HW does internally.

Testcase: igt/pm_rc6_residency

---
 drivers/gpu/drm/i915/i915_sysfs.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/i915_sysfs.c +3 -0
index 74086eb..7879255 100644
@@ -54,6 +54,9 @@ static u32 calc_residency(struct drm_device *dev, const u32 reg)
 
 		if (I915_READ(VLV_COUNTER_CONTROL) & VLV_COUNT_RANGE_HIGH)
 			units <<= 8;
+	} else {
+		units = 1;
+		div = 1200;		/* 833.33ns */
 	}
 
 	raw_time = I915_READ(reg) * units;
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Imre Deak

The RC6 residency time unit is 833.33ns on BXT according to the specification, so update the calculation accordingly. Use the same way as CHV/VLV to divide by the corresponding frequency, as I think this is the more natural unit for what the HW does internally.

Testcase: igt/pm_rc6_residency

---
 drivers/gpu/drm/i915/i915_sysfs.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/i915_sysfs.c +0 -0
index 74086eb..7879255 100644

drivers/gpu/drm/i915/i915_sysfs.c static u32 calc_residency(struct drm_device *dev, const u32 reg) · line 57

Quoted 4 lines
drivers/gpu/drm/i915/i915_sysfs.c +1 -0
@@ -54,6 +54,9 @@ static u32 calc_residency(struct drm_device *dev, const u32 reg)
 
 		if (I915_READ(VLV_COUNTER_CONTROL) & VLV_COUNT_RANGE_HIGH)
 			units <<= 8;
+	} else {

missing IS_BROXTON()

drivers/gpu/drm/i915/i915_sysfs.c static u32 calc_residency(struct drm_device *dev, const u32 reg) · line 59

Quoted 2 lines
drivers/gpu/drm/i915/i915_sysfs.c +2 -0
+		units = 1;
+		div = 1200;		/* 833.33ns */

Yeah, so based on Bspec "Timestamp bases" section, this is in fact 16 19.2MHz clocks.

With the bxt check added this is

Quoted 10 lines
drivers/gpu/drm/i915/i915_sysfs.c +0 -0
 	}
 
 	raw_time = I915_READ(reg) * units;
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#2 lore raw

PATCH v2 1/1 drm/i915/bxt: fix RC6 residency time calculation

In reply to Imre Deak

The RC6 residency time unit is 833.33ns on BXT according to the specification, so update the calculation accordingly. Use the same way as CHV/VLV to divide by the corresponding frequency, as I think this is the more natural unit for what the HW does internally.

v2:
- add missing IS_BROXTON check (Ville)

Testcase: igt/pm_rc6_residency

---
 drivers/gpu/drm/i915/i915_sysfs.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/i915_sysfs.c +3 -0
index 74086eb..50ce9ce 100644
@@ -54,6 +54,9 @@ static u32 calc_residency(struct drm_device *dev, const u32 reg)
 
 		if (I915_READ(VLV_COUNTER_CONTROL) & VLV_COUNT_RANGE_HIGH)
 			units <<= 8;
+	} else if (IS_BROXTON(dev)) {
+		units = 1;
+		div = 1200;		/* 833.33ns */
 	}
 
 	raw_time = I915_READ(reg) * units;
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v2 1/1
#3 lore raw
Quoted 10 lines · Imre Deak

The RC6 residency time unit is 833.33ns on BXT according to the specification, so update the calculation accordingly. Use the same way as CHV/VLV to divide by the corresponding frequency, as I think this is the more natural unit for what the HW does internally.

v2:
- add missing IS_BROXTON check (Ville)

Testcase: igt/pm_rc6_residency

Quoted 20 lines
---
 drivers/gpu/drm/i915/i915_sysfs.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/i915_sysfs.c +3 -0
index 74086eb..50ce9ce 100644
@@ -54,6 +54,9 @@ static u32 calc_residency(struct drm_device *dev, const u32 reg)
 
 		if (I915_READ(VLV_COUNTER_CONTROL) & VLV_COUNT_RANGE_HIGH)
 			units <<= 8;
+	} else if (IS_BROXTON(dev)) {
+		units = 1;
+		div = 1200;		/* 833.33ns */
 	}
 
 	raw_time = I915_READ(reg) * units;
Signature · 1 line
2.1.4
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw
Quoted 6 lines · Ville Syrjälä
Quoted 5 lines · Imre Deak

The RC6 residency time unit is 833.33ns on BXT according to the specification, so update the calculation accordingly. Use the same way as CHV/VLV to divide by the corresponding frequency, as I think this is the more natural unit for what the HW does internally.

Quoted 7 lines
Quoted 5 lines

v2:
- add missing IS_BROXTON check (Ville)

Testcase: igt/pm_rc6_residency

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

Quoted 29 lines
Quoted 21 lines
---
 drivers/gpu/drm/i915/i915_sysfs.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/i915_sysfs.c +3 -0
index 74086eb..50ce9ce 100644
@@ -54,6 +54,9 @@ static u32 calc_residency(struct drm_device *dev, const u32 reg)
 
 		if (I915_READ(VLV_COUNTER_CONTROL) & VLV_COUNT_RANGE_HIGH)
 			units <<= 8;
+	} else if (IS_BROXTON(dev)) {
+		units = 1;
+		div = 1200;		/* 833.33ns */
 	}
 
 	raw_time = I915_READ(reg) * units;
Signature · 1 line
2.1.4
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx