From patchwork Wed Jul 19 12:39:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 122607 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2417219vqt; Wed, 19 Jul 2023 05:58:28 -0700 (PDT) X-Google-Smtp-Source: APBJJlEpw565lJUCD65LI1YQGHLyCnC7E2rU4qepRk2J4kadE7k2PhLLJtCuCCZWC3O9RccZmNMx X-Received: by 2002:aa7:d615:0:b0:51e:1643:5ad0 with SMTP id c21-20020aa7d615000000b0051e16435ad0mr2490371edr.8.1689771508258; Wed, 19 Jul 2023 05:58:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689771508; cv=none; d=google.com; s=arc-20160816; b=FztmSrcEljdDY5JNRAmRf1FYrGo5wa84VrP+zm1bgxTmDOxN9nmLzqqDBNKXcC2XRC hM27N5RD1UOtV0N9FyPpH5ZU1zZlUXa8L4C+KQP6crs3s42IC8Gd1lCdLWv7tOSu0TzV kT7NeB4GdpvWHCFEK5/pt7UfJ38FgpCsB2LKJl2bXT+oJVg5AbMOvVJAvah2TDuRYVJL Qzy8tRXtVfHaHcxAaBpOk2HBnX2NEbGBtXa9lt7a6nl1diBU+CGCdHNZ+jc036K4a9q2 1p7ALaajkyxhRIcGQqUoP4gJgKhJrOPqFSMyLNIjLHdcEQDDX7PR2Q4i3KExtfbr3oiI HmOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=B5PJfXzia2A2Q+HTsWHVf9AO+h0BAIdhIjCOyGJuJ3I=; fh=4WFkd0SKC531xjglIUi33C1n6bFXFguLuCICsINSE7Y=; b=UxsCAg+CNH9PzWBMra1qn4Vaog8p4GOLiinJGGKBE5qX66FIZ84wOoAwAMQ1DrsJR7 dn4LwLUO/5WZotZC0DTurgRoFrmoCVTc1ME8x8wHwPVz/+o1N7KiD/tPEH+Jvs7sMIWU AkDf9IipWwHWaAk5lRc05SSKvwHC6mDC8k/T4WVB2qMlcoM8mmkn/LGFdtIqOd9cFyY9 cp4UjSVMkpg7rEl1niDLf67syTUdI2DUxysmHZZc1j4fY1hlmeCD5xicj9eYJIXcOh/9 P6nXKS2HGKtwg+nw3D7R7qG2k3ZCmW/9I5GJURwRFOJisnA/vAX9VBtYvBIIGjQY6phi hi9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kdnJnXZB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m15-20020aa7c48f000000b0051ddf359991si2959959edq.344.2023.07.19.05.58.03; Wed, 19 Jul 2023 05:58:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kdnJnXZB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229804AbjGSMkY (ORCPT + 99 others); Wed, 19 Jul 2023 08:40:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229933AbjGSMkT (ORCPT ); Wed, 19 Jul 2023 08:40:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BD7E172A; Wed, 19 Jul 2023 05:40:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8D08061638; Wed, 19 Jul 2023 12:40:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91CEEC433C7; Wed, 19 Jul 2023 12:40:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689770415; bh=2Mh2IaKPPNhzRZYphoca+mrfCEIgr8Qop4RzoTlfeXY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kdnJnXZBopbW8ulNYqpU/DMRLnFvRdebMFTyM5ZbUz9uphIDnfM1bwXcJy4q98hV1 YvkNVBvKC8yohU9kFV2O9rZzsV6BHo+Gp7r57jtuzwT2EGjbSI3SGel3uViBRPEhBb ip/PIfXyASkYOykVmYw18TlYUqquf6JTgcIuRtHIZikFIK7mW6+f54j0fN2gBg6Mo9 33y9RPC8lI3s6GaxlRiG4j0ziax6mnCs9g+lTmKKsuJzAhAhhCpC6roDYXyvQfy8DJ QnH2m6TVUl1aV/rdXInE2gIEgG+xSamAjI3mkmHoaGPYauUBjJf5u1R0YwiqgRL3Hb 2sr2V6misyjqQ== From: Arnd Bergmann To: linux-fbdev@vger.kernel.org, Thomas Zimmermann , Helge Deller , Javier Martinez Canillas Cc: Arnd Bergmann , "David S. Miller" , "K. Y. Srinivasan" , Ard Biesheuvel , Borislav Petkov , Brian Cain , Catalin Marinas , Christophe Leroy , Daniel Vetter , Dave Hansen , David Airlie , Deepak Rawat , Dexuan Cui , Dinh Nguyen , Greg Kroah-Hartman , Guo Ren , Haiyang Zhang , Huacai Chen , Ingo Molnar , John Paul Adrian Glaubitz , Khalid Aziz , Linus Walleij , Matt Turner , Max Filippov , Michael Ellerman , Nicholas Piggin , Palmer Dabbelt , Russell King , Thomas Bogendoerfer , Thomas Gleixner , WANG Xuerui , Wei Liu , Will Deacon , x86@kernel.org, linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-efi@vger.kernel.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-hyperv@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH v2 1/9] vgacon: rework Kconfig dependencies Date: Wed, 19 Jul 2023 14:39:36 +0200 Message-Id: <20230719123944.3438363-2-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230719123944.3438363-1-arnd@kernel.org> References: <20230719123944.3438363-1-arnd@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771853849288773959 X-GMAIL-MSGID: 1771853849288773959 From: Arnd Bergmann The list of dependencies here is phrased as an opt-out, but this is missing a lot of architectures that don't actually support VGA consoles, and some of the entries are stale: - powerpc used to support VGA consoles in the old arch/ppc codebase, but the merged arch/powerpc never did - arm lists footbridge, integrator and netwinder, but netwinder is actually part of footbridge, and integrator does not appear to have an actual VGA hardware, or list it in its ATAG or DT. - mips has a few platforms (malta, sibyte, and sni) that initialize screen_info, on everything else the console is selected but cannot actually work. - csky, hexgagon, loongarch, nios2, riscv and xtensa are not listed in the opt-out table and declare a screen_info to allow building vga_con, but this cannot work because the console is never selected. Replace this with an opt-in table that lists only the platforms that remain. This is effectively x86, plus a couple of historic workstation and server machines that reused parts of the x86 system architecture. Reviewed-by: Javier Martinez Canillas Reviewed-by: Thomas Zimmermann Signed-off-by: Arnd Bergmann Reviewed-by: Khalid Aziz --- drivers/video/console/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig index 1b5a319971ed0..6af90db6d2da9 100644 --- a/drivers/video/console/Kconfig +++ b/drivers/video/console/Kconfig @@ -7,9 +7,9 @@ menu "Console display driver support" config VGA_CONSOLE bool "VGA text console" if EXPERT || !X86 - depends on !4xx && !PPC_8xx && !SPARC && !M68K && !PARISC && !SUPERH && \ - (!ARM || ARCH_FOOTBRIDGE || ARCH_INTEGRATOR || ARCH_NETWINDER) && \ - !ARM64 && !ARC && !MICROBLAZE && !OPENRISC && !S390 && !UML + depends on ALPHA || IA64 || X86 || \ + (ARM && ARCH_FOOTBRIDGE) || \ + (MIPS && (MIPS_MALTA || SIBYTE_BCM112X || SIBYTE_SB1250 || SIBYTE_BCM1x80 || SNI_RM)) select APERTURE_HELPERS if (DRM || FB || VFIO_PCI_CORE) default y help From patchwork Wed Jul 19 12:39:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 122611 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2419202vqt; Wed, 19 Jul 2023 06:01:13 -0700 (PDT) X-Google-Smtp-Source: APBJJlEzGPJJE/7C4fy0bwM09dVwmeUpUBHiyLHnPJYl9XVs/j9R96+u8p5Gk7h/zm0HtWqa73uK X-Received: by 2002:a2e:80d3:0:b0:2b6:a186:52ac with SMTP id r19-20020a2e80d3000000b002b6a18652acmr1771032ljg.47.1689771673252; Wed, 19 Jul 2023 06:01:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689771673; cv=none; d=google.com; s=arc-20160816; b=x/t7EIf+1FGgQF7Ne+lindDny+/VkYLzQmR0sVEGec0JANcE9Zz/nEauNoKMJCb16x 7EbZI5bpOEfkdhxruPcvVszwhrpeBj63i/dU/KBgIlwpCcd9Mj3jjt/+yatpXiSfR8cB N4Dtz77kCHs9zn5s1D8l80FNiezEw/fNnMF3IdykWk6hA+jbcaKuWHxuobUPzof/Ff9i md5L896fPlFVhOwzfp9HJ9PAv9fZTavWbaTU6y+qicCNQ8yId8lSgD/swxODs3qtI0Xp LPvdLXBosnSe1LUrxY/8O0KkzWqDQxw+kNv/VK5Tsum84CT1JQmPZWIbQ6U2La5K+M60 q6sQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hfOp21yphV0ue3baTko6/qVfPZ442SfzbSCVe6+oNOQ=; fh=4WFkd0SKC531xjglIUi33C1n6bFXFguLuCICsINSE7Y=; b=wval+2b9dOWSIAex6S7EA0isbE3SnLgEpH9m2TCHoXH6fwmafF+bkpVYMvXxpxBlhd w8UwOQTlEfXeDR/tNRX4SbYBGdWxiNvd3yq09OzWpaFZiXYauK115Eu+EhSE3HVPQZLL n+N8nch2YdxCi32gp63OLnnA6tsISduswLuw/E18JHhsfVLr7HG/eYBHCBD4QhUKs7rv IHrnbPoNCf/qV2+scYdeZj0HYnGoX6ofcRZYCFQHNt47O4NPiSL5M6vUnIMIrwBHyPDh QVyQs0fZ8Yo096vFcGs03vdmDgEBuNLOS0GFXzPxS1bQf1AKDi3oYHqahaXIccKd4KPN 4s6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VZOm7QC5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y3-20020a170906470300b009929566f00asi2551845ejq.467.2023.07.19.06.00.48; Wed, 19 Jul 2023 06:01:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VZOm7QC5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230034AbjGSMkj (ORCPT + 99 others); Wed, 19 Jul 2023 08:40:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229835AbjGSMke (ORCPT ); Wed, 19 Jul 2023 08:40:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55D6B1985; Wed, 19 Jul 2023 05:40:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 92CC260B5E; Wed, 19 Jul 2023 12:40:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A953C433C8; Wed, 19 Jul 2023 12:40:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689770426; bh=1xxJ92HMZHkMrmgB3qJ3qga4AePLoEhCYGynQ3AK3kw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VZOm7QC5zE9qow5z/O0EDrGX8NJ9D8oaachbTEVb6dqMZyd9CkI3ve99wALqTHxvv +0ztzgJSXF9aHuZ/o3AQSULXwlMSUjxU9CUHA9nlt9gmMg22pdnaE4oDrngr4qn3fG AF4sv+8wBgGUeXv0EF8lso8ikCxi+yWjNyOplvx8QbaNjmFdADYWpe6t/Pm1ff3FAa fO2s7aOOg5G2+dnygK5mltsm+LkrLRwoVQv4oHc9cBAFCX5TtO3O4DU+QFQGrG4kWQ Y96BjxgrLASmygoxIHOP10UeNkX0ZfqP48yrARJeixgalG/NuOUaIOmgXoPRNFyyVI 8mhS4YO6UI+ig== From: Arnd Bergmann To: linux-fbdev@vger.kernel.org, Thomas Zimmermann , Helge Deller , Javier Martinez Canillas Cc: Arnd Bergmann , "David S. Miller" , "K. Y. Srinivasan" , Ard Biesheuvel , Borislav Petkov , Brian Cain , Catalin Marinas , Christophe Leroy , Daniel Vetter , Dave Hansen , David Airlie , Deepak Rawat , Dexuan Cui , Dinh Nguyen , Greg Kroah-Hartman , Guo Ren , Haiyang Zhang , Huacai Chen , Ingo Molnar , John Paul Adrian Glaubitz , Khalid Aziz , Linus Walleij , Matt Turner , Max Filippov , Michael Ellerman , Nicholas Piggin , Palmer Dabbelt , Russell King , Thomas Bogendoerfer , Thomas Gleixner , WANG Xuerui , Wei Liu , Will Deacon , x86@kernel.org, linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-efi@vger.kernel.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-hyperv@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH v2 2/9] vgacon: rework screen_info #ifdef checks Date: Wed, 19 Jul 2023 14:39:37 +0200 Message-Id: <20230719123944.3438363-3-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230719123944.3438363-1-arnd@kernel.org> References: <20230719123944.3438363-1-arnd@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771854022399605170 X-GMAIL-MSGID: 1771854022399605170 From: Arnd Bergmann On non-x86 architectures, the screen_info variable is generally only used for the VGA console where supported, and in some cases the EFI framebuffer or vga16fb. Now that we have a definite list of which architectures actually use it for what, use consistent #ifdef checks so the global variable is only defined when it is actually used on those architectures. Loongarch and riscv have no support for vgacon or vga16fb, but they support EFI firmware, so only that needs to be checked, and the initialization can be removed because that is handled by EFI. IA64 has both vgacon and EFI, though EFI apparently never uses a framebuffer here. Reviewed-by: Javier Martinez Canillas Reviewed-by: Thomas Zimmermann Signed-off-by: Arnd Bergmann Reviewed-by: Khalid Aziz --- v2 changes: - split out mips/jazz change - improve ia64 #ifdef changes --- arch/alpha/kernel/setup.c | 2 ++ arch/alpha/kernel/sys_sio.c | 2 ++ arch/ia64/kernel/setup.c | 6 ++++++ arch/loongarch/kernel/setup.c | 2 ++ arch/mips/kernel/setup.c | 2 +- arch/mips/sibyte/swarm/setup.c | 2 +- arch/mips/sni/setup.c | 2 +- arch/riscv/kernel/setup.c | 11 ++--------- 8 files changed, 17 insertions(+), 12 deletions(-) diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c index b650ff1cb022e..b4d2297765c02 100644 --- a/arch/alpha/kernel/setup.c +++ b/arch/alpha/kernel/setup.c @@ -131,6 +131,7 @@ static void determine_cpu_caches (unsigned int); static char __initdata command_line[COMMAND_LINE_SIZE]; +#ifdef CONFIG_VGA_CONSOLE /* * The format of "screen_info" is strange, and due to early * i386-setup code. This is just enough to make the console @@ -147,6 +148,7 @@ struct screen_info screen_info = { }; EXPORT_SYMBOL(screen_info); +#endif /* * The direct map I/O window, if any. This should be the same diff --git a/arch/alpha/kernel/sys_sio.c b/arch/alpha/kernel/sys_sio.c index 7c420d8dac53d..7de8a5d2d2066 100644 --- a/arch/alpha/kernel/sys_sio.c +++ b/arch/alpha/kernel/sys_sio.c @@ -57,11 +57,13 @@ sio_init_irq(void) static inline void __init alphabook1_init_arch(void) { +#ifdef CONFIG_VGA_CONSOLE /* The AlphaBook1 has LCD video fixed at 800x600, 37 rows and 100 cols. */ screen_info.orig_y = 37; screen_info.orig_video_cols = 100; screen_info.orig_video_lines = 37; +#endif lca_init_arch(); } diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c index 5a55ac82c13a4..d2c66efdde560 100644 --- a/arch/ia64/kernel/setup.c +++ b/arch/ia64/kernel/setup.c @@ -86,9 +86,13 @@ EXPORT_SYMBOL(local_per_cpu_offset); #endif unsigned long ia64_cycles_per_usec; struct ia64_boot_param *ia64_boot_param; +#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_EFI) struct screen_info screen_info; +#endif +#ifdef CONFIG_VGA_CONSOLE unsigned long vga_console_iobase; unsigned long vga_console_membase; +#endif static struct resource data_resource = { .name = "Kernel data", @@ -497,6 +501,7 @@ early_console_setup (char *cmdline) static void __init screen_info_setup(void) { +#ifdef CONFIG_VGA_CONSOLE unsigned int orig_x, orig_y, num_cols, num_rows, font_height; memset(&screen_info, 0, sizeof(screen_info)); @@ -525,6 +530,7 @@ screen_info_setup(void) screen_info.orig_video_mode = 3; /* XXX fake */ screen_info.orig_video_isVGA = 1; /* XXX fake */ screen_info.orig_video_ega_bx = 3; /* XXX fake */ +#endif } static inline void diff --git a/arch/loongarch/kernel/setup.c b/arch/loongarch/kernel/setup.c index 95e6b579dfdd1..77e7a3722caa6 100644 --- a/arch/loongarch/kernel/setup.c +++ b/arch/loongarch/kernel/setup.c @@ -57,7 +57,9 @@ #define SMBIOS_CORE_PACKAGE_OFFSET 0x23 #define LOONGSON_EFI_ENABLE (1 << 3) +#ifdef CONFIG_EFI struct screen_info screen_info __section(".data"); +#endif unsigned long fw_arg0, fw_arg1, fw_arg2; DEFINE_PER_CPU(unsigned long, kernelsp); diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index cb871eb784a7c..1aba7dc95132c 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c @@ -54,7 +54,7 @@ struct cpuinfo_mips cpu_data[NR_CPUS] __read_mostly; EXPORT_SYMBOL(cpu_data); -#ifdef CONFIG_VT +#ifdef CONFIG_VGA_CONSOLE struct screen_info screen_info; #endif diff --git a/arch/mips/sibyte/swarm/setup.c b/arch/mips/sibyte/swarm/setup.c index 76683993cdd3a..37df504d3ecbb 100644 --- a/arch/mips/sibyte/swarm/setup.c +++ b/arch/mips/sibyte/swarm/setup.c @@ -129,7 +129,7 @@ void __init plat_mem_setup(void) if (m41t81_probe()) swarm_rtc_type = RTC_M41T81; -#ifdef CONFIG_VT +#ifdef CONFIG_VGA_CONSOLE screen_info = (struct screen_info) { .orig_video_page = 52, .orig_video_mode = 3, diff --git a/arch/mips/sni/setup.c b/arch/mips/sni/setup.c index efad85c8c823b..9984cf91be7d0 100644 --- a/arch/mips/sni/setup.c +++ b/arch/mips/sni/setup.c @@ -38,7 +38,7 @@ extern void sni_machine_power_off(void); static void __init sni_display_setup(void) { -#if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE) && defined(CONFIG_FW_ARC) +#if defined(CONFIG_VGA_CONSOLE) && defined(CONFIG_FW_ARC) struct screen_info *si = &screen_info; DISPLAY_STATUS *di; diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c index 971fe776e2f8b..a3dbe13f45fb3 100644 --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -39,15 +39,8 @@ #include "head.h" -#if defined(CONFIG_DUMMY_CONSOLE) || defined(CONFIG_EFI) -struct screen_info screen_info __section(".data") = { - .orig_video_lines = 30, - .orig_video_cols = 80, - .orig_video_mode = 0, - .orig_video_ega_bx = 0, - .orig_video_isVGA = 1, - .orig_video_points = 8 -}; +#if defined(CONFIG_EFI) +struct screen_info screen_info __section(".data"); #endif /* From patchwork Wed Jul 19 12:39:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 122603 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2412019vqt; Wed, 19 Jul 2023 05:48:42 -0700 (PDT) X-Google-Smtp-Source: APBJJlF29j3/GWSNOD/TeSq6lHaq0G6HVP3tpkc7xWQiYKna0S9X8LxZPNXhBJWSP5RZpQyHv2vI X-Received: by 2002:a17:907:daa:b0:997:beca:f9db with SMTP id go42-20020a1709070daa00b00997becaf9dbmr2686789ejc.54.1689770922007; Wed, 19 Jul 2023 05:48:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689770921; cv=none; d=google.com; s=arc-20160816; b=N9okcieSu2I2w3VMMEjfhNQHQxpczgaYDVnqAdwxTvJXJnn6bSZyhgWxjZSzUnk5WF UOWTY5hwV908pOE3Dchwn8jF9kmpJ9m36r3hO3d7HWa5TktEP3hqwO4TlwRE2BEcQwqe trWAfV3A8E0yWom9nt9iJyQOhK/hpkqROZV+4r6a16FegNUWIxq6psAMAqiPNuYCNi5m YFpNIuPnpdCKywBwPPm5dcQ79/UOaF/6hw/FtUE9Lu5dQTtMA5jtJ6eG2Z7CYJx/kz/r IGUAjyoffggEtVHHsZ/lMYbqmQTTct4AK9i9+pdxA7Z7oVVJ+bCb7/tw9k+d2zb6GomD uJlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jS16gYjhPzUeEVnhauc9se+2ahiz7Jh3TVrOoWfSZm0=; fh=4WFkd0SKC531xjglIUi33C1n6bFXFguLuCICsINSE7Y=; b=TAwJEnI8GHVuenZG3nupLG4eTY2nqNsmic1g+3fyJhZ41gV6prgiOYlpIypG4dWkWH aaLwmc4QHYZAEh8o2dyxSvD/ro70biAdMV/5iFrqjre6QfDDmWSLmJS4X/k42u1gDx7m w3+4cXA2MfKn8jAKbfrbdVim3P8YykspdbMio3Im7aIRacpjKFkXf/xl/wkDtRu7lhhn lybRzI8PonifVG4PD64I7pLgPk7q+ABucg8bQQWG8TSo4JkJRCMbQBP17X4K3KO2miRy 9JxmQCtgmAiR3qyyQPt6DlRA5Oc3mtoYsZCXQb05hfE699xiX1NMPcVLTpFgcBwVLqDN H6Tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kLu0o+AM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x24-20020a1709060a5800b00992b63c9f9csi2701855ejf.456.2023.07.19.05.48.17; Wed, 19 Jul 2023 05:48:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kLu0o+AM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230281AbjGSMky (ORCPT + 99 others); Wed, 19 Jul 2023 08:40:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229636AbjGSMkl (ORCPT ); Wed, 19 Jul 2023 08:40:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD47A171A; Wed, 19 Jul 2023 05:40:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 44E2B6163F; Wed, 19 Jul 2023 12:40:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3DC10C433C7; Wed, 19 Jul 2023 12:40:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689770437; bh=VpF6OsRFZPIlruH3a+6MdFFoHowjkcTVP3QV/GMSTJA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kLu0o+AM59zDqOSuHvQf1xyyht6DA3UDDCMzWz8oOzgZwgfUqBZah/BCAR6IYAx2G Zovn7/vsuxpAzgzbGPUlv4oXIILODdQ1iQWmupu6B2FjYNoOlKM0BwJqgrfh33SkDV avkW7+6w7HuGQpm0j775UN3Y0NbEQTTz8CjefhtC5WB+IK8I8BajFX7UnXVEqYA6aV nGcCxf0nLaBPIIj7I8+Rn004bgs9Ug5KA6530Q5m8RBKmJjI0LhSkW7TgdCXQ9BzS0 VLKJwrGdui8TogUJYxmulPomi18zSuJD1mkvC33kR3VGy6c19VnjM9GCXn6NTqMK3g 5Nq81f8bKBVHg== From: Arnd Bergmann To: linux-fbdev@vger.kernel.org, Thomas Zimmermann , Helge Deller , Javier Martinez Canillas Cc: Arnd Bergmann , "David S. Miller" , "K. Y. Srinivasan" , Ard Biesheuvel , Borislav Petkov , Brian Cain , Catalin Marinas , Christophe Leroy , Daniel Vetter , Dave Hansen , David Airlie , Deepak Rawat , Dexuan Cui , Dinh Nguyen , Greg Kroah-Hartman , Guo Ren , Haiyang Zhang , Huacai Chen , Ingo Molnar , John Paul Adrian Glaubitz , Khalid Aziz , Linus Walleij , Matt Turner , Max Filippov , Michael Ellerman , Nicholas Piggin , Palmer Dabbelt , Russell King , Thomas Bogendoerfer , Thomas Gleixner , WANG Xuerui , Wei Liu , Will Deacon , x86@kernel.org, linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-efi@vger.kernel.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-hyperv@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH v2 3/9] dummycon: limit Arm console size hack to footbridge Date: Wed, 19 Jul 2023 14:39:38 +0200 Message-Id: <20230719123944.3438363-4-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230719123944.3438363-1-arnd@kernel.org> References: <20230719123944.3438363-1-arnd@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771853234454682815 X-GMAIL-MSGID: 1771853234454682815 From: Arnd Bergmann The dummycon default console size used to be determined by architecture, but now this is a Kconfig setting on everything except ARM. Tracing this back in the historic git trees, this was used to match the size of VGA console or VGA framebuffer on early machines, but nowadays that code is no longer used, except probably on the old footbridge/netwinder since that is the only one that supports vgacon. On machines with a framebuffer, booting with DT so far results in always using the hardcoded 80x30 size in dummycon, while on ATAGS the setting can come from a bootloader specific override. Both seem to be worse choices than the Kconfig setting, since the actual text size for fbcon also depends on the selected font. Make this work the same way as everywhere else and use the normal Kconfig setting, except for the footbridge with vgacon, which keeps using the traditional code. If vgacon is disabled, footbridge can also ignore the setting. This means the screen_info only has to be provided when either vgacon or EFI are enabled now. To limit the amount of surprises on Arm, change the Kconfig default to the previously used 80x30 setting instead of the usual 80x25. Reviewed-by: Thomas Zimmermann Tested-by: Linus Walleij Reviewed-by: Javier Martinez Canillas Signed-off-by: Arnd Bergmann --- arch/arm/kernel/atags_parse.c | 2 +- arch/arm/kernel/setup.c | 3 +-- drivers/video/console/Kconfig | 5 +++-- drivers/video/console/dummycon.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/arm/kernel/atags_parse.c b/arch/arm/kernel/atags_parse.c index 33f6eb5213a5a..4c815da3b77b0 100644 --- a/arch/arm/kernel/atags_parse.c +++ b/arch/arm/kernel/atags_parse.c @@ -69,7 +69,7 @@ static int __init parse_tag_mem32(const struct tag *tag) __tagtable(ATAG_MEM, parse_tag_mem32); -#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE) +#if defined(CONFIG_ARCH_FOOTBRIDGE) && defined(CONFIG_VGA_CONSOLE) static int __init parse_tag_videotext(const struct tag *tag) { screen_info.orig_x = tag->u.videotext.x; diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index c66b560562b30..40326a35a179b 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -928,8 +928,7 @@ static void __init request_standard_resources(const struct machine_desc *mdesc) request_resource(&ioport_resource, &lp2); } -#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE) || \ - defined(CONFIG_EFI) +#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_EFI) struct screen_info screen_info = { .orig_video_lines = 30, .orig_video_cols = 80, diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig index 6af90db6d2da9..b575cf54174af 100644 --- a/drivers/video/console/Kconfig +++ b/drivers/video/console/Kconfig @@ -52,7 +52,7 @@ config DUMMY_CONSOLE config DUMMY_CONSOLE_COLUMNS int "Initial number of console screen columns" - depends on DUMMY_CONSOLE && !ARM + depends on DUMMY_CONSOLE && !ARCH_FOOTBRIDGE default 160 if PARISC default 80 help @@ -62,8 +62,9 @@ config DUMMY_CONSOLE_COLUMNS config DUMMY_CONSOLE_ROWS int "Initial number of console screen rows" - depends on DUMMY_CONSOLE && !ARM + depends on DUMMY_CONSOLE && !ARCH_FOOTBRIDGE default 64 if PARISC + default 30 if ARM default 25 help On PA-RISC, the default value is 64, which should fit a 1280x1024 diff --git a/drivers/video/console/dummycon.c b/drivers/video/console/dummycon.c index f1711b2f9ff05..70549fecee12c 100644 --- a/drivers/video/console/dummycon.c +++ b/drivers/video/console/dummycon.c @@ -18,7 +18,7 @@ * Dummy console driver */ -#if defined(__arm__) +#if defined(CONFIG_ARCH_FOOTBRIDGE) && defined(CONFIG_VGA_CONSOLE) #define DUMMY_COLUMNS screen_info.orig_video_cols #define DUMMY_ROWS screen_info.orig_video_lines #else From patchwork Wed Jul 19 12:39:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 122606 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2412833vqt; Wed, 19 Jul 2023 05:50:23 -0700 (PDT) X-Google-Smtp-Source: APBJJlEQCWhSQKZoQ/h1fiEsZ9tFuJo6eayeW8k89NMV+8+XDemHBv/xmrSmWYD8yvkxDryaX9G/ X-Received: by 2002:a17:903:41d2:b0:1b8:ab0d:cd5 with SMTP id u18-20020a17090341d200b001b8ab0d0cd5mr16292660ple.49.1689771023273; Wed, 19 Jul 2023 05:50:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689771023; cv=none; d=google.com; s=arc-20160816; b=p05Cv9kPkY9CrmCq8sNssWTWBEVtZ9uY2+YadVEEc2Vb6KmJVynwGYUYQQeYo0B9FC vvYtFbGabSE8UApPl2JlZqb2as6LJp+Hv0vQGPzR49BJdpXi1aojKSc9f8XbaLDlEfbG NWQpE6hmfHo/FjlyJ0AQ0qNRPwSPGvaIA0b6PXYtkkHFCX37xluyh6k7pfjoQqhSF+AU y8OLwU3rH/hUilotKn6ZLHB0OfDJJgGb9GvA3BRziKdY0fbmmJwWFDWaF3GpbCgBF4+y 5zilhcTK6BbSRzaHuudFwAXGgMYGXzIjTvOC5eRJhdRC5bVGXxxOtZLGOUGsXi+sQCKK ic4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=O6SVoSfHBdgTUyYknHWeClxBnE+pxl5ddjHkmunStP8=; fh=IJaDbTHDTfnlY24uJvOvspvL7TJFrEakHr7HTL5xdHI=; b=1DPnQIEM2g1dKM5Y7f1j6OymGH16RhGASfZVthGUPuZ5I8Tdb2CpKNmcmRkjEoJijc a24o50x1ttXk530dL0NJmOAjyP9y4FgDd882ppoG+5pqOOu+bO1t3ef9N0bSAozAehoq MrNXh3WO4+3Q64ty5NPyFcQQUm0ujUJqHEupTRnXf5oYfwaRtIPx9rLfcQBV4kWGQutS dhOzlVdd3bzRsGMy1bRZSugHBnQJCzOFo9AhDIgI/zhkFYvX9e+83G5pSR158d9hjsvW 6VU+10SopQEglomajlG5UNjvD2u0wMEWTpJy2JHAD37Zo9O6fGljFfoLroZuF5N2q3T5 0GnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CW+5Fzwl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c1-20020a170902d48100b001b892a54d89si3593910plg.629.2023.07.19.05.50.08; Wed, 19 Jul 2023 05:50:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CW+5Fzwl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229709AbjGSMlJ (ORCPT + 99 others); Wed, 19 Jul 2023 08:41:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229503AbjGSMkw (ORCPT ); Wed, 19 Jul 2023 08:40:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02F1310CB; Wed, 19 Jul 2023 05:40:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 79ADB6167A; Wed, 19 Jul 2023 12:40:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12C1FC43395; Wed, 19 Jul 2023 12:40:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689770448; bh=Zj4qMdB+kdRnCA5GmyWBhlkXMmOYN6ga97/WSRarSdg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CW+5Fzwl9GvF1zpGL5WabF11xRyzz4NfXJ7TLrfdCsSY7QMKWK+XFmteHNdetz5Wm 8V/jFnCnlCzEPbd0gfjrLIMFUQ837BTflCU4yTEjvDRAAnofufXgsjx48XYlrnM5vQ dr/BjO5+SJPPfE/wpTPmhl+Fe6lJTcDJfqM+3et15MZQZGBahrwv5cJQVm5sKVJL41 k5Vjy7NobNYucgsojt+CRCpbgrYD12JbOQK+uWUg9NbohhAr7lMa47HFwDezpF4JfN mqLANz754LA1YAvVNtkHg/HYJwzBYju5kHekQlFi3NNOxFAyOgyjWJmRE2xOUAoxGZ QAcGO35O87DPw== From: Arnd Bergmann To: linux-fbdev@vger.kernel.org, Thomas Zimmermann , Helge Deller , Javier Martinez Canillas Cc: Arnd Bergmann , "David S. Miller" , "K. Y. Srinivasan" , Ard Biesheuvel , Borislav Petkov , Brian Cain , Catalin Marinas , Christophe Leroy , Daniel Vetter , Dave Hansen , David Airlie , Deepak Rawat , Dexuan Cui , Dinh Nguyen , Greg Kroah-Hartman , Guo Ren , Haiyang Zhang , Huacai Chen , Ingo Molnar , John Paul Adrian Glaubitz , Khalid Aziz , Linus Walleij , Matt Turner , Max Filippov , Michael Ellerman , Nicholas Piggin , Palmer Dabbelt , Russell King , Thomas Bogendoerfer , Thomas Gleixner , WANG Xuerui , Wei Liu , Will Deacon , x86@kernel.org, linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-efi@vger.kernel.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-hyperv@vger.kernel.org, dri-devel@lists.freedesktop.org, Palmer Dabbelt Subject: [PATCH v2 4/9] vgacon, arch/*: remove unused screen_info definitions Date: Wed, 19 Jul 2023 14:39:39 +0200 Message-Id: <20230719123944.3438363-5-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230719123944.3438363-1-arnd@kernel.org> References: <20230719123944.3438363-1-arnd@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771853340306162135 X-GMAIL-MSGID: 1771853340306162135 From: Arnd Bergmann A number of architectures either kept the screen_info definition for historical purposes as it used to be required by the generic VT code, or they copied it from another architecture in order to build the VGA console driver in an allmodconfig build. The mips definition is used by some platforms, but the initialization on jazz is not needed. Now that vgacon no longer builds on these architectures, remove the stale definitions and initializations. Reviewed-by: Javier Martinez Canillas Reviewed-by: Thomas Zimmermann Acked-by: Dinh Nguyen Acked-by: Max Filippov Acked-by: Palmer Dabbelt Acked-by: Guo Ren Signed-off-by: Arnd Bergmann Reviewed-by: Philippe Mathieu-Daudé --- arch/csky/kernel/setup.c | 12 ------------ arch/hexagon/kernel/Makefile | 2 -- arch/hexagon/kernel/screen_info.c | 3 --- arch/mips/jazz/setup.c | 9 --------- arch/nios2/kernel/setup.c | 5 ----- arch/sh/kernel/setup.c | 5 ----- arch/sparc/kernel/setup_32.c | 13 ------------- arch/sparc/kernel/setup_64.c | 13 ------------- arch/xtensa/kernel/setup.c | 12 ------------ 9 files changed, 74 deletions(-) delete mode 100644 arch/hexagon/kernel/screen_info.c diff --git a/arch/csky/kernel/setup.c b/arch/csky/kernel/setup.c index 106fbf0b6f3b4..51012e90780d6 100644 --- a/arch/csky/kernel/setup.c +++ b/arch/csky/kernel/setup.c @@ -8,22 +8,10 @@ #include #include #include -#include #include #include #include -#ifdef CONFIG_DUMMY_CONSOLE -struct screen_info screen_info = { - .orig_video_lines = 30, - .orig_video_cols = 80, - .orig_video_mode = 0, - .orig_video_ega_bx = 0, - .orig_video_isVGA = 1, - .orig_video_points = 8 -}; -#endif - static void __init csky_memblock_init(void) { unsigned long lowmem_size = PFN_DOWN(LOWMEM_LIMIT - PHYS_OFFSET_OFFSET); diff --git a/arch/hexagon/kernel/Makefile b/arch/hexagon/kernel/Makefile index e73cb321630ec..3fdf937eb572e 100644 --- a/arch/hexagon/kernel/Makefile +++ b/arch/hexagon/kernel/Makefile @@ -17,5 +17,3 @@ obj-y += vm_vectors.o obj-$(CONFIG_HAS_DMA) += dma.o obj-$(CONFIG_STACKTRACE) += stacktrace.o - -obj-$(CONFIG_VGA_CONSOLE) += screen_info.o diff --git a/arch/hexagon/kernel/screen_info.c b/arch/hexagon/kernel/screen_info.c deleted file mode 100644 index 1e1ceb18bafe7..0000000000000 --- a/arch/hexagon/kernel/screen_info.c +++ /dev/null @@ -1,3 +0,0 @@ -#include - -struct screen_info screen_info; diff --git a/arch/mips/jazz/setup.c b/arch/mips/jazz/setup.c index ee044261eb223..23059ead773fc 100644 --- a/arch/mips/jazz/setup.c +++ b/arch/mips/jazz/setup.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -76,14 +75,6 @@ void __init plat_mem_setup(void) _machine_restart = jazz_machine_restart; -#ifdef CONFIG_VT - screen_info = (struct screen_info) { - .orig_video_cols = 160, - .orig_video_lines = 64, - .orig_video_points = 16, - }; -#endif - add_preferred_console("ttyS", 0, "9600"); } diff --git a/arch/nios2/kernel/setup.c b/arch/nios2/kernel/setup.c index 8582ed9658447..da122a5fa43b2 100644 --- a/arch/nios2/kernel/setup.c +++ b/arch/nios2/kernel/setup.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include @@ -36,10 +35,6 @@ static struct pt_regs fake_regs = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; -#ifdef CONFIG_VT -struct screen_info screen_info; -#endif - /* Copy a short hook instruction sequence to the exception address */ static inline void copy_exception_handler(unsigned int addr) { diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c index b3da2757faaf3..3d80515298d26 100644 --- a/arch/sh/kernel/setup.c +++ b/arch/sh/kernel/setup.c @@ -7,7 +7,6 @@ * Copyright (C) 1999 Niibe Yutaka * Copyright (C) 2002 - 2010 Paul Mundt */ -#include #include #include #include @@ -69,10 +68,6 @@ EXPORT_SYMBOL(cpu_data); struct sh_machine_vector sh_mv = { .mv_name = "generic", }; EXPORT_SYMBOL(sh_mv); -#ifdef CONFIG_VT -struct screen_info screen_info; -#endif - extern int root_mountflags; #define RAMDISK_IMAGE_START_MASK 0x07FF diff --git a/arch/sparc/kernel/setup_32.c b/arch/sparc/kernel/setup_32.c index 34ef7febf0d56..e3b72a7b46d37 100644 --- a/arch/sparc/kernel/setup_32.c +++ b/arch/sparc/kernel/setup_32.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -51,18 +50,6 @@ #include "kernel.h" -struct screen_info screen_info = { - 0, 0, /* orig-x, orig-y */ - 0, /* unused */ - 0, /* orig-video-page */ - 0, /* orig-video-mode */ - 128, /* orig-video-cols */ - 0,0,0, /* ega_ax, ega_bx, ega_cx */ - 54, /* orig-video-lines */ - 0, /* orig-video-isVGA */ - 16 /* orig-video-points */ -}; - /* Typing sync at the prom prompt calls the function pointed to by * romvec->pv_synchook which I set to the following function. * This should sync all filesystems and return, for now it just diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c index 6546ca9d4d3f1..6a4797dec34b4 100644 --- a/arch/sparc/kernel/setup_64.c +++ b/arch/sparc/kernel/setup_64.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -68,18 +67,6 @@ DEFINE_SPINLOCK(ns87303_lock); EXPORT_SYMBOL(ns87303_lock); -struct screen_info screen_info = { - 0, 0, /* orig-x, orig-y */ - 0, /* unused */ - 0, /* orig-video-page */ - 0, /* orig-video-mode */ - 128, /* orig-video-cols */ - 0, 0, 0, /* unused, ega_bx, unused */ - 54, /* orig-video-lines */ - 0, /* orig-video-isVGA */ - 16 /* orig-video-points */ -}; - static void prom_console_write(struct console *con, const char *s, unsigned int n) { diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c index aba3ff4e60d85..3f22d0537818d 100644 --- a/arch/xtensa/kernel/setup.c +++ b/arch/xtensa/kernel/setup.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -49,17 +48,6 @@ #include #include -#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE) -struct screen_info screen_info = { - .orig_x = 0, - .orig_y = 24, - .orig_video_cols = 80, - .orig_video_lines = 24, - .orig_video_isVGA = 1, - .orig_video_points = 16, -}; -#endif - #ifdef CONFIG_BLK_DEV_INITRD extern unsigned long initrd_start; extern unsigned long initrd_end; From patchwork Wed Jul 19 12:39:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 122604 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2412172vqt; Wed, 19 Jul 2023 05:49:00 -0700 (PDT) X-Google-Smtp-Source: APBJJlGBburp+x5dXgH2sFYFkC5M0jGTxRJG/g8Yu/QZEcvAAcytv43OLjF2se+pKnjdPbD62z6g X-Received: by 2002:a05:6808:1403:b0:3a4:58:8e87 with SMTP id w3-20020a056808140300b003a400588e87mr20235242oiv.52.1689770940193; Wed, 19 Jul 2023 05:49:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689770940; cv=none; d=google.com; s=arc-20160816; b=T6kpnry2efA7fDLiINJQEMVQ9sK8ljX01UKld4rSHgfC7Khwc2/qMqMA2idUpiHBYL Wa3hCUtCGO5RlEqDuGrgYHxQ7huk31MdPve6273s6ckTVYBcHQ2SVe2oJVH7O1H0DmzE j06TOkUhj3XHtXtATTWEk21k0E8a1GowSAVQiUoeOPJ39sF/74zfzanDMWMLBXyI1yk8 WccflYPRCavEkrf3gxX5dqHIfuFNrxQn52BYAd5HUgPpMC2XpYXm9aNh+V8AuUgXe37N i2Eo07mzW7FAElXdIeeZ+eIN/7mpeuEyi3ij3QROzyYM6V+tukEFr0gYlkYcSxtixfr7 Vfmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=993wKmgxVyNOcdb/WQ1fbNsrgg2P11CR4cRM2ryioNo=; fh=4WFkd0SKC531xjglIUi33C1n6bFXFguLuCICsINSE7Y=; b=xDEMiEQDZQUAXxHAzAhmSgdgP4eelOuTjrHnHVirVABmCGi3CCJbj2jS7W/ZdOVSur Z2bl6JssJGCjlIH+lB6GqYMTuosj1AHMawlf+SA7Utg+l3CED14X3tSEP4973KbbV4vT mdSn03JS2VRsHpIwM3DgZzOhyRFmcfz0rQtCTuNIQSZIWGZdyE1AnmOciweQxC4p7bYz c8gDhVWENQcQGemiQACH+d14Qe5ZpNY58WKJX+wppkJ29tkOCgph+w+iRXrC/DAgQEu+ tIyC1etsVCWOC5J04cTidv4yuZNmBT+RScnM1jsLihe4pVjuMbCAhNRUDQJtNSooar9h EfNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LJWj6Wix; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id il8-20020a17090b164800b00252d84b7af0si1367248pjb.181.2023.07.19.05.48.45; Wed, 19 Jul 2023 05:49:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LJWj6Wix; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230382AbjGSMlY (ORCPT + 99 others); Wed, 19 Jul 2023 08:41:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229719AbjGSMlE (ORCPT ); Wed, 19 Jul 2023 08:41:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCE9D1FF6; Wed, 19 Jul 2023 05:41:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2268E616F1; Wed, 19 Jul 2023 12:41:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 214B3C433C7; Wed, 19 Jul 2023 12:40:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689770459; bh=2czZT/DmFX+7crSyzIj0EfttXU0qPdjVzvuXTkWux8A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LJWj6WixnQj4+2aLEHAIRvLw29ImJXthoxDqs1IVrOBbY/CZsqpVLePGAF4ekS+oa xi9vq+103tgk/utjEEwDyWvcMjuwi4tsf9dk1aePYAAORZgYYoGXps5kfX/gKIY1RB /HCSaO7Uqc94ixGBpe1wSwjyXPND6p3+M3xD+/lNS+KkAo4wUhIho2WG1KZySKhrXR beVohX0SBvPN95rtMggXeXlkgKJEcE4s/3wRIIXyTCIbVVp6vKd/mOssYbHkgZ5FKG TiOPs4WpmM7tktbLXiLDJjbsVeFFNq7to19X4bN5brnCWtrFlOHof5XcEjEL+AEE9d Vq3E2+3125qHA== From: Arnd Bergmann To: linux-fbdev@vger.kernel.org, Thomas Zimmermann , Helge Deller , Javier Martinez Canillas Cc: Arnd Bergmann , "David S. Miller" , "K. Y. Srinivasan" , Ard Biesheuvel , Borislav Petkov , Brian Cain , Catalin Marinas , Christophe Leroy , Daniel Vetter , Dave Hansen , David Airlie , Deepak Rawat , Dexuan Cui , Dinh Nguyen , Greg Kroah-Hartman , Guo Ren , Haiyang Zhang , Huacai Chen , Ingo Molnar , John Paul Adrian Glaubitz , Khalid Aziz , Linus Walleij , Matt Turner , Max Filippov , Michael Ellerman , Nicholas Piggin , Palmer Dabbelt , Russell King , Thomas Bogendoerfer , Thomas Gleixner , WANG Xuerui , Wei Liu , Will Deacon , x86@kernel.org, linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-efi@vger.kernel.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-hyperv@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH v2 5/9] vgacon: remove screen_info dependency Date: Wed, 19 Jul 2023 14:39:40 +0200 Message-Id: <20230719123944.3438363-6-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230719123944.3438363-1-arnd@kernel.org> References: <20230719123944.3438363-1-arnd@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771853253480661663 X-GMAIL-MSGID: 1771853253480661663 From: Arnd Bergmann The vga console driver is fairly self-contained, and only used by architectures that explicitly initialize the screen_info settings. Chance every instance that picks the vga console by setting conswitchp to call a function instead, and pass a reference to the screen_info there. Signed-off-by: Arnd Bergmann Reviewed-by: Javier Martinez Canillas Acked-by: Khalid Azzi --- arch/alpha/kernel/setup.c | 2 +- arch/arm/kernel/setup.c | 2 +- arch/ia64/kernel/setup.c | 2 +- arch/mips/kernel/setup.c | 2 +- arch/x86/kernel/setup.c | 2 +- drivers/firmware/pcdp.c | 2 +- drivers/video/console/vgacon.c | 68 ++++++++++++++++++++-------------- include/linux/console.h | 7 ++++ 8 files changed, 53 insertions(+), 34 deletions(-) diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c index b4d2297765c02..d73b685fe9852 100644 --- a/arch/alpha/kernel/setup.c +++ b/arch/alpha/kernel/setup.c @@ -655,7 +655,7 @@ setup_arch(char **cmdline_p) #ifdef CONFIG_VT #if defined(CONFIG_VGA_CONSOLE) - conswitchp = &vga_con; + vgacon_register_screen(&screen_info); #endif #endif diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 40326a35a179b..5d8a7fb3eba45 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -1192,7 +1192,7 @@ void __init setup_arch(char **cmdline_p) #ifdef CONFIG_VT #if defined(CONFIG_VGA_CONSOLE) - conswitchp = &vga_con; + vgacon_register_screen(&screen_info); #endif #endif diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c index d2c66efdde560..2c9283fcd3759 100644 --- a/arch/ia64/kernel/setup.c +++ b/arch/ia64/kernel/setup.c @@ -619,7 +619,7 @@ setup_arch (char **cmdline_p) * memory so we can avoid this problem. */ if (efi_mem_type(0xA0000) != EFI_CONVENTIONAL_MEMORY) - conswitchp = &vga_con; + vgacon_register_screen(&screen_info); # endif } #endif diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index 1aba7dc95132c..6c3fae62a9f6b 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c @@ -794,7 +794,7 @@ void __init setup_arch(char **cmdline_p) #if defined(CONFIG_VT) #if defined(CONFIG_VGA_CONSOLE) - conswitchp = &vga_con; + vgacon_register_screen(&screen_info); #endif #endif diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index fd975a4a52006..b1ea77d504615 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -1293,7 +1293,7 @@ void __init setup_arch(char **cmdline_p) #ifdef CONFIG_VT #if defined(CONFIG_VGA_CONSOLE) if (!efi_enabled(EFI_BOOT) || (efi_mem_type(0xa0000) != EFI_CONVENTIONAL_MEMORY)) - conswitchp = &vga_con; + vgacon_register_screen(&screen_info); #endif #endif x86_init.oem.banner(); diff --git a/drivers/firmware/pcdp.c b/drivers/firmware/pcdp.c index 715a45442d1cf..667a595373b2d 100644 --- a/drivers/firmware/pcdp.c +++ b/drivers/firmware/pcdp.c @@ -72,7 +72,7 @@ setup_vga_console(struct pcdp_device *dev) return -ENODEV; } - conswitchp = &vga_con; + vgacon_register_screen(&screen_info); printk(KERN_INFO "PCDP: VGA console\n"); return 0; #else diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c index e25ba523892e5..3d7fedf27ffc1 100644 --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c @@ -97,6 +97,8 @@ static int vga_video_font_height; static int vga_scan_lines __read_mostly; static unsigned int vga_rolled_over; /* last vc_origin offset before wrap */ +static struct screen_info *vga_si; + static bool vga_hardscroll_enabled; static bool vga_hardscroll_user_enable = true; @@ -161,8 +163,9 @@ static const char *vgacon_startup(void) u16 saved1, saved2; volatile u16 *p; - if (screen_info.orig_video_isVGA == VIDEO_TYPE_VLFB || - screen_info.orig_video_isVGA == VIDEO_TYPE_EFI) { + if (!vga_si || + vga_si->orig_video_isVGA == VIDEO_TYPE_VLFB || + vga_si->orig_video_isVGA == VIDEO_TYPE_EFI) { no_vga: #ifdef CONFIG_DUMMY_CONSOLE conswitchp = &dummy_con; @@ -172,29 +175,29 @@ static const char *vgacon_startup(void) #endif } - /* boot_params.screen_info reasonably initialized? */ - if ((screen_info.orig_video_lines == 0) || - (screen_info.orig_video_cols == 0)) + /* vga_si reasonably initialized? */ + if ((vga_si->orig_video_lines == 0) || + (vga_si->orig_video_cols == 0)) goto no_vga; /* VGA16 modes are not handled by VGACON */ - if ((screen_info.orig_video_mode == 0x0D) || /* 320x200/4 */ - (screen_info.orig_video_mode == 0x0E) || /* 640x200/4 */ - (screen_info.orig_video_mode == 0x10) || /* 640x350/4 */ - (screen_info.orig_video_mode == 0x12) || /* 640x480/4 */ - (screen_info.orig_video_mode == 0x6A)) /* 800x600/4 (VESA) */ + if ((vga_si->orig_video_mode == 0x0D) || /* 320x200/4 */ + (vga_si->orig_video_mode == 0x0E) || /* 640x200/4 */ + (vga_si->orig_video_mode == 0x10) || /* 640x350/4 */ + (vga_si->orig_video_mode == 0x12) || /* 640x480/4 */ + (vga_si->orig_video_mode == 0x6A)) /* 800x600/4 (VESA) */ goto no_vga; - vga_video_num_lines = screen_info.orig_video_lines; - vga_video_num_columns = screen_info.orig_video_cols; + vga_video_num_lines = vga_si->orig_video_lines; + vga_video_num_columns = vga_si->orig_video_cols; vgastate.vgabase = NULL; - if (screen_info.orig_video_mode == 7) { + if (vga_si->orig_video_mode == 7) { /* Monochrome display */ vga_vram_base = 0xb0000; vga_video_port_reg = VGA_CRT_IM; vga_video_port_val = VGA_CRT_DM; - if ((screen_info.orig_video_ega_bx & 0xff) != 0x10) { + if ((vga_si->orig_video_ega_bx & 0xff) != 0x10) { static struct resource ega_console_resource = { .name = "ega", .flags = IORESOURCE_IO, @@ -231,12 +234,12 @@ static const char *vgacon_startup(void) vga_vram_base = 0xb8000; vga_video_port_reg = VGA_CRT_IC; vga_video_port_val = VGA_CRT_DC; - if ((screen_info.orig_video_ega_bx & 0xff) != 0x10) { + if ((vga_si->orig_video_ega_bx & 0xff) != 0x10) { int i; vga_vram_size = 0x8000; - if (!screen_info.orig_video_isVGA) { + if (!vga_si->orig_video_isVGA) { static struct resource ega_console_resource = { .name = "ega", .flags = IORESOURCE_IO, @@ -327,14 +330,14 @@ static const char *vgacon_startup(void) || vga_video_type == VIDEO_TYPE_VGAC || vga_video_type == VIDEO_TYPE_EGAM) { vga_hardscroll_enabled = vga_hardscroll_user_enable; - vga_default_font_height = screen_info.orig_video_points; - vga_video_font_height = screen_info.orig_video_points; + vga_default_font_height = vga_si->orig_video_points; + vga_video_font_height = vga_si->orig_video_points; /* This may be suboptimal but is a safe bet - go with it */ vga_scan_lines = vga_video_font_height * vga_video_num_lines; } - vgacon_xres = screen_info.orig_video_cols * VGA_FONTWIDTH; + vgacon_xres = vga_si->orig_video_cols * VGA_FONTWIDTH; vgacon_yres = vga_scan_lines; return display_desc; @@ -379,7 +382,7 @@ static void vgacon_init(struct vc_data *c, int init) /* Only set the default if the user didn't deliberately override it */ if (global_cursor_default == -1) global_cursor_default = - !(screen_info.flags & VIDEO_FLAGS_NOCURSOR); + !(vga_si->flags & VIDEO_FLAGS_NOCURSOR); } static void vgacon_deinit(struct vc_data *c) @@ -607,7 +610,7 @@ static int vgacon_switch(struct vc_data *c) { int x = c->vc_cols * VGA_FONTWIDTH; int y = c->vc_rows * c->vc_cell_height; - int rows = screen_info.orig_video_lines * vga_default_font_height/ + int rows = vga_si->orig_video_lines * vga_default_font_height/ c->vc_cell_height; /* * We need to save screen size here as it's the only way @@ -627,7 +630,7 @@ static int vgacon_switch(struct vc_data *c) if ((vgacon_xres != x || vgacon_yres != y) && (!(vga_video_num_columns % 2) && - vga_video_num_columns <= screen_info.orig_video_cols && + vga_video_num_columns <= vga_si->orig_video_cols && vga_video_num_lines <= rows)) vgacon_doresize(c, c->vc_cols, c->vc_rows); } @@ -1074,13 +1077,13 @@ static int vgacon_resize(struct vc_data *c, unsigned int width, * Ho ho! Someone (svgatextmode, eh?) may have reprogrammed * the video mode! Set the new defaults then and go away. */ - screen_info.orig_video_cols = width; - screen_info.orig_video_lines = height; + vga_si->orig_video_cols = width; + vga_si->orig_video_lines = height; vga_default_font_height = c->vc_cell_height; return 0; } - if (width % 2 || width > screen_info.orig_video_cols || - height > (screen_info.orig_video_lines * vga_default_font_height)/ + if (width % 2 || width > vga_si->orig_video_cols || + height > (vga_si->orig_video_lines * vga_default_font_height)/ c->vc_cell_height) return -EINVAL; @@ -1110,8 +1113,8 @@ static void vgacon_save_screen(struct vc_data *c) * console initialization routines. */ vga_bootup_console = 1; - c->state.x = screen_info.orig_x; - c->state.y = screen_info.orig_y; + c->state.x = vga_si->orig_x; + c->state.y = vga_si->orig_y; } /* We can't copy in more than the size of the video buffer, @@ -1204,4 +1207,13 @@ const struct consw vga_con = { }; EXPORT_SYMBOL(vga_con); +void vgacon_register_screen(struct screen_info *si) +{ + if (!si || vga_si) + return; + + conswitchp = &vga_con; + vga_si = si; +} + MODULE_LICENSE("GPL"); diff --git a/include/linux/console.h b/include/linux/console.h index d3195664baa5a..5f900210e689e 100644 --- a/include/linux/console.h +++ b/include/linux/console.h @@ -101,6 +101,13 @@ extern const struct consw dummy_con; /* dummy console buffer */ extern const struct consw vga_con; /* VGA text console */ extern const struct consw newport_con; /* SGI Newport console */ +struct screen_info; +#ifdef CONFIG_VGA_CONSOLE +void vgacon_register_screen(struct screen_info *si); +#else +static inline void vgacon_register_screen(struct screen_info *si) { } +#endif + int con_is_bound(const struct consw *csw); int do_unregister_con_driver(const struct consw *csw); int do_take_over_console(const struct consw *sw, int first, int last, int deflt); From patchwork Wed Jul 19 12:39:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 122609 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2418001vqt; Wed, 19 Jul 2023 05:59:56 -0700 (PDT) X-Google-Smtp-Source: APBJJlE1e+8OFqu3ACGu72aL6pN70FAzi6XIDH3ndOR5T3ceKTQRcafauYkashKL+Hlu7IZ+kriE X-Received: by 2002:aa7:d5d4:0:b0:51e:3558:5eb8 with SMTP id d20-20020aa7d5d4000000b0051e35585eb8mr2545896eds.19.1689771596299; Wed, 19 Jul 2023 05:59:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689771596; cv=none; d=google.com; s=arc-20160816; b=yT5ziIBawVWwB6bf88SPh8Z9cUK8oFE8fal0zG/JceaBp9VVCv1dV75FgUYyLN2eKP /rZ6YoSJYZkzAxl05fIZ4U+eKGFmQ+N6btt8Ojz90Lad7o0rSnMQ8DzBN3nPsE3p3ErT sSoCH4+Wc+65wptPeBQRRicx0zVrLqW1CBp2jY65UiOUUb9Z/zK32cAcG8IuW3dyDGfZ gw+92shpdJKnY/YwIMXr9kdH7iGS/SvAZRIYX/EKWH9/5XRvVY4m5EWzfm6a1BcaN5Bx QxCzv4MQoAVN0EcmXHraGTmMyIGTDs4Xq7EB2rrSMbRG0irQXvaKbAPWKijAoAkV4vHx Z2rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WbB+msogZmTe0MaAABFpfz2G8XhadbDoLhDJzjW2LOg=; fh=4WFkd0SKC531xjglIUi33C1n6bFXFguLuCICsINSE7Y=; b=WCZl7yrCdeTveMmyLr1DPP0dBbojaqqnh2RkG4FnAekEZX3wVbjVrVKVRZD2bAFe32 s4FDZkRaZSi6tGqX/fH9PfLVIrF1CeAZrwRNFsttpakdEzl1UTx4rlmNwHqtQskIlU4L /89miDeDk0qODxXWqcodHH1Te/bt5Rsccj7bfos2CHflZY3BKwyJmYqGgyAK5BW9aLkh 2MojnVGXfjcnJjsKm0cFCa+2EEhimPPSUnBosJbrUGEDr+/Be0J8Fer3oeOm85uTeoGE robTAZ0c1E1qY0+kkbU6zK8udh3t8QUcG34Qvf+/nB3n08u84YQfYic3GcmCtTsrsJFC Ia+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JJHmVL40; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r14-20020aa7d14e000000b0051df118addasi3052866edo.230.2023.07.19.05.59.31; Wed, 19 Jul 2023 05:59:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JJHmVL40; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230418AbjGSMlo (ORCPT + 99 others); Wed, 19 Jul 2023 08:41:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230471AbjGSMlU (ORCPT ); Wed, 19 Jul 2023 08:41:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E88F1FDD; Wed, 19 Jul 2023 05:41:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E83F360B5E; Wed, 19 Jul 2023 12:41:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EAF51C433CB; Wed, 19 Jul 2023 12:40:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689770470; bh=DSbbxM7Nm5R08oXf4nrTJZNlLKLq0B901vQZguQIfaQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JJHmVL40dK/B5XyvTW4hIONjVHwXhHB1N1WMGvcOOAz3pkee5wcjjJ+HGuW5zSXgK hfWJ5V9HLYhQRtq764mXFMOqv+ulqXOU9TOt2KxYj3n2iZwuy5W8auMxzt5MSTbBlH WEJUG3agXHVtAAw0bstpk2cV0zlWodATGGh2nvqV1nRDiTgx3F4oaBCZw3bNjfiz/H ysuKpoa2UkvUmrYNxcs+p2NQw0t63dCxoQxHWOcoK7htztJiayK/IORWTl2FQ043Wp 6nO9m8qlKti3zdrwEA3rl5cf4NjJ/OlxJ2+mOB75c56//SM+9c6EJgg7XA/IaN3pUP nxpli2y0BjzdA== From: Arnd Bergmann To: linux-fbdev@vger.kernel.org, Thomas Zimmermann , Helge Deller , Javier Martinez Canillas Cc: Arnd Bergmann , "David S. Miller" , "K. Y. Srinivasan" , Ard Biesheuvel , Borislav Petkov , Brian Cain , Catalin Marinas , Christophe Leroy , Daniel Vetter , Dave Hansen , David Airlie , Deepak Rawat , Dexuan Cui , Dinh Nguyen , Greg Kroah-Hartman , Guo Ren , Haiyang Zhang , Huacai Chen , Ingo Molnar , John Paul Adrian Glaubitz , Khalid Aziz , Linus Walleij , Matt Turner , Max Filippov , Michael Ellerman , Nicholas Piggin , Palmer Dabbelt , Russell King , Thomas Bogendoerfer , Thomas Gleixner , WANG Xuerui , Wei Liu , Will Deacon , x86@kernel.org, linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-efi@vger.kernel.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-hyperv@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH v2 6/9] vgacon: clean up global screen_info instances Date: Wed, 19 Jul 2023 14:39:41 +0200 Message-Id: <20230719123944.3438363-7-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230719123944.3438363-1-arnd@kernel.org> References: <20230719123944.3438363-1-arnd@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771853940903447819 X-GMAIL-MSGID: 1771853940903447819 From: Arnd Bergmann To prepare for completely separating the VGA console screen_info from the one used in EFI/sysfb, rename the vgacon instances and make them local as much as possible. ia64 and arm both have confurations with vgacon and efi, but the contents never overlaps because ia64 has no EFI framebuffer, and arm only has vga console on legacy platforms without EFI. Renaming these is required before the EFI screen_info can be moved into drivers/firmware. The ia64 vga console is actually registered in two places from setup_arch(), but one of them is wrong, so drop the one in pcdp.c and the fix the one in setup.c to use the correct conditional. x86 has to keep them together, as the boot protocol is used to switch between VGA text console and framebuffer through the screen_info data. Signed-off-by: Arnd Bergmann Acked-by: Javier Martinez Canillas Acked-by: Khalid Aziz --- arch/alpha/kernel/proto.h | 2 ++ arch/alpha/kernel/setup.c | 6 ++-- arch/alpha/kernel/sys_sio.c | 6 ++-- arch/arm/include/asm/setup.h | 5 ++++ arch/arm/kernel/atags_parse.c | 18 ++++++------ arch/arm/kernel/efi.c | 6 ---- arch/arm/kernel/setup.c | 10 +++++-- arch/ia64/kernel/setup.c | 49 +++++++++++++++---------------- arch/mips/kernel/setup.c | 11 ------- arch/mips/mti-malta/malta-setup.c | 4 ++- arch/mips/sibyte/swarm/setup.c | 24 ++++++++------- arch/mips/sni/setup.c | 16 +++++----- drivers/firmware/pcdp.c | 1 - 13 files changed, 78 insertions(+), 80 deletions(-) diff --git a/arch/alpha/kernel/proto.h b/arch/alpha/kernel/proto.h index 5816a31c1b386..2c89c1c557129 100644 --- a/arch/alpha/kernel/proto.h +++ b/arch/alpha/kernel/proto.h @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 */ #include +#include #include /* Prototypes of functions used across modules here in this directory. */ @@ -113,6 +114,7 @@ extern int boot_cpuid; #ifdef CONFIG_VERBOSE_MCHECK extern unsigned long alpha_verbose_mcheck; #endif +extern struct screen_info vgacon_screen_info; /* srmcons.c */ #if defined(CONFIG_ALPHA_GENERIC) || defined(CONFIG_ALPHA_SRM) diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c index d73b685fe9852..7b35af2ed2787 100644 --- a/arch/alpha/kernel/setup.c +++ b/arch/alpha/kernel/setup.c @@ -138,7 +138,7 @@ static char __initdata command_line[COMMAND_LINE_SIZE]; * code think we're on a VGA color display. */ -struct screen_info screen_info = { +struct screen_info vgacon_screen_info = { .orig_x = 0, .orig_y = 25, .orig_video_cols = 80, @@ -146,8 +146,6 @@ struct screen_info screen_info = { .orig_video_isVGA = 1, .orig_video_points = 16 }; - -EXPORT_SYMBOL(screen_info); #endif /* @@ -655,7 +653,7 @@ setup_arch(char **cmdline_p) #ifdef CONFIG_VT #if defined(CONFIG_VGA_CONSOLE) - vgacon_register_screen(&screen_info); + vgacon_register_screen(&vgacon_screen_info); #endif #endif diff --git a/arch/alpha/kernel/sys_sio.c b/arch/alpha/kernel/sys_sio.c index 7de8a5d2d2066..086488ed83a7f 100644 --- a/arch/alpha/kernel/sys_sio.c +++ b/arch/alpha/kernel/sys_sio.c @@ -60,9 +60,9 @@ alphabook1_init_arch(void) #ifdef CONFIG_VGA_CONSOLE /* The AlphaBook1 has LCD video fixed at 800x600, 37 rows and 100 cols. */ - screen_info.orig_y = 37; - screen_info.orig_video_cols = 100; - screen_info.orig_video_lines = 37; + vgacon_screen_info.orig_y = 37; + vgacon_screen_info.orig_video_cols = 100; + vgacon_screen_info.orig_video_lines = 37; #endif lca_init_arch(); diff --git a/arch/arm/include/asm/setup.h b/arch/arm/include/asm/setup.h index 546af8b1e3f65..cc106f946c691 100644 --- a/arch/arm/include/asm/setup.h +++ b/arch/arm/include/asm/setup.h @@ -11,6 +11,7 @@ #ifndef __ASMARM_SETUP_H #define __ASMARM_SETUP_H +#include #include @@ -35,4 +36,8 @@ void early_mm_init(const struct machine_desc *); void adjust_lowmem_bounds(void); void setup_dma_zone(const struct machine_desc *desc); +#ifdef CONFIG_VGA_CONSOLE +extern struct screen_info vgacon_screen_info; +#endif + #endif diff --git a/arch/arm/kernel/atags_parse.c b/arch/arm/kernel/atags_parse.c index 4c815da3b77b0..4ec591bde3dfa 100644 --- a/arch/arm/kernel/atags_parse.c +++ b/arch/arm/kernel/atags_parse.c @@ -72,15 +72,15 @@ __tagtable(ATAG_MEM, parse_tag_mem32); #if defined(CONFIG_ARCH_FOOTBRIDGE) && defined(CONFIG_VGA_CONSOLE) static int __init parse_tag_videotext(const struct tag *tag) { - screen_info.orig_x = tag->u.videotext.x; - screen_info.orig_y = tag->u.videotext.y; - screen_info.orig_video_page = tag->u.videotext.video_page; - screen_info.orig_video_mode = tag->u.videotext.video_mode; - screen_info.orig_video_cols = tag->u.videotext.video_cols; - screen_info.orig_video_ega_bx = tag->u.videotext.video_ega_bx; - screen_info.orig_video_lines = tag->u.videotext.video_lines; - screen_info.orig_video_isVGA = tag->u.videotext.video_isvga; - screen_info.orig_video_points = tag->u.videotext.video_points; + vgacon_screen_info.orig_x = tag->u.videotext.x; + vgacon_screen_info.orig_y = tag->u.videotext.y; + vgacon_screen_info.orig_video_page = tag->u.videotext.video_page; + vgacon_screen_info.orig_video_mode = tag->u.videotext.video_mode; + vgacon_screen_info.orig_video_cols = tag->u.videotext.video_cols; + vgacon_screen_info.orig_video_ega_bx = tag->u.videotext.video_ega_bx; + vgacon_screen_info.orig_video_lines = tag->u.videotext.video_lines; + vgacon_screen_info.orig_video_isVGA = tag->u.videotext.video_isvga; + vgacon_screen_info.orig_video_points = tag->u.videotext.video_points; return 0; } diff --git a/arch/arm/kernel/efi.c b/arch/arm/kernel/efi.c index e94655ef16bb3..6f9ec7d28a710 100644 --- a/arch/arm/kernel/efi.c +++ b/arch/arm/kernel/efi.c @@ -123,12 +123,6 @@ void __init arm_efi_init(void) { efi_init(); - if (screen_info.orig_video_isVGA == VIDEO_TYPE_EFI) { - /* dummycon on ARM needs non-zero values for columns/lines */ - screen_info.orig_video_cols = 80; - screen_info.orig_video_lines = 25; - } - /* ARM does not permit early mappings to persist across paging_init() */ efi_memmap_unmap(); diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 5d8a7fb3eba45..86c2751f56dcf 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -928,8 +928,8 @@ static void __init request_standard_resources(const struct machine_desc *mdesc) request_resource(&ioport_resource, &lp2); } -#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_EFI) -struct screen_info screen_info = { +#if defined(CONFIG_VGA_CONSOLE) +static struct screen_info vgacon_screen_info = { .orig_video_lines = 30, .orig_video_cols = 80, .orig_video_mode = 0, @@ -939,6 +939,10 @@ struct screen_info screen_info = { }; #endif +#if defined(CONFIG_EFI) +struct screen_info screen_info; +#endif + static int __init customize_machine(void) { /* @@ -1192,7 +1196,7 @@ void __init setup_arch(char **cmdline_p) #ifdef CONFIG_VT #if defined(CONFIG_VGA_CONSOLE) - vgacon_register_screen(&screen_info); + vgacon_register_screen(&vgacon_screen_info); #endif #endif diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c index 2c9283fcd3759..82feae1323f40 100644 --- a/arch/ia64/kernel/setup.c +++ b/arch/ia64/kernel/setup.c @@ -86,7 +86,8 @@ EXPORT_SYMBOL(local_per_cpu_offset); #endif unsigned long ia64_cycles_per_usec; struct ia64_boot_param *ia64_boot_param; -#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_EFI) +#if defined(CONFIG_EFI) +/* No longer used on ia64, but needed for linking */ struct screen_info screen_info; #endif #ifdef CONFIG_VGA_CONSOLE @@ -503,8 +504,9 @@ screen_info_setup(void) { #ifdef CONFIG_VGA_CONSOLE unsigned int orig_x, orig_y, num_cols, num_rows, font_height; + static struct screen_info si; - memset(&screen_info, 0, sizeof(screen_info)); + memset(&si, 0, sizeof(si)); if (!ia64_boot_param->console_info.num_rows || !ia64_boot_param->console_info.num_cols) { @@ -522,14 +524,26 @@ screen_info_setup(void) font_height = 400 / num_rows; } - screen_info.orig_x = orig_x; - screen_info.orig_y = orig_y; - screen_info.orig_video_cols = num_cols; - screen_info.orig_video_lines = num_rows; - screen_info.orig_video_points = font_height; - screen_info.orig_video_mode = 3; /* XXX fake */ - screen_info.orig_video_isVGA = 1; /* XXX fake */ - screen_info.orig_video_ega_bx = 3; /* XXX fake */ + si.orig_x = orig_x; + si.orig_y = orig_y; + si.orig_video_cols = num_cols; + si.orig_video_lines = num_rows; + si.orig_video_points = font_height; + si.orig_video_mode = 3; /* XXX fake */ + si.orig_video_isVGA = 1; /* XXX fake */ + si.orig_video_ega_bx = 3; /* XXX fake */ + + if (!conswitchp) { + /* + * Non-legacy systems may route legacy VGA MMIO range to system + * memory. vga_con probes the MMIO hole, so memory looks like + * a VGA device to it. The EFI memory map can tell us if it's + * memory so we can avoid this problem. + */ + if (efi_mem_type(vga_console_membase + 0xA0000) != + EFI_CONVENTIONAL_MEMORY) { + vgacon_register_screen(&si); + } #endif } @@ -609,21 +623,6 @@ setup_arch (char **cmdline_p) cpu_init(); /* initialize the bootstrap CPU */ mmu_context_init(); /* initialize context_id bitmap */ -#ifdef CONFIG_VT - if (!conswitchp) { -# if defined(CONFIG_VGA_CONSOLE) - /* - * Non-legacy systems may route legacy VGA MMIO range to system - * memory. vga_con probes the MMIO hole, so memory looks like - * a VGA device to it. The EFI memory map can tell us if it's - * memory so we can avoid this problem. - */ - if (efi_mem_type(0xA0000) != EFI_CONVENTIONAL_MEMORY) - vgacon_register_screen(&screen_info); -# endif - } -#endif - /* enable IA-64 Machine Check Abort Handling unless disabled */ if (!nomca) ia64_mca_init(); diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index 6c3fae62a9f6b..cae181bbfee10 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -54,10 +53,6 @@ struct cpuinfo_mips cpu_data[NR_CPUS] __read_mostly; EXPORT_SYMBOL(cpu_data); -#ifdef CONFIG_VGA_CONSOLE -struct screen_info screen_info; -#endif - /* * Setup information * @@ -792,12 +787,6 @@ void __init setup_arch(char **cmdline_p) if (IS_ENABLED(CONFIG_CPU_R4X00_BUGS64)) check_bugs64_early(); -#if defined(CONFIG_VT) -#if defined(CONFIG_VGA_CONSOLE) - vgacon_register_screen(&screen_info); -#endif -#endif - arch_mem_init(cmdline_p); dmi_setup(); diff --git a/arch/mips/mti-malta/malta-setup.c b/arch/mips/mti-malta/malta-setup.c index 21cb3ac1237b7..3a2836e9d8566 100644 --- a/arch/mips/mti-malta/malta-setup.c +++ b/arch/mips/mti-malta/malta-setup.c @@ -161,7 +161,7 @@ static void __init pci_clock_check(void) #if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE) static void __init screen_info_setup(void) { - screen_info = (struct screen_info) { + static struct screen_info si = { .orig_x = 0, .orig_y = 25, .ext_mem_k = 0, @@ -175,6 +175,8 @@ static void __init screen_info_setup(void) .orig_video_isVGA = VIDEO_TYPE_VGAC, .orig_video_points = 16 }; + + vgacon_register_screen(&si); } #endif diff --git a/arch/mips/sibyte/swarm/setup.c b/arch/mips/sibyte/swarm/setup.c index 37df504d3ecbb..74e7c242b6902 100644 --- a/arch/mips/sibyte/swarm/setup.c +++ b/arch/mips/sibyte/swarm/setup.c @@ -112,6 +112,19 @@ int update_persistent_clock64(struct timespec64 now) } } +#ifdef CONFIG_VGA_CONSOLE +static struct screen_info vgacon_screen_info = { + .orig_video_page = 52, + .orig_video_mode = 3, + .orig_video_cols = 80, + .flags = 12, + .orig_video_ega_bx = 3, + .orig_video_lines = 25, + .orig_video_isVGA = 0x22, + .orig_video_points = 16, +}; +#endif + void __init plat_mem_setup(void) { #ifdef CONFIG_SIBYTE_BCM1x80 @@ -130,16 +143,7 @@ void __init plat_mem_setup(void) swarm_rtc_type = RTC_M41T81; #ifdef CONFIG_VGA_CONSOLE - screen_info = (struct screen_info) { - .orig_video_page = 52, - .orig_video_mode = 3, - .orig_video_cols = 80, - .flags = 12, - .orig_video_ega_bx = 3, - .orig_video_lines = 25, - .orig_video_isVGA = 0x22, - .orig_video_points = 16, - }; + vgacon_register_screen(&vgacon_screen_info); /* XXXKW for CFE, get lines/cols from environment */ #endif } diff --git a/arch/mips/sni/setup.c b/arch/mips/sni/setup.c index 9984cf91be7d0..42fdb939c88d8 100644 --- a/arch/mips/sni/setup.c +++ b/arch/mips/sni/setup.c @@ -39,18 +39,20 @@ extern void sni_machine_power_off(void); static void __init sni_display_setup(void) { #if defined(CONFIG_VGA_CONSOLE) && defined(CONFIG_FW_ARC) - struct screen_info *si = &screen_info; + static struct screen_info si; DISPLAY_STATUS *di; di = ArcGetDisplayStatus(1); if (di) { - si->orig_x = di->CursorXPosition; - si->orig_y = di->CursorYPosition; - si->orig_video_cols = di->CursorMaxXPosition; - si->orig_video_lines = di->CursorMaxYPosition; - si->orig_video_isVGA = VIDEO_TYPE_VGAC; - si->orig_video_points = 16; + si.orig_x = di->CursorXPosition; + si.orig_y = di->CursorYPosition; + si.orig_video_cols = di->CursorMaxXPosition; + si.orig_video_lines = di->CursorMaxYPosition; + si.orig_video_isVGA = VIDEO_TYPE_VGAC; + si.orig_video_points = 16; + + vgacon_register_screen(&si); } #endif } diff --git a/drivers/firmware/pcdp.c b/drivers/firmware/pcdp.c index 667a595373b2d..876b3e9b37e25 100644 --- a/drivers/firmware/pcdp.c +++ b/drivers/firmware/pcdp.c @@ -72,7 +72,6 @@ setup_vga_console(struct pcdp_device *dev) return -ENODEV; } - vgacon_register_screen(&screen_info); printk(KERN_INFO "PCDP: VGA console\n"); return 0; #else From patchwork Wed Jul 19 12:39:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 122600 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2409094vqt; Wed, 19 Jul 2023 05:43:18 -0700 (PDT) X-Google-Smtp-Source: APBJJlE6hMS/gpqbMstd/wp1Jr6kNngQ0NYbBBl7+pZH7kCPP6utSRgEJp9Bub26Hxip7cyh2eAS X-Received: by 2002:a17:907:3fa7:b0:992:7594:e6b2 with SMTP id hr39-20020a1709073fa700b009927594e6b2mr2221258ejc.77.1689770597868; Wed, 19 Jul 2023 05:43:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689770597; cv=none; d=google.com; s=arc-20160816; b=hLh0M8HHdDd7zwgkaBKv9hsx+dZSRV/PJ9cSBtHGVcRoAXafvQkGZE4ELOSwqYG6Yv d9u2unqFJza/XWGySbspBq3aitTFX4CAtrIT3wm6BJk8PRR1X+WWvKjWoj/PQ8DHFpSL Wschv1BDuvmfA1vWZF87qGSaKbyds0enr4rlDvlvKyu3o8m+iObz4WaicxG+yIgh+/+c ehxdxMqkub/6OTBy475yFWzyYlHqPK3SpmjQIw5NIXhHpk3NWUC0LRVaICvirKUNgEwW L9dtP2afTG4cuAuZJnKl9oFleuu52DV3ikYqrqBcwxtIabvxIARKZ+qeYEIyfzblvdHG 09yA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zfIDB+eLS3MyoNh8QY5FxsffyHCWTz675+Bl2ivwJGQ=; fh=4WFkd0SKC531xjglIUi33C1n6bFXFguLuCICsINSE7Y=; b=D40zOOs5TdLrvjw2oOyEC6V4XxiyJFX4jKJXvjPK35OuuGlGzHILdndXf6Ru932t6q Pc62uSQ6YQ/tyjzAhwvvBhTd73RPB3uXKnUFM0WS6N8i4f64+Ts9Pp+6fc/7A3guXG+6 EZ1WbqQkxPt6qNEr/FAcAljR+9A8CtVXmYBZjQ0wX7rHUTj2pV2foRHGfEN6ekDBfhm1 6iUjlhlgNo15jZW1qEtVbsPSQFKEM1Eni8Z5tb6FRf6Mn8tPYgK2zRxibyOwEfFTBnwz DWJvyMPVgWo3NmNTgSqHGmPs9rISXJgt4GC72TG1MEv8ZMUnxSsbxSyTtliHC+0Aov5z DH9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vKNV9sNT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jt18-20020a170906dfd200b0098da8d0ce54si2813933ejc.834.2023.07.19.05.42.53; Wed, 19 Jul 2023 05:43:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vKNV9sNT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229884AbjGSMmC (ORCPT + 99 others); Wed, 19 Jul 2023 08:42:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230322AbjGSMli (ORCPT ); Wed, 19 Jul 2023 08:41:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EB241737; Wed, 19 Jul 2023 05:41:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DE212616DA; Wed, 19 Jul 2023 12:41:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B72B0C43395; Wed, 19 Jul 2023 12:41:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689770481; bh=v4M0j8Y9+LzNwuF8nVwMAulIi63E5C7p3UByRxJEuxo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vKNV9sNTUJTcnOk/TL1KoiaHwQQWXHhoPLKo9L7gVUY2yHAnPr3rQfnX/Hso6oJB+ CVdZjSwY/u59qA7uEwriqWsna0VDWCA/aNy3xTaAcHxVapcawxYk8rr49rerGskgYx EJQDb1y5KekinNzg4lX8z5NxO4z5mTup06SfWlkpBZ68CgccaIITSkVOcz/btQ61id eAtCGgCQBOga8OpRGnTyyB54IQWyww6fUqyA5eClL00d32lpYcqM2IQB1PufsqqvYg 1quMka/+qOF+lFoyojoKihE+OHdIXdpDavOUO4HdjzNycQivZ6VIEN22J9iVg/xnEl TF7iPTAVjg67A== From: Arnd Bergmann To: linux-fbdev@vger.kernel.org, Thomas Zimmermann , Helge Deller , Javier Martinez Canillas Cc: Arnd Bergmann , "David S. Miller" , "K. Y. Srinivasan" , Ard Biesheuvel , Borislav Petkov , Brian Cain , Catalin Marinas , Christophe Leroy , Daniel Vetter , Dave Hansen , David Airlie , Deepak Rawat , Dexuan Cui , Dinh Nguyen , Greg Kroah-Hartman , Guo Ren , Haiyang Zhang , Huacai Chen , Ingo Molnar , John Paul Adrian Glaubitz , Khalid Aziz , Linus Walleij , Matt Turner , Max Filippov , Michael Ellerman , Nicholas Piggin , Palmer Dabbelt , Russell King , Thomas Bogendoerfer , Thomas Gleixner , WANG Xuerui , Wei Liu , Will Deacon , x86@kernel.org, linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-efi@vger.kernel.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-hyperv@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH v2 7/9] vga16fb: drop powerpc support Date: Wed, 19 Jul 2023 14:39:42 +0200 Message-Id: <20230719123944.3438363-8-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230719123944.3438363-1-arnd@kernel.org> References: <20230719123944.3438363-1-arnd@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771852894331716741 X-GMAIL-MSGID: 1771852894331716741 From: Arnd Bergmann I noticed that commit 0db5b61e0dc07 ("fbdev/vga16fb: Create EGA/VGA devices in sysfb code") broke vga16fb on non-x86 platforms, because the sysfb code never creates a vga-framebuffer device when screen_info.orig_video_isVGA is set to '1' instead of VIDEO_TYPE_VGAC. However, it turns out that the only architecture that has allowed building vga16fb in the past 20 years is powerpc, and this only worked on two 32-bit platforms and never on 64-bit powerpc. The last machine that actually used this was removed in linux-3.10, so this is all dead code and can be removed. The big-endian support in vga16fb.c could also be removed, but I'd just leave this in place. Fixes: 933ee7119fb14 ("powerpc: remove PReP platform") Signed-off-by: Arnd Bergmann Reviewed-by: Javier Martinez Canillas --- arch/powerpc/kernel/setup-common.c | 16 ---------------- drivers/video/fbdev/Kconfig | 2 +- drivers/video/fbdev/vga16fb.c | 9 +-------- 3 files changed, 2 insertions(+), 25 deletions(-) diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index d2a446216444f..81a6313927228 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -98,21 +97,6 @@ int boot_cpu_hwid = -1; int dcache_bsize; int icache_bsize; -/* - * This still seems to be needed... -- paulus - */ -struct screen_info screen_info = { - .orig_x = 0, - .orig_y = 25, - .orig_video_cols = 80, - .orig_video_lines = 25, - .orig_video_isVGA = 1, - .orig_video_points = 16 -}; -#if defined(CONFIG_FB_VGA16_MODULE) -EXPORT_SYMBOL(screen_info); -#endif - /* Variables required to store legacy IO irq routing */ int of_i8042_kbd_irq; EXPORT_SYMBOL_GPL(of_i8042_kbd_irq); diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig index 9169ee532baf7..ebc3cdfdfca07 100644 --- a/drivers/video/fbdev/Kconfig +++ b/drivers/video/fbdev/Kconfig @@ -368,7 +368,7 @@ config FB_IMSTT config FB_VGA16 tristate "VGA 16-color graphics support" - depends on FB && (X86 || PPC) + depends on FB && X86 select APERTURE_HELPERS select FB_CFB_FILLRECT select FB_CFB_COPYAREA diff --git a/drivers/video/fbdev/vga16fb.c b/drivers/video/fbdev/vga16fb.c index 34d00347ad58a..8e28f9dd19044 100644 --- a/drivers/video/fbdev/vga16fb.c +++ b/drivers/video/fbdev/vga16fb.c @@ -185,8 +185,6 @@ static inline void setindex(int index) /* Check if the video mode is supported by the driver */ static inline int check_mode_supported(const struct screen_info *si) { - /* non-x86 architectures treat orig_video_isVGA as a boolean flag */ -#if defined(CONFIG_X86) /* only EGA and VGA in 16 color graphic mode are supported */ if (si->orig_video_isVGA != VIDEO_TYPE_EGAC && si->orig_video_isVGA != VIDEO_TYPE_VGAC) @@ -197,7 +195,7 @@ static inline int check_mode_supported(const struct screen_info *si) si->orig_video_mode != 0x10 && /* 640x350/4 (EGA) */ si->orig_video_mode != 0x12) /* 640x480/4 (VGA) */ return -ENODEV; -#endif + return 0; } @@ -1338,12 +1336,7 @@ static int vga16fb_probe(struct platform_device *dev) printk(KERN_INFO "vga16fb: mapped to 0x%p\n", info->screen_base); par = info->par; -#if defined(CONFIG_X86) par->isVGA = si->orig_video_isVGA == VIDEO_TYPE_VGAC; -#else - /* non-x86 architectures treat orig_video_isVGA as a boolean flag */ - par->isVGA = si->orig_video_isVGA; -#endif par->palette_blanked = 0; par->vesa_blanked = 0; From patchwork Wed Jul 19 12:39:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 122601 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2409185vqt; Wed, 19 Jul 2023 05:43:28 -0700 (PDT) X-Google-Smtp-Source: APBJJlFel2C5bYL6HTHVH0TfkLkOCc1R6gC5JvBoF7wYCp5SkLhkLpioNNmahlIvccUNvEaRkSLm X-Received: by 2002:a17:906:3b0e:b0:957:2e48:5657 with SMTP id g14-20020a1709063b0e00b009572e485657mr2023217ejf.68.1689770608392; Wed, 19 Jul 2023 05:43:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689770608; cv=none; d=google.com; s=arc-20160816; b=aXw4oO+xTDuMiHfXIKrtVqdK60Po8QzTiqTqkvuCNGgJvRccQD2EaK9ttB5nZj1TDC c1+PyvSloDTbX1+IR8YhnVHgoto+wXEMy5085vXs9PltyWDLaef75OkZBjaIF/VIAhtm 1h7JQg25TN5TUGzpOnZ0518KFj9lhZheQ8RhqnFeoW+jGa7MPaTo5dJ1//EhvJT+f3ev XEZHrNuTizHcYIR/Sce+VZg8o8+aY3qBz3SnDYXT9RVd+WuLnWiC466ZYZgQYvNo2Hr0 z6LpbDP0VDDKrZsDcMgh3askWdWNco3raecVyMNWeCTYz5TuaKhZ6wvtZvOhPWz9wmNf JSdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hw02gRz9BRBvFgHVJvZUwvEhpwe9IIFWraR+a7WdarE=; fh=4WFkd0SKC531xjglIUi33C1n6bFXFguLuCICsINSE7Y=; b=IZQcEEsNWq3AlBGXkbOUWcuIxY2R1DP5MYW4CUuNWZWAhSbBqJjqvzZYB50meuL14V y5E3SLIyzhxSoMI7uSK8WJQn08ZLusRLFMLw3AXCPTT4OeoOr1uO5xcsTOU+MwoS9mPh xeRj3wZ9lTPVXMYZWAB0xfe23+L+QES9dqYtyqNXZiZjrBqiWTiX92P0RtyCtv7iXM2Z WwRMS5SuiiV8Hom191FqYk1L4wuE0Aa+muxhqoIi7rMb/R823l8I0WD4ePMh1rzGvUF8 vzrpwXdb1vacM0AysM/SvXhArz35F7ixbwwC39bSbe5yCzCwWLgMi4vp8DvWqqldTA1B xYhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bQx8YO5r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x24-20020a1709060a5800b00992b63c9f9csi2701855ejf.456.2023.07.19.05.43.04; Wed, 19 Jul 2023 05:43:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bQx8YO5r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229800AbjGSMmU (ORCPT + 99 others); Wed, 19 Jul 2023 08:42:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230288AbjGSMly (ORCPT ); Wed, 19 Jul 2023 08:41:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C96F271D; Wed, 19 Jul 2023 05:41:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AAC766165F; Wed, 19 Jul 2023 12:41:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88321C43391; Wed, 19 Jul 2023 12:41:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689770491; bh=9fW6U6BHu4TUL4RWpVUJbdMggGEj9FTfMpLEh+DKB4A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bQx8YO5rdZGaGJpL2Tgt6DTW/RbyR/A8QofqucAc+4eXdqqSGZqRJ1SkbMDzh4BLI 2NLToZZIHIF9hyPL+Cyk9ib9veIe3JFCFQPNi1M5+29webS34B7tOY2yr6coi1kyR9 68cbQ5j1lku+Y3+WAYkMKAfJYmwUgtN18hZyJw7RPd8HjbKYCKDKOoyZuP0RMlDEPX GCkx3VMGRM6F3nmHYu2QILv1caInSzegNyJm5qhaqJg/HU5Vh3+s6GYahBrXTRz+u2 q5NpRtNW4/xAU+AMW7Nj2hyg2oXsH5ekaaNx3M1dPNTw9WEqMuc5GB/KyGcnL8ktIs NotTDXWPm4GSw== From: Arnd Bergmann To: linux-fbdev@vger.kernel.org, Thomas Zimmermann , Helge Deller , Javier Martinez Canillas Cc: Arnd Bergmann , "David S. Miller" , "K. Y. Srinivasan" , Ard Biesheuvel , Borislav Petkov , Brian Cain , Catalin Marinas , Christophe Leroy , Daniel Vetter , Dave Hansen , David Airlie , Deepak Rawat , Dexuan Cui , Dinh Nguyen , Greg Kroah-Hartman , Guo Ren , Haiyang Zhang , Huacai Chen , Ingo Molnar , John Paul Adrian Glaubitz , Khalid Aziz , Linus Walleij , Matt Turner , Max Filippov , Michael Ellerman , Nicholas Piggin , Palmer Dabbelt , Russell King , Thomas Bogendoerfer , Thomas Gleixner , WANG Xuerui , Wei Liu , Will Deacon , x86@kernel.org, linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-efi@vger.kernel.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-hyperv@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH v2 8/9] hyperv: avoid dependency on screen_info Date: Wed, 19 Jul 2023 14:39:43 +0200 Message-Id: <20230719123944.3438363-9-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230719123944.3438363-1-arnd@kernel.org> References: <20230719123944.3438363-1-arnd@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771852905215977743 X-GMAIL-MSGID: 1771852905215977743 From: Arnd Bergmann The two hyperv framebuffer drivers (hyperv_fb or hyperv_drm_drv) access the global screen_info in order to take over from the sysfb framebuffer, which in turn could be handled by simplefb, simpledrm or efifb. Similarly, the vmbus_drv code marks the original EFI framebuffer as reserved, but this is not required if there is no sysfb. As a preparation for making screen_info itself more local to the sysfb helper code, add a compile-time conditional in all three files that relate to hyperv fb and just skip this code if there is no sysfb that needs to be unregistered. Signed-off-by: Arnd Bergmann Reviewed-by: Javier Martinez Canillas --- drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 7 ++++--- drivers/hv/vmbus_drv.c | 6 ++++-- drivers/video/fbdev/hyperv_fb.c | 8 ++++---- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c index 8026118c6e033..9a44a00effc24 100644 --- a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c +++ b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c @@ -73,9 +73,10 @@ static int hyperv_setup_vram(struct hyperv_drm_device *hv, struct drm_device *dev = &hv->dev; int ret; - drm_aperture_remove_conflicting_framebuffers(screen_info.lfb_base, - screen_info.lfb_size, - &hyperv_driver); + if (IS_ENABLED(CONFIG_SYSFB)) + drm_aperture_remove_conflicting_framebuffers(screen_info.lfb_base, + screen_info.lfb_size, + &hyperv_driver); hv->fb_size = (unsigned long)hv->mmio_megabytes * 1024 * 1024; diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index 67f95a29aeca5..5bc059e8a9f5f 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -2100,8 +2100,10 @@ static void __maybe_unused vmbus_reserve_fb(void) if (efi_enabled(EFI_BOOT)) { /* Gen2 VM: get FB base from EFI framebuffer */ - start = screen_info.lfb_base; - size = max_t(__u32, screen_info.lfb_size, 0x800000); + if (IS_ENABLED(CONFIG_SYSFB)) { + start = screen_info.lfb_base; + size = max_t(__u32, screen_info.lfb_size, 0x800000); + } } else { /* Gen1 VM: get FB base from PCI */ pdev = pci_get_device(PCI_VENDOR_ID_MICROSOFT, diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c index b331452aab4fb..7e0d1c4235549 100644 --- a/drivers/video/fbdev/hyperv_fb.c +++ b/drivers/video/fbdev/hyperv_fb.c @@ -1030,7 +1030,7 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info) goto getmem_done; } pr_info("Unable to allocate enough contiguous physical memory on Gen 1 VM. Using MMIO instead.\n"); - } else { + } else if (IS_ENABLED(CONFIG_SYSFB)) { base = screen_info.lfb_base; size = screen_info.lfb_size; } @@ -1076,13 +1076,13 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info) getmem_done: aperture_remove_conflicting_devices(base, size, KBUILD_MODNAME); - if (gen2vm) { + if (!gen2vm) { + pci_dev_put(pdev); + } else if (IS_ENABLED(CONFIG_SYSFB)) { /* framebuffer is reallocated, clear screen_info to avoid misuse from kexec */ screen_info.lfb_size = 0; screen_info.lfb_base = 0; screen_info.orig_video_isVGA = 0; - } else { - pci_dev_put(pdev); } return 0; From patchwork Wed Jul 19 12:39:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 122602 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2409271vqt; Wed, 19 Jul 2023 05:43:38 -0700 (PDT) X-Google-Smtp-Source: APBJJlEYBoiicp/bvgcIYwdzY8BPV/TLuPgFzYtjUCB52URKQEAnq5cU01Ue0UE8d5BvHkarEBuT X-Received: by 2002:aa7:c246:0:b0:521:8817:cc4c with SMTP id y6-20020aa7c246000000b005218817cc4cmr2517019edo.38.1689770618168; Wed, 19 Jul 2023 05:43:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689770618; cv=none; d=google.com; s=arc-20160816; b=MMeKnnNreDDx4aEdfh9Ikd4Bx6U2sN9uHAQkVXC4AngUBC7Al6h1qN9RMiXzn6n6FR lYsadben8FvKTLW1NKZyyKXWZBgFz6ZUXjW5rmKaYPkXVFNQbzLnp906BRM1ChpwTpi+ jyy2TnEBtb+2ysdNgJPTPmQKuchMDUheXBIVDlI8JqIiHNoIYNjXSALeDKOMaZEq3tNu fmSQVPjJ2ccdQ7Fr8d/RZlh+sBP3zScTAGwdj1ELCdoKPD8jk7Ff44xSGFKy44umcMF1 DcydnnN5VsN5W2jr/RGTfogHx6a2t/mr8aKWHJsZh2lmpVZi/VXFpIDgeVr8Ah30xQ8w wiQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vtLugIaunx2ov+H0xBeZV7qGbtu3/uTaGGNSFBs49k8=; fh=4WFkd0SKC531xjglIUi33C1n6bFXFguLuCICsINSE7Y=; b=SQ5iA/utG7UFkIr8zXfz8mxlb9n9YGn6MwcTvxFRxdeDl9yoN9DWpNPZj6Dr2K4tY0 R8Gg5ujUQITqP0lomaNz8jfv5iXw3maicJHHJYib/R06HwAhiGN/v2vHqy5+mAjXmCtN AzcQ/YipNRAF4XbrnsRDzsFqEVPXNhIxS5y0P+kkws/MPSHeSp9P3NcJD9XkcJDdHPt3 0ufQ3iR0t+FkoxvRvnxr0HTb/GnMkgHZt7G3WtM/ba/NH0GC4rnV9bxB8aYRV1DIu2pH k5FY+Fw8lzPPSe4GGKWAgvSjXGtmGqx2zxgX7IHaIRnSznZekbnhzvlOTuoEuhh3uLYV rFUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sjP1r68G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g21-20020aa7d1d5000000b0051dd07680f2si3049311edp.370.2023.07.19.05.43.14; Wed, 19 Jul 2023 05:43:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sjP1r68G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230432AbjGSMm2 (ORCPT + 99 others); Wed, 19 Jul 2023 08:42:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229719AbjGSMl6 (ORCPT ); Wed, 19 Jul 2023 08:41:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA28B1705; Wed, 19 Jul 2023 05:41:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6A0926163F; Wed, 19 Jul 2023 12:41:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 531E0C433CD; Wed, 19 Jul 2023 12:41:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689770502; bh=QY56G9sStLrW/jpZJL34RSfA39Lgimj77x9wAgnTwKA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sjP1r68GhqPeRtXe827oZjgvfqsr2Kz6jrTRHHaJXY1QqllMVnXytbGdGLmFx1DYl ZZ4jZLtG3wB/uEuHgmX4UvxjdfvODxXuclsAx+unckRlkE6K3Q4uoOvZicqqZ6eDY/ lVLPdUylNAotLohfrI6a0VEs89nV9Z338ZvAcu60wvJa91d7tTZ42ko4IDJLV/AWoI +G0GuXTTwO/InerZqm+4HNgDF0/x2I/Kon118vYZAOx3lhMtaWNawYlxLIfXwgUTRU w8Oyu6p/x9InB4vHL0N6VEA0KCfr4KA6E+eyPDhU0janG05aYXnmXUzd7z7YT6GMHR Um+08NCtT/Y7Q== From: Arnd Bergmann To: linux-fbdev@vger.kernel.org, Thomas Zimmermann , Helge Deller , Javier Martinez Canillas Cc: Arnd Bergmann , "David S. Miller" , "K. Y. Srinivasan" , Ard Biesheuvel , Borislav Petkov , Brian Cain , Catalin Marinas , Christophe Leroy , Daniel Vetter , Dave Hansen , David Airlie , Deepak Rawat , Dexuan Cui , Dinh Nguyen , Greg Kroah-Hartman , Guo Ren , Haiyang Zhang , Huacai Chen , Ingo Molnar , John Paul Adrian Glaubitz , Khalid Aziz , Linus Walleij , Matt Turner , Max Filippov , Michael Ellerman , Nicholas Piggin , Palmer Dabbelt , Russell King , Thomas Bogendoerfer , Thomas Gleixner , WANG Xuerui , Wei Liu , Will Deacon , x86@kernel.org, linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-efi@vger.kernel.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-hyperv@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH v2 9/9] efi: move screen_info into efi init code Date: Wed, 19 Jul 2023 14:39:44 +0200 Message-Id: <20230719123944.3438363-10-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230719123944.3438363-1-arnd@kernel.org> References: <20230719123944.3438363-1-arnd@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771852915657004465 X-GMAIL-MSGID: 1771852915657004465 From: Arnd Bergmann After the vga console no longer relies on global screen_info, there are only two remaining use cases: - on the x86 architecture, it is used for multiple boot methods (bzImage, EFI, Xen, kexec) to commicate the initial VGA or framebuffer settings to a number of device drivers. - on other architectures, it is only used as part of the EFI stub, and only for the three sysfb framebuffers (simpledrm, simplefb, efifb). Remove the duplicate data structure definitions by moving it into the efi-init.c file that sets it up initially for the EFI case, leaving x86 as an exception that retains its own definition for non-EFI boots. The added #ifdefs here are optional, I added them to further limit the reach of screen_info to configurations that have at least one of the users enabled. Signed-off-by: Arnd Bergmann Reviewed-by: Ard Biesheuvel Reviewed-by: Javier Martinez Canillas --- arch/arm/kernel/setup.c | 4 ---- arch/arm64/kernel/efi.c | 4 ---- arch/arm64/kernel/image-vars.h | 2 ++ arch/ia64/kernel/setup.c | 4 ---- arch/loongarch/kernel/efi.c | 3 ++- arch/loongarch/kernel/image-vars.h | 2 ++ arch/loongarch/kernel/setup.c | 5 ----- arch/riscv/kernel/image-vars.h | 2 ++ arch/riscv/kernel/setup.c | 5 ----- drivers/firmware/efi/efi-init.c | 14 +++++++++++++- drivers/firmware/efi/libstub/efi-stub-entry.c | 8 +++++++- 11 files changed, 28 insertions(+), 25 deletions(-) diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 86c2751f56dcf..135b7eff03f72 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -939,10 +939,6 @@ static struct screen_info vgacon_screen_info = { }; #endif -#if defined(CONFIG_EFI) -struct screen_info screen_info; -#endif - static int __init customize_machine(void) { /* diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c index 3afbe503b066f..ff2d5169d7f1f 100644 --- a/arch/arm64/kernel/efi.c +++ b/arch/arm64/kernel/efi.c @@ -71,10 +71,6 @@ static __init pteval_t create_mapping_protection(efi_memory_desc_t *md) return pgprot_val(PAGE_KERNEL_EXEC); } -/* we will fill this structure from the stub, so don't put it in .bss */ -struct screen_info screen_info __section(".data"); -EXPORT_SYMBOL(screen_info); - int __init efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md) { pteval_t prot_val = create_mapping_protection(md); diff --git a/arch/arm64/kernel/image-vars.h b/arch/arm64/kernel/image-vars.h index 35f3c79595137..5e4dc72ab1bda 100644 --- a/arch/arm64/kernel/image-vars.h +++ b/arch/arm64/kernel/image-vars.h @@ -27,7 +27,9 @@ PROVIDE(__efistub__text = _text); PROVIDE(__efistub__end = _end); PROVIDE(__efistub___inittext_end = __inittext_end); PROVIDE(__efistub__edata = _edata); +#if defined(CONFIG_EFI_EARLYCON) || defined(CONFIG_SYSFB) PROVIDE(__efistub_screen_info = screen_info); +#endif PROVIDE(__efistub__ctype = _ctype); PROVIDE(__pi___memcpy = __pi_memcpy); diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c index 82feae1323f40..e91a91b5e9142 100644 --- a/arch/ia64/kernel/setup.c +++ b/arch/ia64/kernel/setup.c @@ -86,10 +86,6 @@ EXPORT_SYMBOL(local_per_cpu_offset); #endif unsigned long ia64_cycles_per_usec; struct ia64_boot_param *ia64_boot_param; -#if defined(CONFIG_EFI) -/* No longer used on ia64, but needed for linking */ -struct screen_info screen_info; -#endif #ifdef CONFIG_VGA_CONSOLE unsigned long vga_console_iobase; unsigned long vga_console_membase; diff --git a/arch/loongarch/kernel/efi.c b/arch/loongarch/kernel/efi.c index 9fc10cea21e10..df7db34024e61 100644 --- a/arch/loongarch/kernel/efi.c +++ b/arch/loongarch/kernel/efi.c @@ -115,7 +115,8 @@ void __init efi_init(void) set_bit(EFI_CONFIG_TABLES, &efi.flags); - init_screen_info(); + if (IS_ENABLED(CONFIG_EFI_EARLYCON) || IS_ENABLED(CONFIG_SYSFB)) + init_screen_info(); if (boot_memmap == EFI_INVALID_TABLE_ADDR) return; diff --git a/arch/loongarch/kernel/image-vars.h b/arch/loongarch/kernel/image-vars.h index e561989d02de9..5087416b9678d 100644 --- a/arch/loongarch/kernel/image-vars.h +++ b/arch/loongarch/kernel/image-vars.h @@ -12,7 +12,9 @@ __efistub_kernel_entry = kernel_entry; __efistub_kernel_asize = kernel_asize; __efistub_kernel_fsize = kernel_fsize; __efistub_kernel_offset = kernel_offset; +#if defined(CONFIG_EFI_EARLYCON) || defined(CONFIG_SYSFB) __efistub_screen_info = screen_info; +#endif #endif diff --git a/arch/loongarch/kernel/setup.c b/arch/loongarch/kernel/setup.c index 77e7a3722caa6..4570c3149b849 100644 --- a/arch/loongarch/kernel/setup.c +++ b/arch/loongarch/kernel/setup.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include @@ -57,10 +56,6 @@ #define SMBIOS_CORE_PACKAGE_OFFSET 0x23 #define LOONGSON_EFI_ENABLE (1 << 3) -#ifdef CONFIG_EFI -struct screen_info screen_info __section(".data"); -#endif - unsigned long fw_arg0, fw_arg1, fw_arg2; DEFINE_PER_CPU(unsigned long, kernelsp); struct cpuinfo_loongarch cpu_data[NR_CPUS] __read_mostly; diff --git a/arch/riscv/kernel/image-vars.h b/arch/riscv/kernel/image-vars.h index 15616155008cc..89d92f9644d5e 100644 --- a/arch/riscv/kernel/image-vars.h +++ b/arch/riscv/kernel/image-vars.h @@ -27,7 +27,9 @@ __efistub__start = _start; __efistub__start_kernel = _start_kernel; __efistub__end = _end; __efistub__edata = _edata; +#if defined(CONFIG_EFI_EARLYCON) || defined(CONFIG_SYSFB) __efistub_screen_info = screen_info; +#endif #endif diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c index a3dbe13f45fb3..aea585dc8e8f3 100644 --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -39,10 +38,6 @@ #include "head.h" -#if defined(CONFIG_EFI) -struct screen_info screen_info __section(".data"); -#endif - /* * The lucky hart to first increment this variable will boot the other cores. * This is used before the kernel initializes the BSS so it can't be in the diff --git a/drivers/firmware/efi/efi-init.c b/drivers/firmware/efi/efi-init.c index ef0820f1a9246..d4987d0130801 100644 --- a/drivers/firmware/efi/efi-init.c +++ b/drivers/firmware/efi/efi-init.c @@ -55,6 +55,15 @@ static phys_addr_t __init efi_to_phys(unsigned long addr) extern __weak const efi_config_table_type_t efi_arch_tables[]; +/* + * x86 defines its own screen_info and uses it even without EFI, + * everything else can get it from here. + */ +#if !defined(CONFIG_X86) && (defined(CONFIG_SYSFB) || defined(CONFIG_EFI_EARLYCON)) +struct screen_info screen_info __section(".data"); +EXPORT_SYMBOL_GPL(screen_info); +#endif + static void __init init_screen_info(void) { struct screen_info *si; @@ -240,5 +249,8 @@ void __init efi_init(void) memblock_reserve(data.phys_map & PAGE_MASK, PAGE_ALIGN(data.size + (data.phys_map & ~PAGE_MASK))); - init_screen_info(); + if (IS_ENABLED(CONFIG_X86) || + IS_ENABLED(CONFIG_SYSFB) || + IS_ENABLED(CONFIG_EFI_EARLYCON)) + init_screen_info(); } diff --git a/drivers/firmware/efi/libstub/efi-stub-entry.c b/drivers/firmware/efi/libstub/efi-stub-entry.c index 2f1902e5d4075..a6c0498351905 100644 --- a/drivers/firmware/efi/libstub/efi-stub-entry.c +++ b/drivers/firmware/efi/libstub/efi-stub-entry.c @@ -13,7 +13,13 @@ struct screen_info *alloc_screen_info(void) { if (IS_ENABLED(CONFIG_ARM)) return __alloc_screen_info(); - return (void *)&screen_info + screen_info_offset; + + if (IS_ENABLED(CONFIG_X86) || + IS_ENABLED(CONFIG_EFI_EARLYCON) || + IS_ENABLED(CONFIG_SYSFB)) + return (void *)&screen_info + screen_info_offset; + + return NULL; } /*