Skip to contentSkip to conversation

drm/i915/dp: native aux defer retry timeout & retry limit

PATCH In review Jani Nikula 3 participants 8 messages Feb 11, 2014 – Feb 13, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover drm/i915/dp: native aux defer retry timeout & retry limit

These should fix the hang in the bug referenced in patch 2/2. Based on some links the actual error might be a firmware bug in the docking station, but we shouldn't trust on DP sinks to not keep replying aux defer indefinitely.

Even with the docking station's firmware fixed, this may not be enough to actually get the output working. They are branch devices, possibly MST devices, which we still suck at.

But hey, at least we won't freeze the system.

The retry timeout and limit are in line with Thierry's dp aux series [1], so this should in fact ease the transition by catching any regressions caused by this change up front.

BR,
Jani.

[1] http://mid.gmane.org/[email protected]

Jani Nikula (2):
drm/i915/dp: increase native aux defer retry timeout drm/i915/dp: add native aux defer retry limit

 drivers/gpu/drm/i915/intel_dp.c |   19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/2 drm/i915/dp: increase native aux defer retry timeout

Give more slack to sink devices before retrying on native aux defer. AFAICT the 100 us timeout was not based on the DP spec.

---
 drivers/gpu/drm/i915/intel_dp.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +2 -2
index 50381f765504..abbc80243234 100644
@@ -596,7 +596,7 @@ intel_dp_aux_native_write(struct intel_dp *intel_dp,
 		if ((ack & DP_AUX_NATIVE_REPLY_MASK) == DP_AUX_NATIVE_REPLY_ACK)
 			break;
 		else if ((ack & DP_AUX_NATIVE_REPLY_MASK) == DP_AUX_NATIVE_REPLY_DEFER)
-			udelay(100);
+			usleep_range(400, 500);
 		else
 			return -EIO;
 	}
@@ -648,7 +648,7 @@ intel_dp_aux_native_read(struct intel_dp *intel_dp,
 			return ret - 1;
 		}
 		else if ((ack & DP_AUX_NATIVE_REPLY_MASK) == DP_AUX_NATIVE_REPLY_DEFER)
-			udelay(100);
+			usleep_range(400, 500);
 		else
 			return -EIO;
 	}
Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH 1/2] drm/i915/dp: increase native aux defer retry timeout

Quoted 2 lines · Jani Nikula

Give more slack to sink devices before retrying on native aux defer. AFAICT the 100 us timeout was not based on the DP spec.

If the issue is that there is an unknown amount of time that must be waited before the device is ready, should we not try increasing the sleep value on each iteration?

If you were to do that, I would put patch 2 (which lgtm) first. -Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#3 lore raw

Re: [PATCH 1/2] drm/i915/dp: increase native aux defer retry timeout

Quoted 9 lines · Chris Wilson
Quoted 2 lines · Jani Nikula

Give more slack to sink devices before retrying on native aux defer. AFAICT the 100 us timeout was not based on the DP spec.

If the issue is that there is an unknown amount of time that must be waited before the device is ready, should we not try increasing the sleep value on each iteration?

If you were to do that, I would put patch 2 (which lgtm) first.

All of this code will change when we eventually move to the common DP aux helpers. I'd like to get such fixes in the common code after it's been merged. Diverging now makes the conversion harder.

I also thought this would be the better order bisect-wise. 2/2 first might be unnecessarily strict, possibly creating a false culprit in bisect for any other possible DP issues. Maybe that is a silly thing to worry about.

BR,
Jani.

Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
#4 lore raw

PATCH 2/2 drm/i915/dp: add native aux defer retry limit

In reply to Jani Nikula

Retrying indefinitely places too much trust on the aux implementation of the sink devices.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71267

---
 drivers/gpu/drm/i915/intel_dp.c |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +11 -4
index abbc80243234..bd1df502bc34 100644
@@ -577,6 +577,7 @@ intel_dp_aux_native_write(struct intel_dp *intel_dp,
 	uint8_t	msg[20];
 	int msg_bytes;
 	uint8_t	ack;
+	int retry;
 
 	if (WARN_ON(send_bytes > 16))
 		return -E2BIG;
@@ -588,19 +589,21 @@ intel_dp_aux_native_write(struct intel_dp *intel_dp,
 	msg[3] = send_bytes - 1;
 	memcpy(&msg[4], send, send_bytes);
 	msg_bytes = send_bytes + 4;
-	for (;;) {
+	for (retry = 0; retry < 7; retry++) {
 		ret = intel_dp_aux_ch(intel_dp, msg, msg_bytes, &ack, 1);
 		if (ret < 0)
 			return ret;
 		ack >>= 4;
 		if ((ack & DP_AUX_NATIVE_REPLY_MASK) == DP_AUX_NATIVE_REPLY_ACK)
-			break;
+			return send_bytes;
 		else if ((ack & DP_AUX_NATIVE_REPLY_MASK) == DP_AUX_NATIVE_REPLY_DEFER)
 			usleep_range(400, 500);
 		else
 			return -EIO;
 	}
-	return send_bytes;
+
+	DRM_ERROR("too many retries, giving up\n");
+	return -EIO;
 }
 
 /* Write a single byte to the aux channel in native mode */
@@ -622,6 +625,7 @@ intel_dp_aux_native_read(struct intel_dp *intel_dp,
 	int reply_bytes;
 	uint8_t ack;
 	int ret;
+	int retry;
 
 	if (WARN_ON(recv_bytes > 19))
 		return -E2BIG;
@@ -635,7 +639,7 @@ intel_dp_aux_native_read(struct intel_dp *intel_dp,
 	msg_bytes = 4;
 	reply_bytes = recv_bytes + 1;
 
-	for (;;) {
+	for (retry = 0; retry < 7; retry++) {
 		ret = intel_dp_aux_ch(intel_dp, msg, msg_bytes,
 				      reply, reply_bytes);
 		if (ret == 0)
@@ -652,6 +656,9 @@ intel_dp_aux_native_read(struct intel_dp *intel_dp,
 		else
 			return -EIO;
 	}
+
+	DRM_ERROR("too many retries, giving up\n");
+	return -EIO;
 }
 
 static int
Signature · 1 line
1.7.9.5
Reviewed-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] drm/i915/dp: add native aux defer retry limit

Quoted 6 lines · Jani Nikula

Retrying indefinitely places too much trust on the aux implementation of the sink devices.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71267

Brings us closer to the new shared dp aux helpers and generally makes sense so

on both. I also think we need a cc: stable on the 2nd on here. -Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#6 lore raw

Re: [PATCH 2/2] drm/i915/dp: add native aux defer retry limit

Quoted 8 lines · Daniel Vetter
Quoted 6 lines · Jani Nikula

Retrying indefinitely places too much trust on the aux implementation of the sink devices.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71267

Quoted 6 lines

Brings us closer to the new shared dp aux helpers and generally makes sense so

on both. I also think we need a cc: stable on the 2nd on here.

I've pulled them into -fixes, thanks for the patches. -Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#7 lore raw

Re: [PATCH 2/2] drm/i915/dp: add native aux defer retry limit

Quoted 9 lines · Daniel Vetter
Quoted 8 lines · Daniel Vetter
Quoted 6 lines · Jani Nikula

Retrying indefinitely places too much trust on the aux implementation of the sink devices.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71267

Quoted 6 lines
Quoted 6 lines

Brings us closer to the new shared dp aux helpers and generally makes sense so

on both. I also think we need a cc: stable on the 2nd on here.

This comes a bit late I know, but I think it would be the safest to cc:
stable both of them.

Jani.

Quoted 11 lines

I've pulled them into -fixes, thanks for the patches. -Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center