Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Add a bit of locking to intel_dp_hpd_pulse()
@ 2014-07-30 15:39 ville.syrjala
  2014-07-30 23:49 ` Dave Airlie
  0 siblings, 1 reply; 9+ messages in thread
From: ville.syrjala @ 2014-07-30 15:39 UTC (permalink / raw)
  To: intel-gfx; +Cc: Dave Airlie

From: Ville Syrjälä <ville.syrjala@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 <airlied@redhat.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-08-04 14:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-30 15:39 [PATCH] drm/i915: Add a bit of locking to intel_dp_hpd_pulse() ville.syrjala
2014-07-30 23:49 ` Dave Airlie
2014-07-31  7:37   ` Daniel Vetter
2014-07-31 10:59     ` Dave Airlie
2014-08-01 11:55       ` Ville Syrjälä
2014-08-04  8:10         ` Daniel Vetter
2014-08-04  8:21           ` Dave Airlie
2014-08-04 12:50           ` Ville Syrjälä
2014-08-04 14:58             ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox