From patchwork Tue Jun 3 22:57:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 4291611 Return-Path: X-Original-To: patchwork-linux-fbdev@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 55E0D9F1D6 for ; Tue, 3 Jun 2014 22:57:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7100320254 for ; Tue, 3 Jun 2014 22:57:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C4D1520204 for ; Tue, 3 Jun 2014 22:57:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934202AbaFCW5q (ORCPT ); Tue, 3 Jun 2014 18:57:46 -0400 Received: from mail-we0-f180.google.com ([74.125.82.180]:32870 "EHLO mail-we0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932485AbaFCW5p (ORCPT ); Tue, 3 Jun 2014 18:57:45 -0400 Received: by mail-we0-f180.google.com with SMTP id q58so7665306wes.11 for ; Tue, 03 Jun 2014 15:57:44 -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=LH3fDKEEr4sTDykc17pN+EEdWqbzJL8lv2vaqRfmaXg=; b=QeK641jsUVh52HkAaF3sbTyJBIVVpx7gfinsjAEDH5RY5Q/LoKaWEcWRgV4ZLkQkPj 5Xitc/QcMD8HCcxdbJpDRmj2Wn3qiPoLywYaNGwMgA1YFxlHmtW6UUQVCs08/pwM26Xk GrPt84CEDk0z6MD1T7tz2CL9DTyrNCo3Mzca8= 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=LH3fDKEEr4sTDykc17pN+EEdWqbzJL8lv2vaqRfmaXg=; b=QkpPz4lFDlec2aPpMF6jnHFVERpHu+1+Jk/fukqNnYXmAofBm1Y5FtIT+VAMxICJcI kASHS5268hXgSekLrZmP9/wJAy0rwR5PbPd6HARG4o+m7sn9asPFebK5lLaDOrtmYv0u gKHitCHppKvDOjyOEbag0H0Lcg0UShnfYZeKGDZlcJ463KE0eDiICqZKy9xe4GWPPl8P AMiWfR8Gc0pJuCI1HnaE+fSD4CNp013q1sWuo+cIDitYyI57g45XTAul8587MWH/8c0D A2PB5e+8DXilC+fhdOyq79WFdBAnf4bn2694ZoXbFUhCzhI7GPS/HnLppAj8oTy5O7Tr ku7A== X-Gm-Message-State: ALoCoQlyrs1w59jTJlGzfkQs/etzgjFUK4Ca9+G7LNvwD4IV+8snfW5HoRVdLzlFYvEn4pvZEfYW X-Received: by 10.14.208.195 with SMTP id q43mr2097775eeo.42.1401836264192; Tue, 03 Jun 2014 15:57:44 -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 d3sm862181eem.43.2014.06.03.15.57.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Jun 2014 15:57:43 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Cc: DRI Development , Chris Wilson , David Herrmann , Jean-Christophe Plagniol-Villard , Tomi Valkeinen , linux-fbdev@vger.kernel.org, Daniel Vetter Subject: [PATCH] drm/i915: Kick out vga console Date: Wed, 4 Jun 2014 00:57:29 +0200 Message-Id: <1401836249-4922-1-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.8.1.4 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 From: Chris Wilson 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. 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 Signed-off-by: Chris Wilson (v1) Signed-off-by: Daniel Vetter --- drivers/gpu/drm/i915/i915_dma.c | 34 +++++++++++++++++++++++++++++++++- drivers/video/console/dummycon.c | 1 + drivers/video/console/vgacon.c | 1 + 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index b9159ade5e85..a4df80740b37 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 @@ -1450,6 +1452,29 @@ static void i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv) } #endif +static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv) +{ +#if !defined(CONFIG_VGA_CONSOLE) + return 0; +#else + int ret; + +#if !defined(CONFIG_DUMMY_CONSOLE) + return -ENODEV; +#endif + + 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); + 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; @@ -1623,8 +1648,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");