HSW PM - RC6 fixes, clean up and split
Subsystems (2)
cover HSW PM - RC6 fixes, clean up and split
This series fixes a RC6 bug at HSW that can impact its performance.
At my fiurst attempt I noticed more than 1W saved, but I didn't measured this lates series yet.
Also there are 2 clean ups patches that removes unecessary registers and bits set for HSW.
The latest patch is optional. It splits hsw_enable_rps to make it more clean since the gen6_enable_rps was becoming a mess full of IS_HASWELL and probably becoming worse with new upcoming platforms.
Rodrigo Vivi (4):
drm/i915: HSW PM Frequency bits fix
drm/i915: HSW PM Cleaning - Removing unecessary register/bits set. drm/i915: HSW PM - removing pcode read/write
drm/i915: creating Haswell rc6 function
drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_pm.c | 133 +++++++++++++++++++++++++++++++++++----- 2 files changed, 119 insertions(+), 15 deletions(-)
Signature · 1 line
1.8.1.4
PATCH 1/4 drm/i915: HSW PM Frequency bits fix
According to HSW PM programming guide, frequency bits starts at 24 instead of 25.
v2: Paulo Zanoni noticed that only frequency bits can be set at GEN6_RPNSWREQ. All others are read only.
--- drivers/gpu/drm/i915/i915_reg.h | 1 + drivers/gpu/drm/i915/intel_pm.c | 31 +++++++++++++++++++++---------- 2 files changed, 22 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +1 -0
@@ -4190,6 +4190,7 @@#define GEN6_RPNSWREQ 0xA008#define GEN6_TURBO_DISABLE (1<<31)#define GEN6_FREQUENCY (x) ((x)<<25) +#define HSW_FREQUENCY (x) ((x)<<24)#define GEN6_OFFSET (x) ((x)<<19)#define GEN6_AGGRESSIVE_TURBO (0<<15)#define GEN6_RC_VIDEO_FREQ 0xA00C
drivers/gpu/drm/i915/intel_pm.c +21 -10
@@ -2460,10 +2460,14 @@ void gen6_set_rps(struct drm_device *dev, u8 val)if (val == dev_priv->rps.cur_delay)return ; -I915_WRITE (GEN6_RPNSWREQ , -GEN6_FREQUENCY (val) | -GEN6_OFFSET (0 ) | -GEN6_AGGRESSIVE_TURBO ); +if (IS_HASWELL (dev)) +I915_WRITE (GEN6_RPNSWREQ , +HSW_FREQUENCY (val)); +else +I915_WRITE (GEN6_RPNSWREQ , +GEN6_FREQUENCY (val) | +GEN6_OFFSET (0 ) | +GEN6_AGGRESSIVE_TURBO );/* Make sure we continue to get interrupts * until we hit the minimum or maximum frequencies.
@@ -2601,12 +2605,19 @@ static void gen6_enable_rps(struct drm_device *dev)GEN6_RC_CTL_EI_MODE (1 ) | GEN6_RC_CTL_HW_ENABLE); -I915_WRITE (GEN6_RPNSWREQ , -GEN6_FREQUENCY (10 ) | -GEN6_OFFSET (0 ) | -GEN6_AGGRESSIVE_TURBO ); -I915_WRITE (GEN6_RC_VIDEO_FREQ , -GEN6_FREQUENCY (12 )); +if (IS_HASWELL (dev)) { +I915_WRITE (GEN6_RPNSWREQ , +HSW_FREQUENCY (10 )); +I915_WRITE (GEN6_RC_VIDEO_FREQ , +HSW_FREQUENCY (12 )); + }else { +I915_WRITE (GEN6_RPNSWREQ , +GEN6_FREQUENCY (10 ) | +GEN6_OFFSET (0 ) | +GEN6_AGGRESSIVE_TURBO ); +I915_WRITE (GEN6_RC_VIDEO_FREQ , +GEN6_FREQUENCY (12 )); + }I915_WRITE (GEN6_RP_DOWN_TIMEOUT ,1000000 ); I915_WRITE(GEN6_RP_INTERRUPT_LIMITS,
Signature · 1 line
1.8.1.4
Re: [PATCH 1/4] drm/i915: HSW PM Frequency bits fix
Quoted 9 lines · Rodrigo Vivi
According to HSW PM programming guide, frequency bits starts at 24 instead of 25.
v2: Paulo Zanoni noticed that only frequency bits can be set at
GEN6_RPNSWREQ. All others are read only.CC Ben Widawsky <[email protected]>CC Paulo Zanoni <[email protected]Signed-off-by Rodrigo Vivi <[email protected]>
Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
Daniel Vetter
AppliedRe: [PATCH 1/4] drm/i915: HSW PM Frequency bits fix
Quoted 11 lines · Ben Widawsky
Quoted 9 lines · Rodrigo Vivi
According to HSW PM programming guide, frequency bits starts at 24 instead of 25.
v2: Paulo Zanoni noticed that only frequency bits can be set at
GEN6_RPNSWREQ. All others are read only.CC Ben Widawsky <[email protected]>CC Paulo Zanoni <[email protected]Signed-off-by Rodrigo Vivi <[email protected]>Reviewed-by Ben Widawsky <[email protected]>
Queued for -next, thanks for the patch.
-Daniel
Quoted 6 lines
Signature · 5 lines
Ben Widawsky, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 2/4 drm/i915: HSW PM Cleaning - Removing unecessary register/bits set.
In reply to Rodrigo ViviAccording to HSW PM Programming guide it is not needed touch this registers or setting these values anymore.
--- drivers/gpu/drm/i915/intel_pm.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +13 -6
@@ -2566,9 +2566,13 @@ static void gen6_enable_rps(struct drm_device *dev)/* disable the counters and set deterministic thresholds */ I915_WRITE (GEN6_RC_CONTROL ,0 ); -I915_WRITE (GEN6_RC1_WAKE_RATE_LIMIT ,1000 <<16 ); -I915_WRITE (GEN6_RC6_WAKE_RATE_LIMIT ,40 <<16 |30 ); -I915_WRITE (GEN6_RC6pp_WAKE_RATE_LIMIT,30 ); +if (IS_HASWELL (dev)) +I915_WRITE (GEN6_RC6_WAKE_RATE_LIMIT ,40 <<16 ); +else { +I915_WRITE (GEN6_RC1_WAKE_RATE_LIMIT ,1000 <<16 ); +I915_WRITE (GEN6_RC6_WAKE_RATE_LIMIT ,40 <<16 |30 ); +I915_WRITE (GEN6_RC6pp_WAKE_RATE_LIMIT,30 ); + }I915_WRITE (GEN6_RC_EVALUATION_INTERVAL ,125000 );I915_WRITE (GEN6_RC_IDLE_HYSTERSIS ,25 );
@@ -2576,10 +2580,13 @@ static void gen6_enable_rps(struct drm_device *dev)I915_WRITE (RING_MAX_IDLE (ring->mmio_base),10 );I915_WRITE (GEN6_RC_SLEEP ,0 ); -I915_WRITE (GEN6_RC1e_THRESHOLD,1000 ); +if (!IS_HASWELL (dev)) +I915_WRITE (GEN6_RC1e_THRESHOLD,1000 );I915_WRITE (GEN6_RC6_THRESHOLD ,50000 ); -I915_WRITE (GEN6_RC6p_THRESHOLD,150000 ); -I915_WRITE (GEN6_RC6pp_THRESHOLD,64000 );/* unused */ +if (!IS_HASWELL (dev)) { +I915_WRITE (GEN6_RC6p_THRESHOLD,150000 ); +I915_WRITE (GEN6_RC6pp_THRESHOLD,64000 );/* unused */ + }/* Check if we are enabling RC6 */ rc6_mode =intel_enable_rc6 (dev_priv->dev);
Signature · 1 line
1.8.1.4
PATCH 3/4 drm/i915: HSW PM - removing pcode read/write
In reply to Rodrigo ViviYet according to pm spec pcode read/write operations aren't necessary for HSW.
--- drivers/gpu/drm/i915/intel_pm.c | 50 ++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 23 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +27 -23
@@ -2645,18 +2645,20 @@ static void gen6_enable_rps(struct drm_device *dev)GEN6_RP_UP_BUSY_AVG | (IS_HASWELL(dev) ? GEN7_RP_DOWN_IDLE_AVG : GEN6_RP_DOWN_IDLE_CONT)); - ret =sandybridge_pcode_write (dev_priv,GEN6_PCODE_WRITE_MIN_FREQ_TABLE ,0 ); -if (!ret && (IS_GEN6 (dev) ||IS_IVYBRIDGE (dev))) { - pcu_mbox =0 ; - ret =sandybridge_pcode_read (dev_priv,GEN6_READ_OC_PARAMS , &pcu_mbox); -if (!ret && (pcu_mbox & (1 <<31 ))) {/* OC supported */ -DRM_DEBUG_DRIVER ("overclocking supported, adjusting frequency max from %dMHz to %dMHz\n" , - (dev_priv->rps.max_delay &0xff ) *50 , - (pcu_mbox &0xff ) *50 ); - dev_priv->rps.max_delay = pcu_mbox &0xff ; +if (!IS_HASWELL (dev)) { + ret =sandybridge_pcode_write (dev_priv,GEN6_PCODE_WRITE_MIN_FREQ_TABLE ,0 ); +if (!ret && (IS_GEN6 (dev) ||IS_IVYBRIDGE (dev))) { + pcu_mbox =0 ; + ret =sandybridge_pcode_read (dev_priv,GEN6_READ_OC_PARAMS , &pcu_mbox); +if (!ret && (pcu_mbox & (1 <<31 ))) {/* OC supported */ +DRM_DEBUG_DRIVER ("overclocking supported, adjusting frequency max from %dMHz to %dMHz\n" , + (dev_priv->rps.max_delay &0xff ) *50 , + (pcu_mbox &0xff ) *50 ); + dev_priv->rps.max_delay = pcu_mbox &0xff ; + } + }else { +DRM_DEBUG_DRIVER ("Failed to set the min frequency\n" ); } - }else { -DRM_DEBUG_DRIVER ("Failed to set the min frequency\n" ); }gen6_set_rps (dev_priv->dev, (gt_perf_status &0xff00 ) >>8 );
@@ -2670,18 +2672,20 @@ static void gen6_enable_rps(struct drm_device *dev)/* enable all PM interrupts */ I915_WRITE (GEN6_PMINTRMSK ,0 ); - rc6vids =0 ; - ret =sandybridge_pcode_read (dev_priv,GEN6_PCODE_READ_RC6VIDS , &rc6vids); -if (IS_GEN6 (dev) && ret) { -DRM_DEBUG_DRIVER ("Couldn't check for BIOS workaround\n" ); - }else if (IS_GEN6 (dev) && (GEN6_DECODE_RC6_VID (rc6vids &0xff ) <450 )) { -DRM_DEBUG_DRIVER ("You should update your BIOS. Correcting minimum rc6 voltage (%dmV->%dmV)\n" , -GEN6_DECODE_RC6_VID (rc6vids &0xff ),450 ); - rc6vids &=0xffff00 ; - rc6vids |=GEN6_ENCODE_RC6_VID (450 ); - ret =sandybridge_pcode_write (dev_priv,GEN6_PCODE_WRITE_RC6VIDS , rc6vids); -if (ret) -DRM_ERROR ("Couldn't fix incorrect rc6 voltage\n" ); +if (!IS_HASWELL (dev)) { + rc6vids =0 ; + ret =sandybridge_pcode_read (dev_priv,GEN6_PCODE_READ_RC6VIDS , &rc6vids); +if (IS_GEN6 (dev) && ret) { +DRM_DEBUG_DRIVER ("Couldn't check for BIOS workaround\n" ); + }else if (IS_GEN6 (dev) && (GEN6_DECODE_RC6_VID (rc6vids &0xff ) <450 )) { +DRM_DEBUG_DRIVER ("You should update your BIOS. Correcting minimum rc6 voltage (%dmV->%dmV)\n" , +GEN6_DECODE_RC6_VID (rc6vids &0xff ),450 ); + rc6vids &=0xffff00 ; + rc6vids |=GEN6_ENCODE_RC6_VID (450 ); + ret =sandybridge_pcode_write (dev_priv,GEN6_PCODE_WRITE_RC6VIDS , rc6vids); +if (ret) +DRM_ERROR ("Couldn't fix incorrect rc6 voltage\n" ); + } }gen6_gt_force_wake_put (dev_priv);
Signature · 1 line
1.8.1.4
Re: [PATCH 3/4] drm/i915: HSW PM - removing pcode read/write
Quoted 31 lines · Rodrigo Vivi
Yet according to pm spec pcode read/write operations aren't necessary for HSW.
CC Paulo Zanoni <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/i915/intel_pm.c | 50 ++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 23 deletions(-)drivers/gpu/drm/i915/intel_pm.c +6
-9@@ -2645,18 +2645,20 @@ static void gen6_enable_rps(struct drm_device *dev)GEN6_RP_UP_BUSY_AVG | (IS_HASWELL(dev) ? GEN7_RP_DOWN_IDLE_AVG : GEN6_RP_DOWN_IDLE_CONT)); - ret =sandybridge_pcode_write (dev_priv,GEN6_PCODE_WRITE_MIN_FREQ_TABLE ,0 ); -if (!ret && (IS_GEN6 (dev) ||IS_IVYBRIDGE (dev))) { - pcu_mbox =0 ; - ret =sandybridge_pcode_read (dev_priv,GEN6_READ_OC_PARAMS , &pcu_mbox); -if (!ret && (pcu_mbox & (1 <<31 ))) {/* OC supported */ -DRM_DEBUG_DRIVER ("overclocking supported, adjusting frequency max from %dMHz to %dMHz\n" , - (dev_priv->rps.max_delay &0xff ) *50 , - (pcu_mbox &0xff ) *50 ); - dev_priv->rps.max_delay = pcu_mbox &0xff ; +if (!IS_HASWELL (dev)) { + ret =sandybridge_pcode_write (dev_priv,GEN6_PCODE_WRITE_MIN_FREQ_TABLE ,0 ); +if (!ret && (IS_GEN6 (dev) ||IS_IVYBRIDGE (dev))) { + pcu_mbox =0 ; + ret =sandybridge_pcode_read (dev_priv,GEN6_READ_OC_PARAMS , &pcu_mbox); +if (!ret && (pcu_mbox & (1 <<31 ))) {/* OC supported */
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev) · line 2659
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +7
-2+DRM_DEBUG_DRIVER ("overclocking supported, adjusting frequency max from %dMHz to %dMHz\n" , + (dev_priv->rps.max_delay &0xff ) *50 , + (pcu_mbox &0xff ) *50 ); + dev_priv->rps.max_delay = pcu_mbox &0xff ; + } + }else { +DRM_DEBUG_DRIVER ("Failed to set the min frequency\n" ); } - }else { -DRM_DEBUG_DRIVER ("Failed to set the min frequency\n" );
Note that the turbo code only runs on snb/ivb - Ben has promised to supply the hsw turbo support. So imo adding this check isn't required really.
Quoted 23 lines
drivers/gpu/drm/i915/intel_pm.c +4
-12}gen6_set_rps (dev_priv->dev, (gt_perf_status &0xff00 ) >>8 );@@ -2670,18 +2672,20 @@ static void gen6_enable_rps(struct drm_device *dev)/* enable all PM interrupts */ I915_WRITE (GEN6_PMINTRMSK ,0 ); - rc6vids =0 ; - ret =sandybridge_pcode_read (dev_priv,GEN6_PCODE_READ_RC6VIDS , &rc6vids); -if (IS_GEN6 (dev) && ret) { -DRM_DEBUG_DRIVER ("Couldn't check for BIOS workaround\n" ); - }else if (IS_GEN6 (dev) && (GEN6_DECODE_RC6_VID (rc6vids &0xff ) <450 )) { -DRM_DEBUG_DRIVER ("You should update your BIOS. Correcting minimum rc6 voltage (%dmV->%dmV)\n" , -GEN6_DECODE_RC6_VID (rc6vids &0xff ),450 ); - rc6vids &=0xffff00 ; - rc6vids |=GEN6_ENCODE_RC6_VID (450 ); - ret =sandybridge_pcode_write (dev_priv,GEN6_PCODE_WRITE_RC6VIDS , rc6vids); -if (ret) -DRM_ERROR ("Couldn't fix incorrect rc6 voltage\n" ); +if (!IS_HASWELL (dev)) { + rc6vids =0 ; + ret =sandybridge_pcode_read (dev_priv,GEN6_PCODE_READ_RC6VIDS , &rc6vids); +if (IS_GEN6 (dev) && ret) {
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev) · line 2688
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+DRM_DEBUG_DRIVER ("Couldn't check for BIOS workaround\n" ); + }else if (IS_GEN6 (dev) && (GEN6_DECODE_RC6_VID (rc6vids &0xff ) <450 )) { +DRM_DEBUG_DRIVER ("You should update your BIOS. Correcting minimum rc6 voltage (%dmV->%dmV)\n" , +GEN6_DECODE_RC6_VID (rc6vids &0xff ),450 ); + rc6vids &=0xffff00 ; + rc6vids |=GEN6_ENCODE_RC6_VID (450 ); + ret =sandybridge_pcode_write (dev_priv,GEN6_PCODE_WRITE_RC6VIDS , rc6vids); +if (ret) +DRM_ERROR ("Couldn't fix incorrect rc6 voltage\n" ); + }
This is a w/a only for snb - it would be much clearer to slap an if (IS_GEN6) check around it (and remove the funny logic with the existing GEN6 checks). Maybe resend just that?
-Daniel
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +0
-0}gen6_gt_force_wake_put (dev_priv);Signature · 6 lines
1.8.1.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Re: [PATCH 3/4] drm/i915: HSW PM - removing pcode read/write
Yeah, this kind of overlaps ben's patch, but also remove unecessary sandybridge_pcode_write.
Quoted 128 lines · Daniel Vetter
Quoted 1 line · Rodrigo Vivi
Yet according to pm spec pcode read/write operations aren't necessary
for HSW.
Quoted 5 lines
CC Paulo Zanoni <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/i915/intel_pm.c | 50++++++++++++++++++++++-------------------
Review
Quoted 3 lines
1 file changed, 27 insertions(+), 23 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/i915/intel_pm.cdrivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device
Quoted 4 lines
index aea5fac..f6a7366 100644
drivers/gpu/drm/i915/intel_pm.c +0
-0@@ -2645,18 +2645,20 @@ static void gen6_enable_rps(struct drm_device*dev)
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2646
Quoted 2 lines
drivers/gpu/drm/i915/intel_pm.c +0
-0GEN6_RP_UP_BUSY_AVG | (IS_HASWELL(dev) ? GEN7_RP_DOWN_IDLE_AVG :
GEN6_RP_DOWN_IDLE_CONT));drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2647
Quoted 2 lines
drivers/gpu/drm/i915/intel_pm.c +0
-1- ret = sandybridge_pcode_write(dev_priv,
GEN6_PCODE_WRITE_MIN_FREQ_TABLE, 0);drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 3 lines
drivers/gpu/drm/i915/intel_pm.c +0
-3-if (!ret && (IS_GEN6 (dev) ||IS_IVYBRIDGE (dev))) { - pcu_mbox =0 ; - ret = sandybridge_pcode_read(dev_priv,
GEN6_READ_OC_PARAMS,&pcu_mbox);drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2652
Quoted 2 lines
drivers/gpu/drm/i915/intel_pm.c +0
-2-if (!ret && (pcu_mbox & (1 <<31 ))) {/* OC supported */ - DRM_DEBUG_DRIVER("overclocking supported,adjusting frequency max from %dMHz to %dMHz\n",
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2653
Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +0
-1- (dev_priv->rps.max_delay &0xff )* 50,
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 4 lines
drivers/gpu/drm/i915/intel_pm.c +2
-2- (pcu_mbox & 0xff) * 50); - dev_priv->rps.max_delay = pcu_mbox &0xff ; +if (!IS_HASWELL (dev)) { + ret = sandybridge_pcode_write(dev_priv,
GEN6_PCODE_WRITE_MIN_FREQ_TABLE, 0);drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 3 lines
drivers/gpu/drm/i915/intel_pm.c +3
-0+if (!ret && (IS_GEN6 (dev) ||IS_IVYBRIDGE (dev))) { + pcu_mbox =0 ; + ret = sandybridge_pcode_read(dev_priv,
GEN6_READ_OC_PARAMS,&pcu_mbox);drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2652
Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +1
-0+if (!ret && (pcu_mbox & (1 <<31 ))) {/* OC supported */
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2653
Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +1
-0+ DRM_DEBUG_DRIVER("overclocking supported,adjusting frequency max from %dMHz to %dMHz\n",
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2654
Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +1
-0+ (dev_priv->rps.max_delay&
0xff) * 50,drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 5 lines
drivers/gpu/drm/i915/intel_pm.c +5
-0+ (pcu_mbox & 0xff) * 50); + dev_priv->rps.max_delay = pcu_mbox &0xff ; + } + }else { + DRM_DEBUG_DRIVER("Failed to set the minfrequency\n");
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev) · line 2659
Quoted 3 lines
drivers/gpu/drm/i915/intel_pm.c +0
-2} - }else { -DRM_DEBUG_DRIVER ("Failed to set the min frequency\n" );Note that the turbo code only runs on snb/ivb - Ben has promised to supply the hsw turbo support. So imo adding this check isn't required really.
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device
Quoted 4 lines
drivers/gpu/drm/i915/intel_pm.c +0
-0}gen6_set_rps (dev_priv->dev, (gt_perf_status &0xff00 ) >>8 );@@ -2670,18 +2672,20 @@ static void gen6_enable_rps(struct drm_device*dev)
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 5 lines
drivers/gpu/drm/i915/intel_pm.c +0
-2/* enable all PM interrupts */ I915_WRITE (GEN6_PMINTRMSK ,0 ); - rc6vids =0 ; - ret = sandybridge_pcode_read(dev_priv, GEN6_PCODE_READ_RC6VIDS,&rc6vids);
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 3 lines
drivers/gpu/drm/i915/intel_pm.c +0
-3-if (IS_GEN6 (dev) && ret) { -DRM_DEBUG_DRIVER ("Couldn't check for BIOS workaround\n" ); - } else if (IS_GEN6(dev) && (GEN6_DECODE_RC6_VID(rc6vids & 0xff) <450)) {
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2678
Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +0
-1- DRM_DEBUG_DRIVER("You should update your BIOS. Correctingminimum rc6 voltage (%dmV->%dmV)\n",
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 4 lines
drivers/gpu/drm/i915/intel_pm.c +0
-4- GEN6_DECODE_RC6_VID(rc6vids & 0xff), 450); - rc6vids &=0xffff00 ; - rc6vids |=GEN6_ENCODE_RC6_VID (450 ); - ret = sandybridge_pcode_write(dev_priv,
GEN6_PCODE_WRITE_RC6VIDS, rc6vids);drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 5 lines
drivers/gpu/drm/i915/intel_pm.c +3
-2-if (ret) -DRM_ERROR ("Couldn't fix incorrect rc6 voltage\n" ); +if (!IS_HASWELL (dev)) { + rc6vids =0 ; + ret = sandybridge_pcode_read(dev_priv,
GEN6_PCODE_READ_RC6VIDS, &rc6vids);drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2679
Quoted 2 lines
drivers/gpu/drm/i915/intel_pm.c +2
-0+if (IS_GEN6 (dev) && ret) { + DRM_DEBUG_DRIVER("Couldn't check for BIOSworkaround\n");
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2680
Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +1
-0+ } else if (IS_GEN6(dev) && (GEN6_DECODE_RC6_VID(rc6vids &
0xff) < 450)) {drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2681
Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +1
-0+ DRM_DEBUG_DRIVER("You should update your BIOS.Correcting minimum rc6 voltage (%dmV->%dmV)\n",
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2682
Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +1
-0+ GEN6_DECODE_RC6_VID(rc6vids &
0xff), 450);drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 3 lines
drivers/gpu/drm/i915/intel_pm.c +3
-0+ rc6vids &=0xffff00 ; + rc6vids |=GEN6_ENCODE_RC6_VID (450 ); + ret = sandybridge_pcode_write(dev_priv,
GEN6_PCODE_WRITE_RC6VIDS, rc6vids);drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2687
Quoted 2 lines
drivers/gpu/drm/i915/intel_pm.c +2
-0+if (ret) + DRM_ERROR("Couldn't fix incorrect rc6voltage\n");
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2688
Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +1
-0+ }This is a w/a only for snb - it would be much clearer to slap an if (
IS_GEN6) check around it (and remove the funny logic with the existing GEN6 checks). Maybe resend just that?
-DanielQuoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +0
-1}gen6_gt_force_wake_put (dev_priv); --1.8.1.4
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
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
PATCH 4/4 drm/i915: creating Haswell rc6 function
In reply to Rodrigo ViviPower management, in special RC6 enabling, differs across platforms. This patch just split out enabling function for HSW.
This is an attempt to make pm code more clean without multiple IS_HASWELL inside enable_rps function. This actually tends to get worse with upcoming platforms.
--- drivers/gpu/drm/i915/intel_pm.c | 211 +++++++++++++++++++++++++++------------- 1 file changed, 146 insertions(+), 65 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +146 -65
@@ -2566,13 +2566,9 @@ static void gen6_enable_rps(struct drm_device *dev)/* disable the counters and set deterministic thresholds */ I915_WRITE (GEN6_RC_CONTROL ,0 ); -if (IS_HASWELL (dev)) -I915_WRITE (GEN6_RC6_WAKE_RATE_LIMIT ,40 <<16 ); -else { -I915_WRITE (GEN6_RC1_WAKE_RATE_LIMIT ,1000 <<16 ); -I915_WRITE (GEN6_RC6_WAKE_RATE_LIMIT ,40 <<16 |30 ); -I915_WRITE (GEN6_RC6pp_WAKE_RATE_LIMIT,30 ); - } +I915_WRITE (GEN6_RC1_WAKE_RATE_LIMIT ,1000 <<16 ); +I915_WRITE (GEN6_RC6_WAKE_RATE_LIMIT ,40 <<16 |30 ); +I915_WRITE (GEN6_RC6pp_WAKE_RATE_LIMIT,30 );I915_WRITE (GEN6_RC_EVALUATION_INTERVAL ,125000 );I915_WRITE (GEN6_RC_IDLE_HYSTERSIS ,25 );
@@ -2580,27 +2576,19 @@ static void gen6_enable_rps(struct drm_device *dev)I915_WRITE (RING_MAX_IDLE (ring->mmio_base),10 );I915_WRITE (GEN6_RC_SLEEP ,0 ); -if (!IS_HASWELL (dev)) -I915_WRITE (GEN6_RC1e_THRESHOLD,1000 ); +I915_WRITE (GEN6_RC1e_THRESHOLD,1000 );I915_WRITE (GEN6_RC6_THRESHOLD ,50000 ); -if (!IS_HASWELL (dev)) { -I915_WRITE (GEN6_RC6p_THRESHOLD,150000 ); -I915_WRITE (GEN6_RC6pp_THRESHOLD,64000 );/* unused */ - } +I915_WRITE (GEN6_RC6p_THRESHOLD,150000 ); +I915_WRITE (GEN6_RC6pp_THRESHOLD,64000 );/* unused */ /* Check if we are enabling RC6 */ rc6_mode =intel_enable_rc6 (dev_priv->dev);if (rc6_mode &INTEL_RC6_ENABLE ) rc6_mask |=GEN6_RC_CTL_RC6_ENABLE ; - -/* We don't use those on Haswell */ -if (!IS_HASWELL (dev)) { -if (rc6_mode & INTEL_RC6p_ENABLE) - rc6_mask |= GEN6_RC_CTL_RC6p_ENABLE; - -if (rc6_mode & INTEL_RC6pp_ENABLE) - rc6_mask |= GEN6_RC_CTL_RC6pp_ENABLE; - } +if (rc6_mode & INTEL_RC6p_ENABLE) + rc6_mask |= GEN6_RC_CTL_RC6p_ENABLE; +if (rc6_mode & INTEL_RC6pp_ENABLE) + rc6_mask |= GEN6_RC_CTL_RC6pp_ENABLE; DRM_INFO("Enabling RC6 states: RC6 %s, RC6p %s, RC6pp %s\n", (rc6_mask & GEN6_RC_CTL_RC6_ENABLE) ? "on" : "off",
@@ -2612,19 +2600,12 @@ static void gen6_enable_rps(struct drm_device *dev)GEN6_RC_CTL_EI_MODE (1 ) | GEN6_RC_CTL_HW_ENABLE); -if (IS_HASWELL (dev)) { -I915_WRITE (GEN6_RPNSWREQ , -HSW_FREQUENCY (10 )); -I915_WRITE (GEN6_RC_VIDEO_FREQ , -HSW_FREQUENCY (12 )); - }else { -I915_WRITE (GEN6_RPNSWREQ , -GEN6_FREQUENCY (10 ) | -GEN6_OFFSET (0 ) | -GEN6_AGGRESSIVE_TURBO ); -I915_WRITE (GEN6_RC_VIDEO_FREQ , -GEN6_FREQUENCY (12 )); - } +I915_WRITE (GEN6_RPNSWREQ , +GEN6_FREQUENCY (10 ) | +GEN6_OFFSET (0 ) | +GEN6_AGGRESSIVE_TURBO ); +I915_WRITE (GEN6_RC_VIDEO_FREQ , +GEN6_FREQUENCY (12 ));I915_WRITE (GEN6_RP_DOWN_TIMEOUT ,1000000 ); I915_WRITE(GEN6_RP_INTERRUPT_LIMITS,
@@ -2643,22 +2624,20 @@ static void gen6_enable_rps(struct drm_device *dev)GEN6_RP_MEDIA_IS_GFX |GEN6_RP_ENABLE |GEN6_RP_UP_BUSY_AVG | - (IS_HASWELL(dev) ? GEN7_RP_DOWN_IDLE_AVG : GEN6_RP_DOWN_IDLE_CONT)); - -if (!IS_HASWELL (dev)) { - ret =sandybridge_pcode_write (dev_priv,GEN6_PCODE_WRITE_MIN_FREQ_TABLE ,0 ); -if (!ret && (IS_GEN6 (dev) ||IS_IVYBRIDGE (dev))) { - pcu_mbox =0 ; - ret =sandybridge_pcode_read (dev_priv,GEN6_READ_OC_PARAMS , &pcu_mbox); -if (!ret && (pcu_mbox & (1 <<31 ))) {/* OC supported */ -DRM_DEBUG_DRIVER ("overclocking supported, adjusting frequency max from %dMHz to %dMHz\n" , - (dev_priv->rps.max_delay &0xff ) *50 , - (pcu_mbox &0xff ) *50 ); - dev_priv->rps.max_delay = pcu_mbox &0xff ; - } - }else { -DRM_DEBUG_DRIVER ("Failed to set the min frequency\n" ); + GEN6_RP_DOWN_IDLE_CONT); + + ret =sandybridge_pcode_write (dev_priv,GEN6_PCODE_WRITE_MIN_FREQ_TABLE ,0 ); +if (!ret && (IS_GEN6 (dev) ||IS_IVYBRIDGE (dev))) { + pcu_mbox =0 ; + ret =sandybridge_pcode_read (dev_priv,GEN6_READ_OC_PARAMS , &pcu_mbox); +if (!ret && (pcu_mbox & (1 <<31 ))) {/* OC supported */ +DRM_DEBUG_DRIVER ("overclocking supported, adjusting frequency max from %dMHz to %dMHz\n" , + (dev_priv->rps.max_delay &0xff ) *50 , + (pcu_mbox &0xff ) *50 ); + dev_priv->rps.max_delay = pcu_mbox &0xff ; } + }else { +DRM_DEBUG_DRIVER ("Failed to set the min frequency\n" ); }gen6_set_rps (dev_priv->dev, (gt_perf_status &0xff00 ) >>8 );
@@ -2672,25 +2651,124 @@ static void gen6_enable_rps(struct drm_device *dev)/* enable all PM interrupts */ I915_WRITE (GEN6_PMINTRMSK ,0 ); -if (!IS_HASWELL (dev)) { - rc6vids =0 ; - ret =sandybridge_pcode_read (dev_priv,GEN6_PCODE_READ_RC6VIDS , &rc6vids); -if (IS_GEN6 (dev) && ret) { -DRM_DEBUG_DRIVER ("Couldn't check for BIOS workaround\n" ); - }else if (IS_GEN6 (dev) && (GEN6_DECODE_RC6_VID (rc6vids &0xff ) <450 )) { -DRM_DEBUG_DRIVER ("You should update your BIOS. Correcting minimum rc6 voltage (%dmV->%dmV)\n" , -GEN6_DECODE_RC6_VID (rc6vids &0xff ),450 ); - rc6vids &=0xffff00 ; - rc6vids |=GEN6_ENCODE_RC6_VID (450 ); - ret =sandybridge_pcode_write (dev_priv,GEN6_PCODE_WRITE_RC6VIDS , rc6vids); -if (ret) -DRM_ERROR ("Couldn't fix incorrect rc6 voltage\n" ); - } + rc6vids =0 ; + ret =sandybridge_pcode_read (dev_priv,GEN6_PCODE_READ_RC6VIDS , &rc6vids); +if (IS_GEN6 (dev) && ret) { +DRM_DEBUG_DRIVER ("Couldn't check for BIOS workaround\n" ); + }else if (IS_GEN6 (dev) && (GEN6_DECODE_RC6_VID (rc6vids &0xff ) <450 )) { +DRM_DEBUG_DRIVER ("You should update your BIOS. Correcting minimum rc6 voltage (%dmV->%dmV)\n" , +GEN6_DECODE_RC6_VID (rc6vids &0xff ),450 ); + rc6vids &=0xffff00 ; + rc6vids |=GEN6_ENCODE_RC6_VID (450 ); + ret =sandybridge_pcode_write (dev_priv,GEN6_PCODE_WRITE_RC6VIDS , rc6vids); +if (ret) +DRM_ERROR ("Couldn't fix incorrect rc6 voltage\n" ); }gen6_gt_force_wake_put (dev_priv); } +static void hsw_enable_rps (struct drm_device *dev) +{ +struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_ring_buffer *ring; +u32 rp_state_cap; +u32 gt_perf_status; +u32 rc6_mask =0 ; +u32 gtfifodbg; +int rc6_mode; +int i; + +WARN_ON (!mutex_is_locked (&dev_priv->rps.hw_lock)); + +/* Here begins a magic sequence of register writes to enable +* auto-downclocking. +* +* Perhaps there might be some value in exposing these to +* userspace... +*/ +I915_WRITE (GEN6_RC_STATE ,0 ); + +/* Clear the DBG now so we don't confuse earlier errors */ +if ((gtfifodbg =I915_READ (GTFIFODBG ))) { +DRM_ERROR ("GT fifo had a previous error %x\n" , gtfifodbg); +I915_WRITE (GTFIFODBG , gtfifodbg); + } + +gen6_gt_force_wake_get (dev_priv); + + rp_state_cap =I915_READ (GEN6_RP_STATE_CAP ); + gt_perf_status =I915_READ (GEN6_GT_PERF_STATUS ); + +/* In units of 100MHz */ + dev_priv->rps.max_delay = rp_state_cap &0xff ; + dev_priv->rps.min_delay = (rp_state_cap &0xff0000 ) >>16 ; + dev_priv->rps.cur_delay =0 ; + +/* disable the counters and set deterministic thresholds */ +I915_WRITE (GEN6_RC_CONTROL ,0 ); + +I915_WRITE (GEN6_RC6_WAKE_RATE_LIMIT ,40 <<16 ); +I915_WRITE (GEN6_RC_EVALUATION_INTERVAL ,125000 ); +I915_WRITE (GEN6_RC_IDLE_HYSTERSIS ,25 ); + +for_each_ring (ring, dev_priv, i) +I915_WRITE (RING_MAX_IDLE (ring->mmio_base),10 ); + +I915_WRITE (GEN6_RC_SLEEP ,0 ); +I915_WRITE (GEN6_RC6_THRESHOLD ,50000 ); + +/* Check if we are enabling RC6 */ + rc6_mode =intel_enable_rc6 (dev_priv->dev); +if (rc6_mode &INTEL_RC6_ENABLE ) + rc6_mask |=GEN6_RC_CTL_RC6_ENABLE ; + +DRM_INFO ("Enabling RC6 states: RC6 %s\n" , + (rc6_mask &GEN6_RC_CTL_RC6_ENABLE ) ?"on" :"off" ); + +I915_WRITE (GEN6_RC_CONTROL , + rc6_mask | +GEN6_RC_CTL_EI_MODE (1 ) | +GEN6_RC_CTL_HW_ENABLE ); + +I915_WRITE (GEN6_RPNSWREQ , +HSW_FREQUENCY (10 )); +I915_WRITE (GEN6_RC_VIDEO_FREQ , +HSW_FREQUENCY (12 )); + +I915_WRITE (GEN6_RP_DOWN_TIMEOUT ,1000000 ); +I915_WRITE (GEN6_RP_INTERRUPT_LIMITS , + dev_priv->rps.max_delay <<24 | + dev_priv->rps.min_delay <<16 ); + +I915_WRITE (GEN6_RP_UP_THRESHOLD ,59400 ); +I915_WRITE (GEN6_RP_DOWN_THRESHOLD ,245000 ); +I915_WRITE (GEN6_RP_UP_EI ,66000 ); +I915_WRITE (GEN6_RP_DOWN_EI ,350000 ); + +I915_WRITE (GEN6_RP_IDLE_HYSTERSIS ,10 ); +I915_WRITE (GEN6_RP_CONTROL , +GEN6_RP_MEDIA_TURBO | +GEN6_RP_MEDIA_HW_NORMAL_MODE | +GEN6_RP_MEDIA_IS_GFX | +GEN6_RP_ENABLE | +GEN6_RP_UP_BUSY_AVG | +GEN7_RP_DOWN_IDLE_AVG ); + +gen6_set_rps (dev_priv->dev, (gt_perf_status &0xff00 ) >>8 ); + +/* requires MSI enabled */ +I915_WRITE (GEN6_PMIER ,GEN6_PM_DEFERRED_EVENTS ); +spin_lock_irq (&dev_priv->rps.lock); +WARN_ON (dev_priv->rps.pm_iir !=0 ); +I915_WRITE (GEN6_PMIMR ,0 ); +spin_unlock_irq (&dev_priv->rps.lock); +/* enable all PM interrupts */ +I915_WRITE (GEN6_PMINTRMSK ,0 ); + +gen6_gt_force_wake_put (dev_priv); +} +static void gen6_update_ring_freq (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;
@@ -3480,7 +3558,10 @@ static void intel_gen6_powersave_work(struct work_struct *work)struct drm_device *dev = dev_priv->dev;mutex_lock (&dev_priv->rps.hw_lock); -gen6_enable_rps (dev); +if (IS_HASWELL (dev)) +hsw_enable_rps (dev); +else +gen6_enable_rps (dev);gen6_update_ring_freq (dev);mutex_unlock (&dev_priv->rps.hw_lock); }
Signature · 1 line
1.8.1.4
Re: [PATCH 4/4] drm/i915: creating Haswell rc6 function
Quoted 7 lines · Rodrigo Vivi
Power management, in special RC6 enabling, differs across platforms. This patch just split out enabling function for HSW.
This is an attempt to make pm code more clean without multipleIS_HASWELLinsideenable_rpsfunction. This actually tends to get worse with upcoming platforms.Signed-off-by Rodrigo Vivi <[email protected]>
I think the split starts to make sense, but ...
Quoted 9 lines
--- drivers/gpu/drm/i915/intel_pm.c | 211 +++++++++++++++++++++++++++------------- 1 file changed, 146 insertions(+), 65 deletions(-)drivers/gpu/drm/i915/intel_pm.c +0
-0
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev) · line 2575
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +0
-7@@ -2566,13 +2566,9 @@ static void gen6_enable_rps(struct drm_device *dev)/* disable the counters and set deterministic thresholds */ I915_WRITE (GEN6_RC_CONTROL ,0 ); -if (IS_HASWELL (dev)) -I915_WRITE (GEN6_RC6_WAKE_RATE_LIMIT ,40 <<16 ); -else { -I915_WRITE (GEN6_RC1_WAKE_RATE_LIMIT ,1000 <<16 ); -I915_WRITE (GEN6_RC6_WAKE_RATE_LIMIT ,40 <<16 |30 ); -I915_WRITE (GEN6_RC6pp_WAKE_RATE_LIMIT,30 ); - }
Adding an if block and then again killing it looks strange. -Daniel
Quoted 261 lines
drivers/gpu/drm/i915/intel_pm.c +146
-58+I915_WRITE (GEN6_RC1_WAKE_RATE_LIMIT ,1000 <<16 ); +I915_WRITE (GEN6_RC6_WAKE_RATE_LIMIT ,40 <<16 |30 ); +I915_WRITE (GEN6_RC6pp_WAKE_RATE_LIMIT,30 );I915_WRITE (GEN6_RC_EVALUATION_INTERVAL ,125000 );I915_WRITE (GEN6_RC_IDLE_HYSTERSIS ,25 );@@ -2580,27 +2576,19 @@ static void gen6_enable_rps(struct drm_device *dev)I915_WRITE (RING_MAX_IDLE (ring->mmio_base),10 );I915_WRITE (GEN6_RC_SLEEP ,0 ); -if (!IS_HASWELL (dev)) -I915_WRITE (GEN6_RC1e_THRESHOLD,1000 ); +I915_WRITE (GEN6_RC1e_THRESHOLD,1000 );I915_WRITE (GEN6_RC6_THRESHOLD ,50000 ); -if (!IS_HASWELL (dev)) { -I915_WRITE (GEN6_RC6p_THRESHOLD,150000 ); -I915_WRITE (GEN6_RC6pp_THRESHOLD,64000 );/* unused */ - } +I915_WRITE (GEN6_RC6p_THRESHOLD,150000 ); +I915_WRITE (GEN6_RC6pp_THRESHOLD,64000 );/* unused */ /* Check if we are enabling RC6 */ rc6_mode =intel_enable_rc6 (dev_priv->dev);if (rc6_mode &INTEL_RC6_ENABLE ) rc6_mask |=GEN6_RC_CTL_RC6_ENABLE ; - -/* We don't use those on Haswell */ -if (!IS_HASWELL (dev)) { -if (rc6_mode & INTEL_RC6p_ENABLE) - rc6_mask |= GEN6_RC_CTL_RC6p_ENABLE; - -if (rc6_mode & INTEL_RC6pp_ENABLE) - rc6_mask |= GEN6_RC_CTL_RC6pp_ENABLE; - } +if (rc6_mode & INTEL_RC6p_ENABLE) + rc6_mask |= GEN6_RC_CTL_RC6p_ENABLE; +if (rc6_mode & INTEL_RC6pp_ENABLE) + rc6_mask |= GEN6_RC_CTL_RC6pp_ENABLE; DRM_INFO("Enabling RC6 states: RC6 %s, RC6p %s, RC6pp %s\n", (rc6_mask & GEN6_RC_CTL_RC6_ENABLE) ? "on" : "off",@@ -2612,19 +2600,12 @@ static void gen6_enable_rps(struct drm_device *dev)GEN6_RC_CTL_EI_MODE (1 ) | GEN6_RC_CTL_HW_ENABLE); -if (IS_HASWELL (dev)) { -I915_WRITE (GEN6_RPNSWREQ , -HSW_FREQUENCY (10 )); -I915_WRITE (GEN6_RC_VIDEO_FREQ , -HSW_FREQUENCY (12 )); - }else { -I915_WRITE (GEN6_RPNSWREQ , -GEN6_FREQUENCY (10 ) | -GEN6_OFFSET (0 ) | -GEN6_AGGRESSIVE_TURBO ); -I915_WRITE (GEN6_RC_VIDEO_FREQ , -GEN6_FREQUENCY (12 )); - } +I915_WRITE (GEN6_RPNSWREQ , +GEN6_FREQUENCY (10 ) | +GEN6_OFFSET (0 ) | +GEN6_AGGRESSIVE_TURBO ); +I915_WRITE (GEN6_RC_VIDEO_FREQ , +GEN6_FREQUENCY (12 ));I915_WRITE (GEN6_RP_DOWN_TIMEOUT ,1000000 ); I915_WRITE(GEN6_RP_INTERRUPT_LIMITS,@@ -2643,22 +2624,20 @@ static void gen6_enable_rps(struct drm_device *dev)GEN6_RP_MEDIA_IS_GFX |GEN6_RP_ENABLE |GEN6_RP_UP_BUSY_AVG | - (IS_HASWELL(dev) ? GEN7_RP_DOWN_IDLE_AVG : GEN6_RP_DOWN_IDLE_CONT)); - -if (!IS_HASWELL (dev)) { - ret =sandybridge_pcode_write (dev_priv,GEN6_PCODE_WRITE_MIN_FREQ_TABLE ,0 ); -if (!ret && (IS_GEN6 (dev) ||IS_IVYBRIDGE (dev))) { - pcu_mbox =0 ; - ret =sandybridge_pcode_read (dev_priv,GEN6_READ_OC_PARAMS , &pcu_mbox); -if (!ret && (pcu_mbox & (1 <<31 ))) {/* OC supported */ -DRM_DEBUG_DRIVER ("overclocking supported, adjusting frequency max from %dMHz to %dMHz\n" , - (dev_priv->rps.max_delay &0xff ) *50 , - (pcu_mbox &0xff ) *50 ); - dev_priv->rps.max_delay = pcu_mbox &0xff ; - } - }else { -DRM_DEBUG_DRIVER ("Failed to set the min frequency\n" ); + GEN6_RP_DOWN_IDLE_CONT); + + ret =sandybridge_pcode_write (dev_priv,GEN6_PCODE_WRITE_MIN_FREQ_TABLE ,0 ); +if (!ret && (IS_GEN6 (dev) ||IS_IVYBRIDGE (dev))) { + pcu_mbox =0 ; + ret =sandybridge_pcode_read (dev_priv,GEN6_READ_OC_PARAMS , &pcu_mbox); +if (!ret && (pcu_mbox & (1 <<31 ))) {/* OC supported */ +DRM_DEBUG_DRIVER ("overclocking supported, adjusting frequency max from %dMHz to %dMHz\n" , + (dev_priv->rps.max_delay &0xff ) *50 , + (pcu_mbox &0xff ) *50 ); + dev_priv->rps.max_delay = pcu_mbox &0xff ; } + }else { +DRM_DEBUG_DRIVER ("Failed to set the min frequency\n" ); }gen6_set_rps (dev_priv->dev, (gt_perf_status &0xff00 ) >>8 );@@ -2672,25 +2651,124 @@ static void gen6_enable_rps(struct drm_device *dev)/* enable all PM interrupts */ I915_WRITE (GEN6_PMINTRMSK ,0 ); -if (!IS_HASWELL (dev)) { - rc6vids =0 ; - ret =sandybridge_pcode_read (dev_priv,GEN6_PCODE_READ_RC6VIDS , &rc6vids); -if (IS_GEN6 (dev) && ret) { -DRM_DEBUG_DRIVER ("Couldn't check for BIOS workaround\n" ); - }else if (IS_GEN6 (dev) && (GEN6_DECODE_RC6_VID (rc6vids &0xff ) <450 )) { -DRM_DEBUG_DRIVER ("You should update your BIOS. Correcting minimum rc6 voltage (%dmV->%dmV)\n" , -GEN6_DECODE_RC6_VID (rc6vids &0xff ),450 ); - rc6vids &=0xffff00 ; - rc6vids |=GEN6_ENCODE_RC6_VID (450 ); - ret =sandybridge_pcode_write (dev_priv,GEN6_PCODE_WRITE_RC6VIDS , rc6vids); -if (ret) -DRM_ERROR ("Couldn't fix incorrect rc6 voltage\n" ); - } + rc6vids =0 ; + ret =sandybridge_pcode_read (dev_priv,GEN6_PCODE_READ_RC6VIDS , &rc6vids); +if (IS_GEN6 (dev) && ret) { +DRM_DEBUG_DRIVER ("Couldn't check for BIOS workaround\n" ); + }else if (IS_GEN6 (dev) && (GEN6_DECODE_RC6_VID (rc6vids &0xff ) <450 )) { +DRM_DEBUG_DRIVER ("You should update your BIOS. Correcting minimum rc6 voltage (%dmV->%dmV)\n" , +GEN6_DECODE_RC6_VID (rc6vids &0xff ),450 ); + rc6vids &=0xffff00 ; + rc6vids |=GEN6_ENCODE_RC6_VID (450 ); + ret =sandybridge_pcode_write (dev_priv,GEN6_PCODE_WRITE_RC6VIDS , rc6vids); +if (ret) +DRM_ERROR ("Couldn't fix incorrect rc6 voltage\n" ); }gen6_gt_force_wake_put (dev_priv); } +static void hsw_enable_rps (struct drm_device *dev) +{ +struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_ring_buffer *ring; +u32 rp_state_cap; +u32 gt_perf_status; +u32 rc6_mask =0 ; +u32 gtfifodbg; +int rc6_mode; +int i; + +WARN_ON (!mutex_is_locked (&dev_priv->rps.hw_lock)); + +/* Here begins a magic sequence of register writes to enable +* auto-downclocking. +* +* Perhaps there might be some value in exposing these to +* userspace... +*/ +I915_WRITE (GEN6_RC_STATE ,0 ); + +/* Clear the DBG now so we don't confuse earlier errors */ +if ((gtfifodbg =I915_READ (GTFIFODBG ))) { +DRM_ERROR ("GT fifo had a previous error %x\n" , gtfifodbg); +I915_WRITE (GTFIFODBG , gtfifodbg); + } + +gen6_gt_force_wake_get (dev_priv); + + rp_state_cap =I915_READ (GEN6_RP_STATE_CAP ); + gt_perf_status =I915_READ (GEN6_GT_PERF_STATUS ); + +/* In units of 100MHz */ + dev_priv->rps.max_delay = rp_state_cap &0xff ; + dev_priv->rps.min_delay = (rp_state_cap &0xff0000 ) >>16 ; + dev_priv->rps.cur_delay =0 ; + +/* disable the counters and set deterministic thresholds */ +I915_WRITE (GEN6_RC_CONTROL ,0 ); + +I915_WRITE (GEN6_RC6_WAKE_RATE_LIMIT ,40 <<16 ); +I915_WRITE (GEN6_RC_EVALUATION_INTERVAL ,125000 ); +I915_WRITE (GEN6_RC_IDLE_HYSTERSIS ,25 ); + +for_each_ring (ring, dev_priv, i) +I915_WRITE (RING_MAX_IDLE (ring->mmio_base),10 ); + +I915_WRITE (GEN6_RC_SLEEP ,0 ); +I915_WRITE (GEN6_RC6_THRESHOLD ,50000 ); + +/* Check if we are enabling RC6 */ + rc6_mode =intel_enable_rc6 (dev_priv->dev); +if (rc6_mode &INTEL_RC6_ENABLE ) + rc6_mask |=GEN6_RC_CTL_RC6_ENABLE ; + +DRM_INFO ("Enabling RC6 states: RC6 %s\n" , + (rc6_mask &GEN6_RC_CTL_RC6_ENABLE ) ?"on" :"off" ); + +I915_WRITE (GEN6_RC_CONTROL , + rc6_mask | +GEN6_RC_CTL_EI_MODE (1 ) | +GEN6_RC_CTL_HW_ENABLE ); + +I915_WRITE (GEN6_RPNSWREQ , +HSW_FREQUENCY (10 )); +I915_WRITE (GEN6_RC_VIDEO_FREQ , +HSW_FREQUENCY (12 )); + +I915_WRITE (GEN6_RP_DOWN_TIMEOUT ,1000000 ); +I915_WRITE (GEN6_RP_INTERRUPT_LIMITS , + dev_priv->rps.max_delay <<24 | + dev_priv->rps.min_delay <<16 ); + +I915_WRITE (GEN6_RP_UP_THRESHOLD ,59400 ); +I915_WRITE (GEN6_RP_DOWN_THRESHOLD ,245000 ); +I915_WRITE (GEN6_RP_UP_EI ,66000 ); +I915_WRITE (GEN6_RP_DOWN_EI ,350000 ); + +I915_WRITE (GEN6_RP_IDLE_HYSTERSIS ,10 ); +I915_WRITE (GEN6_RP_CONTROL , +GEN6_RP_MEDIA_TURBO | +GEN6_RP_MEDIA_HW_NORMAL_MODE | +GEN6_RP_MEDIA_IS_GFX | +GEN6_RP_ENABLE | +GEN6_RP_UP_BUSY_AVG | +GEN7_RP_DOWN_IDLE_AVG ); + +gen6_set_rps (dev_priv->dev, (gt_perf_status &0xff00 ) >>8 ); + +/* requires MSI enabled */ +I915_WRITE (GEN6_PMIER ,GEN6_PM_DEFERRED_EVENTS ); +spin_lock_irq (&dev_priv->rps.lock); +WARN_ON (dev_priv->rps.pm_iir !=0 ); +I915_WRITE (GEN6_PMIMR ,0 ); +spin_unlock_irq (&dev_priv->rps.lock); +/* enable all PM interrupts */ +I915_WRITE (GEN6_PMINTRMSK ,0 ); + +gen6_gt_force_wake_put (dev_priv); +} +static void gen6_update_ring_freq (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;@@ -3480,7 +3558,10 @@ static void intel_gen6_powersave_work(struct work_struct *work)struct drm_device *dev = dev_priv->dev;mutex_lock (&dev_priv->rps.hw_lock); -gen6_enable_rps (dev); +if (IS_HASWELL (dev)) +hsw_enable_rps (dev); +else +gen6_enable_rps (dev);gen6_update_ring_freq (dev);mutex_unlock (&dev_priv->rps.hw_lock); }Signature · 6 lines
1.8.1.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Re: [PATCH 4/4] drm/i915: creating Haswell rc6 function
ops, when reworking to let the split as last patch I missed this one... I'll resend it soon
Quoted 333 lines · Daniel Vetter
Quoted 4 lines · Rodrigo Vivi
Power management, in special RC6 enabling, differs across platforms. This patch just split out enabling function for HSW.
This is an attempt to make pm code more clean without multipleIS_HASWELLinsideenable_rpsfunction. This actually tends to get worse withupcoming
Quoted 3 lines
platforms.
Signed-off-by Rodrigo Vivi <[email protected]>I think the split starts to make sense, but ...
Quoted 2 lines
--- drivers/gpu/drm/i915/intel_pm.c | 211+++++++++++++++++++++++++++-------------
Review
Quoted 3 lines
1 file changed, 146 insertions(+), 65 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/i915/intel_pm.cdrivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device
Quoted 4 lines
index f6a7366..814846d 100644
drivers/gpu/drm/i915/intel_pm.c +0
-0@@ -2566,13 +2566,9 @@ static void gen6_enable_rps(struct drm_device*dev)
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev) · line 2575
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +0
-7/* disable the counters and set deterministic thresholds */ I915_WRITE (GEN6_RC_CONTROL ,0 ); -if (IS_HASWELL (dev)) -I915_WRITE (GEN6_RC6_WAKE_RATE_LIMIT ,40 <<16 ); -else { -I915_WRITE (GEN6_RC1_WAKE_RATE_LIMIT ,1000 <<16 ); -I915_WRITE (GEN6_RC6_WAKE_RATE_LIMIT ,40 <<16 |30 ); -I915_WRITE (GEN6_RC6pp_WAKE_RATE_LIMIT,30 ); - }Adding an if block and then again killing it looks strange. -Daniel
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device
Quoted 7 lines
drivers/gpu/drm/i915/intel_pm.c +3
-0+I915_WRITE (GEN6_RC1_WAKE_RATE_LIMIT ,1000 <<16 ); +I915_WRITE (GEN6_RC6_WAKE_RATE_LIMIT ,40 <<16 |30 ); +I915_WRITE (GEN6_RC6pp_WAKE_RATE_LIMIT,30 );I915_WRITE (GEN6_RC_EVALUATION_INTERVAL ,125000 );I915_WRITE (GEN6_RC_IDLE_HYSTERSIS ,25 );@@ -2580,27 +2576,19 @@ static void gen6_enable_rps(struct drm_device*dev)
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device
Quoted 35 lines
drivers/gpu/drm/i915/intel_pm.c +7
-15I915_WRITE (RING_MAX_IDLE (ring->mmio_base),10 );I915_WRITE (GEN6_RC_SLEEP ,0 ); -if (!IS_HASWELL (dev)) -I915_WRITE (GEN6_RC1e_THRESHOLD,1000 ); +I915_WRITE (GEN6_RC1e_THRESHOLD,1000 );I915_WRITE (GEN6_RC6_THRESHOLD ,50000 ); -if (!IS_HASWELL (dev)) { -I915_WRITE (GEN6_RC6p_THRESHOLD,150000 ); -I915_WRITE (GEN6_RC6pp_THRESHOLD,64000 );/* unused */ - } +I915_WRITE (GEN6_RC6p_THRESHOLD,150000 ); +I915_WRITE (GEN6_RC6pp_THRESHOLD,64000 );/* unused */ /* Check if we are enabling RC6 */ rc6_mode =intel_enable_rc6 (dev_priv->dev);if (rc6_mode &INTEL_RC6_ENABLE ) rc6_mask |=GEN6_RC_CTL_RC6_ENABLE ; - -/* We don't use those on Haswell */ -if (!IS_HASWELL (dev)) { -if (rc6_mode & INTEL_RC6p_ENABLE) - rc6_mask |= GEN6_RC_CTL_RC6p_ENABLE; - -if (rc6_mode & INTEL_RC6pp_ENABLE) - rc6_mask |= GEN6_RC_CTL_RC6pp_ENABLE; - } +if (rc6_mode & INTEL_RC6p_ENABLE) + rc6_mask |= GEN6_RC_CTL_RC6p_ENABLE; +if (rc6_mode & INTEL_RC6pp_ENABLE) + rc6_mask |= GEN6_RC_CTL_RC6pp_ENABLE; DRM_INFO("Enabling RC6 states: RC6 %s, RC6p %s, RC6pp %s\n", (rc6_mask & GEN6_RC_CTL_RC6_ENABLE) ? "on" : "off",@@ -2612,19 +2600,12 @@ static void gen6_enable_rps(struct drm_device*dev)
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device
Quoted 26 lines
drivers/gpu/drm/i915/intel_pm.c +6
-13GEN6_RC_CTL_EI_MODE (1 ) | GEN6_RC_CTL_HW_ENABLE); -if (IS_HASWELL (dev)) { -I915_WRITE (GEN6_RPNSWREQ , -HSW_FREQUENCY (10 )); -I915_WRITE (GEN6_RC_VIDEO_FREQ , -HSW_FREQUENCY (12 )); - }else { -I915_WRITE (GEN6_RPNSWREQ , -GEN6_FREQUENCY (10 ) | -GEN6_OFFSET (0 ) | -GEN6_AGGRESSIVE_TURBO ); -I915_WRITE (GEN6_RC_VIDEO_FREQ , -GEN6_FREQUENCY (12 )); - } +I915_WRITE (GEN6_RPNSWREQ , +GEN6_FREQUENCY (10 ) | +GEN6_OFFSET (0 ) | +GEN6_AGGRESSIVE_TURBO ); +I915_WRITE (GEN6_RC_VIDEO_FREQ , +GEN6_FREQUENCY (12 ));I915_WRITE (GEN6_RP_DOWN_TIMEOUT ,1000000 ); I915_WRITE(GEN6_RP_INTERRUPT_LIMITS,@@ -2643,22 +2624,20 @@ static void gen6_enable_rps(struct drm_device*dev)
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 4 lines
drivers/gpu/drm/i915/intel_pm.c +0
-1GEN6_RP_MEDIA_IS_GFX |GEN6_RP_ENABLE | GEN6_RP_UP_BUSY_AVG | - (IS_HASWELL(dev) ? GEN7_RP_DOWN_IDLE_AVG :
GEN6_RP_DOWN_IDLE_CONT));drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 3 lines
drivers/gpu/drm/i915/intel_pm.c +0
-3- -if (!IS_HASWELL (dev)) { - ret = sandybridge_pcode_write(dev_priv,
GEN6_PCODE_WRITE_MIN_FREQ_TABLE, 0);drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 3 lines
drivers/gpu/drm/i915/intel_pm.c +0
-3-if (!ret && (IS_GEN6 (dev) ||IS_IVYBRIDGE (dev))) { - pcu_mbox =0 ; - ret = sandybridge_pcode_read(dev_priv,
GEN6_READ_OC_PARAMS,&pcu_mbox);drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2653
Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +0
-1-if (!ret && (pcu_mbox & (1 <<31 ))) {/* OC supported */
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2654
Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +0
-1- DRM_DEBUG_DRIVER("overclocking supported,adjusting frequency max from %dMHz to %dMHz\n",
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2655
Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +0
-1- (dev_priv->rps.max_delay&
0xff) * 50,drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 5 lines
drivers/gpu/drm/i915/intel_pm.c +0
-5- (pcu_mbox & 0xff) * 50); - dev_priv->rps.max_delay = pcu_mbox &0xff ; - } - }else { - DRM_DEBUG_DRIVER("Failed to set the minfrequency\n");
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 3 lines
drivers/gpu/drm/i915/intel_pm.c +3
-0+ GEN6_RP_DOWN_IDLE_CONT); + + ret = sandybridge_pcode_write(dev_priv,
GEN6_PCODE_WRITE_MIN_FREQ_TABLE, 0);drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 3 lines
drivers/gpu/drm/i915/intel_pm.c +3
-0+if (!ret && (IS_GEN6 (dev) ||IS_IVYBRIDGE (dev))) { + pcu_mbox =0 ; + ret = sandybridge_pcode_read(dev_priv,
GEN6_READ_OC_PARAMS,&pcu_mbox);drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2634
Quoted 2 lines
drivers/gpu/drm/i915/intel_pm.c +2
-0+if (!ret && (pcu_mbox & (1 <<31 ))) {/* OC supported */ + DRM_DEBUG_DRIVER("overclocking supported,adjusting frequency max from %dMHz to %dMHz\n",
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2635
Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +1
-0+ (dev_priv->rps.max_delay &0xff )* 50,
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device
Quoted 9 lines
drivers/gpu/drm/i915/intel_pm.c +4
-0+ (pcu_mbox & 0xff) * 50); + dev_priv->rps.max_delay = pcu_mbox &0xff ; } + }else { +DRM_DEBUG_DRIVER ("Failed to set the min frequency\n" ); }gen6_set_rps (dev_priv->dev, (gt_perf_status &0xff00 ) >>8 );@@ -2672,25 +2651,124 @@ static void gen6_enable_rps(struct drm_device*dev)
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 6 lines
drivers/gpu/drm/i915/intel_pm.c +0
-3/* enable all PM interrupts */ I915_WRITE (GEN6_PMINTRMSK ,0 ); -if (!IS_HASWELL (dev)) { - rc6vids =0 ; - ret = sandybridge_pcode_read(dev_priv,
GEN6_PCODE_READ_RC6VIDS, &rc6vids);drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2679
Quoted 2 lines
drivers/gpu/drm/i915/intel_pm.c +0
-2-if (IS_GEN6 (dev) && ret) { - DRM_DEBUG_DRIVER("Couldn't check for BIOSworkaround\n");
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2680
Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +0
-1- } else if (IS_GEN6(dev) && (GEN6_DECODE_RC6_VID(rc6vids &
0xff) < 450)) {drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2681
Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +0
-1- DRM_DEBUG_DRIVER("You should update your BIOS.Correcting minimum rc6 voltage (%dmV->%dmV)\n",
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2682
Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +0
-1- GEN6_DECODE_RC6_VID(rc6vids &
0xff), 450);drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 3 lines
drivers/gpu/drm/i915/intel_pm.c +0
-3- rc6vids &=0xffff00 ; - rc6vids |=GEN6_ENCODE_RC6_VID (450 ); - ret = sandybridge_pcode_write(dev_priv,
GEN6_PCODE_WRITE_RC6VIDS, rc6vids);drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2687
Quoted 2 lines
drivers/gpu/drm/i915/intel_pm.c +0
-2-if (ret) - DRM_ERROR("Couldn't fix incorrect rc6voltage\n");
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 3 lines
drivers/gpu/drm/i915/intel_pm.c +2
-1- } + rc6vids =0 ; + ret = sandybridge_pcode_read(dev_priv, GEN6_PCODE_READ_RC6VIDS,&rc6vids);
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 3 lines
drivers/gpu/drm/i915/intel_pm.c +3
-0+if (IS_GEN6 (dev) && ret) { +DRM_DEBUG_DRIVER ("Couldn't check for BIOS workaround\n" ); + } else if (IS_GEN6(dev) && (GEN6_DECODE_RC6_VID(rc6vids & 0xff) <450)) {
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2659
Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +1
-0+ DRM_DEBUG_DRIVER("You should update your BIOS. Correctingminimum rc6 voltage (%dmV->%dmV)\n",
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 4 lines
drivers/gpu/drm/i915/intel_pm.c +4
-0+ GEN6_DECODE_RC6_VID(rc6vids & 0xff), 450); + rc6vids &=0xffff00 ; + rc6vids |=GEN6_ENCODE_RC6_VID (450 ); + ret = sandybridge_pcode_write(dev_priv,
GEN6_PCODE_WRITE_RC6VIDS, rc6vids);Quoted 54 lines
drivers/gpu/drm/i915/intel_pm.c +49
-0+if (ret) +DRM_ERROR ("Couldn't fix incorrect rc6 voltage\n" ); }gen6_gt_force_wake_put (dev_priv); } +static void hsw_enable_rps (struct drm_device *dev) +{ +struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_ring_buffer *ring; +u32 rp_state_cap; +u32 gt_perf_status; +u32 rc6_mask =0 ; +u32 gtfifodbg; +int rc6_mode; +int i; + +WARN_ON (!mutex_is_locked (&dev_priv->rps.hw_lock)); + +/* Here begins a magic sequence of register writes to enable +* auto-downclocking. +* +* Perhaps there might be some value in exposing these to +* userspace... +*/ +I915_WRITE (GEN6_RC_STATE ,0 ); + +/* Clear the DBG now so we don't confuse earlier errors */ +if ((gtfifodbg =I915_READ (GTFIFODBG ))) { +DRM_ERROR ("GT fifo had a previous error %x\n" , gtfifodbg); +I915_WRITE (GTFIFODBG , gtfifodbg); + } + +gen6_gt_force_wake_get (dev_priv); + + rp_state_cap =I915_READ (GEN6_RP_STATE_CAP ); + gt_perf_status =I915_READ (GEN6_GT_PERF_STATUS ); + +/* In units of 100MHz */ + dev_priv->rps.max_delay = rp_state_cap &0xff ; + dev_priv->rps.min_delay = (rp_state_cap &0xff0000 ) >>16 ; + dev_priv->rps.cur_delay =0 ; + +/* disable the counters and set deterministic thresholds */ +I915_WRITE (GEN6_RC_CONTROL ,0 ); + +I915_WRITE (GEN6_RC6_WAKE_RATE_LIMIT ,40 <<16 ); +I915_WRITE (GEN6_RC_EVALUATION_INTERVAL ,125000 ); +I915_WRITE (GEN6_RC_IDLE_HYSTERSIS ,25 ); + +for_each_ring (ring, dev_priv, i) +I915_WRITE (RING_MAX_IDLE (ring->mmio_base),10 ); +drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+I915_WRITE (GEN6_RC_SLEEP ,0 ); +I915_WRITE (GEN6_RC6_THRESHOLD ,50000 ); + +/* Check if we are enabling RC6 */ + rc6_mode =intel_enable_rc6 (dev_priv->dev); +if (rc6_mode &INTEL_RC6_ENABLE ) + rc6_mask |=GEN6_RC_CTL_RC6_ENABLE ; + + DRM_INFO("Enabling RC6 states: RC6 %s\n", + (rc6_mask & GEN6_RC_CTL_RC6_ENABLE) ? "on" :"off");
drivers/gpu/drm/i915/intel_pm.c static void intel_gen6_powersave_work(struct
Quoted 48 lines
drivers/gpu/drm/i915/intel_pm.c +44
-0+ +I915_WRITE (GEN6_RC_CONTROL , + rc6_mask | +GEN6_RC_CTL_EI_MODE (1 ) | +GEN6_RC_CTL_HW_ENABLE ); + +I915_WRITE (GEN6_RPNSWREQ , +HSW_FREQUENCY (10 )); +I915_WRITE (GEN6_RC_VIDEO_FREQ , +HSW_FREQUENCY (12 )); + +I915_WRITE (GEN6_RP_DOWN_TIMEOUT ,1000000 ); +I915_WRITE (GEN6_RP_INTERRUPT_LIMITS , + dev_priv->rps.max_delay <<24 | + dev_priv->rps.min_delay <<16 ); + +I915_WRITE (GEN6_RP_UP_THRESHOLD ,59400 ); +I915_WRITE (GEN6_RP_DOWN_THRESHOLD ,245000 ); +I915_WRITE (GEN6_RP_UP_EI ,66000 ); +I915_WRITE (GEN6_RP_DOWN_EI ,350000 ); + +I915_WRITE (GEN6_RP_IDLE_HYSTERSIS ,10 ); +I915_WRITE (GEN6_RP_CONTROL , +GEN6_RP_MEDIA_TURBO | +GEN6_RP_MEDIA_HW_NORMAL_MODE | +GEN6_RP_MEDIA_IS_GFX | +GEN6_RP_ENABLE | +GEN6_RP_UP_BUSY_AVG | +GEN7_RP_DOWN_IDLE_AVG ); + +gen6_set_rps (dev_priv->dev, (gt_perf_status &0xff00 ) >>8 ); + +/* requires MSI enabled */ +I915_WRITE (GEN6_PMIER ,GEN6_PM_DEFERRED_EVENTS ); +spin_lock_irq (&dev_priv->rps.lock); +WARN_ON (dev_priv->rps.pm_iir !=0 ); +I915_WRITE (GEN6_PMIMR ,0 ); +spin_unlock_irq (&dev_priv->rps.lock); +/* enable all PM interrupts */ +I915_WRITE (GEN6_PMINTRMSK ,0 ); + +gen6_gt_force_wake_put (dev_priv); +} +static void gen6_update_ring_freq (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;@@ -3480,7 +3558,10 @@ static void intel_gen6_powersave_work(struct
work_struct*work)Quoted 14 lines
drivers/gpu/drm/i915/intel_pm.c +4
-2struct drm_device *dev = dev_priv->dev;mutex_lock (&dev_priv->rps.hw_lock); -gen6_enable_rps (dev); +if (IS_HASWELL (dev)) +hsw_enable_rps (dev); +else +gen6_enable_rps (dev);gen6_update_ring_freq (dev);mutex_unlock (&dev_priv->rps.hw_lock); } --1.8.1.4
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
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
Re: [PATCH 4/4] drm/i915: creating Haswell rc6 function
Hi Daniel,
I just checked the code and this patch looks right for me. it doesn't add any if block... just remove them. What am I missing?
Thanks,
Rodrigo.
Quoted 349 lines · Rodrigo Vivi
ops, when reworking to let the split as last patch I missed this one... I'll resend it soon
Quoted 330 lines · Daniel Vetter
Quoted 3 lines · Rodrigo Vivi
Power management, in special RC6 enabling, differs across platforms. This patch just split out enabling function for HSW.
This is an attempt to make pm code more clean without multiple
IS_HASWELLQuoted 1 line
inside
enable_rpsfunction. This actually tends to get worse withupcoming
Quoted 3 lines
platforms.
Signed-off-by Rodrigo Vivi <[email protected]>I think the split starts to make sense, but ...
Quoted 2 lines
--- drivers/gpu/drm/i915/intel_pm.c | 211+++++++++++++++++++++++++++-------------
Review
Quoted 3 lines
1 file changed, 146 insertions(+), 65 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/i915/intel_pm.cdrivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device
Quoted 4 lines
index f6a7366..814846d 100644
drivers/gpu/drm/i915/intel_pm.c +0
-0@@ -2566,13 +2566,9 @@ static void gen6_enable_rps(struct drm_device*dev)
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev) · line 2575
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +0
-7/* disable the counters and set deterministic thresholds */ I915_WRITE (GEN6_RC_CONTROL ,0 ); -if (IS_HASWELL (dev)) -I915_WRITE (GEN6_RC6_WAKE_RATE_LIMIT ,40 <<16 ); -else { -I915_WRITE (GEN6_RC1_WAKE_RATE_LIMIT ,1000 <<16 ); -I915_WRITE (GEN6_RC6_WAKE_RATE_LIMIT ,40 <<16 |30 ); -I915_WRITE (GEN6_RC6pp_WAKE_RATE_LIMIT,30 ); - }Adding an if block and then again killing it looks strange. -Daniel
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device
Quoted 7 lines
drivers/gpu/drm/i915/intel_pm.c +3
-0+I915_WRITE (GEN6_RC1_WAKE_RATE_LIMIT ,1000 <<16 ); +I915_WRITE (GEN6_RC6_WAKE_RATE_LIMIT ,40 <<16 |30 ); +I915_WRITE (GEN6_RC6pp_WAKE_RATE_LIMIT,30 );I915_WRITE (GEN6_RC_EVALUATION_INTERVAL ,125000 );I915_WRITE (GEN6_RC_IDLE_HYSTERSIS ,25 );@@ -2580,27 +2576,19 @@ static void gen6_enable_rps(struct drm_device*dev)
Quoted 24 lines
drivers/gpu/drm/i915/intel_pm.c +3
-12I915_WRITE (RING_MAX_IDLE (ring->mmio_base),10 );I915_WRITE (GEN6_RC_SLEEP ,0 ); -if (!IS_HASWELL (dev)) -I915_WRITE (GEN6_RC1e_THRESHOLD,1000 ); +I915_WRITE (GEN6_RC1e_THRESHOLD,1000 );I915_WRITE (GEN6_RC6_THRESHOLD ,50000 ); -if (!IS_HASWELL (dev)) { -I915_WRITE (GEN6_RC6p_THRESHOLD,150000 ); -I915_WRITE (GEN6_RC6pp_THRESHOLD,64000 );/* unused */ - } +I915_WRITE (GEN6_RC6p_THRESHOLD,150000 ); +I915_WRITE (GEN6_RC6pp_THRESHOLD,64000 );/* unused */ /* Check if we are enabling RC6 */ rc6_mode =intel_enable_rc6 (dev_priv->dev);if (rc6_mode &INTEL_RC6_ENABLE ) rc6_mask |=GEN6_RC_CTL_RC6_ENABLE ; - -/* We don't use those on Haswell */ -if (!IS_HASWELL (dev)) { -if (rc6_mode & INTEL_RC6p_ENABLE) - rc6_mask |= GEN6_RC_CTL_RC6p_ENABLE; -drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +4
-3-if (rc6_mode & INTEL_RC6pp_ENABLE) - rc6_mask |= GEN6_RC_CTL_RC6pp_ENABLE; - } +if (rc6_mode & INTEL_RC6p_ENABLE) + rc6_mask |= GEN6_RC_CTL_RC6p_ENABLE; +if (rc6_mode & INTEL_RC6pp_ENABLE) + rc6_mask |= GEN6_RC_CTL_RC6pp_ENABLE; DRM_INFO("Enabling RC6 states: RC6 %s, RC6p %s, RC6pp %s\n", (rc6_mask & GEN6_RC_CTL_RC6_ENABLE) ? "on" :"off",
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device
Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +0
-0@@ -2612,19 +2600,12 @@ static void gen6_enable_rps(struct drm_device*dev)
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device
Quoted 26 lines
drivers/gpu/drm/i915/intel_pm.c +6
-13GEN6_RC_CTL_EI_MODE (1 ) | GEN6_RC_CTL_HW_ENABLE); -if (IS_HASWELL (dev)) { -I915_WRITE (GEN6_RPNSWREQ , -HSW_FREQUENCY (10 )); -I915_WRITE (GEN6_RC_VIDEO_FREQ , -HSW_FREQUENCY (12 )); - }else { -I915_WRITE (GEN6_RPNSWREQ , -GEN6_FREQUENCY (10 ) | -GEN6_OFFSET (0 ) | -GEN6_AGGRESSIVE_TURBO ); -I915_WRITE (GEN6_RC_VIDEO_FREQ , -GEN6_FREQUENCY (12 )); - } +I915_WRITE (GEN6_RPNSWREQ , +GEN6_FREQUENCY (10 ) | +GEN6_OFFSET (0 ) | +GEN6_AGGRESSIVE_TURBO ); +I915_WRITE (GEN6_RC_VIDEO_FREQ , +GEN6_FREQUENCY (12 ));I915_WRITE (GEN6_RP_DOWN_TIMEOUT ,1000000 ); I915_WRITE(GEN6_RP_INTERRUPT_LIMITS,@@ -2643,22 +2624,20 @@ static void gen6_enable_rps(struct drm_device*dev)
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 4 lines
drivers/gpu/drm/i915/intel_pm.c +0
-1GEN6_RP_MEDIA_IS_GFX |GEN6_RP_ENABLE | GEN6_RP_UP_BUSY_AVG | - (IS_HASWELL(dev) ? GEN7_RP_DOWN_IDLE_AVG :
GEN6_RP_DOWN_IDLE_CONT));drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 3 lines
drivers/gpu/drm/i915/intel_pm.c +0
-3- -if (!IS_HASWELL (dev)) { - ret = sandybridge_pcode_write(dev_priv,
GEN6_PCODE_WRITE_MIN_FREQ_TABLE, 0);drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 3 lines
drivers/gpu/drm/i915/intel_pm.c +0
-3-if (!ret && (IS_GEN6 (dev) ||IS_IVYBRIDGE (dev))) { - pcu_mbox =0 ; - ret = sandybridge_pcode_read(dev_priv,
GEN6_READ_OC_PARAMS,&pcu_mbox);drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2653
Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +0
-1-if (!ret && (pcu_mbox & (1 <<31 ))) {/* OC supported */
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2654
Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +0
-1- DRM_DEBUG_DRIVER("overclocking supported,adjusting frequency max from %dMHz to %dMHz\n",
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2655
Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +0
-1- (dev_priv->rps.max_delay&
0xff) * 50,drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 5 lines
drivers/gpu/drm/i915/intel_pm.c +0
-5- (pcu_mbox & 0xff) * 50); - dev_priv->rps.max_delay = pcu_mbox &0xff ; - } - }else { - DRM_DEBUG_DRIVER("Failed to set the minfrequency\n");
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 3 lines
drivers/gpu/drm/i915/intel_pm.c +3
-0+ GEN6_RP_DOWN_IDLE_CONT); + + ret = sandybridge_pcode_write(dev_priv,
GEN6_PCODE_WRITE_MIN_FREQ_TABLE, 0);drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 3 lines
drivers/gpu/drm/i915/intel_pm.c +3
-0+if (!ret && (IS_GEN6 (dev) ||IS_IVYBRIDGE (dev))) { + pcu_mbox =0 ; + ret = sandybridge_pcode_read(dev_priv,
GEN6_READ_OC_PARAMS,&pcu_mbox);drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2634
Quoted 2 lines
drivers/gpu/drm/i915/intel_pm.c +2
-0+if (!ret && (pcu_mbox & (1 <<31 ))) {/* OC supported */ + DRM_DEBUG_DRIVER("overclocking supported,adjusting frequency max from %dMHz to %dMHz\n",
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2635
Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +1
-0+ (dev_priv->rps.max_delay &0xff )* 50,
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device
Quoted 9 lines
drivers/gpu/drm/i915/intel_pm.c +4
-0+ (pcu_mbox & 0xff) * 50); + dev_priv->rps.max_delay = pcu_mbox &0xff ; } + }else { +DRM_DEBUG_DRIVER ("Failed to set the min frequency\n" ); }gen6_set_rps (dev_priv->dev, (gt_perf_status &0xff00 ) >>8 );@@ -2672,25 +2651,124 @@ static void gen6_enable_rps(struct drm_device*dev)
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 6 lines
drivers/gpu/drm/i915/intel_pm.c +0
-3/* enable all PM interrupts */ I915_WRITE (GEN6_PMINTRMSK ,0 ); -if (!IS_HASWELL (dev)) { - rc6vids =0 ; - ret = sandybridge_pcode_read(dev_priv,
GEN6_PCODE_READ_RC6VIDS, &rc6vids);drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2679
Quoted 2 lines
drivers/gpu/drm/i915/intel_pm.c +0
-2-if (IS_GEN6 (dev) && ret) { - DRM_DEBUG_DRIVER("Couldn't check for BIOSworkaround\n");
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2680
Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +0
-1- } else if (IS_GEN6(dev) && (GEN6_DECODE_RC6_VID(rc6vids &
0xff) < 450)) {drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2681
Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +0
-1- DRM_DEBUG_DRIVER("You should update your BIOS.Correcting minimum rc6 voltage (%dmV->%dmV)\n",
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2682
Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +0
-1- GEN6_DECODE_RC6_VID(rc6vids &
0xff), 450);drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 3 lines
drivers/gpu/drm/i915/intel_pm.c +0
-3- rc6vids &=0xffff00 ; - rc6vids |=GEN6_ENCODE_RC6_VID (450 ); - ret = sandybridge_pcode_write(dev_priv,
GEN6_PCODE_WRITE_RC6VIDS, rc6vids);drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2687
Quoted 2 lines
drivers/gpu/drm/i915/intel_pm.c +0
-2-if (ret) - DRM_ERROR("Couldn't fix incorrect rc6voltage\n");
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 3 lines
drivers/gpu/drm/i915/intel_pm.c +2
-1- } + rc6vids =0 ; + ret = sandybridge_pcode_read(dev_priv, GEN6_PCODE_READ_RC6VIDS,&rc6vids);
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 3 lines
drivers/gpu/drm/i915/intel_pm.c +3
-0+if (IS_GEN6 (dev) && ret) { +DRM_DEBUG_DRIVER ("Couldn't check for BIOS workaround\n" ); + } else if (IS_GEN6(dev) && (GEN6_DECODE_RC6_VID(rc6vids & 0xff) <450)) {
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device · line 2659
Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +1
-0+ DRM_DEBUG_DRIVER("You should update your BIOS. Correctingminimum rc6 voltage (%dmV->%dmV)\n",
drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 4 lines
drivers/gpu/drm/i915/intel_pm.c +4
-0+ GEN6_DECODE_RC6_VID(rc6vids & 0xff), 450); + rc6vids &=0xffff00 ; + rc6vids |=GEN6_ENCODE_RC6_VID (450 ); + ret = sandybridge_pcode_write(dev_priv,
GEN6_PCODE_WRITE_RC6VIDS, rc6vids);Quoted 54 lines
drivers/gpu/drm/i915/intel_pm.c +49
-0+if (ret) +DRM_ERROR ("Couldn't fix incorrect rc6 voltage\n" ); }gen6_gt_force_wake_put (dev_priv); } +static void hsw_enable_rps (struct drm_device *dev) +{ +struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_ring_buffer *ring; +u32 rp_state_cap; +u32 gt_perf_status; +u32 rc6_mask =0 ; +u32 gtfifodbg; +int rc6_mode; +int i; + +WARN_ON (!mutex_is_locked (&dev_priv->rps.hw_lock)); + +/* Here begins a magic sequence of register writes to enable +* auto-downclocking. +* +* Perhaps there might be some value in exposing these to +* userspace... +*/ +I915_WRITE (GEN6_RC_STATE ,0 ); + +/* Clear the DBG now so we don't confuse earlier errors */ +if ((gtfifodbg =I915_READ (GTFIFODBG ))) { +DRM_ERROR ("GT fifo had a previous error %x\n" , gtfifodbg); +I915_WRITE (GTFIFODBG , gtfifodbg); + } + +gen6_gt_force_wake_get (dev_priv); + + rp_state_cap =I915_READ (GEN6_RP_STATE_CAP ); + gt_perf_status =I915_READ (GEN6_GT_PERF_STATUS ); + +/* In units of 100MHz */ + dev_priv->rps.max_delay = rp_state_cap &0xff ; + dev_priv->rps.min_delay = (rp_state_cap &0xff0000 ) >>16 ; + dev_priv->rps.cur_delay =0 ; + +/* disable the counters and set deterministic thresholds */ +I915_WRITE (GEN6_RC_CONTROL ,0 ); + +I915_WRITE (GEN6_RC6_WAKE_RATE_LIMIT ,40 <<16 ); +I915_WRITE (GEN6_RC_EVALUATION_INTERVAL ,125000 ); +I915_WRITE (GEN6_RC_IDLE_HYSTERSIS ,25 ); + +for_each_ring (ring, dev_priv, i) +I915_WRITE (RING_MAX_IDLE (ring->mmio_base),10 ); +drivers/gpu/drm/i915/intel_pm.c static void gen6_enable_rps(struct drm_device *dev)
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+I915_WRITE (GEN6_RC_SLEEP ,0 ); +I915_WRITE (GEN6_RC6_THRESHOLD ,50000 ); + +/* Check if we are enabling RC6 */ + rc6_mode =intel_enable_rc6 (dev_priv->dev); +if (rc6_mode &INTEL_RC6_ENABLE ) + rc6_mask |=GEN6_RC_CTL_RC6_ENABLE ; + + DRM_INFO("Enabling RC6 states: RC6 %s\n", + (rc6_mask & GEN6_RC_CTL_RC6_ENABLE) ? "on" :"off");
drivers/gpu/drm/i915/intel_pm.c static void intel_gen6_powersave_work(struct
Quoted 48 lines
drivers/gpu/drm/i915/intel_pm.c +44
-0+ +I915_WRITE (GEN6_RC_CONTROL , + rc6_mask | +GEN6_RC_CTL_EI_MODE (1 ) | +GEN6_RC_CTL_HW_ENABLE ); + +I915_WRITE (GEN6_RPNSWREQ , +HSW_FREQUENCY (10 )); +I915_WRITE (GEN6_RC_VIDEO_FREQ , +HSW_FREQUENCY (12 )); + +I915_WRITE (GEN6_RP_DOWN_TIMEOUT ,1000000 ); +I915_WRITE (GEN6_RP_INTERRUPT_LIMITS , + dev_priv->rps.max_delay <<24 | + dev_priv->rps.min_delay <<16 ); + +I915_WRITE (GEN6_RP_UP_THRESHOLD ,59400 ); +I915_WRITE (GEN6_RP_DOWN_THRESHOLD ,245000 ); +I915_WRITE (GEN6_RP_UP_EI ,66000 ); +I915_WRITE (GEN6_RP_DOWN_EI ,350000 ); + +I915_WRITE (GEN6_RP_IDLE_HYSTERSIS ,10 ); +I915_WRITE (GEN6_RP_CONTROL , +GEN6_RP_MEDIA_TURBO | +GEN6_RP_MEDIA_HW_NORMAL_MODE | +GEN6_RP_MEDIA_IS_GFX | +GEN6_RP_ENABLE | +GEN6_RP_UP_BUSY_AVG | +GEN7_RP_DOWN_IDLE_AVG ); + +gen6_set_rps (dev_priv->dev, (gt_perf_status &0xff00 ) >>8 ); + +/* requires MSI enabled */ +I915_WRITE (GEN6_PMIER ,GEN6_PM_DEFERRED_EVENTS ); +spin_lock_irq (&dev_priv->rps.lock); +WARN_ON (dev_priv->rps.pm_iir !=0 ); +I915_WRITE (GEN6_PMIMR ,0 ); +spin_unlock_irq (&dev_priv->rps.lock); +/* enable all PM interrupts */ +I915_WRITE (GEN6_PMINTRMSK ,0 ); + +gen6_gt_force_wake_put (dev_priv); +} +static void gen6_update_ring_freq (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;@@ -3480,7 +3558,10 @@ static void intel_gen6_powersave_work(struct
work_struct*work)Quoted 14 lines
drivers/gpu/drm/i915/intel_pm.c +4
-2struct drm_device *dev = dev_priv->dev;mutex_lock (&dev_priv->rps.hw_lock); -gen6_enable_rps (dev); +if (IS_HASWELL (dev)) +hsw_enable_rps (dev); +else +gen6_enable_rps (dev);gen6_update_ring_freq (dev);mutex_unlock (&dev_priv->rps.hw_lock); } --1.8.1.4
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfxQuoted 5 lines
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch--
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
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
Re: [PATCH 4/4] drm/i915: creating Haswell rc6 function
Quoted 3 lines · Rodrigo Vivi
I just checked the code and this patch looks right for me. it doesn't add any if block... just remove them. What am I missing?
You've added it right in the previous patch ;-)
Which means if someone tries to understand the history of a given piece of code with git blame, they now have to jump through these 2 patches which change nothing and are right following each another. But in the usual recursive git blame mode you don't see that (or at least I don't check for that by default), so you end up reading both patches to make sure you still see where the code is moving around.
So if you want to split (and I agree that it starts to make sense), pls split first, then apply hsw changes to the hsw rps code only. -Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Re: [PATCH 4/4] drm/i915: creating Haswell rc6 function
ah... got your point...
I just split later because Ben wanted the frequency patch as the first one so I decided to let split at last patch to be really optional... so, you suggestion is to revert the order of this two latest patches or the 3?
I guess frequency one was already queued right?
Quoted 23 lines · Daniel Vetter
Quoted 3 lines · Rodrigo Vivi
I just checked the code and this patch looks right for me. it doesn't add any if block... just remove them. What am I missing?
You've added it right in the previous patch ;-)
Which means if someone tries to understand the history of a given piece of code with git blame, they now have to jump through these 2 patches which change nothing and are right following each another. But in the usual recursive git blame mode you don't see that (or at least I don't check for that by default), so you end up reading both patches to make sure you still see where the code is moving around.
So if you want to split (and I agree that it starts to make sense), pls split first, then apply hsw changes to the hsw rps code only. -Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
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
Re: [PATCH 4/4] drm/i915: creating Haswell rc6 function
Quoted 5 lines · Rodrigo Vivi
ah... got your point...
I just split later because Ben wanted the frequency patch as the first one so I decided to let split at last patch to be really optional... so, you suggestion is to revert the order of this two latest patches or the 3?
Yeah, that's the idea. But since I've merged the first one already I get minus points for inconsistency, too :(
Quoted 1 line
I guess frequency one was already queued right?
Yeah, frequency one is already queued. That one looked more like a real bugfix to me, since it essentially changes what we're writing into functional registers. Hence why I've picked it right away.
Another patch which is still dangling around is Chris' revert of
commit 1ee9ae3244c4789f3184c5123f3b2d7e405b3f4c
Author: Daniel Vetter <[email protected]> Date: Wed Aug 15 10:41:45 2012 +0200
drm/i915: use hsw rps tuning values everywhere on gen6+
With the split-up hsw rps stuff that's imo something we should look into again I think. Chris?
-Daniel
Quoted 33 lines · Daniel Vetter
Quoted 16 lines
Quoted 3 lines · Rodrigo Vivi
I just checked the code and this patch looks right for me. it doesn't add any if block... just remove them. What am I missing?
You've added it right in the previous patch ;-)
Which means if someone tries to understand the history of a given piece of code with git blame, they now have to jump through these 2 patches which change nothing and are right following each another. But in the usual recursive git blame mode you don't see that (or at least I don't check for that by default), so you end up reading both patches to make sure you still see where the code is moving around.
Quoted 8 lines
So if you want to split (and I agree that it starts to make sense), pls split first, then apply hsw changes to the hsw rps code only. -Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch--
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Re: [PATCH 4/4] drm/i915: creating Haswell rc6 function
I'm in favor of this revert. Although I don't have any argument in values, I always guessed that many of rc6 bugs we have on snb came from the gap between the threashold values used and documented for snb.
Quoted 69 lines · Daniel Vetter
Quoted 2 lines · Rodrigo Vivi
ah... got your point...
I just split later because Ben wanted the frequency patch as the firstone
Quoted 2 lines
so I decided to let split at last patch to be really optional... so, you suggestion is to revert the order of this two latest patches or
the
Quoted 1 line
3?
Yeah, that's the idea. But since I've merged the first one already I get minus points for inconsistency, too :(
Quoted 1 line
I guess frequency one was already queued right?
Yeah, frequency one is already queued. That one looked more like a real bugfix to me, since it essentially changes what we're writing into functional registers. Hence why I've picked it right away.
Another patch which is still dangling around is Chris' revert of
commit
1ee9ae3244c4789f3184c5123f3b2d7e405b3f4cAuthor: Daniel Vetter <[email protected]> Date: Wed Aug 15 10:41:45 2012 +0200drm/i915: use hsw rps tuning values everywhere on gen6+
With the split-up hsw rps stuff that's imo something we should look into again I think. Chris?
-DanielQuoted 30 lines · Daniel Vetter
Quoted 16 lines
Quoted 3 lines · Rodrigo Vivi
I just checked the code and this patch looks right for me. it doesn't add any if block... just remove them. What am I missing?
You've added it right in the previous patch ;-)
Which means if someone tries to understand the history of a given piece of code with git blame, they now have to jump through these 2 patches which change nothing and are right following each another. But in the usual recursive git blame mode you don't see that (or at least I don't check for that by default), so you end up reading both patches to make sure you still see where the code is moving around.
Quoted 8 lines
So if you want to split (and I agree that it starts to make sense), pls split first, then apply hsw changes to the hsw rps code only. -Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.chQuoted 3 lines
--
Rodrigo Vivi
Blog: http://blog.vivi.eng.br--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
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
Re: [PATCH 4/4] drm/i915: creating Haswell rc6 function
I forgot to say that I tested patch by patch today on my HSW ULT and just noticed real improvement with the patch you already queued.
Where improvements are: at least 0.2W and also less oscillation and more % on RC and package C states.
Although I'd like to see the rest of the series applied to have the code as clean, organized and matching documentation as possible.
Quoted 85 lines · Rodrigo Vivi
I'm in favor of this revert. Although I don't have any argument in values, I always guessed that many of rc6 bugs we have on snb came from the gap between the threashold values used and documented for snb.
Quoted 61 lines · Daniel Vetter
Quoted 2 lines · Rodrigo Vivi
ah... got your point...
I just split later because Ben wanted the frequency patch as the firstone
Quoted 2 lines
so I decided to let split at last patch to be really optional... so, you suggestion is to revert the order of this two latest patches or
the
Quoted 1 line
3?
Yeah, that's the idea. But since I've merged the first one already I get minus points for inconsistency, too :(
Quoted 1 line
I guess frequency one was already queued right?
Yeah, frequency one is already queued. That one looked more like a real bugfix to me, since it essentially changes what we're writing into functional registers. Hence why I've picked it right away.
Another patch which is still dangling around is Chris' revert of
commit
1ee9ae3244c4789f3184c5123f3b2d7e405b3f4cAuthor: Daniel Vetter <[email protected]> Date: Wed Aug 15 10:41:45 2012 +0200drm/i915: use hsw rps tuning values everywhere on gen6+
With the split-up hsw rps stuff that's imo something we should look into again I think. Chris?
-DanielQuoted 31 lines · Daniel Vetter
Quoted 25 lines
On Tue, Mar 26, 2013 at 5:25 PM, Rodrigo Vivi <[email protected]
Quoted 3 lines · wrote:
I just checked the code and this patch looks right for me. it doesn't add any if block... just remove them. What am I missing?
You've added it right in the previous patch ;-)
Which means if someone tries to understand the history of a given piece of code with git blame, they now have to jump through these 2 patches which change nothing and are right following each another. But in the usual recursive git blame mode you don't see that (or at least I don't check for that by default), so you end up reading both patches to make sure you still see where the code is moving around.
So if you want to split (and I agree that it starts to make sense), pls split first, then apply hsw changes to the hsw rps code only. -Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.chQuoted 9 lines
Quoted 3 lines
--
Rodrigo Vivi
Blog: http://blog.vivi.eng.br--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch--
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
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
Re: [PATCH 4/4] drm/i915: creating Haswell rc6 function
Quoted 5 lines · Rodrigo Vivi
I forgot to say that I tested patch by patch today on my HSW ULT and just noticed real improvement with the patch you already queued.
Where improvements are: at least 0.2W and also less oscillation and more % on RC and package C states.
Cool!
Quoted 2 lines
Although I'd like to see the rest of the series applied to have the code as clean, organized and matching documentation as possible.
Yeah, sounds like a good plan (at least for hsw).
Quoted 6 lines
Quoted 4 lines · Rodrigo Vivi
I'm in favor of this revert. Although I don't have any argument in values, I always guessed that many of rc6 bugs we have on snb came from the gap between the threashold values used and documented for snb.
The reason I'm still wary is that this helped (according to multiple people) to more reliably enter rc6. It might be that we've simply mixed up other rc6 issues and hangs here (or that it's just as flaky as it seems), but for snb/ivb we need to be careful. -Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch