From patchwork Fri Jul 13 17:32:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Ciobanu X-Patchwork-Id: 10523933 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 30AC7602A0 for ; Fri, 13 Jul 2018 17:41:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 237CE28462 for ; Fri, 13 Jul 2018 17:41:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 151BA28606; Fri, 13 Jul 2018 17:41:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C44FB28462 for ; Fri, 13 Jul 2018 17:41:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3E2636F33D; Fri, 13 Jul 2018 17:41:51 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by gabe.freedesktop.org (Postfix) with ESMTPS id C1F066F33D for ; Fri, 13 Jul 2018 17:41:50 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Jul 2018 10:41:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,348,1526367600"; d="scan'208";a="72141453" Received: from nc-new.jf.intel.com (HELO linux.intel.com) ([10.54.75.147]) by fmsmga001.fm.intel.com with SMTP; 13 Jul 2018 10:40:17 -0700 Received: by linux.intel.com (sSMTP sendmail emulation); Fri, 13 Jul 2018 10:33:09 -0700 From: Nathan Ciobanu To: intel-gfx@lists.freedesktop.org Date: Fri, 13 Jul 2018 10:32:15 -0700 Message-Id: <1531503135-19153-1-git-send-email-nathan.d.ciobanu@linux.intel.com> X-Mailer: git-send-email 2.7.4 Subject: [Intel-gfx] [PATCH] drm/i915/dp: Give up link training clock recovery after 10 failed attempts X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dhinakaran.pandiyan@intel.com MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Limit the link training clock recovery loop to 10 failed attempts at LANEx_CR_DONE per DP 1.4 spec. Some USB-C MST hubs cause us to get stuck in this loop on hot-plugging indefinitely as drm_dp_clock_recovery_ok() never returns true and none of the other conditions occur. Signed-off-by: Nathan Ciobanu --- drivers/gpu/drm/i915/intel_dp_link_training.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_dp_link_training.c b/drivers/gpu/drm/i915/intel_dp_link_training.c index 4da6e33c7fa1..66c1a70343ba 100644 --- a/drivers/gpu/drm/i915/intel_dp_link_training.c +++ b/drivers/gpu/drm/i915/intel_dp_link_training.c @@ -129,7 +129,7 @@ static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp) intel_dp_link_training_clock_recovery(struct intel_dp *intel_dp) { uint8_t voltage; - int voltage_tries, max_vswing_tries; + int voltage_tries, max_vswing_tries, cr_tries; uint8_t link_config[2]; uint8_t link_bw, rate_select; @@ -172,6 +172,7 @@ static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp) voltage_tries = 1; max_vswing_tries = 0; + cr_tries = 0; for (;;) { uint8_t link_status[DP_LINK_STATUS_SIZE]; @@ -215,6 +216,11 @@ static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp) if (intel_dp_link_max_vswing_reached(intel_dp)) ++max_vswing_tries; + if (cr_tries == 9) { + DRM_ERROR("Failed clock recovery 10 times, giving up!\n"); + return false; + } + ++cr_tries; } }