Re: [PATCH v4 00/11] Added missing changes for Turbo feature on SKL

Jesse Barnes
2015-03-12T22:08:48Z

On 03/05/2015 09:37 PM, akash.goel@intel.com wrote:
> From: Akash Goel <akash.goel@intel.com>
>
> This patch series add the missing changes, required for proper
> functioning of the Turbo feature on SKL. Most of the changes are
> mainly due to the fact that on SKL, the frequency has to be programmed
> in units of 16.66 MHZ and the time period value programmed in Up/Down
> EI & threshold registers, is in units of 1.333 micro seconds.
> In this version, review comments from Chris & Ville have been addressed
> and a new patch has been added to enable the RPS interrupts programming
> for SKL also.
>
> Akash Goel (11):
> drm/i915/skl: Added new macros
> drm/i915/skl: Updated intel_gpu_freq() and intel_freq_opcode()
> drm/i915/skl: Updated the gen6_init_rps_frequencies function
> drm/i915/skl: Updated the gen6_set_rps function
> drm/i915/skl: Restructured the gen6_set_rps_thresholds function
> drm/i915/skl: Updated the gen6_rps_limits function
> drm/i915/skl: Updated the gen9_enable_rps function
> drm/i915/skl: Updated the i915_frequency_info debugfs function
> drm/i915/skl: Updated the act_freq_mhz_show sysfs function
> drm/i915/skl: Enabling processing of Turbo interrupts
> drm/i915/skl: Enable the RPS interrupts programming
>
> drivers/gpu/drm/i915/i915_debugfs.c | 25 ++++--
> drivers/gpu/drm/i915/i915_drv.h | 1 +
> drivers/gpu/drm/i915/i915_irq.c | 5 --
> drivers/gpu/drm/i915/i915_reg.h | 9 +++
> drivers/gpu/drm/i915/i915_sysfs.c | 4 +-
> drivers/gpu/drm/i915/intel_pm.c | 147 ++++++++++++++++++------------------
> 6 files changed, 105 insertions(+), 86 deletions(-)

It looks like turbo is working, but the pm_rps test is still having a
little trouble. I patched this on top to make it happier, but there are
still problems with the test getting to the expected frequencies, please
check out https://bugs.freedesktop.org/show_bug.cgi?id=89123.

--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -6696,7 +6696,8 @@ static int chv_freq_opcode(struct drm_i915_private
*dev_pr
int intel_gpu_freq(struct drm_i915_private *dev_priv, int val)
{
if (IS_GEN9(dev_priv->dev))
- return (val * GT_FREQUENCY_MULTIPLIER) / GEN9_FREQ_SCALER;
+ return DIV_ROUND_CLOSEST(val * GT_FREQUENCY_MULTIPLIER,
+ GEN9_FREQ_SCALER);
else if (IS_CHERRYVIEW(dev_priv->dev))
return chv_gpu_freq(dev_priv, val);
else if (IS_VALLEYVIEW(dev_priv->dev))
@@ -6708,7 +6709,8 @@ int intel_gpu_freq(struct drm_i915_private
*dev_priv, int
int intel_freq_opcode(struct drm_i915_private *dev_priv, int val)
{
if (IS_GEN9(dev_priv->dev))
- return (val * GEN9_FREQ_SCALER) / GT_FREQUENCY_MULTIPLIER;
+ return DIV_ROUND_CLOSEST(val * GEN9_FREQ_SCALER,
+ GT_FREQUENCY_MULTIPLIER);
else if (IS_CHERRYVIEW(dev_priv->dev))
return chv_freq_opcode(dev_priv, val);
else if (IS_VALLEYVIEW(dev_priv->dev))