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 <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: Ivan Kokshaysky <[email protected]>
Cc: Matt Turner <[email protected]>
Cc: Russell King <[email protected]>
Cc: Catalin Marinas <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Guo Ren <[email protected]>
Cc: Brian Cain <[email protected]>
Cc: Huacai Chen <[email protected]>
Cc: WANG Xuerui <[email protected]>
Cc: Thomas Bogendoerfer <[email protected]>
Cc: Dinh Nguyen <[email protected]>
Cc: Michael Ellerman <[email protected]>
Cc: Nicholas Piggin <[email protected]>
Cc: Christophe Leroy <[email protected]>
Cc: Paul Walmsley <[email protected]>
Cc: Palmer Dabbelt <[email protected]>
Cc: Albert Ou <[email protected]>
Cc: Yoshinori Sato <[email protected]>
Cc: Rich Felker <[email protected]>
Cc: John Paul Adrian Glaubitz <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: [email protected]
Cc: "H. Peter Anvin" <[email protected]>
Cc: Chris Zankel <[email protected]>
Cc: Max Filippov <[email protected]>
Cc: Helge Deller <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Kees Cook <[email protected]>
Cc: "Paul E. McKenney" <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Ard Biesheuvel <[email protected]>
Cc: Sami Tolvanen <[email protected]>
Cc: Juerg Haefliger <[email protected]>
Cc: Geert Uytterhoeven <[email protected]>
Cc: Anshuman Khandual <[email protected]>
Cc: Niklas Schnelle <[email protected]>
Cc: "Russell King (Oracle)" <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: Sebastian Reichel <[email protected]>
Cc: "Mike Rapoport (IBM)" <[email protected]>
Cc: "Kirill A. Shutemov" <[email protected]>
Cc: Zi Yan <[email protected]>
---
  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 <[email protected]> # loongarch

Thanks!

--
WANG "xen0n" Xuerui

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

Reply via email to