From patchwork Thu Jun 5 14:58:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 4306401 Return-Path: X-Original-To: patchwork-linux-fbdev@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 D4CDCBEEAA for ; Thu, 5 Jun 2014 15:00:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EBB4F20154 for ; Thu, 5 Jun 2014 14:59:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0CE042017E for ; Thu, 5 Jun 2014 14:59:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751880AbaFEO7m (ORCPT ); Thu, 5 Jun 2014 10:59:42 -0400 Received: from mail-wi0-f170.google.com ([209.85.212.170]:61591 "EHLO mail-wi0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752080AbaFEO7j (ORCPT ); Thu, 5 Jun 2014 10:59:39 -0400 Received: by mail-wi0-f170.google.com with SMTP id bs8so9813540wib.1 for ; Thu, 05 Jun 2014 07:59:36 -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:in-reply-to:references; bh=APmaqNdV3WPq03d9WT9EIksfJAkJltDT88o9LRQsSZs=; b=cxq+XmR8aMty9ZYx21HjSp3s9cDq5796E8kiQFp4vzzvb2OOfkd63MECmSvkHAr6P/ oM/q/rQV3UBcwiteMZElVH5kyY3HuH+gQ0vzU/MiSd5v9Y8PVVQ7dzG32aK2RfmxdS8K fmq6OVdgyighovhz2PiTXqtKrA0xe61ROGvhA= 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:in-reply-to :references; bh=APmaqNdV3WPq03d9WT9EIksfJAkJltDT88o9LRQsSZs=; b=a5WSavCwYXTl23ohbY27ThZz198jOMTC2aLB68wPPlcXLKWbdGT6w7eyvJfSPHkpgw bb+sBhaMLAkJ8rcKuLg8dvcjmvnmWmdhuvRtqLCBsokBaTHy7mOCYsfajUtjc1O6cw1V nYhD9IaFNr66mObk5SyVAThetoH25yiHCOuC0t4oRBMuj3IanJApSNhe6V+BtxHS70j3 p3HpyHe/FiXHkkLBBgMzCUIoUpF3zQIfcWjDd/o1ZUYV8SSEn0euSSTsqxdBg8LS2Zdc /ORdfs3YTyb+y+0QJu/cg0T3HV4dXG+ETIZ3TkT3Qq0VpcSZB7iWMCDMqckvbBw7+7wa Gk1A== X-Gm-Message-State: ALoCoQkBQzikNFC8/cOrQOP8bmL1nY5Fv9MlZF0ngB5WB0i0d3qLqbLn+MNqurULWfoiJXy1tLeg X-Received: by 10.180.189.76 with SMTP id gg12mr16620402wic.28.1401980376467; Thu, 05 Jun 2014 07:59:36 -0700 (PDT) Received: from biene.ffwll.local (84-73-67-144.dclient.hispeed.ch. [84.73.67.144]) by mx.google.com with ESMTPSA id do5sm54609673wib.16.2014.06.05.07.59.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Jun 2014 07:59:35 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Cc: DRI Development , LKML , Daniel Vetter , David Herrmann , Jean-Christophe Plagniol-Villard , Tomi Valkeinen , linux-fbdev@vger.kernel.org, Jani Nikula , Chris Wilson Subject: [PATCH 5/5] drm/i915: Kick out vga console Date: Thu, 5 Jun 2014 16:58:28 +0200 Message-Id: <1401980308-5116-5-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1401980308-5116-1-git-send-email-daniel.vetter@ffwll.ch> References: <1401980308-5116-1-git-send-email-daniel.vetter@ffwll.ch> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,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 Touching the VGA resources on an IVB EFI machine causes hard hangs when we then kick out the efifb. Ouch. Apparently this also prevents unclaimed register errors on hsw and hard machine hangs on my i855gm when trying to unbind fbcon. Also, we want this to make I915_FBDEV=n safe. v2: Rebase and pimp commit message. v3: We also need to unregister the vga console, otherwise the unbind of the fb console before module unload might resurrect it again. v4: Ignore errors when the vga console is already unregistered - this can happen when e.g. reloading i915.ko. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67813 Cc: David Herrmann Cc: Jean-Christophe Plagniol-Villard Cc: Tomi Valkeinen Cc: linux-fbdev@vger.kernel.org Cc: Jani Nikula Signed-off-by: Chris Wilson (v1) Signed-off-by: Daniel Vetter Reviewed-by: David Herrmann Acked-by: Tomi Valkeinen --- drivers/gpu/drm/i915/i915_dma.c | 43 +++++++++++++++++++++++++++++++++++++++- drivers/video/console/dummycon.c | 1 + drivers/video/console/vgacon.c | 1 + 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 27fe65ac5940..bcb66ddd649e 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c @@ -36,6 +36,8 @@ #include "i915_drv.h" #include "i915_trace.h" #include +#include +#include #include #include #include @@ -1449,6 +1451,38 @@ static void i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv) } #endif +#if !defined(CONFIG_VGA_CONSOLE) +static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv) +{ + return 0; +} +#elif !defined(CONFIG_DUMMY_CONSOLE) +static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv) +{ + return -ENODEV; +} +#else +static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv) +{ + int ret; + + DRM_INFO("Replacing VGA console driver\n"); + + console_lock(); + ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1); + if (ret == 0) { + ret = do_unregister_con_driver(&vga_con); + + /* Ignore "already unregistered". */ + if (ret == -ENODEV) + ret = 0; + } + console_unlock(); + + return ret; +} +#endif + static void i915_dump_device_info(struct drm_i915_private *dev_priv) { const struct intel_device_info *info = &dev_priv->info; @@ -1622,8 +1656,15 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) if (ret) goto out_regs; - if (drm_core_check_feature(dev, DRIVER_MODESET)) + if (drm_core_check_feature(dev, DRIVER_MODESET)) { + ret = i915_kick_out_vgacon(dev_priv); + if (ret) { + DRM_ERROR("failed to remove conflicting VGA console\n"); + goto out_gtt; + } + i915_kick_out_firmware_fb(dev_priv); + } pci_set_master(dev->pdev); diff --git a/drivers/video/console/dummycon.c b/drivers/video/console/dummycon.c index b63860f7beab..40bec8d64b0a 100644 --- a/drivers/video/console/dummycon.c +++ b/drivers/video/console/dummycon.c @@ -77,3 +77,4 @@ const struct consw dummy_con = { .con_set_palette = DUMMY, .con_scrolldelta = DUMMY, }; +EXPORT_SYMBOL_GPL(dummy_con); diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c index 9d8feac67637..84acd6223dc5 100644 --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c @@ -1440,5 +1440,6 @@ const struct consw vga_con = { .con_build_attr = vgacon_build_attr, .con_invert_region = vgacon_invert_region, }; +EXPORT_SYMBOL(vga_con); MODULE_LICENSE("GPL");