diff mbox

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

Message ID ea56be132324f590d05508887e94962393a95e0d.1392111874.git.jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jani Nikula Feb. 11, 2014, 9:52 a.m. UTC
Retrying indefinitely places too much trust on the aux implementation of
the sink devices.

Reported-by: Daniel Martin <consume.noise@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71267
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

Comments

Daniel Vetter Feb. 11, 2014, 2:17 p.m. UTC | #1
On Tue, Feb 11, 2014 at 10:52 AM, Jani Nikula <jani.nikula@intel.com> wrote:
> Retrying indefinitely places too much trust on the aux implementation of
> the sink devices.
>
> Reported-by: Daniel Martin <consume.noise@gmail.com>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71267
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

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

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

on both. I also think we need a cc: stable on the 2nd on here.
-Daniel
Daniel Vetter Feb. 13, 2014, 8:45 a.m. UTC | #2
On Tue, Feb 11, 2014 at 03:17:58PM +0100, Daniel Vetter wrote:
> On Tue, Feb 11, 2014 at 10:52 AM, Jani Nikula <jani.nikula@intel.com> wrote:
> > Retrying indefinitely places too much trust on the aux implementation of
> > the sink devices.
> >
> > Reported-by: Daniel Martin <consume.noise@gmail.com>
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71267
> > Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> 
> Brings us closer to the new shared dp aux helpers and generally makes
> sense so
> 
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> 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
Jani Nikula Feb. 13, 2014, 2:17 p.m. UTC | #3
On Thu, 13 Feb 2014, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Tue, Feb 11, 2014 at 03:17:58PM +0100, Daniel Vetter wrote:
>> On Tue, Feb 11, 2014 at 10:52 AM, Jani Nikula <jani.nikula@intel.com> wrote:
>> > Retrying indefinitely places too much trust on the aux implementation of
>> > the sink devices.
>> >
>> > Reported-by: Daniel Martin <consume.noise@gmail.com>
>> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71267
>> > Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>> 
>> Brings us closer to the new shared dp aux helpers and generally makes
>> sense so
>> 
>> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>> 
>> 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.

>
> I've pulled them into -fixes, thanks for the patches.
> -Daniel
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - http://blog.ffwll.ch
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://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 abbc80243234..bd1df502bc34 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -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