diff options
| author | Jani Nikula <jani.nikula@intel.com> | 2014-02-11 04:52:05 -0500 |
|---|---|---|
| committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-02-13 10:12:42 -0500 |
| commit | f51a44b9a6c4982cc25bfb3727de9bb893621ebc (patch) | |
| tree | eb46d6d35cf355f7f06533ff9ec91d69ccfbd3f9 | |
| parent | 04eada25d1f72efdecd32d702706594f81de65d5 (diff) | |
drm/i915/dp: add native aux defer retry limit
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>
Cc: stable@vger.kernel.org
Tested-by: Theodore Ts'o <tytso@mit.edu>
Tested-by: Sree Harsha Totakura <freedesktop@h.totakura.in>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
| -rw-r--r-- | drivers/gpu/drm/i915/intel_dp.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index c36960488c89..57552eb386b0 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
| @@ -537,6 +537,7 @@ intel_dp_aux_native_write(struct intel_dp *intel_dp, | |||
| 537 | uint8_t msg[20]; | 537 | uint8_t msg[20]; |
| 538 | int msg_bytes; | 538 | int msg_bytes; |
| 539 | uint8_t ack; | 539 | uint8_t ack; |
| 540 | int retry; | ||
| 540 | 541 | ||
| 541 | if (WARN_ON(send_bytes > 16)) | 542 | if (WARN_ON(send_bytes > 16)) |
| 542 | return -E2BIG; | 543 | return -E2BIG; |
| @@ -548,19 +549,21 @@ intel_dp_aux_native_write(struct intel_dp *intel_dp, | |||
| 548 | msg[3] = send_bytes - 1; | 549 | msg[3] = send_bytes - 1; |
| 549 | memcpy(&msg[4], send, send_bytes); | 550 | memcpy(&msg[4], send, send_bytes); |
| 550 | msg_bytes = send_bytes + 4; | 551 | msg_bytes = send_bytes + 4; |
| 551 | for (;;) { | 552 | for (retry = 0; retry < 7; retry++) { |
| 552 | ret = intel_dp_aux_ch(intel_dp, msg, msg_bytes, &ack, 1); | 553 | ret = intel_dp_aux_ch(intel_dp, msg, msg_bytes, &ack, 1); |
| 553 | if (ret < 0) | 554 | if (ret < 0) |
| 554 | return ret; | 555 | return ret; |
| 555 | ack >>= 4; | 556 | ack >>= 4; |
| 556 | if ((ack & DP_AUX_NATIVE_REPLY_MASK) == DP_AUX_NATIVE_REPLY_ACK) | 557 | if ((ack & DP_AUX_NATIVE_REPLY_MASK) == DP_AUX_NATIVE_REPLY_ACK) |
| 557 | break; | 558 | return send_bytes; |
| 558 | else if ((ack & DP_AUX_NATIVE_REPLY_MASK) == DP_AUX_NATIVE_REPLY_DEFER) | 559 | else if ((ack & DP_AUX_NATIVE_REPLY_MASK) == DP_AUX_NATIVE_REPLY_DEFER) |
| 559 | usleep_range(400, 500); | 560 | usleep_range(400, 500); |
| 560 | else | 561 | else |
| 561 | return -EIO; | 562 | return -EIO; |
| 562 | } | 563 | } |
| 563 | return send_bytes; | 564 | |
| 565 | DRM_ERROR("too many retries, giving up\n"); | ||
| 566 | return -EIO; | ||
| 564 | } | 567 | } |
| 565 | 568 | ||
| 566 | /* Write a single byte to the aux channel in native mode */ | 569 | /* Write a single byte to the aux channel in native mode */ |
| @@ -582,6 +585,7 @@ intel_dp_aux_native_read(struct intel_dp *intel_dp, | |||
| 582 | int reply_bytes; | 585 | int reply_bytes; |
| 583 | uint8_t ack; | 586 | uint8_t ack; |
| 584 | int ret; | 587 | int ret; |
| 588 | int retry; | ||
| 585 | 589 | ||
| 586 | if (WARN_ON(recv_bytes > 19)) | 590 | if (WARN_ON(recv_bytes > 19)) |
| 587 | return -E2BIG; | 591 | return -E2BIG; |
| @@ -595,7 +599,7 @@ intel_dp_aux_native_read(struct intel_dp *intel_dp, | |||
| 595 | msg_bytes = 4; | 599 | msg_bytes = 4; |
| 596 | reply_bytes = recv_bytes + 1; | 600 | reply_bytes = recv_bytes + 1; |
| 597 | 601 | ||
| 598 | for (;;) { | 602 | for (retry = 0; retry < 7; retry++) { |
| 599 | ret = intel_dp_aux_ch(intel_dp, msg, msg_bytes, | 603 | ret = intel_dp_aux_ch(intel_dp, msg, msg_bytes, |
| 600 | reply, reply_bytes); | 604 | reply, reply_bytes); |
| 601 | if (ret == 0) | 605 | if (ret == 0) |
| @@ -612,6 +616,9 @@ intel_dp_aux_native_read(struct intel_dp *intel_dp, | |||
| 612 | else | 616 | else |
| 613 | return -EIO; | 617 | return -EIO; |
| 614 | } | 618 | } |
| 619 | |||
| 620 | DRM_ERROR("too many retries, giving up\n"); | ||
| 621 | return -EIO; | ||
| 615 | } | 622 | } |
| 616 | 623 | ||
| 617 | static int | 624 | static int |
