FAILED: patch "[PATCH] drm/i915/bxt, glk: Increase PCODE timeouts during CDCLK freq" failed to apply to 4.15-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 4.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
Quoted 1 line
From
5e1df40f40ee45a97bb1066c3d71f0ae920a9672Mon Sep 17 00:00:00 2001
From: Imre Deak <[email protected]>
Date: Tue, 30 Jan 2018 16:29:38 +0200
Subject: [PATCH] drm/i915/bxt, glk: Increase PCODE timeouts during CDCLK freq
changing
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Currently we see sporadic timeouts during CDCLK changing both on BXT and GLK as reported by the Bugzilla: ticket. It's easy to reproduce this by changing the frequency in a tight loop after blanking the display. The upper bound for the completion time is 800us based on my tests, so increase it from the current 500us to 2ms; with that I couldn't trigger the problem either on BXT or GLK.
Note that timeouts happened during both the change notification and the voltage level setting PCODE request. (For the latter one BSpec doesn't require us to wait for completion before further HW programming.)
This issue is similar to
commit 2c7d0602c815 ("drm/i915/gen9: Fix PCODE polling during CDCLK change notification")
but there the PCODE request does complete (as shown by the mbox busy flag), only the reply we get from PCODE indicates a failure. So there we keep resending the request until a success reply, here we just have to increase the timeout for the one PCODE request we send.
v2:
- s/snb_pcode_request/sandybridge_pcode_write_timeout/ (Ville)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103326
drivers/gpu/drm/i915/i915_drv.h +5 -1
@@ -3717,7 +3717,11 @@ extern void intel_display_print_error_state(struct drm_i915_error_state_buf *e, struct intel_display_error_state *error);int sandybridge_pcode_read (struct drm_i915_private *dev_priv,u32 mbox,u32 *val); -int sandybridge_pcode_write (struct drm_i915_private *dev_priv,u32 mbox,u32 val); +int sandybridge_pcode_write_timeout (struct drm_i915_private *dev_priv,u32 mbox, +u32 val,int timeout_us); +#define sandybridge_pcode_write (dev_priv, mbox, val) \ + sandybridge_pcode_write_timeout(dev_priv, mbox, val, 500) +int skl_pcode_request (struct drm_i915_private *dev_priv,u32 mbox,u32 request,u32 reply_mask,u32 reply,int timeout_base_ms);
drivers/gpu/drm/i915/intel_cdclk.c +17 -5
@@ -1370,10 +1370,15 @@ static void bxt_set_cdclk(struct drm_i915_private *dev_priv,break ; } -/* Inform power controller of upcoming frequency change */ +/* +* Inform power controller of upcoming frequency change. BSpec +* requires us to wait up to 150usec, but that leads to timeouts; +* the 2ms used here is based on experiment. +*/ mutex_lock (&dev_priv->pcu_lock); - ret =sandybridge_pcode_write (dev_priv,HSW_PCODE_DE_WRITE_FREQ_REQ , -0x80000000 ); + ret =sandybridge_pcode_write_timeout (dev_priv, +HSW_PCODE_DE_WRITE_FREQ_REQ , +0x80000000 ,2000 );mutex_unlock (&dev_priv->pcu_lock);if (ret) {
@@ -1404,8 +1409,15 @@ static void bxt_set_cdclk(struct drm_i915_private *dev_priv,I915_WRITE (CDCLK_CTL , val);mutex_lock (&dev_priv->pcu_lock); - ret =sandybridge_pcode_write (dev_priv,HSW_PCODE_DE_WRITE_FREQ_REQ , - cdclk_state->voltage_level); +/* +* The timeout isn't specified, the 2ms used here is based on +* experiment. +* FIXME: Waiting for the request completion could be delayed until +* the next PCODE request based on BSpec. +*/ + ret =sandybridge_pcode_write_timeout (dev_priv, +HSW_PCODE_DE_WRITE_FREQ_REQ , + cdclk_state->voltage_level,2000 );mutex_unlock (&dev_priv->pcu_lock);if (ret) {
drivers/gpu/drm/i915/intel_pm.c +3 -3
@@ -9149,8 +9149,8 @@ int sandybridge_pcode_read(struct drm_i915_private *dev_priv, u32 mbox, u32 *valreturn 0 ; } -int sandybridge_pcode_write (struct drm_i915_private *dev_priv, -u32 mbox,u32 val) +int sandybridge_pcode_write_timeout (struct drm_i915_private *dev_priv, +u32 mbox,u32 val,int timeout_us) {int status;
@@ -9173,7 +9173,7 @@ int sandybridge_pcode_write(struct drm_i915_private *dev_priv,if (__intel_wait_for_register_fw (dev_priv,GEN6_PCODE_MAILBOX ,GEN6_PCODE_READY ,0 , -500 ,0 ,NULL )) { + timeout_us,0 ,NULL )) {DRM_ERROR ("timeout waiting for pcode write of 0x%08x to mbox %x to finish for %ps\n" , val, mbox,__builtin_return_address (0 ));return -ETIMEDOUT ;