[PATCH 06/12] arch: Declare screen_info in <asm/screen_info.h>

WANG Xuerui kernel at xen0n.name
Thu Jun 29 22:55:02 AEST 2023


On 2023/6/29 19:45, Thomas Zimmermann wrote:
> The variable screen_info does not exist on all architectures. Declare
> it in <asm-generic/screen_info.h>. All architectures that do declare it
> will provide it via <asm/screen_info.h>.
> 
> Add the Kconfig token ARCH_HAS_SCREEN_INFO to guard against access on
> architectures that don't provide screen_info.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
> Cc: Richard Henderson <richard.henderson at linaro.org>
> Cc: Ivan Kokshaysky <ink at jurassic.park.msu.ru>
> Cc: Matt Turner <mattst88 at gmail.com>
> Cc: Russell King <linux at armlinux.org.uk>
> Cc: Catalin Marinas <catalin.marinas at arm.com>
> Cc: Will Deacon <will at kernel.org>
> Cc: Guo Ren <guoren at kernel.org>
> Cc: Brian Cain <bcain at quicinc.com>
> Cc: Huacai Chen <chenhuacai at kernel.org>
> Cc: WANG Xuerui <kernel at xen0n.name>
> Cc: Thomas Bogendoerfer <tsbogend at alpha.franken.de>
> Cc: Dinh Nguyen <dinguyen at kernel.org>
> Cc: Michael Ellerman <mpe at ellerman.id.au>
> Cc: Nicholas Piggin <npiggin at gmail.com>
> Cc: Christophe Leroy <christophe.leroy at csgroup.eu>
> Cc: Paul Walmsley <paul.walmsley at sifive.com>
> Cc: Palmer Dabbelt <palmer at dabbelt.com>
> Cc: Albert Ou <aou at eecs.berkeley.edu>
> Cc: Yoshinori Sato <ysato at users.sourceforge.jp>
> Cc: Rich Felker <dalias at libc.org>
> Cc: John Paul Adrian Glaubitz <glaubitz at physik.fu-berlin.de>
> Cc: "David S. Miller" <davem at davemloft.net>
> Cc: Thomas Gleixner <tglx at linutronix.de>
> Cc: Ingo Molnar <mingo at redhat.com>
> Cc: Borislav Petkov <bp at alien8.de>
> Cc: Dave Hansen <dave.hansen at linux.intel.com>
> Cc: x86 at kernel.org
> Cc: "H. Peter Anvin" <hpa at zytor.com>
> Cc: Chris Zankel <chris at zankel.net>
> Cc: Max Filippov <jcmvbkbc at gmail.com>
> Cc: Helge Deller <deller at gmx.de>
> Cc: Arnd Bergmann <arnd at arndb.de>
> Cc: Kees Cook <keescook at chromium.org>
> Cc: "Paul E. McKenney" <paulmck at kernel.org>
> Cc: Peter Zijlstra <peterz at infradead.org>
> Cc: Frederic Weisbecker <frederic at kernel.org>
> Cc: Andrew Morton <akpm at linux-foundation.org>
> Cc: Ard Biesheuvel <ardb at kernel.org>
> Cc: Sami Tolvanen <samitolvanen at google.com>
> Cc: Juerg Haefliger <juerg.haefliger at canonical.com>
> Cc: Geert Uytterhoeven <geert at linux-m68k.org>
> Cc: Anshuman Khandual <anshuman.khandual at arm.com>
> Cc: Niklas Schnelle <schnelle at linux.ibm.com>
> Cc: "Russell King (Oracle)" <rmk+kernel at armlinux.org.uk>
> Cc: Linus Walleij <linus.walleij at linaro.org>
> Cc: Sebastian Reichel <sebastian.reichel at collabora.com>
> Cc: "Mike Rapoport (IBM)" <rppt at kernel.org>
> Cc: "Kirill A. Shutemov" <kirill.shutemov at linux.intel.com>
> Cc: Zi Yan <ziy at nvidia.com>
> ---
>   arch/Kconfig                      |  6 ++++++
>   arch/alpha/Kconfig                |  1 +
>   arch/arm/Kconfig                  |  1 +
>   arch/arm64/Kconfig                |  1 +
>   arch/csky/Kconfig                 |  1 +
>   arch/hexagon/Kconfig              |  1 +
>   arch/ia64/Kconfig                 |  1 +
>   arch/loongarch/Kconfig            |  1 +
>   arch/mips/Kconfig                 |  1 +
>   arch/nios2/Kconfig                |  1 +
>   arch/powerpc/Kconfig              |  1 +
>   arch/riscv/Kconfig                |  1 +
>   arch/sh/Kconfig                   |  1 +
>   arch/sparc/Kconfig                |  1 +
>   arch/x86/Kconfig                  |  1 +
>   arch/xtensa/Kconfig               |  1 +
>   drivers/video/Kconfig             |  3 +++
>   include/asm-generic/Kbuild        |  1 +
>   include/asm-generic/screen_info.h | 12 ++++++++++++
>   include/linux/screen_info.h       |  2 +-
>   20 files changed, 38 insertions(+), 1 deletion(-)
>   create mode 100644 include/asm-generic/screen_info.h
> 
> diff --git a/arch/Kconfig b/arch/Kconfig
> index 205fd23e0cada..2f58293fd7bcb 100644
> --- a/arch/Kconfig
> +++ b/arch/Kconfig
> @@ -1466,6 +1466,12 @@ config ARCH_HAS_NONLEAF_PMD_YOUNG
>   	  address translations. Page table walkers that clear the accessed bit
>   	  may use this capability to reduce their search space.
>   
> +config ARCH_HAS_SCREEN_INFO
> +	bool
> +	help
> +	  Selected by architectures that provide a global instance of
> +	  screen_info.
> +
>   source "kernel/gcov/Kconfig"
>   
>   source "scripts/gcc-plugins/Kconfig"
> [snip]
> diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
> index d38b066fc931b..6aab2fb7753da 100644
> --- a/arch/loongarch/Kconfig
> +++ b/arch/loongarch/Kconfig
> @@ -13,6 +13,7 @@ config LOONGARCH
>   	select ARCH_HAS_FORTIFY_SOURCE
>   	select ARCH_HAS_NMI_SAFE_THIS_CPU_OPS
>   	select ARCH_HAS_PTE_SPECIAL
> +	select ARCH_HAS_SCREEN_INFO
>   	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
>   	select ARCH_INLINE_READ_LOCK if !PREEMPTION
>   	select ARCH_INLINE_READ_LOCK_BH if !PREEMPTION
> [snip]

Acked-by: WANG Xuerui <git at xen0n.name> # loongarch

Thanks!

-- 
WANG "xen0n" Xuerui

Linux/LoongArch mailing list: https://lore.kernel.org/loongarch/



More information about the Linuxppc-dev mailing list