diff mbox

[v3] drm/i915/dp: Clean up intel_dp_check_mst_status

Message ID 20171024224735.2038-1-dhinakaran.pandiyan@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dhinakaran Pandiyan Oct. 24, 2017, 10:47 p.m. UTC
Rewriting this code without the goto, I believe, makes it more readable.
One functional change that has been included is the handling of failed ESI
register reads. Instead of disabling MST only for the first failed read, we
now disable MST on subsequent failed reads too. A failed ESI read is
problematic irrespective of whether it is the first or not.

v2: Don't ignore return from _mst_hpd_irq() (James)
v3: Rebased.

Cc: James Ausmus <james.ausmus@intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Reviewed-by: James Ausmus <james.ausmus@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 78 ++++++++++++++++++-----------------------
 1 file changed, 34 insertions(+), 44 deletions(-)

Comments

Dhinakaran Pandiyan Oct. 25, 2017, 5:13 p.m. UTC | #1
On Wed, 2017-10-25 at 00:09 +0000, Patchwork wrote:
> == Series Details ==

> 

> Series: drm/i915/dp: Clean up intel_dp_check_mst_status

> URL   : https://patchwork.freedesktop.org/series/32584/

> State : failure

> 

> == Summary ==

> 

> Series 32584v1 drm/i915/dp: Clean up intel_dp_check_mst_status

> https://patchwork.freedesktop.org/api/1.0/series/32584/revisions/1/mbox/

> 

> Test kms_pipe_crc_basic:

>         Subgroup suspend-read-crc-pipe-b:

>                 dmesg-warn -> PASS       (fi-byt-n2820) fdo#101705

> Test kms_psr_sink_crc:

>         Subgroup psr_basic:

>                 pass       -> INCOMPLETE (fi-cnl-y)


Doesn't look related, this failure appears in reports for other patches too. 

> 

> fdo#101705 https://bugs.freedesktop.org/show_bug.cgi?id=101705

> 

> fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:440s

> fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:449s

> fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:377s

> fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:524s

> fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:261s

> fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:499s

> fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:501s

> fi-byt-j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35  time:491s

> fi-byt-n2820     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:478s

> fi-cfl-s         total:289  pass:253  dwarn:4   dfail:0   fail:0   skip:32  time:537s

> fi-cnl-y         total:248  pass:223  dwarn:0   dfail:0   fail:0   skip:24 

> fi-gdg-551       total:289  pass:178  dwarn:1   dfail:0   fail:1   skip:109 time:249s

> fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:576s

> fi-glk-dsi       total:289  pass:258  dwarn:0   dfail:0   fail:1   skip:30  time:484s

> fi-hsw-4770      total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:427s

> fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:428s

> fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:438s

> fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:497s

> fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:460s

> fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:495s

> fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:576s

> fi-kbl-7567u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:474s

> fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:584s

> fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:544s

> fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:456s

> fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:642s

> fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:525s

> fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:495s

> fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:456s

> fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:555s

> fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:421s

> fi-elk-e7500 failed to connect after reboot

> 

> 63e85ec6f910933a46b5a50a2a077b6860ed4815 drm-tip: 2017y-10m-24d-20h-52m-45s UTC integration manifest

> a5d7eacb0926 drm/i915/dp: Clean up intel_dp_check_mst_status

> 

> == Logs ==

> 

> For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6175/

> _______________________________________________

> Intel-gfx mailing list

> Intel-gfx@lists.freedesktop.org

> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index aa75f55eeb61..1701ee57ea4f 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -4196,57 +4196,47 @@  static void intel_dp_handle_test_request(struct intel_dp *intel_dp)
 static int
 intel_dp_check_mst_status(struct intel_dp *intel_dp)
 {
-	bool bret;
+	u8 esi[DP_DPRX_ESI_LEN] = { 0 };
+	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
 
-	if (intel_dp->is_mst) {
-		u8 esi[DP_DPRX_ESI_LEN] = { 0 };
-		int ret = 0;
-		int retry;
+	if (!intel_dp->is_mst)
+		return -EINVAL;
+
+	while (intel_dp_get_sink_irq_esi(intel_dp, esi)) {
+		int ret, retry;
 		bool handled;
-		bret = intel_dp_get_sink_irq_esi(intel_dp, esi);
-go_again:
-		if (bret == true) {
-
-			/* check link status - esi[10] = 0x200c */
-			if (intel_dp->active_mst_links &&
-			    !drm_dp_channel_eq_ok(&esi[10], intel_dp->lane_count)) {
-				DRM_DEBUG_KMS("channel EQ not ok, retraining\n");
-				intel_dp_start_link_train(intel_dp);
-				intel_dp_stop_link_train(intel_dp);
-			}
 
-			DRM_DEBUG_KMS("got esi %3ph\n", esi);
-			ret = drm_dp_mst_hpd_irq(&intel_dp->mst_mgr, esi, &handled);
-
-			if (handled) {
-				for (retry = 0; retry < 3; retry++) {
-					int wret;
-					wret = drm_dp_dpcd_write(&intel_dp->aux,
-								 DP_SINK_COUNT_ESI+1,
-								 &esi[1], 3);
-					if (wret == 3) {
-						break;
-					}
-				}
+		DRM_DEBUG_KMS("ESI %3ph\n", esi);
 
-				bret = intel_dp_get_sink_irq_esi(intel_dp, esi);
-				if (bret == true) {
-					DRM_DEBUG_KMS("got esi2 %3ph\n", esi);
-					goto go_again;
-				}
-			} else
-				ret = 0;
+		/* check link status - esi[10] = 0x200c */
+		if (intel_dp->active_mst_links &&
+		    !drm_dp_channel_eq_ok(&esi[10], intel_dp->lane_count)) {
+			intel_dp_start_link_train(intel_dp);
+			intel_dp_stop_link_train(intel_dp);
+		}
 
-			return ret;
-		} else {
-			struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
-			DRM_DEBUG_KMS("failed to get ESI - device may have failed\n");
-			intel_dp->is_mst = false;
-			drm_dp_mst_topology_mgr_set_mst(&intel_dp->mst_mgr, intel_dp->is_mst);
-			/* send a hotplug event */
-			drm_kms_helper_hotplug_event(intel_dig_port->base.base.dev);
+		ret = drm_dp_mst_hpd_irq(&intel_dp->mst_mgr, esi, &handled);
+		if (!handled)
+			return 0;
+
+		if (ret)
+			DRM_DEBUG_KMS("error handling MST IRQ_HPD %d\n", ret);
+
+		for (retry = 0; retry < 3; retry++) {
+			int wret;
+
+			wret = drm_dp_dpcd_write(&intel_dp->aux,
+						 DP_SINK_COUNT_ESI + 1, &esi[1],
+						 3);
+			if (wret == 3)
+				break;
 		}
 	}
+
+	DRM_DEBUG_KMS("failed to get ESI - device may have failed\n");
+	intel_dp->is_mst = false;
+	drm_dp_mst_topology_mgr_set_mst(&intel_dp->mst_mgr, intel_dp->is_mst);
+	drm_kms_helper_hotplug_event(intel_dig_port->base.base.dev);
 	return -EINVAL;
 }