From patchwork Wed Oct 2 09:25:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Herrmann X-Patchwork-Id: 2973841 Return-Path: X-Original-To: patchwork-dri-devel@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 14B07BFF0B for ; Wed, 2 Oct 2013 09:33:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4927B2037F for ; Wed, 2 Oct 2013 09:33:50 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 282E2201FD for ; Wed, 2 Oct 2013 09:33:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1E0B9E7304 for ; Wed, 2 Oct 2013 02:33:49 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ee0-f45.google.com (mail-ee0-f45.google.com [74.125.83.45]) by gabe.freedesktop.org (Postfix) with ESMTP id 0EF66E71BB for ; Wed, 2 Oct 2013 02:25:43 -0700 (PDT) Received: by mail-ee0-f45.google.com with SMTP id c50so253109eek.18 for ; Wed, 02 Oct 2013 02:25:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=Z4zj2SLn38+hsrfVHlSaptniNPyVwZis0mosiTC0iPA=; b=TjZa7A+2jM4MRRnfF6549DL2/p2zQ1BZc/16WYFdaLQLt5ZcReAOnkdt/JcKdj5eIw YV7flNelhOhnyv3G6dazarkUxcmz2VZDEBmEXYuKMiePD+w57Qo8nJ772FTpAGEA3fCA o241W9iVdsbT8uJUNE75etAHuGIUuvSCyjrBUPuz4++/vIpPT12BAg/f5BMHPcgbFQ3F AxNgRWVB8AzrUmzQkgsxQ0Jmnh742urR70vCA1+WzgCainiZQjpLTMy0YBg0XgRZJsgV rAKlE1J5TF3YbyNRJWlFB+eGLvobR4UUKrGNuz2H3yqAucrZUtx1uuDaWdzXmvjsQcTr hKxQ== X-Received: by 10.15.32.7 with SMTP id z7mr887053eeu.78.1380705943219; Wed, 02 Oct 2013 02:25:43 -0700 (PDT) Received: from localhost.localdomain (stgt-5f71b885.pool.mediaWays.net. [95.113.184.133]) by mx.google.com with ESMTPSA id n48sm1589948eeg.17.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 02 Oct 2013 02:25:42 -0700 (PDT) From: David Herrmann To: dri-devel@lists.freedesktop.org Subject: [PATCH] vgacon: prevent vgacon from reloading Date: Wed, 2 Oct 2013 11:25:44 +0200 Message-Id: <1380705944-4155-1-git-send-email-dh.herrmann@gmail.com> X-Mailer: git-send-email 1.8.4 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+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-4.7 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 If vgacon got unloaded for any reason, we can never be sure that vga registers are still accessible. fbdev/DRM/xycon might reconfigure graphics devices in a way that prevents vgacon from working again. Therefore, inhibit rebinding vgacon. Note that this _might_ break use-cases where users unbind vgacon and then rebind it without breaking VGA mode. However, this seems to be rarely useful and given that several GPUs cannot even restore VGA mode it seems safer to prevent it entirely. This also adds a dependency to dummy_con as the VT layer does not allow failure during console-rebinding. Hence, we need a guarantee that dummy_con is available. To avoid recursive Kconfig dependencies, we move the vga-con/sgi-con conflict directly into VGA_CONSOLE and make DUMMY_CONSOLE always active. Signed-off-by: David Herrmann --- drivers/video/console/Kconfig | 2 +- drivers/video/console/vgacon.c | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig index 846caab..173f1e7 100644 --- a/drivers/video/console/Kconfig +++ b/drivers/video/console/Kconfig @@ -8,6 +8,7 @@ config VGA_CONSOLE bool "VGA text console" if EXPERT || !X86 depends on !4xx && !8xx && !SPARC && !M68K && !PARISC && !FRV && \ !SUPERH && !BLACKFIN && !AVR32 && !MN10300 && !CRIS && \ + SGI_NEWPORT_CONSOLE!=y && DUMMY_CONSOLE && \ (!ARM || ARCH_FOOTBRIDGE || ARCH_INTEGRATOR || ARCH_NETWINDER) default y help @@ -71,7 +72,6 @@ config SGI_NEWPORT_CONSOLE config DUMMY_CONSOLE bool - depends on VGA_CONSOLE!=y || SGI_NEWPORT_CONSOLE!=y default y config DUMMY_CONSOLE_COLUMNS diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c index 9d8feac..d598af6 100644 --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c @@ -368,6 +368,7 @@ static int vgacon_scrolldelta(struct vc_data *c, int lines) static const char *vgacon_startup(void) { + static bool vgacon_inhibit; const char *display_desc = NULL; u16 saved1, saved2; volatile u16 *p; @@ -375,14 +376,15 @@ static const char *vgacon_startup(void) if (screen_info.orig_video_isVGA == VIDEO_TYPE_VLFB || screen_info.orig_video_isVGA == VIDEO_TYPE_EFI) { no_vga: -#ifdef CONFIG_DUMMY_CONSOLE conswitchp = &dummy_con; return conswitchp->con_startup(); -#else - return NULL; -#endif } + /* fbdev/DRM can disable VGA-mode so prevent reloading */ + if (vgacon_inhibit) + goto no_vga; + vgacon_inhibit = true; + /* boot_params.screen_info initialized? */ if ((screen_info.orig_video_mode == 0) && (screen_info.orig_video_lines == 0) &&