From: Ville Syrjälä <ville.syrj...@linux.intel.com>

->hpd_pulse() is called from a workqueue via an interrupt so it happens
asynchronously with modesets. Grab the connection_mutex in
intel_dp_hpd_pulse() to avoid disturbing on angoing modeset with
parallel hpd processing.

On my IVB turning off the port during a modeset could result in a
hpd which would then proceed to link train while the modeset was
still happening. Suffice to say that didn't go so well.

Cc: Dave Airlie <airl...@redhat.com>
Signed-off-by: Ville Syrjälä <ville.syrj...@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 87d0489..cd63e74 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -4051,6 +4051,8 @@ intel_dp_hpd_pulse(struct intel_digital_port 
*intel_dig_port, bool long_hpd)
        DRM_DEBUG_KMS("got hpd irq on port %d - %s\n", intel_dig_port->port,
                      long_hpd ? "long" : "short");
 
+       drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
+
        if (long_hpd) {
                if (!ibx_digital_port_connected(dev_priv, intel_dig_port))
                        goto mst_fail;
@@ -4079,6 +4081,7 @@ intel_dp_hpd_pulse(struct intel_digital_port 
*intel_dig_port, bool long_hpd)
                        intel_dp_check_link_status(intel_dp);
                }
        }
+       drm_modeset_unlock(&dev->mode_config.connection_mutex);
        return false;
 mst_fail:
        /* if we were in MST mode, and device is not there get out of MST mode 
*/
@@ -4087,6 +4090,7 @@ mst_fail:
                intel_dp->is_mst = false;
                drm_dp_mst_topology_mgr_set_mst(&intel_dp->mst_mgr, 
intel_dp->is_mst);
        }
+       drm_modeset_unlock(&dev->mode_config.connection_mutex);
        return true;
 }
 
-- 
1.8.5.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to