Commit 04ea7f8d authored by Jani Nikula's avatar Jani Nikula Committed by Jiri Slaby

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

commit f51a44b9 upstream.

Retrying indefinitely places too much trust on the aux implementation of
the sink devices.
Reported-by: default avatarDaniel Martin <consume.noise@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71267Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Tested-by: default avatarTheodore Ts'o <tytso@mit.edu>
Tested-by: default avatarSree Harsha Totakura <freedesktop@h.totakura.in>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
parent 4a036dd4
......@@ -450,6 +450,7 @@ intel_dp_aux_native_write(struct intel_dp *intel_dp,
uint8_t msg[20];
int msg_bytes;
uint8_t ack;
int retry;
intel_dp_check_edp(intel_dp);
if (send_bytes > 16)
......@@ -460,18 +461,20 @@ 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;
if ((ack & AUX_NATIVE_REPLY_MASK) == AUX_NATIVE_REPLY_ACK)
break;
return send_bytes;
else if ((ack & AUX_NATIVE_REPLY_MASK) == 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 */
......@@ -493,6 +496,7 @@ intel_dp_aux_native_read(struct intel_dp *intel_dp,
int reply_bytes;
uint8_t ack;
int ret;
int retry;
intel_dp_check_edp(intel_dp);
msg[0] = AUX_NATIVE_READ << 4;
......@@ -503,7 +507,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)
......@@ -520,6 +524,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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment