aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorImre Deak <imre.deak@intel.com>2016-12-05 11:27:38 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-01-19 14:18:06 -0500
commit3b376640445a68d3531caf39d8092331fd14b641 (patch)
treef9917e50c137d621f5508fa964eddb2e3e16ac93
parent26eae206b78669ec4994d047a4b9418b1c588e35 (diff)
drm/i915/gen9: Fix PCODE polling during SAGV disabling
commit dccf82ad1775f2b9c36ec85e25e39d88c7e86818 upstream. According to the previous patch, it's possible atm that we call intel_do_sagv_disable() only once during the 1ms period and time out if that call fails. As opposed to this the spec says that we need to keep retrying this request for a 1ms duration, so let's do this similarly to the CDCLK change notification request. v4-5: - Rebased on the reply_mask, reply change. v6: - Remove w/s change. (Lyude) - Rebased on the timeout_base argument change. Cc: Lyude <cpaul@redhat.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Fixes: 656d1b89e5ff ("drm/i915/skl: Add support for the SAGV, fix underrun hangs") Signed-off-by: Imre Deak <imre.deak@intel.com> Reviewed-by: Lyude <lyude@redhat.com> (v4) Link: http://patchwork.freedesktop.org/patch/msgid/1480955258-26311-2-git-send-email-imre.deak@intel.com (cherry picked from commit b3b8e99984a4eace91bc097e8f8cec71441cae16) Signed-off-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c34
1 files changed, 9 insertions, 25 deletions
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 22313980789b..e559a45ff1f7 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -2955,24 +2955,10 @@ intel_enable_sagv(struct drm_i915_private *dev_priv)
2955 return 0; 2955 return 0;
2956} 2956}
2957 2957
2958static int
2959intel_do_sagv_disable(struct drm_i915_private *dev_priv)
2960{
2961 int ret;
2962 uint32_t temp = GEN9_SAGV_DISABLE;
2963
2964 ret = sandybridge_pcode_read(dev_priv, GEN9_PCODE_SAGV_CONTROL,
2965 &temp);
2966 if (ret)
2967 return ret;
2968 else
2969 return temp & GEN9_SAGV_IS_DISABLED;
2970}
2971
2972int 2958int
2973intel_disable_sagv(struct drm_i915_private *dev_priv) 2959intel_disable_sagv(struct drm_i915_private *dev_priv)
2974{ 2960{
2975 int ret, result; 2961 int ret;
2976 2962
2977 if (!intel_has_sagv(dev_priv)) 2963 if (!intel_has_sagv(dev_priv))
2978 return 0; 2964 return 0;
@@ -2984,25 +2970,23 @@ intel_disable_sagv(struct drm_i915_private *dev_priv)
2984 mutex_lock(&dev_priv->rps.hw_lock); 2970 mutex_lock(&dev_priv->rps.hw_lock);
2985 2971
2986 /* bspec says to keep retrying for at least 1 ms */ 2972 /* bspec says to keep retrying for at least 1 ms */
2987 ret = wait_for(result = intel_do_sagv_disable(dev_priv), 1); 2973 ret = skl_pcode_request(dev_priv, GEN9_PCODE_SAGV_CONTROL,
2974 GEN9_SAGV_DISABLE,
2975 GEN9_SAGV_IS_DISABLED, GEN9_SAGV_IS_DISABLED,
2976 1);
2988 mutex_unlock(&dev_priv->rps.hw_lock); 2977 mutex_unlock(&dev_priv->rps.hw_lock);
2989 2978
2990 if (ret == -ETIMEDOUT) {
2991 DRM_ERROR("Request to disable SAGV timed out\n");
2992 return -ETIMEDOUT;
2993 }
2994
2995 /* 2979 /*
2996 * Some skl systems, pre-release machines in particular, 2980 * Some skl systems, pre-release machines in particular,
2997 * don't actually have an SAGV. 2981 * don't actually have an SAGV.
2998 */ 2982 */
2999 if (IS_SKYLAKE(dev_priv) && result == -ENXIO) { 2983 if (IS_SKYLAKE(dev_priv) && ret == -ENXIO) {
3000 DRM_DEBUG_DRIVER("No SAGV found on system, ignoring\n"); 2984 DRM_DEBUG_DRIVER("No SAGV found on system, ignoring\n");
3001 dev_priv->sagv_status = I915_SAGV_NOT_CONTROLLED; 2985 dev_priv->sagv_status = I915_SAGV_NOT_CONTROLLED;
3002 return 0; 2986 return 0;
3003 } else if (result < 0) { 2987 } else if (ret < 0) {
3004 DRM_ERROR("Failed to disable the SAGV\n"); 2988 DRM_ERROR("Failed to disable the SAGV (%d)\n", ret);
3005 return result; 2989 return ret;
3006 } 2990 }
3007 2991
3008 dev_priv->sagv_status = I915_SAGV_DISABLED; 2992 dev_priv->sagv_status = I915_SAGV_DISABLED;