On Fri, Sep 09, 2022 at 03:42:34PM +0300, Jani Nikula wrote: > Rename intel_hpd_init_work() to the more generic intel_hpd_init_early(), > and move the hotplug storm initialization there. This lets us move the > HPD_STORM_DEFAULT_THRESHOLD macro to intel_hotplug.c too. > > Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx> Series is Reviewed-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> > --- > drivers/gpu/drm/i915/display/intel_hotplug.c | 22 +++++++++++++++----- > drivers/gpu/drm/i915/display/intel_hotplug.h | 2 +- > drivers/gpu/drm/i915/i915_drv.h | 3 --- > drivers/gpu/drm/i915/i915_irq.c | 11 +--------- > 4 files changed, 19 insertions(+), 19 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_hotplug.c b/drivers/gpu/drm/i915/display/intel_hotplug.c > index 4faae25d76c0..352a1b53b63e 100644 > --- a/drivers/gpu/drm/i915/display/intel_hotplug.c > +++ b/drivers/gpu/drm/i915/display/intel_hotplug.c > @@ -90,6 +90,9 @@ enum hpd_pin intel_hpd_pin_default(struct drm_i915_private *dev_priv, > return HPD_PORT_A + port - PORT_A; > } > > +/* Threshold == 5 for long IRQs, 50 for short */ > +#define HPD_STORM_DEFAULT_THRESHOLD 50 > + > #define HPD_STORM_DETECT_PERIOD 1000 > #define HPD_STORM_REENABLE_DELAY (2 * 60 * 1000) > #define HPD_RETRY_DELAY 1000 > @@ -711,14 +714,23 @@ void intel_hpd_poll_disable(struct drm_i915_private *dev_priv) > schedule_work(&dev_priv->display.hotplug.poll_init_work); > } > > -void intel_hpd_init_work(struct drm_i915_private *dev_priv) > +void intel_hpd_init_early(struct drm_i915_private *i915) > { > - INIT_DELAYED_WORK(&dev_priv->display.hotplug.hotplug_work, > + INIT_DELAYED_WORK(&i915->display.hotplug.hotplug_work, > i915_hotplug_work_func); > - INIT_WORK(&dev_priv->display.hotplug.dig_port_work, i915_digport_work_func); > - INIT_WORK(&dev_priv->display.hotplug.poll_init_work, i915_hpd_poll_init_work); > - INIT_DELAYED_WORK(&dev_priv->display.hotplug.reenable_work, > + INIT_WORK(&i915->display.hotplug.dig_port_work, i915_digport_work_func); > + INIT_WORK(&i915->display.hotplug.poll_init_work, i915_hpd_poll_init_work); > + INIT_DELAYED_WORK(&i915->display.hotplug.reenable_work, > intel_hpd_irq_storm_reenable_work); > + > + i915->display.hotplug.hpd_storm_threshold = HPD_STORM_DEFAULT_THRESHOLD; > + /* If we have MST support, we want to avoid doing short HPD IRQ storm > + * detection, as short HPD storms will occur as a natural part of > + * sideband messaging with MST. > + * On older platforms however, IRQ storms can occur with both long and > + * short pulses, as seen on some G4x systems. > + */ > + i915->display.hotplug.hpd_short_storm_enabled = !HAS_DP_MST(i915); > } > > void intel_hpd_cancel_work(struct drm_i915_private *dev_priv) > diff --git a/drivers/gpu/drm/i915/display/intel_hotplug.h b/drivers/gpu/drm/i915/display/intel_hotplug.h > index aa84e381d6c3..424ae5dbf5a0 100644 > --- a/drivers/gpu/drm/i915/display/intel_hotplug.h > +++ b/drivers/gpu/drm/i915/display/intel_hotplug.h > @@ -22,7 +22,7 @@ void intel_hpd_irq_handler(struct drm_i915_private *dev_priv, > u32 pin_mask, u32 long_mask); > void intel_hpd_trigger_irq(struct intel_digital_port *dig_port); > void intel_hpd_init(struct drm_i915_private *dev_priv); > -void intel_hpd_init_work(struct drm_i915_private *dev_priv); > +void intel_hpd_init_early(struct drm_i915_private *i915); > void intel_hpd_cancel_work(struct drm_i915_private *dev_priv); > enum hpd_pin intel_hpd_pin_default(struct drm_i915_private *dev_priv, > enum port port); > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h > index be201ba5e9ab..c91cccb2b8c7 100644 > --- a/drivers/gpu/drm/i915/i915_drv.h > +++ b/drivers/gpu/drm/i915/i915_drv.h > @@ -75,9 +75,6 @@ struct intel_limit; > struct intel_overlay_error_state; > struct vlv_s0ix_state; > > -/* Threshold == 5 for long IRQs, 50 for short */ > -#define HPD_STORM_DEFAULT_THRESHOLD 50 > - > #define I915_GEM_GPU_DOMAINS \ > (I915_GEM_DOMAIN_RENDER | \ > I915_GEM_DOMAIN_SAMPLER | \ > diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c > index 515648cd1233..8ffd81243a19 100644 > --- a/drivers/gpu/drm/i915/i915_irq.c > +++ b/drivers/gpu/drm/i915/i915_irq.c > @@ -4399,7 +4399,7 @@ void intel_irq_init(struct drm_i915_private *dev_priv) > > intel_hpd_init_pins(dev_priv); > > - intel_hpd_init_work(dev_priv); > + intel_hpd_init_early(dev_priv); > > dev->vblank_disable_immediate = true; > > @@ -4413,15 +4413,6 @@ void intel_irq_init(struct drm_i915_private *dev_priv) > if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) > dev_priv->display_irqs_enabled = false; > > - dev_priv->display.hotplug.hpd_storm_threshold = HPD_STORM_DEFAULT_THRESHOLD; > - /* If we have MST support, we want to avoid doing short HPD IRQ storm > - * detection, as short HPD storms will occur as a natural part of > - * sideband messaging with MST. > - * On older platforms however, IRQ storms can occur with both long and > - * short pulses, as seen on some G4x systems. > - */ > - dev_priv->display.hotplug.hpd_short_storm_enabled = !HAS_DP_MST(dev_priv); > - > if (HAS_GMCH(dev_priv)) { > if (I915_HAS_HOTPLUG(dev_priv)) > dev_priv->display.funcs.hotplug = &i915_hpd_funcs; > -- > 2.34.1 -- Ville Syrjälä Intel