drm/i915/bdw: Set initial rps freq to RP1
Subsystems (2)
PATCH 1/4 drm/i915/bdw: Set initial rps freq to RP1
Programming it outside of the rp0-rp1 range is considered a programming error. Since we do not know that the previous value would actually be in the range, program something we've read from the hardware, and therefore know will work.
This is potentially an issue for platforms whose ranges are outside the norms given in the programming guide (ie. early silicon)
v2: Use RP1 instead of RPn
--- drivers/gpu/drm/i915/intel_pm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +4 -2
@@ -3284,8 +3284,10 @@ static void gen8_enable_rps(struct drm_device *dev) rc6_mask);/* 4 Program defaults and thresholds for RPS*/ -I915_WRITE (GEN6_RPNSWREQ ,HSW_FREQUENCY (10 ));/* Request 500 MHz */ -I915_WRITE (GEN6_RC_VIDEO_FREQ ,HSW_FREQUENCY (12 ));/* Request 600 MHz */ +I915_WRITE (GEN6_RPNSWREQ , +HSW_FREQUENCY (dev_priv->rps.rp1_freq)); +I915_WRITE (GEN6_RC_VIDEO_FREQ , +HSW_FREQUENCY (dev_priv->rps.rp1_freq));/* NB: Docs say 1s, and 1000000 - which aren't equivalent */ I915_WRITE (GEN6_RP_DOWN_TIMEOUT ,100000000 /128 );/* 1 second timeout */
Signature · 1 line
1.9.1
PATCH 2/4 drm/i915/bdw: Extract rp_state_caps logic
We have a need for duplicated parsing of the RP_STATE_CAPS register (and the setting of the associated fields). To reuse some code, we can extract the function into a simple helper.
This patch also addresses the fact that we missed doing this for gen8, something we should have done anyway.
This could be two patches, one to extract, and one to add gen8, but it's trivial enough that I think one is fine. I will accept a request to split it. Please notice the fix addressed by v2 below.
Valleyview is left untouched because it is different.
v2: Logically rebased on top of
commit dd0a1aa19bd3d7203e58157b84cea78bbac605ac
Author: Jeff McGee <[email protected]> Date: Tue Feb 4 11:32:31 2014 -0600
drm/i915: Restore rps/rc6 on reset
Note with the above change the fix for gen8 is also handled (which was not the case in Jeff's original patch).
--- drivers/gpu/drm/i915/intel_pm.c | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +23 -17
@@ -3247,6 +3247,27 @@ static void gen6_enable_rps_interrupts(struct drm_device *dev)spin_unlock_irq (&dev_priv->irq_lock); } +static void parse_rp_state_cap (struct drm_i915_private *dev_priv,u32 rp_state_cap) +{ +/* All of these values are in units of 50MHz */ + dev_priv->rps.cur_freq =0 ; +/* static values from HW: RP0 < RPe < RP1 < RPn (min_freq) */ + dev_priv->rps.rp1_freq = (rp_state_cap >>8 ) &0xff ; + dev_priv->rps.rp0_freq = (rp_state_cap >>0 ) &0xff ; + dev_priv->rps.min_freq = (rp_state_cap >>16 ) &0xff ; +/* XXX: only BYT has a special efficient freq */ + dev_priv->rps.efficient_freq = dev_priv->rps.rp1_freq; +/* hw_max = RP0 until we check for overclocking */ + dev_priv->rps.max_freq = dev_priv->rps.rp0_freq; + +/* Preserve min/max settings in case of re-init */ +if (dev_priv->rps.max_freq_softlimit ==0 ) + dev_priv->rps.max_freq_softlimit = dev_priv->rps.max_freq; + +if (dev_priv->rps.min_freq_softlimit ==0 ) + dev_priv->rps.min_freq_softlimit = dev_priv->rps.min_freq; +} +static void gen8_enable_rps (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;
@@ -3265,6 +3286,7 @@ static void gen8_enable_rps(struct drm_device *dev)I915_WRITE (GEN6_RC_CONTROL ,0 ); rp_state_cap =I915_READ (GEN6_RP_STATE_CAP ); +parse_rp_state_cap (dev_priv, rp_state_cap);/* 2b: Program RC6 thresholds.*/ I915_WRITE (GEN6_RC6_WAKE_RATE_LIMIT ,40 <<16 );
@@ -3353,23 +3375,7 @@ static void gen6_enable_rps(struct drm_device *dev) rp_state_cap =I915_READ (GEN6_RP_STATE_CAP ); gt_perf_status =I915_READ (GEN6_GT_PERF_STATUS ); -/* All of these values are in units of 50MHz */ - dev_priv->rps.cur_freq =0 ; -/* static values from HW: RP0 < RPe < RP1 < RPn (min_freq) */ - dev_priv->rps.rp1_freq = (rp_state_cap >>8 ) &0xff ; - dev_priv->rps.rp0_freq = (rp_state_cap >>0 ) &0xff ; - dev_priv->rps.min_freq = (rp_state_cap >>16 ) &0xff ; -/* XXX: only BYT has a special efficient freq */ - dev_priv->rps.efficient_freq = dev_priv->rps.rp1_freq; -/* hw_max = RP0 until we check for overclocking */ - dev_priv->rps.max_freq = dev_priv->rps.rp0_freq; - -/* Preserve min/max settings in case of re-init */ -if (dev_priv->rps.max_freq_softlimit ==0 ) - dev_priv->rps.max_freq_softlimit = dev_priv->rps.max_freq; - -if (dev_priv->rps.min_freq_softlimit ==0 ) - dev_priv->rps.min_freq_softlimit = dev_priv->rps.min_freq; +parse_rp_state_cap (dev_priv, rp_state_cap);/* disable the counters and set deterministic thresholds */ I915_WRITE (GEN6_RC_CONTROL ,0 );
Signature · 1 line
1.9.1
PATCH 3/4 drm/i915/bdw: RPS frequency bits are the same as HSW
In reply to Ben Widawsky--- drivers/gpu/drm/i915/intel_pm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +1 -1
@@ -3041,7 +3041,7 @@ void gen6_set_rps(struct drm_device *dev, u8 val)if (val != dev_priv->rps.cur_freq) {gen6_set_rps_thresholds (dev_priv, val); -if (IS_HASWELL (dev)) +if (IS_HASWELL (dev) ||IS_BROADWELL (dev))I915_WRITE (GEN6_RPNSWREQ ,HSW_FREQUENCY (val));else
Signature · 1 line
1.9.1
Re: [PATCH 3/4] drm/i915/bdw: RPS frequency bits are the same as HSW
Quoted 2 lines · Ben Widawsky
Reviewed-by Rodrigo Vivi <[email protected]>Signed-off-by Ben Widawsky <[email protected]>
Series slurped into dinq, thanks.
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch