From patchwork Mon Nov 3 13:00:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dariusz Gadomski X-Patchwork-Id: 406174 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 63E3214003E; Tue, 4 Nov 2014 00:01:54 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1XlHGX-0002qQ-It; Mon, 03 Nov 2014 13:01:49 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1XlHFy-0002ak-0o for kernel-team@lists.ubuntu.com; Mon, 03 Nov 2014 13:01:14 +0000 Received: from 89-76-229-51.dynamic.chello.pl ([89.76.229.51] helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1XlHFx-0007IZ-Md for kernel-team@lists.ubuntu.com; Mon, 03 Nov 2014 13:01:13 +0000 From: Dariusz Gadomski To: kernel-team@lists.ubuntu.com Subject: [PATCH 16/18] drm/i915: lock around link status and link training. Date: Mon, 3 Nov 2014 14:00:59 +0100 Message-Id: <1415019661-19435-17-git-send-email-dariusz.gadomski@canonical.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1415019661-19435-1-git-send-email-dariusz.gadomski@canonical.com> References: <1415019661-19435-1-git-send-email-dariusz.gadomski@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com From: Dave Airlie BugLink: https://bugs.launchpad.net/bugs/1104230 We need to take the connection mutex around the link status check for non-MST case, but also around the MST link training on short HPDs. I suspect we actually should have a dpcd lock in the future as well, that just lock the local copies of dpcd and flags stored from that. Reviewed-by: Daniel Vetter Signed-off-by: Dave Airlie (cherry picked from commit 1c306fcd8a18519e4247060dd85a534c6ce29c1d upstream) Signed-off-by: Dariusz Gadomski --- drivers/gpu/drm/i915/intel_dp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 52dd196..b17e7e7 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -3400,11 +3400,13 @@ intel_dp_check_mst_status(struct intel_dp *intel_dp) void intel_dp_check_link_status(struct intel_dp *intel_dp) { + struct drm_device *dev = intel_dp_to_dev(intel_dp); struct intel_encoder *intel_encoder = &dp_to_dig_port(intel_dp)->base; u8 sink_irq_vector; u8 link_status[DP_LINK_STATUS_SIZE]; - /* FIXME: This access isn't protected by any locks. */ + WARN_ON(!drm_modeset_is_locked(&dev->mode_config.connection_mutex)); + if (!intel_encoder->connectors_active) return; @@ -3931,7 +3933,9 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd) * we'll check the link status via the normal hot plug path later - * but for short hpds we should check it now */ + drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); intel_dp_check_link_status(intel_dp); + drm_modeset_unlock(&dev->mode_config.connection_mutex); } } return false;