From patchwork Fri Nov 22 08:36:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 3221741 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id ED6B29F3A0 for ; Fri, 22 Nov 2013 08:36:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D88FD20715 for ; Fri, 22 Nov 2013 08:36:13 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id B33D920714 for ; Fri, 22 Nov 2013 08:36:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E310CFADBE; Fri, 22 Nov 2013 00:36:11 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by gabe.freedesktop.org (Postfix) with ESMTP id 211DEFADBE for ; Fri, 22 Nov 2013 00:36:10 -0800 (PST) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 295EBA79B1 for ; Fri, 22 Nov 2013 09:36:09 +0100 (CET) Date: Fri, 22 Nov 2013 09:36:09 +0100 Message-ID: From: Takashi Iwai To: intel-gfx@lists.freedesktop.org User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Subject: [Intel-gfx] [PATCH] drm/i915: Retry reading DPCD when bogus values are read X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP I got kernel WARNINGs frequently on Haswell laptops complaining about invalid max DP link bw. With drm.debug=0x0e, it turned out that the obtained DPCD is utterly bogus when it happens: [drm:intel_dp_get_dpcd], DPCD: 4d 4d 4d 4d 4d 4d 4d 4d 4d 4d 4d 4d 4d 4d 4d This seems happening intermittently without plug state changes and even after the first few reads succeeded. As a workaround, add a sanity check for such bogus values and retry reading if it hits. Signed-off-by: Takashi Iwai --- drivers/gpu/drm/i915/intel_dp.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index eb8139da9763..f596353da557 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -2792,13 +2792,26 @@ intel_dp_get_dpcd(struct intel_dp *intel_dp) struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); struct drm_device *dev = dig_port->base.base.dev; struct drm_i915_private *dev_priv = dev->dev_private; - + int retry = 0; char dpcd_hex_dump[sizeof(intel_dp->dpcd) * 3]; + again: if (intel_dp_aux_native_read_retry(intel_dp, 0x000, intel_dp->dpcd, sizeof(intel_dp->dpcd)) == 0) return false; /* aux transfer failed */ + /* sanity check: sometimes DPCD contains a series of same bogus value + * even though the above returned success. Retry reading in that case. + */ + if (intel_dp->dpcd[0]) { + int i; + for (i = 1; i < sizeof(intel_dp->dpcd); i++) + if (intel_dp->dpcd[i] != intel_dp->dpcd[0]) + break; + if (i >= sizeof(intel_dp->dpcd) && retry++ < 2) + goto again; + } + hex_dump_to_buffer(intel_dp->dpcd, sizeof(intel_dp->dpcd), 32, 1, dpcd_hex_dump, sizeof(dpcd_hex_dump), false); DRM_DEBUG_KMS("DPCD: %s\n", dpcd_hex_dump);