From patchwork Fri Mar 21 22:22:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 3876611 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 33065BF540 for ; Fri, 21 Mar 2014 22:44:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 487D320266 for ; Fri, 21 Mar 2014 22:44:38 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 4971B2025B for ; Fri, 21 Mar 2014 22:44:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 872F86E463; Fri, 21 Mar 2014 15:44:36 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com [74.125.83.54]) by gabe.freedesktop.org (Postfix) with ESMTP id EC5536E463 for ; Fri, 21 Mar 2014 15:44:35 -0700 (PDT) Received: by mail-ee0-f54.google.com with SMTP id d49so2293340eek.41 for ; Fri, 21 Mar 2014 15:44:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id; bh=9u06D/Sne/5fSxi096Msj5QL4EKfV+ijCUsmkWnaQ20=; b=FK87usNqxbUL92jqDXrse2rBix4DnEcPOKorpoq3NINf8Ssiy1UAnjfxZTlLlDVCyf WjpZ4Qw7pIr7+TRjY4gWCLgd2vFvDUTiLv7amdwkvwv3ma+IWPDNsPutfKaHjhwq/m0i 1853n2pXMUuH+a6w7Xe3qq/fj6Xa82+TBhdPg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=9u06D/Sne/5fSxi096Msj5QL4EKfV+ijCUsmkWnaQ20=; b=Bj03/PlmkljC8omzPVFfceGFGEc319+fdPZ4ojJn11g6f/Opv8mmSOAnJsTQ3nETB9 pq0Yi71iP+/zpdWvNyFTuQ0ILaUmuZ11KLNdkQcgfC7w/hiMfIgdoEYpgdT1p49hJOQd 0s/pF1fUjib1qw6QzvMPAIG3ts0XSlYHx66fUTsRkeuvHgAfSRJTEynU+IX7bCu6cQH9 jenLGhxeFgpGYcW9RMWvdWGETYSWP1oQcOC3SJKq6/7UBTR9hrov6nP4VgAF9LVl+WAI yVuRXBEWq8Y6Yiqs3KQP9NOKj3YusU5kZpAB7ELBLCLQGrmYwpViHeF1cAgbWOmJQL8l J7sw== X-Gm-Message-State: ALoCoQlhcH4NQJY+gpJRPeMn7Z9NhczYmKm8AKwfnzC/lcVIEcYvuh+4u5HlSXvtAQRbcyGgggf3 X-Received: by 10.15.49.65 with SMTP id i41mr415631eew.87.1395441875111; Fri, 21 Mar 2014 15:44:35 -0700 (PDT) Received: from wespe.ffwll.local (84-73-67-144.dclient.hispeed.ch. [84.73.67.144]) by mx.google.com with ESMTPSA id q49sm14641026eem.34.2014.03.21.15.44.33 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Mar 2014 15:44:34 -0700 (PDT) From: Daniel Vetter To: DRI Development Date: Fri, 21 Mar 2014 23:22:35 +0100 Message-Id: <1395440556-5850-1-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.8.1.4 Cc: Daniel Vetter , Intel Graphics Development Subject: [Intel-gfx] [PATCH 1/2] drm/i915: add locking to fixed panel edid probing X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_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 With the recent addition of locking checks in commit 62ff94a5492175759546f8bc61383189d6b49122 Author: Daniel Vetter AuthorDate: Thu Jan 23 22:18:47 2014 +0100 drm/crtc-helper: remove LOCKING from kerneldoc drm_add_edid_modes started to WARN about the mode_config.mutex not being held in the lvds and dp initialization code. Now since this is init code locking is fairly redudant if it wouldn't be for the drm core registering sysfs files a bit early. And the locking WARNINGs nicely enforce that indeed all access to the mode lists are properly protected. And a full audit shows that only i915 and gma500 touch the modes lists at init time. Hence I've opted to wrap up this entire mode detection sequence for fixed panels with the mode_config mutex for both lvds and edp outputs. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/i915/intel_dp.c | 2 ++ drivers/gpu/drm/i915/intel_lvds.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 59ee4dcfebee..6f767e522b3f 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -3646,6 +3646,7 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp, /* We now know it's not a ghost, init power sequence regs. */ intel_dp_init_panel_power_sequencer_registers(dev, intel_dp, power_seq); + mutex_lock(&dev->mode_config.mutex); edid = drm_get_edid(connector, &intel_dp->aux.ddc); if (edid) { if (drm_add_edid_modes(connector, edid)) { @@ -3676,6 +3677,7 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp, if (fixed_mode) fixed_mode->type |= DRM_MODE_TYPE_PREFERRED; } + mutex_unlock(&dev->mode_config.mutex); intel_panel_init(&intel_connector->panel, fixed_mode, NULL); intel_panel_setup_backlight(connector); diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index ef5e5661efb2..f1ecf916474a 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c @@ -1002,6 +1002,7 @@ void intel_lvds_init(struct drm_device *dev) * Attempt to get the fixed panel mode from DDC. Assume that the * preferred mode is the right one. */ + mutex_lock(&dev->mode_config.mutex); edid = drm_get_edid(connector, intel_gmbus_get_adapter(dev_priv, pin)); if (edid) { if (drm_add_edid_modes(connector, edid)) { @@ -1095,6 +1096,8 @@ void intel_lvds_init(struct drm_device *dev) goto failed; out: + mutex_unlock(&dev->mode_config.mutex); + lvds_encoder->is_dual_link = compute_is_dual_link_lvds(lvds_encoder); DRM_DEBUG_KMS("detected %s-link lvds configuration\n", lvds_encoder->is_dual_link ? "dual" : "single"); @@ -1123,6 +1126,8 @@ out: return; failed: + mutex_unlock(&dev->mode_config.mutex); + DRM_DEBUG_KMS("No LVDS modes found, disabling.\n"); drm_connector_cleanup(connector); drm_encoder_cleanup(encoder);