From patchwork Thu Jan 23 14:15:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Herrmann X-Patchwork-Id: 3529151 Return-Path: X-Original-To: patchwork-dri-devel@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 2A8A49F1C3 for ; Thu, 23 Jan 2014 14:17:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 28B2220108 for ; Thu, 23 Jan 2014 14:16:59 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 16D04200F0 for ; Thu, 23 Jan 2014 14:16:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 125ECFBF8C; Thu, 23 Jan 2014 06:16:55 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com [74.125.82.45]) by gabe.freedesktop.org (Postfix) with ESMTP id 1491AFBF7D for ; Thu, 23 Jan 2014 06:16:03 -0800 (PST) Received: by mail-wg0-f45.google.com with SMTP id n12so1559821wgh.12 for ; Thu, 23 Jan 2014 06:16:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=V4aU/N9wsA98G2DX/2TaY3S8cjW2GhUjD2P5eav8qUE=; b=OufDuIebUwMZgbPxHuaWDzth1DEYu+7uKCdgdmBJjlFZelZ1U2JsP2DBWOkqVPrWLq rgYsAemFk1AzhRF91EhBDZMWQoaTOBWcqov4mB+tg5b99Cq8XrkkMSdtmln6p5e1bXOV OWcpgrv9uh35q6dOZDgGg8JFqTz0p4Qk2F3O6/xCw+ZRHFvDbna5XBl5bOrVpyH61YAa BKHaEMio48O/TNaqSsnjDZJOh3qfxFXh4EqCmjLIGy31vU2m9hOmLqT/MGcqdlSwfW9S ziUU8ej7GrZkDeSeqCYqTDcfflHeN1Y0BL2zdtluELqzAy/Un8LOcCccZpAGiY9EKn28 gjrA== X-Received: by 10.194.201.65 with SMTP id jy1mr6689473wjc.43.1390486563042; Thu, 23 Jan 2014 06:16:03 -0800 (PST) Received: from david-ub.localdomain (stgt-5f71be19.pool.mediaWays.net. [95.113.190.25]) by mx.google.com with ESMTPSA id ci4sm22667871wjc.21.2014.01.23.06.16.00 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 23 Jan 2014 06:16:02 -0800 (PST) From: David Herrmann To: dri-devel@lists.freedesktop.org Subject: [PATCH 08/11] drm/i915: remove sysfbs early Date: Thu, 23 Jan 2014 15:15:00 +0100 Message-Id: <1390486503-1504-9-git-send-email-dh.herrmann@gmail.com> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1390486503-1504-1-git-send-email-dh.herrmann@gmail.com> References: <1390486503-1504-1-git-send-email-dh.herrmann@gmail.com> Cc: linux-fbdev@vger.kernel.org, Daniel Vetter , linux-kernel@vger.kernel.org, Tomi Valkeinen , Ingo Molnar X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 Once we allow DRM drivers for system-framebuffers, we need to evict such devices *before* probing the real driver. A simple call to sysfb_claim() does this and remove_conflicting_framebuffers() implicitly calls this. However, it causes the sysfb device to be unloaded and thus locks drm_global_mutex. remove_conflicting_framebuffers() must be called from outside any ->load() callback to avoid a dead-lock. All other DRM drivers call this right before probing the pci-device, which is fine. For i915 we need to figure out the apertures before we can evict fw-framebuffers, though. This turns out to be not as easy as you might think, so lets just evict all sysfbs for now before loading i915. A proper fix would be to make DRM code allow parallel device probing. That's not going to happen soon, so be safe and make i915 evict all sysfbs. Signed-off-by: David Herrmann --- drivers/gpu/drm/i915/i915_drv.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 43245b3..ceb875a 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -838,6 +838,12 @@ static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) driver.driver_features &= ~(DRIVER_USE_AGP); + /* We cannot call remove_conflicting_framebuffers() here as we cannot + * easily figure out the apertures here. So lets just remove all + * system-framebuffers early so we don't deadlock later when calling it + * with drm_global_mutex held. */ + sysfb_claim(NULL, SYSFB_CLAIM_ALL); + return drm_get_pci_dev(pdev, ent, &driver); }