Message ID | 1463499808-3335-8-git-send-email-mika.kuoppala@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Tue, May 17, 2016 at 06:43:28PM +0300, Mika Kuoppala wrote: > Warn if we timeout on waiting register or other condition. > > Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com> > --- > drivers/gpu/drm/i915/i915_drv.h | 25 ++++++++++++++++++++----- > drivers/gpu/drm/i915/intel_drv.h | 10 +++++++++- > drivers/gpu/drm/i915/intel_uncore.c | 10 +++++----- > 3 files changed, 34 insertions(+), 11 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h > index ccf6747894b1..3d03a17a8b7c 100644 > --- a/drivers/gpu/drm/i915/i915_drv.h > +++ b/drivers/gpu/drm/i915/i915_drv.h > @@ -2873,11 +2873,26 @@ static inline bool intel_vgpu_active(struct drm_i915_private *dev_priv) > return dev_priv->vgpu.active; > } > > -int intel_wait_until_register(struct drm_i915_private *dev_priv, > - i915_reg_t reg, > - u32 mask, > - u32 value, > - unsigned long timeout_ms); > +int __intel_wait_until_register(struct drm_i915_private *dev_priv, > + i915_reg_t reg, > + u32 mask, > + u32 value, > + unsigned long timeout_ms); > + > +#if defined(CONFIG_DRM_I915_DEBUG) > +#define intel_wait_until_register(dev_priv, reg, mask, value, timeout_ms) ({ \ > + int __ret; \ > + WARN_ON(__ret = __intel_wait_until_register((dev_priv), \ > + (reg), (mask), \ > + (value), \ > + (timeout_ms))); \ > + __ret; \ > + }) > +#else > +#define intel_wait_until_register(dev_priv, reg, mask, value, timeout_ms) \ > + __intel_wait_until_register((dev_priv), \ > + (reg), (mask), (value), timeout_ms); > +#endif Stuff it inside intel_wait_until_register. One more frame in the WARN isn't going to confuse us? And make it a WARN() with more interesting fmt string. Seems silly to undo the bloat you were fighting! Good idea nevertheless. -Chris
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index ccf6747894b1..3d03a17a8b7c 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -2873,11 +2873,26 @@ static inline bool intel_vgpu_active(struct drm_i915_private *dev_priv) return dev_priv->vgpu.active; } -int intel_wait_until_register(struct drm_i915_private *dev_priv, - i915_reg_t reg, - u32 mask, - u32 value, - unsigned long timeout_ms); +int __intel_wait_until_register(struct drm_i915_private *dev_priv, + i915_reg_t reg, + u32 mask, + u32 value, + unsigned long timeout_ms); + +#if defined(CONFIG_DRM_I915_DEBUG) +#define intel_wait_until_register(dev_priv, reg, mask, value, timeout_ms) ({ \ + int __ret; \ + WARN_ON(__ret = __intel_wait_until_register((dev_priv), \ + (reg), (mask), \ + (value), \ + (timeout_ms))); \ + __ret; \ + }) +#else +#define intel_wait_until_register(dev_priv, reg, mask, value, timeout_ms) \ + __intel_wait_until_register((dev_priv), \ + (reg), (mask), (value), timeout_ms); +#endif #define wait_until_reg(reg, mask, value, timeout_ms) ({ \ if (__builtin_constant_p(timeout_ms)) \ diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 1b03461e75e4..917b649f84b6 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -80,7 +80,15 @@ ret__; \ }) -#define wait_for(COND, MS) __wait_for_ms((COND), (MS), 5) +#if defined(CONFIG_DRM_I915_DEBUG) +#define wait_for(COND, MS) ({ \ + int r__; \ + WARN_ON(r__ = __wait_for_ms((COND), (MS), 5)); \ + r__;\ + }) +#else +#define wait_for(COND, MS) __wait_for_ms((COND), (MS), 5) +#endif /* If CONFIG_PREEMPT_COUNT is disabled, in_atomic() always reports false. */ #if defined(CONFIG_DRM_I915_DEBUG) && defined(CONFIG_PREEMPT_COUNT) diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c index f72420e00621..def601ba93d4 100644 --- a/drivers/gpu/drm/i915/intel_uncore.c +++ b/drivers/gpu/drm/i915/intel_uncore.c @@ -1859,11 +1859,11 @@ intel_uncore_forcewake_for_reg(struct drm_i915_private *dev_priv, return fw_domains; } -int intel_wait_until_register(struct drm_i915_private *dev_priv, - i915_reg_t reg, - u32 mask, - u32 value, - unsigned long timeout_ms) +int __intel_wait_until_register(struct drm_i915_private *dev_priv, + i915_reg_t reg, + u32 mask, + u32 value, + unsigned long timeout_ms) { return wait_for((I915_READ(reg) & mask) == value, timeout_ms); }
Warn if we timeout on waiting register or other condition. Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com> --- drivers/gpu/drm/i915/i915_drv.h | 25 ++++++++++++++++++++----- drivers/gpu/drm/i915/intel_drv.h | 10 +++++++++- drivers/gpu/drm/i915/intel_uncore.c | 10 +++++----- 3 files changed, 34 insertions(+), 11 deletions(-)