Commit ff26ffa8 authored by Daniel Vetter's avatar Daniel Vetter

drm/i915: Fix __intel_wait_for_register_fw to not sleep in atomic

The unconditionally fallback to the blocking wait_for resulted in
impressive fireworks at boot-up on my snb here. Make sure if we set
the slow timeout to 0 that we never ever sleep. The tail of the
callchain was

intel_wait_for_register
-> __intel_wait_for_register_fw
  -> usleep_range
     -> BOOM

It blew up in intel_crt_detect load detection code on the
ADPA_CRT_HOTPLUG_FORCE_TRIGGER in the ADPA register.

v2: Shut up gcc.

v3: Use uninitialized_var() (Chris).

Fixes: 05646543 ("drm/i915: Acquire uncore.lock over intel_uncore_wait_for_register()")
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1494429572-15118-1-git-send-email-daniel.vetter@ffwll.ch
parent e11ffddb
...@@ -1610,7 +1610,7 @@ int __intel_wait_for_register_fw(struct drm_i915_private *dev_priv, ...@@ -1610,7 +1610,7 @@ int __intel_wait_for_register_fw(struct drm_i915_private *dev_priv,
unsigned int slow_timeout_ms, unsigned int slow_timeout_ms,
u32 *out_value) u32 *out_value)
{ {
u32 reg_value; u32 uninitialized_var(reg_value);
#define done (((reg_value = I915_READ_FW(reg)) & mask) == value) #define done (((reg_value = I915_READ_FW(reg)) & mask) == value)
int ret; int ret;
...@@ -1621,7 +1621,7 @@ int __intel_wait_for_register_fw(struct drm_i915_private *dev_priv, ...@@ -1621,7 +1621,7 @@ int __intel_wait_for_register_fw(struct drm_i915_private *dev_priv,
ret = -ETIMEDOUT; ret = -ETIMEDOUT;
if (fast_timeout_us && fast_timeout_us <= 20000) if (fast_timeout_us && fast_timeout_us <= 20000)
ret = _wait_for_atomic(done, fast_timeout_us, 0); ret = _wait_for_atomic(done, fast_timeout_us, 0);
if (ret) if (ret && slow_timeout_ms)
ret = wait_for(done, slow_timeout_ms); ret = wait_for(done, slow_timeout_ms);
if (out_value) if (out_value)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment