[Intel-gfx] [PATCH 3/6] drm/i915: Optimize the VLV Punit wait a bit
Daniel Vetter
daniel at ffwll.ch
Wed Jun 26 12:17:55 CEST 2013
On Tue, Jun 25, 2013 at 07:21:03PM +0300, ville.syrjala at linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
>
> Don't do needless udelay() calls if the Punit already completed
> the frequency change.
>
> Also double check things after the timeout to make sure the timeout
> wasn't just caused by some scheduling delays.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> ---
> drivers/gpu/drm/i915/intel_pm.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 6dbcad7..6b98d45 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -3078,14 +3078,20 @@ static void vlv_update_rps_cur_delay(struct drm_i915_private *dev_priv)
>
> WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
>
> - do {
> - pval = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS);
> + pval = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS);
> +
> + while (pval & 1) {
> if (time_after(jiffies, timeout)) {
> - DRM_DEBUG_DRIVER("timed out waiting for Punit\n");
> + pval = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS);
> break;
> }
> +
> udelay(10);
> - } while (pval & 1);
> + pval = vlv_punit_read(dev_priv, PUNIT_REG_GPU_FREQ_STS);
> + }
> +
> + if (pval & 1)
> + DRM_DEBUG_DRIVER("timed out waiting for Punit\n");
Since we notoriously get these suckers wrong and this check isn't really
in the critical path any more (the punit should have complete the last
change already) and furthermore in a work item: Can we just use one of our
bog-standard wait_for macros here now?
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
More information about the Intel-gfx
mailing list