Commit 22062dba authored by Daniel Vetter's avatar Daniel Vetter

drm/i915: s/hotplug_irq_storm_detect/intel_hpd_irq_handler/

The combination of Paulo's fifo underrun detection code and Egbert's
hpd storm handling code unfortunately made the hpd storm handling code
racy.

To avoid duplicating tricky interrupt locking code over all platforms
start with a bit of refactoring. This patch is the very first step
since in the end the irq storm handling code will handle all hotplug
logic (and so also encapsulate the locking nicely).

v2: Rebase on top of the i965g/gm sdvo hpd fix.

Cc: Egbert Eich <eich@suse.de>
Reviewed-by: default avatarEgbert Eich <eich@suse.de>
Reviewed-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 6005ce42
...@@ -875,7 +875,7 @@ static void gen6_queue_rps_work(struct drm_i915_private *dev_priv, ...@@ -875,7 +875,7 @@ static void gen6_queue_rps_work(struct drm_i915_private *dev_priv,
#define HPD_STORM_DETECT_PERIOD 1000 #define HPD_STORM_DETECT_PERIOD 1000
#define HPD_STORM_THRESHOLD 5 #define HPD_STORM_THRESHOLD 5
static inline bool hotplug_irq_storm_detect(struct drm_device *dev, static inline bool intel_hpd_irq_handler(struct drm_device *dev,
u32 hotplug_trigger, u32 hotplug_trigger,
const u32 *hpd) const u32 *hpd)
{ {
...@@ -1018,7 +1018,7 @@ static irqreturn_t valleyview_irq_handler(int irq, void *arg) ...@@ -1018,7 +1018,7 @@ static irqreturn_t valleyview_irq_handler(int irq, void *arg)
DRM_DEBUG_DRIVER("hotplug event received, stat 0x%08x\n", DRM_DEBUG_DRIVER("hotplug event received, stat 0x%08x\n",
hotplug_status); hotplug_status);
if (hotplug_trigger) { if (hotplug_trigger) {
if (hotplug_irq_storm_detect(dev, hotplug_trigger, hpd_status_i915)) if (intel_hpd_irq_handler(dev, hotplug_trigger, hpd_status_i915))
i915_hpd_irq_setup(dev); i915_hpd_irq_setup(dev);
queue_work(dev_priv->wq, queue_work(dev_priv->wq,
&dev_priv->hotplug_work); &dev_priv->hotplug_work);
...@@ -1049,7 +1049,7 @@ static void ibx_irq_handler(struct drm_device *dev, u32 pch_iir) ...@@ -1049,7 +1049,7 @@ static void ibx_irq_handler(struct drm_device *dev, u32 pch_iir)
u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK; u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK;
if (hotplug_trigger) { if (hotplug_trigger) {
if (hotplug_irq_storm_detect(dev, hotplug_trigger, hpd_ibx)) if (intel_hpd_irq_handler(dev, hotplug_trigger, hpd_ibx))
ibx_hpd_irq_setup(dev); ibx_hpd_irq_setup(dev);
queue_work(dev_priv->wq, &dev_priv->hotplug_work); queue_work(dev_priv->wq, &dev_priv->hotplug_work);
} }
...@@ -1154,7 +1154,7 @@ static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir) ...@@ -1154,7 +1154,7 @@ static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir)
u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_CPT; u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_CPT;
if (hotplug_trigger) { if (hotplug_trigger) {
if (hotplug_irq_storm_detect(dev, hotplug_trigger, hpd_cpt)) if (intel_hpd_irq_handler(dev, hotplug_trigger, hpd_cpt))
ibx_hpd_irq_setup(dev); ibx_hpd_irq_setup(dev);
queue_work(dev_priv->wq, &dev_priv->hotplug_work); queue_work(dev_priv->wq, &dev_priv->hotplug_work);
} }
...@@ -3232,7 +3232,7 @@ static irqreturn_t i915_irq_handler(int irq, void *arg) ...@@ -3232,7 +3232,7 @@ static irqreturn_t i915_irq_handler(int irq, void *arg)
DRM_DEBUG_DRIVER("hotplug event received, stat 0x%08x\n", DRM_DEBUG_DRIVER("hotplug event received, stat 0x%08x\n",
hotplug_status); hotplug_status);
if (hotplug_trigger) { if (hotplug_trigger) {
if (hotplug_irq_storm_detect(dev, hotplug_trigger, hpd_status_i915)) if (intel_hpd_irq_handler(dev, hotplug_trigger, hpd_status_i915))
i915_hpd_irq_setup(dev); i915_hpd_irq_setup(dev);
queue_work(dev_priv->wq, queue_work(dev_priv->wq,
&dev_priv->hotplug_work); &dev_priv->hotplug_work);
...@@ -3473,7 +3473,7 @@ static irqreturn_t i965_irq_handler(int irq, void *arg) ...@@ -3473,7 +3473,7 @@ static irqreturn_t i965_irq_handler(int irq, void *arg)
DRM_DEBUG_DRIVER("hotplug event received, stat 0x%08x\n", DRM_DEBUG_DRIVER("hotplug event received, stat 0x%08x\n",
hotplug_status); hotplug_status);
if (hotplug_trigger) { if (hotplug_trigger) {
if (hotplug_irq_storm_detect(dev, hotplug_trigger, if (intel_hpd_irq_handler(dev, hotplug_trigger,
IS_G4X(dev) ? hpd_status_gen4 : hpd_status_i915)) IS_G4X(dev) ? hpd_status_gen4 : hpd_status_i915))
i915_hpd_irq_setup(dev); i915_hpd_irq_setup(dev);
queue_work(dev_priv->wq, queue_work(dev_priv->wq,
......
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