dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/12] arch,fbdev: Move screen_info into arch/
@ 2023-06-29 11:45 Thomas Zimmermann
  2023-06-29 11:45 ` [PATCH 01/12] efi: Do not include <linux/screen_info.h> from EFI header Thomas Zimmermann
                   ` (12 more replies)
  0 siblings, 13 replies; 44+ messages in thread
From: Thomas Zimmermann @ 2023-06-29 11:45 UTC (permalink / raw)
  To: arnd, deller, daniel, airlied
  Cc: linux-arch, linux-hyperv, linux-efi, linux-ia64,
	Thomas Zimmermann, linux-sh, linux-hexagon, linux-staging,
	linux-kernel, linux-csky, linux-mips, linux-fbdev, dri-devel,
	loongarch, linux-alpha, sparclinux, linux-riscv, linuxppc-dev,
	linux-arm-kernel

The variables screen_info and edid_info provide information about
the system's screen, and possibly EDID data of the connected display.
Both are defined and set by architecture code. But both variables are
declared in non-arch header files. Dependencies are at bease loosely
tracked. To resolve this, move the global state screen_info and its
companion edid_info into arch/. Only declare them on architectures
that define them. List dependencies on the variables in the Kconfig
files. Also clean up the callers.

Patch 1 to 4 resolve a number of unnecessary include statements of
<linux/screen_info.h>. The header should only be included in source
files that access struct screen_info.

Patches 5 to 7 move the declaration of screen_info and edid_info to
<asm-generic/screen_info.h>. Architectures that provide either set
a Kconfig token to enable them.

Patches 8 to 9 make users of screen_info depend on the architecture's
feature.

Finally, patches 10 to 12 rework fbdev's handling of firmware EDID
data to make use of existing helpers and the refactored edid_info.

Tested on x86-64. Built for a variety of platforms.

Future directions: with the patchset in place, it will become possible
to provide screen_info and edid_info only if there are users. Some
architectures do this by testing for CONFIG_VT, CONFIG_DUMMY_CONSOLE,
etc. A more uniform approach would be nice. We should also attempt
to minimize access to the global screen_info as much as possible. To
do so, some drivers, such as efifb and vesafb, would require an update.
The firmware's EDID data could possibly made available outside of fbdev.
For example, the simpledrm and ofdrm drivers could provide such data
to userspace compositors.

Thomas Zimmermann (12):
  efi: Do not include <linux/screen_info.h> from EFI header
  fbdev/sm712fb: Do not include <linux/screen_info.h>
  sysfb: Do not include <linux/screen_info.h> from sysfb header
  staging/sm750fb: Do not include <linux/screen_info.h>
  arch: Remove trailing whitespaces
  arch: Declare screen_info in <asm/screen_info.h>
  arch/x86: Declare edid_info in <asm/screen_info.h>
  drivers/firmware: Remove trailing whitespaces
  drivers: Add dependencies on CONFIG_ARCH_HAS_SCREEN_INFO
  fbdev/core: Use fb_is_primary_device() in fb_firmware_edid()
  fbdev/core: Protect edid_info with CONFIG_ARCH_HAS_EDID_INFO
  fbdev/core: Define empty fb_firmware_edid() in <linux/fb.h>

 arch/Kconfig                                  | 12 +++++++
 arch/alpha/Kconfig                            |  1 +
 arch/arm/Kconfig                              |  1 +
 arch/arm/kernel/efi.c                         |  2 ++
 arch/arm64/Kconfig                            |  1 +
 arch/arm64/kernel/efi.c                       |  1 +
 arch/csky/Kconfig                             |  1 +
 arch/hexagon/Kconfig                          |  1 +
 arch/ia64/Kconfig                             |  5 +--
 arch/loongarch/Kconfig                        |  1 +
 arch/mips/Kconfig                             |  1 +
 arch/nios2/Kconfig                            |  1 +
 arch/powerpc/Kconfig                          |  1 +
 arch/riscv/Kconfig                            |  1 +
 arch/sh/Kconfig                               |  7 ++--
 arch/sparc/Kconfig                            |  1 +
 arch/x86/Kconfig                              |  2 ++
 arch/xtensa/Kconfig                           |  1 +
 drivers/firmware/Kconfig                      |  3 +-
 drivers/firmware/efi/Kconfig                  |  1 +
 drivers/firmware/efi/libstub/efi-stub-entry.c |  2 ++
 drivers/firmware/efi/libstub/screen_info.c    |  2 ++
 drivers/gpu/drm/Kconfig                       |  1 +
 drivers/hv/Kconfig                            |  1 +
 drivers/staging/sm750fb/sm750.c               |  1 -
 drivers/staging/sm750fb/sm750_accel.c         |  1 -
 drivers/staging/sm750fb/sm750_cursor.c        |  1 -
 drivers/staging/sm750fb/sm750_hw.c            |  1 -
 drivers/video/console/Kconfig                 |  2 ++
 drivers/video/fbdev/Kconfig                   |  4 +++
 drivers/video/fbdev/core/fbmon.c              | 34 ++++++-------------
 drivers/video/fbdev/i810/i810-i2c.c           |  2 +-
 drivers/video/fbdev/intelfb/intelfbdrv.c      |  2 +-
 drivers/video/fbdev/nvidia/nv_i2c.c           |  2 +-
 drivers/video/fbdev/savage/savagefb-i2c.c     |  2 +-
 drivers/video/fbdev/sm712fb.c                 |  9 +++--
 include/asm-generic/Kbuild                    |  1 +
 include/asm-generic/screen_info.h             | 18 ++++++++++
 include/linux/efi.h                           |  3 +-
 include/linux/fb.h                            | 10 +++++-
 include/linux/screen_info.h                   |  2 +-
 include/linux/sysfb.h                         |  3 +-
 include/video/edid.h                          |  3 --
 43 files changed, 105 insertions(+), 47 deletions(-)
 create mode 100644 include/asm-generic/screen_info.h


base-commit: d2f0af8472494398a42153684b790b723a79f143
-- 
2.41.0


^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH 01/12] efi: Do not include <linux/screen_info.h> from EFI header
  2023-06-29 11:45 [PATCH 00/12] arch,fbdev: Move screen_info into arch/ Thomas Zimmermann
@ 2023-06-29 11:45 ` Thomas Zimmermann
  2023-07-04 16:23   ` Javier Martinez Canillas
  2023-07-05  1:40   ` [01/12] " Sui Jingfeng
  2023-06-29 11:45 ` [PATCH 02/12] fbdev/sm712fb: Do not include <linux/screen_info.h> Thomas Zimmermann
                   ` (11 subsequent siblings)
  12 siblings, 2 replies; 44+ messages in thread
From: Thomas Zimmermann @ 2023-06-29 11:45 UTC (permalink / raw)
  To: arnd, deller, daniel, airlied
  Cc: linux-hyperv, linux-efi, linux-ia64, linux-sh, Catalin Marinas,
	linux-fbdev, dri-devel, linux-mips, sparclinux, linux-riscv,
	Will Deacon, Ard Biesheuvel, linux-arch, linux-hexagon,
	linux-staging, Russell King, linux-csky, loongarch,
	linux-arm-kernel, linux-kernel, Thomas Zimmermann, linux-alpha,
	linuxppc-dev

The header file <linux/efi.h> does not need anything from
<linux/screen_info.h>. Declare struct screen_info and remove
the include statements. Update a number of source files that
require struct screen_info's definition.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
---
 arch/arm/kernel/efi.c                         | 2 ++
 arch/arm64/kernel/efi.c                       | 1 +
 drivers/firmware/efi/libstub/efi-stub-entry.c | 2 ++
 drivers/firmware/efi/libstub/screen_info.c    | 2 ++
 include/linux/efi.h                           | 3 ++-
 5 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/arch/arm/kernel/efi.c b/arch/arm/kernel/efi.c
index e2b9d2618c672..e94655ef16bb3 100644
--- a/arch/arm/kernel/efi.c
+++ b/arch/arm/kernel/efi.c
@@ -5,6 +5,8 @@
 
 #include <linux/efi.h>
 #include <linux/memblock.h>
+#include <linux/screen_info.h>
+
 #include <asm/efi.h>
 #include <asm/mach/map.h>
 #include <asm/mmu_context.h>
diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
index baab8dd3ead3c..3afbe503b066f 100644
--- a/arch/arm64/kernel/efi.c
+++ b/arch/arm64/kernel/efi.c
@@ -9,6 +9,7 @@
 
 #include <linux/efi.h>
 #include <linux/init.h>
+#include <linux/screen_info.h>
 
 #include <asm/efi.h>
 #include <asm/stacktrace.h>
diff --git a/drivers/firmware/efi/libstub/efi-stub-entry.c b/drivers/firmware/efi/libstub/efi-stub-entry.c
index cc4dcaea67fa6..2f1902e5d4075 100644
--- a/drivers/firmware/efi/libstub/efi-stub-entry.c
+++ b/drivers/firmware/efi/libstub/efi-stub-entry.c
@@ -1,6 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0-only
 
 #include <linux/efi.h>
+#include <linux/screen_info.h>
+
 #include <asm/efi.h>
 
 #include "efistub.h"
diff --git a/drivers/firmware/efi/libstub/screen_info.c b/drivers/firmware/efi/libstub/screen_info.c
index 4be1c4d1f922b..a51ec201ca3cb 100644
--- a/drivers/firmware/efi/libstub/screen_info.c
+++ b/drivers/firmware/efi/libstub/screen_info.c
@@ -1,6 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0
 
 #include <linux/efi.h>
+#include <linux/screen_info.h>
+
 #include <asm/efi.h>
 
 #include "efistub.h"
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 571d1a6e1b744..360895a5572c0 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -24,10 +24,11 @@
 #include <linux/range.h>
 #include <linux/reboot.h>
 #include <linux/uuid.h>
-#include <linux/screen_info.h>
 
 #include <asm/page.h>
 
+struct screen_info;
+
 #define EFI_SUCCESS		0
 #define EFI_LOAD_ERROR		( 1 | (1UL << (BITS_PER_LONG-1)))
 #define EFI_INVALID_PARAMETER	( 2 | (1UL << (BITS_PER_LONG-1)))
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 02/12] fbdev/sm712fb: Do not include <linux/screen_info.h>
  2023-06-29 11:45 [PATCH 00/12] arch,fbdev: Move screen_info into arch/ Thomas Zimmermann
  2023-06-29 11:45 ` [PATCH 01/12] efi: Do not include <linux/screen_info.h> from EFI header Thomas Zimmermann
@ 2023-06-29 11:45 ` Thomas Zimmermann
  2023-07-04 16:25   ` Javier Martinez Canillas
  2023-06-29 11:45 ` [PATCH 03/12] sysfb: Do not include <linux/screen_info.h> from sysfb header Thomas Zimmermann
                   ` (10 subsequent siblings)
  12 siblings, 1 reply; 44+ messages in thread
From: Thomas Zimmermann @ 2023-06-29 11:45 UTC (permalink / raw)
  To: arnd, deller, daniel, airlied
  Cc: linux-arch, linux-hyperv, linux-efi, linux-ia64,
	Thomas Zimmermann, linux-sh, linux-hexagon, linux-staging,
	linux-kernel, linux-csky, linux-mips, linux-fbdev, dri-devel,
	loongarch, linux-alpha, sparclinux, linux-riscv, linuxppc-dev,
	Sudip Mukherjee, linux-arm-kernel, Teddy Wang

Sm712fb's dependency on <linux/screen_info.h> is artificial in that
it only uses struct screen_info for its internals. Replace the use of
struct screen_info with a custom data structure and remove the include
of <linux/screen_info.h>.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Cc: Teddy Wang <teddy.wang@siliconmotion.com>
Cc: Helge Deller <deller@gmx.de>
---
 drivers/video/fbdev/sm712fb.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/sm712fb.c b/drivers/video/fbdev/sm712fb.c
index b7ad3c644e138..f929091da4e77 100644
--- a/drivers/video/fbdev/sm712fb.c
+++ b/drivers/video/fbdev/sm712fb.c
@@ -27,12 +27,17 @@
 #include <linux/uaccess.h>
 #include <linux/module.h>
 #include <linux/console.h>
-#include <linux/screen_info.h>
 
 #include <linux/pm.h>
 
 #include "sm712.h"
 
+struct smtcfb_screen_info {
+	u16 lfb_width;
+	u16 lfb_height;
+	u16 lfb_depth;
+};
+
 /*
  * Private structure
  */
@@ -829,7 +834,7 @@ static const struct modeinit vgamode[] = {
 	},
 };
 
-static struct screen_info smtc_scr_info;
+static struct smtcfb_screen_info smtc_scr_info;
 
 static char *mode_option;
 
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 03/12] sysfb: Do not include <linux/screen_info.h> from sysfb header
  2023-06-29 11:45 [PATCH 00/12] arch,fbdev: Move screen_info into arch/ Thomas Zimmermann
  2023-06-29 11:45 ` [PATCH 01/12] efi: Do not include <linux/screen_info.h> from EFI header Thomas Zimmermann
  2023-06-29 11:45 ` [PATCH 02/12] fbdev/sm712fb: Do not include <linux/screen_info.h> Thomas Zimmermann
@ 2023-06-29 11:45 ` Thomas Zimmermann
  2023-07-04 16:26   ` Javier Martinez Canillas
  2023-07-05  1:41   ` [03/12] " Sui Jingfeng
  2023-06-29 11:45 ` [PATCH 04/12] staging/sm750fb: Do not include <linux/screen_info.h> Thomas Zimmermann
                   ` (9 subsequent siblings)
  12 siblings, 2 replies; 44+ messages in thread
From: Thomas Zimmermann @ 2023-06-29 11:45 UTC (permalink / raw)
  To: arnd, deller, daniel, airlied
  Cc: linux-hyperv, linux-efi, linux-ia64, linux-sh, linux-fbdev,
	dri-devel, linux-mips, sparclinux, linux-riscv, Ard Biesheuvel,
	linux-arch, linux-hexagon, linux-staging,
	Javier Martinez Canillas, linux-csky, Hans de Goede, loongarch,
	linux-arm-kernel, linux-kernel, Thomas Zimmermann, linux-alpha,
	linuxppc-dev

The header file <linux/sysfb.h> does not need anything from
<linux/screen_info.h>. Declare struct screen_info and remove
the include statements.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Javier Martinez Canillas <javierm@redhat.com>
---
 include/linux/sysfb.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/sysfb.h b/include/linux/sysfb.h
index c1ef5fc60a3cb..19cb803dd5ecd 100644
--- a/include/linux/sysfb.h
+++ b/include/linux/sysfb.h
@@ -9,7 +9,8 @@
 
 #include <linux/kernel.h>
 #include <linux/platform_data/simplefb.h>
-#include <linux/screen_info.h>
+
+struct screen_info;
 
 enum {
 	M_I17,		/* 17-Inch iMac */
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 04/12] staging/sm750fb: Do not include <linux/screen_info.h>
  2023-06-29 11:45 [PATCH 00/12] arch,fbdev: Move screen_info into arch/ Thomas Zimmermann
                   ` (2 preceding siblings ...)
  2023-06-29 11:45 ` [PATCH 03/12] sysfb: Do not include <linux/screen_info.h> from sysfb header Thomas Zimmermann
@ 2023-06-29 11:45 ` Thomas Zimmermann
  2023-07-04 16:27   ` Javier Martinez Canillas
  2023-06-29 11:45 ` [PATCH 05/12] arch: Remove trailing whitespaces Thomas Zimmermann
                   ` (8 subsequent siblings)
  12 siblings, 1 reply; 44+ messages in thread
From: Thomas Zimmermann @ 2023-06-29 11:45 UTC (permalink / raw)
  To: arnd, deller, daniel, airlied
  Cc: linux-arch, linux-hyperv, linux-efi, linux-ia64,
	Thomas Zimmermann, linux-sh, linux-hexagon, linux-staging,
	linux-kernel, linux-csky, linux-mips, linux-fbdev, dri-devel,
	loongarch, linux-alpha, sparclinux, linux-riscv, linuxppc-dev,
	Sudip Mukherjee, linux-arm-kernel, Teddy Wang

The sm750fb driver does not need anything from <linux/screen_info.h>.
Remove the include statements.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Cc: Teddy Wang <teddy.wang@siliconmotion.com>
---
 drivers/staging/sm750fb/sm750.c        | 1 -
 drivers/staging/sm750fb/sm750_accel.c  | 1 -
 drivers/staging/sm750fb/sm750_cursor.c | 1 -
 drivers/staging/sm750fb/sm750_hw.c     | 1 -
 4 files changed, 4 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 55e302a27847d..c260f73cf570a 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -14,7 +14,6 @@
 #include <linux/mm_types.h>
 #include <linux/vmalloc.h>
 #include <linux/pagemap.h>
-#include <linux/screen_info.h>
 #include <linux/console.h>
 
 #include "sm750.h"
diff --git a/drivers/staging/sm750fb/sm750_accel.c b/drivers/staging/sm750fb/sm750_accel.c
index 24b9077a634a6..44b9e3fe3a41d 100644
--- a/drivers/staging/sm750fb/sm750_accel.c
+++ b/drivers/staging/sm750fb/sm750_accel.c
@@ -14,7 +14,6 @@
 #include <linux/pagemap.h>
 #include <linux/console.h>
 #include <linux/platform_device.h>
-#include <linux/screen_info.h>
 
 #include "sm750.h"
 #include "sm750_accel.h"
diff --git a/drivers/staging/sm750fb/sm750_cursor.c b/drivers/staging/sm750fb/sm750_cursor.c
index 43e6f52c2551f..eea4d1bd36ce7 100644
--- a/drivers/staging/sm750fb/sm750_cursor.c
+++ b/drivers/staging/sm750fb/sm750_cursor.c
@@ -14,7 +14,6 @@
 #include <linux/pagemap.h>
 #include <linux/console.h>
 #include <linux/platform_device.h>
-#include <linux/screen_info.h>
 
 #include "sm750.h"
 #include "sm750_cursor.h"
diff --git a/drivers/staging/sm750fb/sm750_hw.c b/drivers/staging/sm750fb/sm750_hw.c
index 55cb00e8b0d1c..71247eaf26eef 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -17,7 +17,6 @@
 #include <asm/mtrr.h>
 #endif
 #include <linux/platform_device.h>
-#include <linux/screen_info.h>
 #include <linux/sizes.h>
 
 #include "sm750.h"
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 05/12] arch: Remove trailing whitespaces
  2023-06-29 11:45 [PATCH 00/12] arch,fbdev: Move screen_info into arch/ Thomas Zimmermann
                   ` (3 preceding siblings ...)
  2023-06-29 11:45 ` [PATCH 04/12] staging/sm750fb: Do not include <linux/screen_info.h> Thomas Zimmermann
@ 2023-06-29 11:45 ` Thomas Zimmermann
  2023-07-04 16:27   ` Javier Martinez Canillas
  2023-07-05  1:25   ` [05/12] " Sui Jingfeng
  2023-06-29 11:45 ` [PATCH 06/12] arch: Declare screen_info in <asm/screen_info.h> Thomas Zimmermann
                   ` (7 subsequent siblings)
  12 siblings, 2 replies; 44+ messages in thread
From: Thomas Zimmermann @ 2023-06-29 11:45 UTC (permalink / raw)
  To: arnd, deller, daniel, airlied
  Cc: linux-hyperv, linux-efi, linux-ia64, linux-sh, Peter Zijlstra,
	linux-fbdev, dri-devel, linux-mips, Rich Felker, sparclinux,
	linux-riscv, linux-arch, Yoshinori Sato, linux-hexagon,
	linux-staging, linux-csky, Geert Uytterhoeven, Zi Yan,
	Anshuman Khandual, Niklas Schnelle, loongarch,
	John Paul Adrian Glaubitz, linux-arm-kernel, Arnd Bergmann,
	linux-kernel, Mike Rapoport (IBM),
	Thomas Zimmermann, linux-alpha, Andrew Morton, linuxppc-dev,
	Kirill A. Shutemov

Fix coding style. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Arnd Bergmann <arnd@kernel.org>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Niklas Schnelle <schnelle@linux.ibm.com>
Cc: Zi Yan <ziy@nvidia.com>
Cc: "Mike Rapoport (IBM)" <rppt@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
---
 arch/ia64/Kconfig | 4 ++--
 arch/sh/Kconfig   | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 21fa63ce5ffc0..e79f15e32a451 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -260,7 +260,7 @@ config PERMIT_BSP_REMOVE
 	default n
 	help
 	Say Y here if your platform SAL will support removal of BSP with HOTPLUG_CPU
-	support. 
+	support.
 
 config FORCE_CPEI_RETARGET
 	bool "Force assumption that CPEI can be re-targeted"
@@ -335,7 +335,7 @@ config IA64_PALINFO
 config IA64_MC_ERR_INJECT
 	tristate "MC error injection support"
 	help
-	  Adds support for MC error injection. If enabled, the kernel 
+	  Adds support for MC error injection. If enabled, the kernel
 	  will provide a sysfs interface for user applications to
 	  call MC error injection PAL procedures to inject various errors.
 	  This is a useful tool for MCA testing.
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 9652d367fc377..04b9550cf0070 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -234,7 +234,7 @@ config CPU_SUBTYPE_SH7201
 	select CPU_SH2A
 	select CPU_HAS_FPU
 	select SYS_SUPPORTS_SH_MTU2
- 
+
 config CPU_SUBTYPE_SH7203
 	bool "Support SH7203 processor"
 	select CPU_SH2A
@@ -496,7 +496,7 @@ config CPU_SUBTYPE_SH7366
 endchoice
 
 source "arch/sh/mm/Kconfig"
- 
+
 source "arch/sh/Kconfig.cpu"
 
 source "arch/sh/boards/Kconfig"
@@ -647,7 +647,7 @@ config GUSA
 	  This is the default implementation for both UP and non-ll/sc
 	  CPUs, and is used by the libc, amongst others.
 
-	  For additional information, design information can be found 
+	  For additional information, design information can be found
 	  in <http://lc.linux.or.jp/lc2002/papers/niibe0919p.pdf>.
 
 	  This should only be disabled for special cases where alternate
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 06/12] arch: Declare screen_info in <asm/screen_info.h>
  2023-06-29 11:45 [PATCH 00/12] arch,fbdev: Move screen_info into arch/ Thomas Zimmermann
                   ` (4 preceding siblings ...)
  2023-06-29 11:45 ` [PATCH 05/12] arch: Remove trailing whitespaces Thomas Zimmermann
@ 2023-06-29 11:45 ` Thomas Zimmermann
  2023-06-29 12:55   ` WANG Xuerui
                     ` (3 more replies)
  2023-06-29 11:45 ` [PATCH 07/12] arch/x86: Declare edid_info " Thomas Zimmermann
                   ` (6 subsequent siblings)
  12 siblings, 4 replies; 44+ messages in thread
From: Thomas Zimmermann @ 2023-06-29 11:45 UTC (permalink / raw)
  To: arnd, deller, daniel, airlied
  Cc: linux-hyperv, linux-efi, linux-ia64, Anshuman Khandual, linux-sh,
	Peter Zijlstra, Catalin Marinas, John Paul Adrian Glaubitz,
	linux-fbdev, dri-devel, linux-mips, Max Filippov, Rich Felker,
	Guo Ren, Michael Ellerman, H. Peter Anvin, sparclinux,
	linux-riscv, Will Deacon, WANG Xuerui, linux-arch,
	Kirill A. Shutemov, Yoshinori Sato, linux-hexagon, linux-staging,
	Russell King, linux-csky, Ard Biesheuvel, Dave Hansen,
	Ingo Molnar, Geert Uytterhoeven, Sami Tolvanen, Juerg Haefliger,
	Matt Turner, Huacai Chen, Albert Ou, Kees Cook, Paul E. McKenney,
	Chris Zankel, Frederic Weisbecker, Richard Henderson,
	Nicholas Piggin, Niklas Schnelle, Russell King (Oracle),
	Ivan Kokshaysky, loongarch, Paul Walmsley, Thomas Gleixner,
	Zi Yan, linux-arm-kernel, Brian Cain, Thomas Bogendoerfer,
	Sebastian Reichel, linux-kernel, Dinh Nguyen, Palmer Dabbelt,
	Mike Rapoport (IBM),
	Thomas Zimmermann, linux-alpha, Borislav Petkov, Andrew Morton,
	Christophe Leroy, linuxppc-dev, David S. Miller, x86

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@suse.de>
Cc: Richard Henderson <richard.henderson@linaro.org>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Guo Ren <guoren@kernel.org>
Cc: Brian Cain <bcain@quicinc.com>
Cc: Huacai Chen <chenhuacai@kernel.org>
Cc: WANG Xuerui <kernel@xen0n.name>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Dinh Nguyen <dinguyen@kernel.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: x86@kernel.org
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Chris Zankel <chris@zankel.net>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: Helge Deller <deller@gmx.de>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Kees Cook <keescook@chromium.org>
Cc: "Paul E. McKenney" <paulmck@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Frederic Weisbecker <frederic@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Sami Tolvanen <samitolvanen@google.com>
Cc: Juerg Haefliger <juerg.haefliger@canonical.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Niklas Schnelle <schnelle@linux.ibm.com>
Cc: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Sebastian Reichel <sebastian.reichel@collabora.com>
Cc: "Mike Rapoport (IBM)" <rppt@kernel.org>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Zi Yan <ziy@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"
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index a5c2b1aa46b02..d749011d88b14 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -4,6 +4,7 @@ config ALPHA
 	default y
 	select ARCH_32BIT_USTAT_F_TINODE
 	select ARCH_HAS_CURRENT_STACK_POINTER
+	select ARCH_HAS_SCREEN_INFO
 	select ARCH_MIGHT_HAVE_PC_PARPORT
 	select ARCH_MIGHT_HAVE_PC_SERIO
 	select ARCH_NO_PREEMPT
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 0fb4b218f6658..a9d01ee67a90e 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -15,6 +15,7 @@ config ARM
 	select ARCH_HAS_MEMBARRIER_SYNC_CORE
 	select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
 	select ARCH_HAS_PTE_SPECIAL if ARM_LPAE
+	select ARCH_HAS_SCREEN_INFO
 	select ARCH_HAS_SETUP_DMA_OPS
 	select ARCH_HAS_SET_MEMORY
 	select ARCH_STACKWALK
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 343e1e1cae10a..21addc4715bb3 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -36,6 +36,7 @@ config ARM64
 	select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
 	select ARCH_HAS_PTE_DEVMAP
 	select ARCH_HAS_PTE_SPECIAL
+	select ARCH_HAS_SCREEN_INFO
 	select ARCH_HAS_SETUP_DMA_OPS
 	select ARCH_HAS_SET_DIRECT_MAP
 	select ARCH_HAS_SET_MEMORY
diff --git a/arch/csky/Kconfig b/arch/csky/Kconfig
index 4df1f8c9d170b..28444e581fc1f 100644
--- a/arch/csky/Kconfig
+++ b/arch/csky/Kconfig
@@ -10,6 +10,7 @@ config CSKY
 	select ARCH_USE_QUEUED_RWLOCKS
 	select ARCH_USE_QUEUED_SPINLOCKS
 	select ARCH_HAS_CURRENT_STACK_POINTER
+	select ARCH_HAS_SCREEN_INFO
 	select ARCH_INLINE_READ_LOCK if !PREEMPTION
 	select ARCH_INLINE_READ_LOCK_BH if !PREEMPTION
 	select ARCH_INLINE_READ_LOCK_IRQ if !PREEMPTION
diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig
index 54eadf2651786..cc683c0a43d34 100644
--- a/arch/hexagon/Kconfig
+++ b/arch/hexagon/Kconfig
@@ -5,6 +5,7 @@ comment "Linux Kernel Configuration for Hexagon"
 config HEXAGON
 	def_bool y
 	select ARCH_32BIT_OFF_T
+	select ARCH_HAS_SCREEN_INFO
 	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_NO_PREEMPT
 	select DMA_GLOBAL_POOL
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index e79f15e32a451..8b1e785e6d53d 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -10,6 +10,7 @@ config IA64
 	bool
 	select ARCH_BINFMT_ELF_EXTRA_PHDRS
 	select ARCH_HAS_DMA_MARK_CLEAN
+	select ARCH_HAS_SCREEN_INFO
 	select ARCH_HAS_STRNCPY_FROM_USER
 	select ARCH_HAS_STRNLEN_USER
 	select ARCH_MIGHT_HAVE_PC_PARPORT
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
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 675a8660cb85a..c0ae09789cb6d 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -10,6 +10,7 @@ config MIPS
 	select ARCH_HAS_KCOV
 	select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE if !EVA
 	select ARCH_HAS_PTE_SPECIAL if !(32BIT && CPU_HAS_RIXI)
+	select ARCH_HAS_SCREEN_INFO
 	select ARCH_HAS_STRNCPY_FROM_USER
 	select ARCH_HAS_STRNLEN_USER
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig
index e5936417d3cd3..7183eea282212 100644
--- a/arch/nios2/Kconfig
+++ b/arch/nios2/Kconfig
@@ -3,6 +3,7 @@ config NIOS2
 	def_bool y
 	select ARCH_32BIT_OFF_T
 	select ARCH_HAS_DMA_PREP_COHERENT
+	select ARCH_HAS_SCREEN_INFO
 	select ARCH_HAS_SYNC_DMA_FOR_CPU
 	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_HAS_DMA_SET_UNCACHED
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index bff5820b7cda1..b1acad3076180 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -148,6 +148,7 @@ config PPC
 	select ARCH_HAS_PTE_DEVMAP		if PPC_BOOK3S_64
 	select ARCH_HAS_PTE_SPECIAL
 	select ARCH_HAS_SCALED_CPUTIME		if VIRT_CPU_ACCOUNTING_NATIVE && PPC_BOOK3S_64
+	select ARCH_HAS_SCREEN_INFO
 	select ARCH_HAS_SET_MEMORY
 	select ARCH_HAS_STRICT_KERNEL_RWX	if (PPC_BOOK3S || PPC_8xx || 40x) && !HIBERNATION
 	select ARCH_HAS_STRICT_KERNEL_RWX	if PPC_85xx && !HIBERNATION && !RANDOMIZE_BASE
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 5966ad97c30c3..b5a48f8424af9 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -29,6 +29,7 @@ config RISCV
 	select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
 	select ARCH_HAS_PMEM_API
 	select ARCH_HAS_PTE_SPECIAL
+	select ARCH_HAS_SCREEN_INFO
 	select ARCH_HAS_SET_DIRECT_MAP if MMU
 	select ARCH_HAS_SET_MEMORY if MMU
 	select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 04b9550cf0070..001f5149952b4 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -10,6 +10,7 @@ config SUPERH
 	select ARCH_HAS_GIGANTIC_PAGE
 	select ARCH_HAS_GCOV_PROFILE_ALL
 	select ARCH_HAS_PTE_SPECIAL
+	select ARCH_HAS_SCREEN_INFO
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
 	select ARCH_HIBERNATION_POSSIBLE if MMU
 	select ARCH_MIGHT_HAVE_PC_PARPORT
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 8535e19062f65..e4bfb80b48cfe 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -13,6 +13,7 @@ config 64BIT
 config SPARC
 	bool
 	default y
+	select ARCH_HAS_SCREEN_INFO
 	select ARCH_MIGHT_HAVE_PC_PARPORT if SPARC64 && PCI
 	select ARCH_MIGHT_HAVE_PC_SERIO
 	select DMA_OPS
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 53bab123a8ee4..d7c2bf4ee403d 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -91,6 +91,7 @@ config X86
 	select ARCH_HAS_NONLEAF_PMD_YOUNG	if PGTABLE_LEVELS > 2
 	select ARCH_HAS_UACCESS_FLUSHCACHE	if X86_64
 	select ARCH_HAS_COPY_MC			if X86_64
+	select ARCH_HAS_SCREEN_INFO
 	select ARCH_HAS_SET_MEMORY
 	select ARCH_HAS_SET_DIRECT_MAP
 	select ARCH_HAS_STRICT_KERNEL_RWX
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 3c6e5471f025b..c6cbd7459939c 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -8,6 +8,7 @@ config XTENSA
 	select ARCH_HAS_DMA_PREP_COHERENT if MMU
 	select ARCH_HAS_GCOV_PROFILE_ALL
 	select ARCH_HAS_KCOV
+	select ARCH_HAS_SCREEN_INFO
 	select ARCH_HAS_SYNC_DMA_FOR_CPU if MMU
 	select ARCH_HAS_SYNC_DMA_FOR_DEVICE if MMU
 	select ARCH_HAS_DMA_SET_UNCACHED if MMU
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 8b2b9ac37c3df..d4a72bea56be0 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -21,6 +21,9 @@ config STI_CORE
 config VIDEO_CMDLINE
 	bool
 
+config ARCH_HAS_SCREEN_INFO
+	bool
+
 config VIDEO_NOMODESET
 	bool
 	default n
diff --git a/include/asm-generic/Kbuild b/include/asm-generic/Kbuild
index 941be574bbe00..5e5d4158a4b4b 100644
--- a/include/asm-generic/Kbuild
+++ b/include/asm-generic/Kbuild
@@ -47,6 +47,7 @@ mandatory-y += percpu.h
 mandatory-y += pgalloc.h
 mandatory-y += preempt.h
 mandatory-y += rwonce.h
+mandatory-y += screen_info.h
 mandatory-y += sections.h
 mandatory-y += serial.h
 mandatory-y += shmparam.h
diff --git a/include/asm-generic/screen_info.h b/include/asm-generic/screen_info.h
new file mode 100644
index 0000000000000..6fd0e50fabfcd
--- /dev/null
+++ b/include/asm-generic/screen_info.h
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef _ASM_GENERIC_SCREEN_INFO_H
+#define _ASM_GENERIC_SCREEN_INFO_H
+
+#include <uapi/linux/screen_info.h>
+
+#if defined(CONFIG_ARCH_HAS_SCREEN_INFO)
+extern struct screen_info screen_info;
+#endif
+
+#endif /* _ASM_GENERIC_SCREEN_INFO_H */
diff --git a/include/linux/screen_info.h b/include/linux/screen_info.h
index eab7081392d50..c764b9a51c24b 100644
--- a/include/linux/screen_info.h
+++ b/include/linux/screen_info.h
@@ -4,6 +4,6 @@
 
 #include <uapi/linux/screen_info.h>
 
-extern struct screen_info screen_info;
+#include <asm/screen_info.h>
 
 #endif /* _SCREEN_INFO_H */
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 07/12] arch/x86: Declare edid_info in <asm/screen_info.h>
  2023-06-29 11:45 [PATCH 00/12] arch,fbdev: Move screen_info into arch/ Thomas Zimmermann
                   ` (5 preceding siblings ...)
  2023-06-29 11:45 ` [PATCH 06/12] arch: Declare screen_info in <asm/screen_info.h> Thomas Zimmermann
@ 2023-06-29 11:45 ` Thomas Zimmermann
  2023-06-29 12:35   ` Arnd Bergmann
  2023-06-29 11:45 ` [PATCH 08/12] drivers/firmware: Remove trailing whitespaces Thomas Zimmermann
                   ` (5 subsequent siblings)
  12 siblings, 1 reply; 44+ messages in thread
From: Thomas Zimmermann @ 2023-06-29 11:45 UTC (permalink / raw)
  To: arnd, deller, daniel, airlied
  Cc: linux-hyperv, linux-efi, linux-ia64, linux-sh, Peter Zijlstra,
	Dave Hansen, linux-fbdev, dri-devel, linux-mips, H. Peter Anvin,
	sparclinux, linux-riscv, Ard Biesheuvel, linux-arch,
	linux-hexagon, linux-staging, linux-csky, Ingo Molnar,
	Sami Tolvanen, Kees Cook, Paul E. McKenney, Frederic Weisbecker,
	Nicholas Piggin, Borislav Petkov, loongarch, Thomas Gleixner,
	linux-arm-kernel, x86, linux-kernel, Juerg Haefliger,
	Thomas Zimmermann, linux-alpha, Andrew Morton, linuxppc-dev

The global variable edid_info contains the firmware's EDID information
as an extension to the regular screen_info on x86. Therefore move it to
<asm/screen_info.h>.

Add the Kconfig token ARCH_HAS_EDID_INFO to guard against access on
architectures that don't provide edid_info. Select it on x86.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: x86@kernel.org
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Helge Deller <deller@gmx.de>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Kees Cook <keescook@chromium.org>
Cc: "Paul E. McKenney" <paulmck@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Frederic Weisbecker <frederic@kernel.org>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Sami Tolvanen <samitolvanen@google.com>
Cc: Juerg Haefliger <juerg.haefliger@canonical.com>
---
 arch/Kconfig                      | 6 ++++++
 arch/x86/Kconfig                  | 1 +
 drivers/video/Kconfig             | 3 ---
 include/asm-generic/screen_info.h | 6 ++++++
 include/video/edid.h              | 3 ---
 5 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index 2f58293fd7bcb..ee9866e4df2b0 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_EDID_INFO
+	bool
+	help
+	  Selected by architectures that provide a global instance of
+	  edid_info.
+
 config ARCH_HAS_SCREEN_INFO
 	bool
 	help
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index d7c2bf4ee403d..ee81855116be7 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -76,6 +76,7 @@ config X86
 	select ARCH_HAS_DEBUG_VM_PGTABLE	if !X86_PAE
 	select ARCH_HAS_DEVMEM_IS_ALLOWED
 	select ARCH_HAS_EARLY_DEBUG		if KGDB
+	select ARCH_HAS_EDID_INFO
 	select ARCH_HAS_ELF_RANDOMIZE
 	select ARCH_HAS_FAST_MULTIPLIER
 	select ARCH_HAS_FORTIFY_SOURCE
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index d4a72bea56be0..8b2b9ac37c3df 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -21,9 +21,6 @@ config STI_CORE
 config VIDEO_CMDLINE
 	bool
 
-config ARCH_HAS_SCREEN_INFO
-	bool
-
 config VIDEO_NOMODESET
 	bool
 	default n
diff --git a/include/asm-generic/screen_info.h b/include/asm-generic/screen_info.h
index 6fd0e50fabfcd..5efc99c296b40 100644
--- a/include/asm-generic/screen_info.h
+++ b/include/asm-generic/screen_info.h
@@ -5,6 +5,12 @@
 
 #include <uapi/linux/screen_info.h>
 
+#include <video/edid.h>
+
+#if defined(CONFIG_ARCH_HAS_EDID_INFO)
+extern struct edid_info edid_info;
+#endif
+
 #if defined(CONFIG_ARCH_HAS_SCREEN_INFO)
 extern struct screen_info screen_info;
 #endif
diff --git a/include/video/edid.h b/include/video/edid.h
index f614371e9116a..52aabb7060321 100644
--- a/include/video/edid.h
+++ b/include/video/edid.h
@@ -4,7 +4,4 @@
 
 #include <uapi/video/edid.h>
 
-#ifdef CONFIG_X86
-extern struct edid_info edid_info;
-#endif
 #endif /* __linux_video_edid_h__ */
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 08/12] drivers/firmware: Remove trailing whitespaces
  2023-06-29 11:45 [PATCH 00/12] arch,fbdev: Move screen_info into arch/ Thomas Zimmermann
                   ` (6 preceding siblings ...)
  2023-06-29 11:45 ` [PATCH 07/12] arch/x86: Declare edid_info " Thomas Zimmermann
@ 2023-06-29 11:45 ` Thomas Zimmermann
  2023-07-05  1:26   ` [08/12] " Sui Jingfeng
  2023-07-05  7:46   ` [PATCH 08/12] " Javier Martinez Canillas
  2023-06-29 11:45 ` [PATCH 09/12] drivers: Add dependencies on CONFIG_ARCH_HAS_SCREEN_INFO Thomas Zimmermann
                   ` (4 subsequent siblings)
  12 siblings, 2 replies; 44+ messages in thread
From: Thomas Zimmermann @ 2023-06-29 11:45 UTC (permalink / raw)
  To: arnd, deller, daniel, airlied
  Cc: linux-arch, linux-hyperv, linux-efi, linux-ia64,
	Thomas Zimmermann, linux-sh, linux-hexagon, linux-staging,
	linux-kernel, linux-csky, linux-mips, linux-fbdev, dri-devel,
	loongarch, linux-alpha, sparclinux, linux-riscv, linuxppc-dev,
	linux-arm-kernel

Fix coding style. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/firmware/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index b59e3041fd627..0432737bbb8b4 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -99,7 +99,7 @@ config EFI_PCDP
 	  You must also enable the appropriate drivers (serial, VGA, etc.)
 
 	  See DIG64_HCDPv20_042804.pdf available from
-	  <http://www.dig64.org/specifications/> 
+	  <http://www.dig64.org/specifications/>
 
 config DMIID
     bool "Export DMI identification via sysfs to userspace"
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 09/12] drivers: Add dependencies on CONFIG_ARCH_HAS_SCREEN_INFO
  2023-06-29 11:45 [PATCH 00/12] arch,fbdev: Move screen_info into arch/ Thomas Zimmermann
                   ` (7 preceding siblings ...)
  2023-06-29 11:45 ` [PATCH 08/12] drivers/firmware: Remove trailing whitespaces Thomas Zimmermann
@ 2023-06-29 11:45 ` Thomas Zimmermann
  2023-06-29 11:45 ` [PATCH 10/12] fbdev/core: Use fb_is_primary_device() in fb_firmware_edid() Thomas Zimmermann
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 44+ messages in thread
From: Thomas Zimmermann @ 2023-06-29 11:45 UTC (permalink / raw)
  To: arnd, deller, daniel, airlied
  Cc: linux-hyperv, linux-efi, linux-ia64, linux-sh, linux-fbdev,
	dri-devel, linux-mips, sparclinux, linux-riscv, K. Y. Srinivasan,
	Ard Biesheuvel, linux-arch, Wei Liu, linux-hexagon,
	linux-staging, Dexuan Cui, Javier Martinez Canillas, linux-csky,
	Haiyang Zhang, Maxime Ripard, loongarch, Andy Shevchenko,
	linux-arm-kernel, Greg Kroah-Hartman, Randy Dunlap, linux-kernel,
	Thomas Zimmermann, linux-alpha, linuxppc-dev

Various files within drivers/ depend on the declaration of the
screen_info variable. Add this information to Kconfig.

In the case of the dummy console, the dependency exists only
on ARM. Ignore it on !ARM platforms.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Wei Liu <wei.liu@kernel.org>
Cc: Dexuan Cui <decui@microsoft.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Helge Deller <deller@gmx.de>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Javier Martinez Canillas <javierm@redhat.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/firmware/Kconfig      | 1 +
 drivers/firmware/efi/Kconfig  | 1 +
 drivers/gpu/drm/Kconfig       | 1 +
 drivers/hv/Kconfig            | 1 +
 drivers/video/console/Kconfig | 2 ++
 drivers/video/fbdev/Kconfig   | 4 ++++
 6 files changed, 10 insertions(+)

diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index 0432737bbb8b4..65bbf7422f1db 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -228,6 +228,7 @@ config QCOM_SCM_DOWNLOAD_MODE_DEFAULT
 
 config SYSFB
 	bool
+	depends on ARCH_HAS_SCREEN_INFO
 	select BOOT_VESA_SUPPORT
 
 config SYSFB_SIMPLEFB
diff --git a/drivers/firmware/efi/Kconfig b/drivers/firmware/efi/Kconfig
index 043ca31c114eb..963d305421e50 100644
--- a/drivers/firmware/efi/Kconfig
+++ b/drivers/firmware/efi/Kconfig
@@ -225,6 +225,7 @@ config EFI_DISABLE_PCI_DMA
 config EFI_EARLYCON
 	def_bool y
 	depends on SERIAL_EARLYCON && !ARM && !IA64
+	depends on ARCH_HAS_SCREEN_INFO
 	select FONT_SUPPORT
 	select ARCH_USE_MEMREMAP_PROT
 
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index afb3b2f5f4253..63dfc3391d2ff 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -366,6 +366,7 @@ source "drivers/gpu/drm/sprd/Kconfig"
 config DRM_HYPERV
 	tristate "DRM Support for Hyper-V synthetic video device"
 	depends on DRM && PCI && MMU && HYPERV
+	depends on ARCH_HAS_SCREEN_INFO
 	select DRM_KMS_HELPER
 	select DRM_GEM_SHMEM_HELPER
 	help
diff --git a/drivers/hv/Kconfig b/drivers/hv/Kconfig
index 00242107d62e0..3730c9b42a9bd 100644
--- a/drivers/hv/Kconfig
+++ b/drivers/hv/Kconfig
@@ -6,6 +6,7 @@ config HYPERV
 	tristate "Microsoft Hyper-V client drivers"
 	depends on (X86 && X86_LOCAL_APIC && HYPERVISOR_GUEST) \
 		|| (ACPI && ARM64 && !CPU_BIG_ENDIAN)
+	depends on ARCH_HAS_SCREEN_INFO
 	select PARAVIRT
 	select X86_HV_CALLBACK_VECTOR if X86
 	select OF_EARLY_FLATTREE if OF
diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
index a2a88d42edf0c..b39e2ae039783 100644
--- a/drivers/video/console/Kconfig
+++ b/drivers/video/console/Kconfig
@@ -10,6 +10,7 @@ config VGA_CONSOLE
 	depends on !4xx && !PPC_8xx && !SPARC && !M68K && !PARISC &&  !SUPERH && \
 		(!ARM || ARCH_FOOTBRIDGE || ARCH_INTEGRATOR || ARCH_NETWINDER) && \
 		!ARM64 && !ARC && !MICROBLAZE && !OPENRISC && !S390 && !UML
+	depends on ARCH_HAS_SCREEN_INFO
 	select APERTURE_HELPERS if (DRM || FB || VFIO_PCI_CORE)
 	default y
 	help
@@ -48,6 +49,7 @@ config SGI_NEWPORT_CONSOLE
 
 config DUMMY_CONSOLE
 	bool
+	depends on ARCH_HAS_SCREEN_INFO || !ARM
 	default y
 
 config DUMMY_CONSOLE_COLUMNS
diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index cecf15418632d..e11d85e802bc7 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -655,6 +655,7 @@ config FB_UVESA
 config FB_VESA
 	bool "VESA VGA graphics support"
 	depends on (FB = y) && X86
+	depends on ARCH_HAS_SCREEN_INFO
 	select APERTURE_HELPERS
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
@@ -669,6 +670,7 @@ config FB_VESA
 config FB_EFI
 	bool "EFI-based Framebuffer Support"
 	depends on (FB = y) && !IA64 && EFI
+	depends on ARCH_HAS_SCREEN_INFO
 	select APERTURE_HELPERS
 	select DRM_PANEL_ORIENTATION_QUIRKS
 	select FB_CFB_FILLRECT
@@ -1089,6 +1091,7 @@ config FB_CARILLO_RANCH
 config FB_INTEL
 	tristate "Intel 830M/845G/852GM/855GM/865G/915G/945G/945GM/965G/965GM support"
 	depends on FB && PCI && X86 && AGP_INTEL && EXPERT
+	depends on ARCH_HAS_SCREEN_INFO
 	select FB_MODE_HELPERS
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
@@ -2185,6 +2188,7 @@ config FB_BROADSHEET
 config FB_HYPERV
 	tristate "Microsoft Hyper-V Synthetic Video support"
 	depends on FB && HYPERV
+	depends on ARCH_HAS_SCREEN_INFO
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 10/12] fbdev/core: Use fb_is_primary_device() in fb_firmware_edid()
  2023-06-29 11:45 [PATCH 00/12] arch,fbdev: Move screen_info into arch/ Thomas Zimmermann
                   ` (8 preceding siblings ...)
  2023-06-29 11:45 ` [PATCH 09/12] drivers: Add dependencies on CONFIG_ARCH_HAS_SCREEN_INFO Thomas Zimmermann
@ 2023-06-29 11:45 ` Thomas Zimmermann
  2023-07-05  8:02   ` Javier Martinez Canillas
  2023-06-29 11:45 ` [PATCH 11/12] fbdev/core: Protect edid_info with CONFIG_ARCH_HAS_EDID_INFO Thomas Zimmermann
                   ` (2 subsequent siblings)
  12 siblings, 1 reply; 44+ messages in thread
From: Thomas Zimmermann @ 2023-06-29 11:45 UTC (permalink / raw)
  To: arnd, deller, daniel, airlied
  Cc: linux-hyperv, linux-efi, linux-ia64, linux-sh, linux-fbdev,
	dri-devel, linux-mips, sparclinux, linux-riscv, linux-arch,
	linux-hexagon, linux-staging, linux-csky, Antonino Daplas,
	Maik Broemme, loongarch, linux-arm-kernel, Randy Dunlap,
	linux-kernel, Thomas Zimmermann, linux-alpha, linuxppc-dev

Detect the primary VGA device with fb_is_primary_device() in the
implementation of fb_firmware_edid(). Remove the existing code.

Adapt the function to receive an instance of struct fb_info and
update all callers.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Helge Deller <deller@gmx.de>
Cc: Antonino Daplas <adaplas@gmail.com>
Cc: Maik Broemme <mbroemme@libmpq.org>
Cc: Randy Dunlap <rdunlap@infradead.org>
---
 drivers/video/fbdev/core/fbmon.c          | 25 +++++++----------------
 drivers/video/fbdev/i810/i810-i2c.c       |  2 +-
 drivers/video/fbdev/intelfb/intelfbdrv.c  |  2 +-
 drivers/video/fbdev/nvidia/nv_i2c.c       |  2 +-
 drivers/video/fbdev/savage/savagefb-i2c.c |  2 +-
 include/linux/fb.h                        |  2 +-
 6 files changed, 12 insertions(+), 23 deletions(-)

diff --git a/drivers/video/fbdev/core/fbmon.c b/drivers/video/fbdev/core/fbmon.c
index 79e5bfbdd34c2..35be4431f649a 100644
--- a/drivers/video/fbdev/core/fbmon.c
+++ b/drivers/video/fbdev/core/fbmon.c
@@ -28,7 +28,6 @@
  */
 #include <linux/fb.h>
 #include <linux/module.h>
-#include <linux/pci.h>
 #include <linux/slab.h>
 #include <video/edid.h>
 #include <video/of_videomode.h>
@@ -1482,31 +1481,21 @@ int fb_validate_mode(const struct fb_var_screeninfo *var, struct fb_info *info)
 }
 
 #if defined(CONFIG_FIRMWARE_EDID) && defined(CONFIG_X86)
-
-/*
- * We need to ensure that the EDID block is only returned for
- * the primary graphics adapter.
- */
-
-const unsigned char *fb_firmware_edid(struct device *device)
+const unsigned char *fb_firmware_edid(struct fb_info *info)
 {
-	struct pci_dev *dev = NULL;
-	struct resource *res = NULL;
 	unsigned char *edid = NULL;
 
-	if (device)
-		dev = to_pci_dev(device);
-
-	if (dev)
-		res = &dev->resource[PCI_ROM_RESOURCE];
-
-	if (res && res->flags & IORESOURCE_ROM_SHADOW)
+	/*
+	 * We need to ensure that the EDID block is only
+	 * returned for the primary graphics adapter.
+	 */
+	if (fb_is_primary_device(info))
 		edid = edid_info.dummy;
 
 	return edid;
 }
 #else
-const unsigned char *fb_firmware_edid(struct device *device)
+const unsigned char *fb_firmware_edid(struct fb_info *info)
 {
 	return NULL;
 }
diff --git a/drivers/video/fbdev/i810/i810-i2c.c b/drivers/video/fbdev/i810/i810-i2c.c
index 7db17d0d8a8cf..b605e96620c1f 100644
--- a/drivers/video/fbdev/i810/i810-i2c.c
+++ b/drivers/video/fbdev/i810/i810-i2c.c
@@ -161,7 +161,7 @@ int i810_probe_i2c_connector(struct fb_info *info, u8 **out_edid, int conn)
 	if (conn < par->ddc_num) {
 		edid = fb_ddc_read(&par->chan[conn].adapter);
 	} else {
-		const u8 *e = fb_firmware_edid(info->device);
+		const u8 *e = fb_firmware_edid(info);
 
 		if (e != NULL) {
 			DPRINTK("i810-i2c: Getting EDID from BIOS\n");
diff --git a/drivers/video/fbdev/intelfb/intelfbdrv.c b/drivers/video/fbdev/intelfb/intelfbdrv.c
index a81095b2b1ea5..4633a75e3a613 100644
--- a/drivers/video/fbdev/intelfb/intelfbdrv.c
+++ b/drivers/video/fbdev/intelfb/intelfbdrv.c
@@ -1024,7 +1024,7 @@ static int intelfb_init_var(struct intelfb_info *dinfo)
 		       sizeof(struct fb_var_screeninfo));
 		msrc = 5;
 	} else {
-		const u8 *edid_s = fb_firmware_edid(&dinfo->pdev->dev);
+		const u8 *edid_s = fb_firmware_edid(dinfo->info);
 		u8 *edid_d = NULL;
 
 		if (edid_s) {
diff --git a/drivers/video/fbdev/nvidia/nv_i2c.c b/drivers/video/fbdev/nvidia/nv_i2c.c
index 0b48965a6420c..632e7d622ebfa 100644
--- a/drivers/video/fbdev/nvidia/nv_i2c.c
+++ b/drivers/video/fbdev/nvidia/nv_i2c.c
@@ -159,7 +159,7 @@ int nvidia_probe_i2c_connector(struct fb_info *info, int conn, u8 **out_edid)
 
 	if (!edid && conn == 1) {
 		/* try to get from firmware */
-		const u8 *e = fb_firmware_edid(info->device);
+		const u8 *e = fb_firmware_edid(info);
 
 		if (e != NULL)
 			edid = kmemdup(e, EDID_LENGTH, GFP_KERNEL);
diff --git a/drivers/video/fbdev/savage/savagefb-i2c.c b/drivers/video/fbdev/savage/savagefb-i2c.c
index 80fa87e2ae2ff..cf9c376f76526 100644
--- a/drivers/video/fbdev/savage/savagefb-i2c.c
+++ b/drivers/video/fbdev/savage/savagefb-i2c.c
@@ -227,7 +227,7 @@ int savagefb_probe_i2c_connector(struct fb_info *info, u8 **out_edid)
 
 	if (!edid) {
 		/* try to get from firmware */
-		const u8 *e = fb_firmware_edid(info->device);
+		const u8 *e = fb_firmware_edid(info);
 
 		if (e)
 			edid = kmemdup(e, EDID_LENGTH, GFP_KERNEL);
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 1d5c13f34b098..5ffd2223326bf 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -761,7 +761,7 @@ extern int fb_get_mode(int flags, u32 val, struct fb_var_screeninfo *var,
 extern int fb_validate_mode(const struct fb_var_screeninfo *var,
 			    struct fb_info *info);
 extern int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var);
-extern const unsigned char *fb_firmware_edid(struct device *device);
+extern const unsigned char *fb_firmware_edid(struct fb_info *info);
 extern void fb_edid_to_monspecs(unsigned char *edid,
 				struct fb_monspecs *specs);
 extern void fb_destroy_modedb(struct fb_videomode *modedb);
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 11/12] fbdev/core: Protect edid_info with CONFIG_ARCH_HAS_EDID_INFO
  2023-06-29 11:45 [PATCH 00/12] arch,fbdev: Move screen_info into arch/ Thomas Zimmermann
                   ` (9 preceding siblings ...)
  2023-06-29 11:45 ` [PATCH 10/12] fbdev/core: Use fb_is_primary_device() in fb_firmware_edid() Thomas Zimmermann
@ 2023-06-29 11:45 ` Thomas Zimmermann
  2023-07-05  1:43   ` [11/12] " Sui Jingfeng
  2023-06-29 11:45 ` [PATCH 12/12] fbdev/core: Define empty fb_firmware_edid() in <linux/fb.h> Thomas Zimmermann
  2023-06-29 13:31 ` [PATCH 00/12] arch,fbdev: Move screen_info into arch/ Arnd Bergmann
  12 siblings, 1 reply; 44+ messages in thread
From: Thomas Zimmermann @ 2023-06-29 11:45 UTC (permalink / raw)
  To: arnd, deller, daniel, airlied
  Cc: linux-arch, linux-hyperv, linux-efi, linux-ia64,
	Thomas Zimmermann, linux-sh, linux-hexagon, linux-staging,
	linux-kernel, linux-csky, linux-mips, linux-fbdev, Randy Dunlap,
	dri-devel, loongarch, linux-alpha, sparclinux, linux-riscv,
	linuxppc-dev, linux-arm-kernel

Guard usage of edid_info with CONFIG_ARCH_HAS_EDID_INFO instead
of CONFIG_X86. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Helge Deller <deller@gmx.de>
Cc: Randy Dunlap <rdunlap@infradead.org>
---
 drivers/video/fbdev/core/fbmon.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/core/fbmon.c b/drivers/video/fbdev/core/fbmon.c
index 35be4431f649a..9ae063021e431 100644
--- a/drivers/video/fbdev/core/fbmon.c
+++ b/drivers/video/fbdev/core/fbmon.c
@@ -1480,17 +1480,19 @@ int fb_validate_mode(const struct fb_var_screeninfo *var, struct fb_info *info)
 		-EINVAL : 0;
 }
 
-#if defined(CONFIG_FIRMWARE_EDID) && defined(CONFIG_X86)
+#if defined(CONFIG_FIRMWARE_EDID)
 const unsigned char *fb_firmware_edid(struct fb_info *info)
 {
 	unsigned char *edid = NULL;
 
+#if defined(CONFIG_ARCH_HAS_EDID_INFO)
 	/*
 	 * We need to ensure that the EDID block is only
 	 * returned for the primary graphics adapter.
 	 */
 	if (fb_is_primary_device(info))
 		edid = edid_info.dummy;
+#endif
 
 	return edid;
 }
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 12/12] fbdev/core: Define empty fb_firmware_edid() in <linux/fb.h>
  2023-06-29 11:45 [PATCH 00/12] arch,fbdev: Move screen_info into arch/ Thomas Zimmermann
                   ` (10 preceding siblings ...)
  2023-06-29 11:45 ` [PATCH 11/12] fbdev/core: Protect edid_info with CONFIG_ARCH_HAS_EDID_INFO Thomas Zimmermann
@ 2023-06-29 11:45 ` Thomas Zimmermann
  2023-06-29 13:31 ` [PATCH 00/12] arch,fbdev: Move screen_info into arch/ Arnd Bergmann
  12 siblings, 0 replies; 44+ messages in thread
From: Thomas Zimmermann @ 2023-06-29 11:45 UTC (permalink / raw)
  To: arnd, deller, daniel, airlied
  Cc: linux-arch, linux-hyperv, linux-efi, linux-ia64,
	Thomas Zimmermann, linux-sh, linux-hexagon, linux-staging,
	linux-kernel, linux-csky, linux-mips, linux-fbdev, Randy Dunlap,
	dri-devel, loongarch, linux-alpha, sparclinux, linux-riscv,
	linuxppc-dev, linux-arm-kernel

Move the empty declaration of fb_firmware_edid() to <linux/fb.h>.
Follow common style and avoid the overhead of exporting the symbol.
No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Helge Deller <deller@gmx.de>
Cc: Randy Dunlap <rdunlap@infradead.org>
---
 drivers/video/fbdev/core/fbmon.c |  7 +------
 include/linux/fb.h               | 10 +++++++++-
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/video/fbdev/core/fbmon.c b/drivers/video/fbdev/core/fbmon.c
index 9ae063021e431..d45bd8a18c2f2 100644
--- a/drivers/video/fbdev/core/fbmon.c
+++ b/drivers/video/fbdev/core/fbmon.c
@@ -1496,13 +1496,8 @@ const unsigned char *fb_firmware_edid(struct fb_info *info)
 
 	return edid;
 }
-#else
-const unsigned char *fb_firmware_edid(struct fb_info *info)
-{
-	return NULL;
-}
-#endif
 EXPORT_SYMBOL(fb_firmware_edid);
+#endif
 
 EXPORT_SYMBOL(fb_parse_edid);
 EXPORT_SYMBOL(fb_edid_to_monspecs);
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 5ffd2223326bf..e949532ffc109 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -761,7 +761,6 @@ extern int fb_get_mode(int flags, u32 val, struct fb_var_screeninfo *var,
 extern int fb_validate_mode(const struct fb_var_screeninfo *var,
 			    struct fb_info *info);
 extern int fb_parse_edid(unsigned char *edid, struct fb_var_screeninfo *var);
-extern const unsigned char *fb_firmware_edid(struct fb_info *info);
 extern void fb_edid_to_monspecs(unsigned char *edid,
 				struct fb_monspecs *specs);
 extern void fb_destroy_modedb(struct fb_videomode *modedb);
@@ -774,6 +773,15 @@ extern int of_get_fb_videomode(struct device_node *np,
 extern int fb_videomode_from_videomode(const struct videomode *vm,
 				       struct fb_videomode *fbmode);
 
+#if defined(CONFIG_FIRMWARE_EDID)
+const unsigned char *fb_firmware_edid(struct fb_info *info);
+#else
+static inline const unsigned char *fb_firmware_edid(struct fb_info *info)
+{
+	return NULL;
+}
+#endif
+
 /* drivers/video/modedb.c */
 #define VESA_MODEDB_SIZE 43
 #define DMT_SIZE 0x50
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* Re: [PATCH 07/12] arch/x86: Declare edid_info in <asm/screen_info.h>
  2023-06-29 11:45 ` [PATCH 07/12] arch/x86: Declare edid_info " Thomas Zimmermann
@ 2023-06-29 12:35   ` Arnd Bergmann
  2023-06-29 13:01     ` Thomas Zimmermann
  0 siblings, 1 reply; 44+ messages in thread
From: Arnd Bergmann @ 2023-06-29 12:35 UTC (permalink / raw)
  To: Thomas Zimmermann, Helge Deller, Daniel Vetter, Dave Airlie
  Cc: linux-hyperv, linux-efi, linux-ia64, linux-sh, Peter Zijlstra,
	Dave Hansen, linux-fbdev, dri-devel, linux-mips, H. Peter Anvin,
	sparclinux, linux-riscv, Ard Biesheuvel, Linux-Arch,
	linux-hexagon, linux-staging, linux-csky, Ingo Molnar,
	Sami Tolvanen, Kees Cook, Paul E. McKenney, Frederic Weisbecker,
	Nicholas Piggin, Borislav Petkov, loongarch, Thomas Gleixner,
	linux-arm-kernel, x86, linux-kernel, Juerg Haefliger,
	linux-alpha, Andrew Morton, linuxppc-dev

On Thu, Jun 29, 2023, at 13:45, Thomas Zimmermann wrote:
> The global variable edid_info contains the firmware's EDID information
> as an extension to the regular screen_info on x86. Therefore move it to
> <asm/screen_info.h>.
>
> Add the Kconfig token ARCH_HAS_EDID_INFO to guard against access on
> architectures that don't provide edid_info. Select it on x86.

I'm not sure we need another symbol in addition to
CONFIG_FIRMWARE_EDID. Since all the code behind that
existing symbol is also x86 specific, would it be enough
to just add either 'depends on X86' or 'depends on X86 ||
COMPILE_TEST' there?

      Arnd

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 06/12] arch: Declare screen_info in <asm/screen_info.h>
  2023-06-29 11:45 ` [PATCH 06/12] arch: Declare screen_info in <asm/screen_info.h> Thomas Zimmermann
@ 2023-06-29 12:55   ` WANG Xuerui
  2023-06-29 13:03   ` Arnd Bergmann
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 44+ messages in thread
From: WANG Xuerui @ 2023-06-29 12:55 UTC (permalink / raw)
  To: Thomas Zimmermann, arnd, deller, daniel, airlied
  Cc: linux-hyperv, linux-efi, linux-ia64, Anshuman Khandual, linux-sh,
	Peter Zijlstra, Catalin Marinas, John Paul Adrian Glaubitz,
	linux-fbdev, dri-devel, linux-mips, Max Filippov, Rich Felker,
	Guo Ren, Michael Ellerman, H. Peter Anvin, sparclinux,
	linux-riscv, Will Deacon, Ard Biesheuvel, linux-arch,
	Kirill A. Shutemov, Yoshinori Sato, linux-hexagon, linux-staging,
	Russell King, linux-csky, Dave Hansen, Ingo Molnar,
	Geert Uytterhoeven, Sami Tolvanen, Juerg Haefliger, Matt Turner,
	Huacai Chen, Albert Ou, Kees Cook, Paul E. McKenney,
	Chris Zankel, Frederic Weisbecker, Richard Henderson,
	Nicholas Piggin, Russell King (Oracle),
	Ivan Kokshaysky, loongarch, Paul Walmsley, Thomas Gleixner,
	Zi Yan, linux-arm-kernel, Brian Cain, Thomas Bogendoerfer,
	Sebastian Reichel, linux-kernel, Dinh Nguyen, Palmer Dabbelt,
	Mike Rapoport (IBM),
	Niklas Schnelle, linux-alpha, Borislav Petkov, Andrew Morton,
	Christophe Leroy, linuxppc-dev, David S. Miller, x86

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@suse.de>
> Cc: Richard Henderson <richard.henderson@linaro.org>
> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
> Cc: Matt Turner <mattst88@gmail.com>
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Guo Ren <guoren@kernel.org>
> Cc: Brian Cain <bcain@quicinc.com>
> Cc: Huacai Chen <chenhuacai@kernel.org>
> Cc: WANG Xuerui <kernel@xen0n.name>
> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> Cc: Dinh Nguyen <dinguyen@kernel.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
> Cc: Paul Walmsley <paul.walmsley@sifive.com>
> Cc: Palmer Dabbelt <palmer@dabbelt.com>
> Cc: Albert Ou <aou@eecs.berkeley.edu>
> Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
> Cc: Rich Felker <dalias@libc.org>
> Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Dave Hansen <dave.hansen@linux.intel.com>
> Cc: x86@kernel.org
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: Chris Zankel <chris@zankel.net>
> Cc: Max Filippov <jcmvbkbc@gmail.com>
> Cc: Helge Deller <deller@gmx.de>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Kees Cook <keescook@chromium.org>
> Cc: "Paul E. McKenney" <paulmck@kernel.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Frederic Weisbecker <frederic@kernel.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Ard Biesheuvel <ardb@kernel.org>
> Cc: Sami Tolvanen <samitolvanen@google.com>
> Cc: Juerg Haefliger <juerg.haefliger@canonical.com>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Anshuman Khandual <anshuman.khandual@arm.com>
> Cc: Niklas Schnelle <schnelle@linux.ibm.com>
> Cc: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Sebastian Reichel <sebastian.reichel@collabora.com>
> Cc: "Mike Rapoport (IBM)" <rppt@kernel.org>
> Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
> Cc: Zi Yan <ziy@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@xen0n.name> # loongarch

Thanks!

-- 
WANG "xen0n" Xuerui

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


^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 07/12] arch/x86: Declare edid_info in <asm/screen_info.h>
  2023-06-29 12:35   ` Arnd Bergmann
@ 2023-06-29 13:01     ` Thomas Zimmermann
  2023-06-29 13:21       ` Arnd Bergmann
  0 siblings, 1 reply; 44+ messages in thread
From: Thomas Zimmermann @ 2023-06-29 13:01 UTC (permalink / raw)
  To: Arnd Bergmann, Helge Deller, Daniel Vetter, Dave Airlie
  Cc: linux-hyperv, linux-efi, linux-ia64, linux-sh, Peter Zijlstra,
	Dave Hansen, linux-fbdev, dri-devel, linux-mips, H. Peter Anvin,
	sparclinux, linux-riscv, Ard Biesheuvel, Linux-Arch,
	linux-hexagon, linux-staging, linux-csky, Ingo Molnar,
	Sami Tolvanen, Kees Cook, Paul E. McKenney, Frederic Weisbecker,
	Nicholas Piggin, Borislav Petkov, loongarch, Thomas Gleixner,
	linux-arm-kernel, x86, linux-kernel, Juerg Haefliger,
	linux-alpha, Andrew Morton, linuxppc-dev


[-- Attachment #1.1: Type: text/plain, Size: 1578 bytes --]

Hi

Am 29.06.23 um 14:35 schrieb Arnd Bergmann:
> On Thu, Jun 29, 2023, at 13:45, Thomas Zimmermann wrote:
>> The global variable edid_info contains the firmware's EDID information
>> as an extension to the regular screen_info on x86. Therefore move it to
>> <asm/screen_info.h>.
>>
>> Add the Kconfig token ARCH_HAS_EDID_INFO to guard against access on
>> architectures that don't provide edid_info. Select it on x86.
> 
> I'm not sure we need another symbol in addition to
> CONFIG_FIRMWARE_EDID. Since all the code behind that
> existing symbol is also x86 specific, would it be enough
> to just add either 'depends on X86' or 'depends on X86 ||
> COMPILE_TEST' there?

FIRMWARE_EDID is a user-selectable feature, while ARCH_HAS_EDID_INFO 
announces an architecture feature. They do different things.

Right now, ARCH_HAS_EDID_INFO only works on the old BIOS-based VESA 
systems. In the future, I want to add support for EDID data from EFI and 
OF as well. It would be stored in edid_info. I assume that the new 
symbol will become useful then.

Before this patchset, I originally wanted to make use of edid_info in 
the simpledrm graphics driver. But I found that the rsp code could use 
some work first. Maybe the patchset are already tailored towards the 
future changes.

Best regards
Thomas

> 
>        Arnd

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 06/12] arch: Declare screen_info in <asm/screen_info.h>
  2023-06-29 11:45 ` [PATCH 06/12] arch: Declare screen_info in <asm/screen_info.h> Thomas Zimmermann
  2023-06-29 12:55   ` WANG Xuerui
@ 2023-06-29 13:03   ` Arnd Bergmann
  2023-06-29 13:18     ` Thomas Zimmermann
  2023-07-05  1:21   ` [06/12] " Sui Jingfeng
  2023-08-18 14:04   ` suijingfeng
  3 siblings, 1 reply; 44+ messages in thread
From: Arnd Bergmann @ 2023-06-29 13:03 UTC (permalink / raw)
  To: Thomas Zimmermann, Helge Deller, Daniel Vetter, Dave Airlie
  Cc: linux-hyperv, linux-efi, linux-ia64, Anshuman Khandual, linux-sh,
	Peter Zijlstra, Catalin Marinas, John Paul Adrian Glaubitz,
	linux-fbdev, dri-devel, linux-mips, Max Filippov, Rich Felker,
	guoren, Michael Ellerman, H. Peter Anvin, sparclinux,
	linux-riscv, Will Deacon, WANG Xuerui, Linux-Arch,
	Kirill A. Shutemov, Yoshinori Sato, linux-hexagon, linux-staging,
	Russell King, linux-csky, Ard Biesheuvel, Dave Hansen,
	Ingo Molnar, Geert Uytterhoeven, Sami Tolvanen, Juerg Haefliger,
	Matt Turner, Huacai Chen, Albert Ou, Kees Cook, Paul E. McKenney,
	Chris Zankel, Frederic Weisbecker, Richard Henderson,
	Nicholas Piggin, Russell King, Ivan Kokshaysky, loongarch,
	Paul Walmsley, Thomas Gleixner, Zi Yan, linux-arm-kernel,
	Brian Cain, Thomas Bogendoerfer, Sebastian Reichel, linux-kernel,
	Dinh Nguyen, Palmer Dabbelt, Mike Rapoport, Niklas Schnelle,
	linux-alpha, Borislav Petkov, Andrew Morton, Christophe Leroy,
	linuxppc-dev, David S . Miller, x86

On Thu, Jun 29, 2023, at 13:45, Thomas Zimmermann wrote:

> diff --git a/include/asm-generic/screen_info.h 
> b/include/asm-generic/screen_info.h
> new file mode 100644
> index 0000000000000..6fd0e50fabfcd
> --- /dev/null
> +++ b/include/asm-generic/screen_info.h
> @@ -0,0 +1,12 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +
> +#ifndef _ASM_GENERIC_SCREEN_INFO_H
> +#define _ASM_GENERIC_SCREEN_INFO_H
> +
> +#include <uapi/linux/screen_info.h>
> +
> +#if defined(CONFIG_ARCH_HAS_SCREEN_INFO)
> +extern struct screen_info screen_info;
> +#endif
> +
> +#endif /* _ASM_GENERIC_SCREEN_INFO_H */
> diff --git a/include/linux/screen_info.h b/include/linux/screen_info.h
> index eab7081392d50..c764b9a51c24b 100644
> --- a/include/linux/screen_info.h
> +++ b/include/linux/screen_info.h
> @@ -4,6 +4,6 @@
> 
>  #include <uapi/linux/screen_info.h>
> 
> -extern struct screen_info screen_info;
> +#include <asm/screen_info.h>
> 

What is the purpose of adding a file in asm-generic? If all
architectures use the same generic file, I'd just leave the
declaration in include/linux/. I wouldn't bother adding the
#ifdef either, but I can see how that helps turn a link
error into an earlier compile error.

      Arnd

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 06/12] arch: Declare screen_info in <asm/screen_info.h>
  2023-06-29 13:03   ` Arnd Bergmann
@ 2023-06-29 13:18     ` Thomas Zimmermann
  0 siblings, 0 replies; 44+ messages in thread
From: Thomas Zimmermann @ 2023-06-29 13:18 UTC (permalink / raw)
  To: Arnd Bergmann, Helge Deller, Daniel Vetter, Dave Airlie
  Cc: linux-hyperv, linux-efi, linux-ia64, Anshuman Khandual, linux-sh,
	Peter Zijlstra, Catalin Marinas, John Paul Adrian Glaubitz,
	linux-fbdev, dri-devel, linux-mips, Max Filippov, Rich Felker,
	guoren, Michael Ellerman, H. Peter Anvin, sparclinux,
	linux-riscv, Will Deacon, WANG Xuerui, Linux-Arch,
	Kirill A. Shutemov, Yoshinori Sato, linux-hexagon, linux-staging,
	Russell King, linux-csky, Ard Biesheuvel, Dave Hansen,
	Ingo Molnar, Geert Uytterhoeven, Sami Tolvanen, Juerg Haefliger,
	Matt Turner, Huacai Chen, Albert Ou, Kees Cook, Paul E. McKenney,
	Chris Zankel, Frederic Weisbecker, Richard Henderson,
	Nicholas Piggin, Russell King, Ivan Kokshaysky, loongarch,
	Paul Walmsley, Thomas Gleixner, Zi Yan, linux-arm-kernel,
	Brian Cain, Thomas Bogendoerfer, Sebastian Reichel, linux-kernel,
	Dinh Nguyen, Palmer Dabbelt, Mike Rapoport, Niklas Schnelle,
	linux-alpha, Borislav Petkov, Andrew Morton, Christophe Leroy,
	linuxppc-dev, David S . Miller, x86


[-- Attachment #1.1: Type: text/plain, Size: 1819 bytes --]

Hi

Am 29.06.23 um 15:03 schrieb Arnd Bergmann:
> On Thu, Jun 29, 2023, at 13:45, Thomas Zimmermann wrote:
> 
>> diff --git a/include/asm-generic/screen_info.h
>> b/include/asm-generic/screen_info.h
>> new file mode 100644
>> index 0000000000000..6fd0e50fabfcd
>> --- /dev/null
>> +++ b/include/asm-generic/screen_info.h
>> @@ -0,0 +1,12 @@
>> +/* SPDX-License-Identifier: GPL-2.0 */
>> +
>> +#ifndef _ASM_GENERIC_SCREEN_INFO_H
>> +#define _ASM_GENERIC_SCREEN_INFO_H
>> +
>> +#include <uapi/linux/screen_info.h>
>> +
>> +#if defined(CONFIG_ARCH_HAS_SCREEN_INFO)
>> +extern struct screen_info screen_info;
>> +#endif
>> +
>> +#endif /* _ASM_GENERIC_SCREEN_INFO_H */
>> diff --git a/include/linux/screen_info.h b/include/linux/screen_info.h
>> index eab7081392d50..c764b9a51c24b 100644
>> --- a/include/linux/screen_info.h
>> +++ b/include/linux/screen_info.h
>> @@ -4,6 +4,6 @@
>>
>>   #include <uapi/linux/screen_info.h>
>>
>> -extern struct screen_info screen_info;
>> +#include <asm/screen_info.h>
>>
> 
> What is the purpose of adding a file in asm-generic? If all
> architectures use the same generic file, I'd just leave the
> declaration in include/linux/. I wouldn't bother adding the

That appears a bit 'un-clean' for something that is defined in 
architecture? But OK, I would not object.

> #ifdef either, but I can see how that helps turn a link
> error into an earlier compile error.

Yes, that's intentional. If there's a Kconfig token anyway, we can also 
fail early during the build.

Best regards
Thomas

> 
>        Arnd

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 07/12] arch/x86: Declare edid_info in <asm/screen_info.h>
  2023-06-29 13:01     ` Thomas Zimmermann
@ 2023-06-29 13:21       ` Arnd Bergmann
  2023-06-30  7:46         ` Thomas Zimmermann
  0 siblings, 1 reply; 44+ messages in thread
From: Arnd Bergmann @ 2023-06-29 13:21 UTC (permalink / raw)
  To: Thomas Zimmermann, Helge Deller, Daniel Vetter, Dave Airlie
  Cc: linux-hyperv, linux-efi, linux-ia64, linux-sh, Peter Zijlstra,
	Dave Hansen, linux-fbdev, dri-devel, linux-mips, H. Peter Anvin,
	sparclinux, linux-riscv, Ard Biesheuvel, Linux-Arch,
	linux-hexagon, linux-staging, linux-csky, Ingo Molnar,
	Sami Tolvanen, Kees Cook, Paul E. McKenney, Frederic Weisbecker,
	Nicholas Piggin, Borislav Petkov, loongarch, Thomas Gleixner,
	linux-arm-kernel, x86, linux-kernel, Juerg Haefliger,
	linux-alpha, Andrew Morton, linuxppc-dev

On Thu, Jun 29, 2023, at 15:01, Thomas Zimmermann wrote:
> Am 29.06.23 um 14:35 schrieb Arnd Bergmann:
>> On Thu, Jun 29, 2023, at 13:45, Thomas Zimmermann wrote:
>>> The global variable edid_info contains the firmware's EDID information
>>> as an extension to the regular screen_info on x86. Therefore move it to
>>> <asm/screen_info.h>.
>>>
>>> Add the Kconfig token ARCH_HAS_EDID_INFO to guard against access on
>>> architectures that don't provide edid_info. Select it on x86.
>> 
>> I'm not sure we need another symbol in addition to
>> CONFIG_FIRMWARE_EDID. Since all the code behind that
>> existing symbol is also x86 specific, would it be enough
>> to just add either 'depends on X86' or 'depends on X86 ||
>> COMPILE_TEST' there?
>
> FIRMWARE_EDID is a user-selectable feature, while ARCH_HAS_EDID_INFO 
> announces an architecture feature. They do different things.

I still have trouble seeing the difference.

> Right now, ARCH_HAS_EDID_INFO only works on the old BIOS-based VESA 
> systems. In the future, I want to add support for EDID data from EFI and 
> OF as well. It would be stored in edid_info. I assume that the new 
> symbol will become useful then.

I don't see why an OF based system would have the same limitation
as legacy BIOS with supporting only a single monitor, if we need
to have a generic representation of EDID data in DT, that would
probably be in a per device property anyway.

I suppose you could use FIRMWARE_EDID on EFI or OF systems without
the need for a global edid_info structure, but that would not
share any code with the current fb_firmware_edid() function.

     Arnd

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 00/12] arch,fbdev: Move screen_info into arch/
  2023-06-29 11:45 [PATCH 00/12] arch,fbdev: Move screen_info into arch/ Thomas Zimmermann
                   ` (11 preceding siblings ...)
  2023-06-29 11:45 ` [PATCH 12/12] fbdev/core: Define empty fb_firmware_edid() in <linux/fb.h> Thomas Zimmermann
@ 2023-06-29 13:31 ` Arnd Bergmann
  2023-06-29 14:15   ` Thomas Zimmermann
  2023-06-29 14:29   ` Arnd Bergmann
  12 siblings, 2 replies; 44+ messages in thread
From: Arnd Bergmann @ 2023-06-29 13:31 UTC (permalink / raw)
  To: Thomas Zimmermann, Helge Deller, Daniel Vetter, Dave Airlie
  Cc: Linux-Arch, linux-hyperv, linux-efi, linux-ia64, loongarch,
	linux-sh, linux-hexagon, linux-staging, linux-kernel, linux-csky,
	linux-mips, dri-devel, linux-fbdev, linux-alpha, sparclinux,
	linux-riscv, linuxppc-dev, linux-arm-kernel

On Thu, Jun 29, 2023, at 13:45, Thomas Zimmermann wrote:
> The variables screen_info and edid_info provide information about
> the system's screen, and possibly EDID data of the connected display.
> Both are defined and set by architecture code. But both variables are
> declared in non-arch header files. Dependencies are at bease loosely
> tracked. To resolve this, move the global state screen_info and its
> companion edid_info into arch/. Only declare them on architectures
> that define them. List dependencies on the variables in the Kconfig
> files. Also clean up the callers.
>
> Patch 1 to 4 resolve a number of unnecessary include statements of
> <linux/screen_info.h>. The header should only be included in source
> files that access struct screen_info.
>
> Patches 5 to 7 move the declaration of screen_info and edid_info to
> <asm-generic/screen_info.h>. Architectures that provide either set
> a Kconfig token to enable them.
>
> Patches 8 to 9 make users of screen_info depend on the architecture's
> feature.
>
> Finally, patches 10 to 12 rework fbdev's handling of firmware EDID
> data to make use of existing helpers and the refactored edid_info.
>
> Tested on x86-64. Built for a variety of platforms.

This all looks like a nice cleanup!

> Future directions: with the patchset in place, it will become possible
> to provide screen_info and edid_info only if there are users. Some
> architectures do this by testing for CONFIG_VT, CONFIG_DUMMY_CONSOLE,
> etc. A more uniform approach would be nice. We should also attempt
> to minimize access to the global screen_info as much as possible. To
> do so, some drivers, such as efifb and vesafb, would require an update.
> The firmware's EDID data could possibly made available outside of fbdev.
> For example, the simpledrm and ofdrm drivers could provide such data
> to userspace compositors.

I suspect that most architectures that provide a screen_info only
have this in order to compile the framebuffer drivers, and provide
hardcoded data that does not even reflect any real hardware.

We can probably reduce the number of architectures that do this
a lot, especially if we get EFI out of the picture.

      Arnd

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 00/12] arch,fbdev: Move screen_info into arch/
  2023-06-29 13:31 ` [PATCH 00/12] arch,fbdev: Move screen_info into arch/ Arnd Bergmann
@ 2023-06-29 14:15   ` Thomas Zimmermann
  2023-06-29 14:42     ` Arnd Bergmann
  2023-06-29 14:29   ` Arnd Bergmann
  1 sibling, 1 reply; 44+ messages in thread
From: Thomas Zimmermann @ 2023-06-29 14:15 UTC (permalink / raw)
  To: Arnd Bergmann, Helge Deller, Daniel Vetter, Dave Airlie
  Cc: Linux-Arch, linux-hyperv, linux-efi, linux-ia64, loongarch,
	linux-sh, linux-hexagon, linux-staging, linux-kernel, linux-csky,
	linux-mips, dri-devel, linux-fbdev, linux-alpha, sparclinux,
	linux-riscv, linuxppc-dev, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 3299 bytes --]

Hi

Am 29.06.23 um 15:31 schrieb Arnd Bergmann:
> On Thu, Jun 29, 2023, at 13:45, Thomas Zimmermann wrote:
>> The variables screen_info and edid_info provide information about
>> the system's screen, and possibly EDID data of the connected display.
>> Both are defined and set by architecture code. But both variables are
>> declared in non-arch header files. Dependencies are at bease loosely
>> tracked. To resolve this, move the global state screen_info and its
>> companion edid_info into arch/. Only declare them on architectures
>> that define them. List dependencies on the variables in the Kconfig
>> files. Also clean up the callers.
>>
>> Patch 1 to 4 resolve a number of unnecessary include statements of
>> <linux/screen_info.h>. The header should only be included in source
>> files that access struct screen_info.
>>
>> Patches 5 to 7 move the declaration of screen_info and edid_info to
>> <asm-generic/screen_info.h>. Architectures that provide either set
>> a Kconfig token to enable them.
>>
>> Patches 8 to 9 make users of screen_info depend on the architecture's
>> feature.
>>
>> Finally, patches 10 to 12 rework fbdev's handling of firmware EDID
>> data to make use of existing helpers and the refactored edid_info.
>>
>> Tested on x86-64. Built for a variety of platforms.
> 
> This all looks like a nice cleanup!

I guess that patches 1 to 4 are uncontroversial and could be landed 
quickly. Patches 10 to 12 are probably as well.

> 
>> Future directions: with the patchset in place, it will become possible
>> to provide screen_info and edid_info only if there are users. Some
>> architectures do this by testing for CONFIG_VT, CONFIG_DUMMY_CONSOLE,
>> etc. A more uniform approach would be nice. We should also attempt
>> to minimize access to the global screen_info as much as possible. To
>> do so, some drivers, such as efifb and vesafb, would require an update.
>> The firmware's EDID data could possibly made available outside of fbdev.
>> For example, the simpledrm and ofdrm drivers could provide such data
>> to userspace compositors.
> 
> I suspect that most architectures that provide a screen_info only
> have this in order to compile the framebuffer drivers, and provide
> hardcoded data that does not even reflect any real hardware.

That's quite possible. Only x86's bootparam and EFI code sets 
screen_info from external data. The rest is hardcoded. A number of 
architectures protect screen_info with CONFIG_VT, CONFIG_DUMMY_CONSOLE, 
etc. In a later patchset, I wanted to change this such that these users 
of screen_info would enable the feature via select in their Kconfig.

Do you know the reason for this branch in dummycon:

https://elixir.bootlin.com/linux/v6.4/source/drivers/video/console/dummycon.c#L21

What is special about arm that dummycon uses the screeninfo?

> 
> We can probably reduce the number of architectures that do this
> a lot, especially if we get EFI out of the picture.

Can you elaborate?

Best regards
Thomas

> 
>        Arnd

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 00/12] arch,fbdev: Move screen_info into arch/
  2023-06-29 13:31 ` [PATCH 00/12] arch,fbdev: Move screen_info into arch/ Arnd Bergmann
  2023-06-29 14:15   ` Thomas Zimmermann
@ 2023-06-29 14:29   ` Arnd Bergmann
  1 sibling, 0 replies; 44+ messages in thread
From: Arnd Bergmann @ 2023-06-29 14:29 UTC (permalink / raw)
  To: Thomas Zimmermann, Helge Deller, Daniel Vetter, Dave Airlie
  Cc: Linux-Arch, linux-hyperv, linux-efi, linux-ia64, loongarch,
	linux-sh, linux-hexagon, linux-staging, linux-kernel, linux-csky,
	linux-mips, dri-devel, linux-fbdev, linux-alpha, sparclinux,
	linux-riscv, linuxppc-dev, linux-arm-kernel

On Thu, Jun 29, 2023, at 15:31, Arnd Bergmann wrote:
> On Thu, Jun 29, 2023, at 13:45, Thomas Zimmermann wrote:
>>
>> Future directions: with the patchset in place, it will become possible
>> to provide screen_info and edid_info only if there are users. Some
>> architectures do this by testing for CONFIG_VT, CONFIG_DUMMY_CONSOLE,
>> etc. A more uniform approach would be nice. We should also attempt
>> to minimize access to the global screen_info as much as possible. To
>> do so, some drivers, such as efifb and vesafb, would require an update.
>> The firmware's EDID data could possibly made available outside of fbdev.
>> For example, the simpledrm and ofdrm drivers could provide such data
>> to userspace compositors.
>
> I suspect that most architectures that provide a screen_info only
> have this in order to compile the framebuffer drivers, and provide
> hardcoded data that does not even reflect any real hardware.
>
> We can probably reduce the number of architectures that do this
> a lot, especially if we get EFI out of the picture.

I tried to have another look at who uses what, and here are
some observations:

- EFIFB and hyperv are the only ones that are relevant on modern
  systmes, and they are only used on systems using EFI, so they
  could use a separate data structure that is defined as part of
  drivers/firmware/efi. This would likely mean we don't have to
  define a separate screen_info for arm64, loongarch, ia64 and
  riscv, and could separate the legacy vgacon/vesafb stuff on
  arm32 from the efi side.

- FB_SIS can likely be marked 'depends on X86' like FB_INTEL,
  it seems to depend on x86 BOOT_VESA_SUPPORT.

- FB_VGA16 is currently support on powerpc and enabled on
  one defconfig (pasemi), which I'm fairly sure is a mistake,
  so this could be made x86 specific as well.

- VGA_CONSOLE has a complicated Kconfig dependency list that
  lists platforms without VGA support but I think this is better
  expressed with a positive list. It looks like csky, hexagon,
  nios2 and xtensa should be excluded here and not provide
  screen_info.

- arm and mips only need to provide screen_info on machines
  with VGA_CONSOLE. On Arm we have a dependency on
  footbridge/integrator/netwinder, while on mips the
  dependency can be added to the platforms that fill
  the info (mips, malta, sibyte, sni).

- DUMMY_CONSOLE only uses screen_info on arm, and this should
  likely be limited to the three obsolete machines that
  support VGACON. Almost all Arm machines use DT these days
  and won't ever fill the screen info dynamically.

      Arnd

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 00/12] arch,fbdev: Move screen_info into arch/
  2023-06-29 14:15   ` Thomas Zimmermann
@ 2023-06-29 14:42     ` Arnd Bergmann
  0 siblings, 0 replies; 44+ messages in thread
From: Arnd Bergmann @ 2023-06-29 14:42 UTC (permalink / raw)
  To: Thomas Zimmermann, Helge Deller, Daniel Vetter, Dave Airlie
  Cc: Linux-Arch, linux-hyperv, linux-efi, linux-ia64, loongarch,
	linux-sh, linux-hexagon, linux-staging, linux-kernel, linux-csky,
	linux-mips, dri-devel, linux-fbdev, linux-alpha, sparclinux,
	linux-riscv, linuxppc-dev, linux-arm-kernel

On Thu, Jun 29, 2023, at 16:15, Thomas Zimmermann wrote:
> Am 29.06.23 um 15:31 schrieb Arnd Bergmann:
>> On Thu, Jun 29, 2023, at 13:45, Thomas Zimmermann wrote:
>>> Future directions: with the patchset in place, it will become possible
>>> to provide screen_info and edid_info only if there are users. Some
>>> architectures do this by testing for CONFIG_VT, CONFIG_DUMMY_CONSOLE,
>>> etc. A more uniform approach would be nice. We should also attempt
>>> to minimize access to the global screen_info as much as possible. To
>>> do so, some drivers, such as efifb and vesafb, would require an update.
>>> The firmware's EDID data could possibly made available outside of fbdev.
>>> For example, the simpledrm and ofdrm drivers could provide such data
>>> to userspace compositors.
>> 
>> I suspect that most architectures that provide a screen_info only
>> have this in order to compile the framebuffer drivers, and provide
>> hardcoded data that does not even reflect any real hardware.
>
> That's quite possible. Only x86's bootparam and EFI code sets 
> screen_info from external data. The rest is hardcoded. A number of 
> architectures protect screen_info with CONFIG_VT, CONFIG_DUMMY_CONSOLE, 
> etc. In a later patchset, I wanted to change this such that these users 
> of screen_info would enable the feature via select in their Kconfig.
>
> Do you know the reason for this branch in dummycon:
>
> https://elixir.bootlin.com/linux/v6.4/source/drivers/video/console/dummycon.c#L21
>
> What is special about arm that dummycon uses the screeninfo?

I can only guess myself, but I see that the values are only ever
set from the old ATAGS data, and not from DT on any of the
modern ones, and my interpretation is that this is meant to
match whatever the vga console was set to on the three
platforms that support vgacon.
 
I see this was added in linux-2.1.111, just before the
corresponding sparc specific hack was removed, but I don't have
patch descriptions from that era. Russell might remember, or know
if that is actually still needed.

   Arnd

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 07/12] arch/x86: Declare edid_info in <asm/screen_info.h>
  2023-06-29 13:21       ` Arnd Bergmann
@ 2023-06-30  7:46         ` Thomas Zimmermann
  2023-06-30 11:53           ` Arnd Bergmann
  0 siblings, 1 reply; 44+ messages in thread
From: Thomas Zimmermann @ 2023-06-30  7:46 UTC (permalink / raw)
  To: Arnd Bergmann, Helge Deller, Daniel Vetter, Dave Airlie
  Cc: linux-hyperv, linux-efi, linux-ia64, linux-sh, Peter Zijlstra,
	Dave Hansen, linux-fbdev, dri-devel, linux-mips, H. Peter Anvin,
	sparclinux, linux-riscv, Ard Biesheuvel, Linux-Arch,
	linux-hexagon, linux-staging, linux-csky, Ingo Molnar,
	Sami Tolvanen, Kees Cook, Paul E. McKenney, Frederic Weisbecker,
	Nicholas Piggin, Borislav Petkov, loongarch, Thomas Gleixner,
	linux-arm-kernel, x86, linux-kernel, Juerg Haefliger,
	linux-alpha, Andrew Morton, linuxppc-dev


[-- Attachment #1.1: Type: text/plain, Size: 2989 bytes --]

Hi

Am 29.06.23 um 15:21 schrieb Arnd Bergmann:
> On Thu, Jun 29, 2023, at 15:01, Thomas Zimmermann wrote:
>> Am 29.06.23 um 14:35 schrieb Arnd Bergmann:
>>> On Thu, Jun 29, 2023, at 13:45, Thomas Zimmermann wrote:
>>>> The global variable edid_info contains the firmware's EDID information
>>>> as an extension to the regular screen_info on x86. Therefore move it to
>>>> <asm/screen_info.h>.
>>>>
>>>> Add the Kconfig token ARCH_HAS_EDID_INFO to guard against access on
>>>> architectures that don't provide edid_info. Select it on x86.
>>>
>>> I'm not sure we need another symbol in addition to
>>> CONFIG_FIRMWARE_EDID. Since all the code behind that
>>> existing symbol is also x86 specific, would it be enough
>>> to just add either 'depends on X86' or 'depends on X86 ||
>>> COMPILE_TEST' there?
>>
>> FIRMWARE_EDID is a user-selectable feature, while ARCH_HAS_EDID_INFO
>> announces an architecture feature. They do different things.
> 
> I still have trouble seeing the difference.

The idea here is that ARCH_HAS_ signals the architecture's support for 
the feature.  Drivers set 'depends on' in their Kconfig.

Another Kconfig token, VIDEO_SCREEN_INFO or FIRMWARE_EDID, would then 
actually enable the feature.  Drivers select VIDEO_SCREEN_INFO or 
FIRMWARE_EDID and the architectures contains code like

#ifdef VIDEO_SCREEN_INFO
struct screen_info screen_info = {
	/* set values here */
}
#endif

This allows us to disable code that requires screen_info/edid_info, but 
also disable screen_info/edid_info unless such code has been enabled in 
the kernel config.

Some architectures currently mimic this by guarding screen_info with 
ifdef CONFIG_VT or similar. I'd like to make this more flexible. The 
cost of a few more internal Kconfig tokens seems negligible.

> 
>> Right now, ARCH_HAS_EDID_INFO only works on the old BIOS-based VESA
>> systems. In the future, I want to add support for EDID data from EFI and
>> OF as well. It would be stored in edid_info. I assume that the new
>> symbol will become useful then.
> 
> I don't see why an OF based system would have the same limitation
> as legacy BIOS with supporting only a single monitor, if we need
> to have a generic representation of EDID data in DT, that would
> probably be in a per device property anyway.

Sorry that was my mistake. OF has nothing to do with this.

> 
> I suppose you could use FIRMWARE_EDID on EFI or OF systems without
> the need for a global edid_info structure, but that would not
> share any code with the current fb_firmware_edid() function.

The current code is build on top of screen_info and edid_info. I'd 
preferably not replace that, if possible.

Best regards
Thomas

> 
>       Arnd

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 07/12] arch/x86: Declare edid_info in <asm/screen_info.h>
  2023-06-30  7:46         ` Thomas Zimmermann
@ 2023-06-30 11:53           ` Arnd Bergmann
  2023-07-05  8:18             ` Thomas Zimmermann
  0 siblings, 1 reply; 44+ messages in thread
From: Arnd Bergmann @ 2023-06-30 11:53 UTC (permalink / raw)
  To: Thomas Zimmermann, Helge Deller, Daniel Vetter, Dave Airlie
  Cc: linux-hyperv, linux-efi, linux-ia64, linux-sh, Peter Zijlstra,
	Dave Hansen, linux-fbdev, dri-devel, linux-mips, H. Peter Anvin,
	sparclinux, linux-riscv, Ard Biesheuvel, Linux-Arch,
	linux-hexagon, linux-staging, linux-csky, Ingo Molnar,
	Sami Tolvanen, Kees Cook, Paul E. McKenney, Frederic Weisbecker,
	Nicholas Piggin, Borislav Petkov, loongarch, Thomas Gleixner,
	linux-arm-kernel, x86, linux-kernel, Juerg Haefliger,
	linux-alpha, Andrew Morton, linuxppc-dev

On Fri, Jun 30, 2023, at 09:46, Thomas Zimmermann wrote:
> Am 29.06.23 um 15:21 schrieb Arnd Bergmann:
>> On Thu, Jun 29, 2023, at 15:01, Thomas Zimmermann wrote:
>>> Am 29.06.23 um 14:35 schrieb Arnd Bergmann:
>>>> On Thu, Jun 29, 2023, at 13:45, Thomas Zimmermann wrote:
>
>>>
>>> FIRMWARE_EDID is a user-selectable feature, while ARCH_HAS_EDID_INFO
>>> announces an architecture feature. They do different things.
>> 
>> I still have trouble seeing the difference.
>
> The idea here is that ARCH_HAS_ signals the architecture's support for 
> the feature.  Drivers set 'depends on' in their Kconfig.
>
> Another Kconfig token, VIDEO_SCREEN_INFO or FIRMWARE_EDID, would then 
> actually enable the feature.  Drivers select VIDEO_SCREEN_INFO or 
> FIRMWARE_EDID and the architectures contains code like

Fair enough. In that case, I guess FIRMWARE_EDID will just depend on
ARCH_HAS_EDID_INFO, or possibly "depends on FIRMWARE_EDID || EFI"
after it starts calling into an EFI specific function, right?

> #ifdef VIDEO_SCREEN_INFO
> struct screen_info screen_info = {
> 	/* set values here */
> }
> #endif
>
> This allows us to disable code that requires screen_info/edid_info, but 
> also disable screen_info/edid_info unless such code has been enabled in 
> the kernel config.
>
> Some architectures currently mimic this by guarding screen_info with 
> ifdef CONFIG_VT or similar. I'd like to make this more flexible. The 
> cost of a few more internal Kconfig tokens seems negligible.

I definitely get it for the screen_info, which needs the complexity.
For ARCHARCH_HAS_EDID_INFO I would hope that it's never selected by
anything other than x86, so I would still go with just a dependency
on x86 for simplicity, but I don't mind having the extra symbol if that
keeps it more consistent with how the screen_info is handled.

>> I suppose you could use FIRMWARE_EDID on EFI or OF systems without
>> the need for a global edid_info structure, but that would not
>> share any code with the current fb_firmware_edid() function.
>
> The current code is build on top of screen_info and edid_info. I'd 
> preferably not replace that, if possible.

One way I could imagine this looking in the end would be
something like

struct screen_info *fb_screen_info(struct device *dev)
{
      struct screen_info *si = NULL;

      if (IS_ENABLED(CONFIG_EFI))
            si = efi_get_screen_info(dev);

      if (IS_ENABLED(CONFIG_ARCH_HAS_SCREEN_INFO) && !si)
            si = screen_info;

      return si;
}

corresponding to fb_firmware_edid(). With this, any driver
that wants to access screen_info would call this function
instead of using the global pointer, plus either NULL pointer
check or a CONFIG_ARCH_HAS_SCREEN_INFO dependency.

This way we could completely eliminate the global screen_info
on arm64, riscv, and loongarch but still use the efi and
hyperv framebuffer/drm drivers.

    Arnd

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 01/12] efi: Do not include <linux/screen_info.h> from EFI header
  2023-06-29 11:45 ` [PATCH 01/12] efi: Do not include <linux/screen_info.h> from EFI header Thomas Zimmermann
@ 2023-07-04 16:23   ` Javier Martinez Canillas
  2023-07-05  1:40   ` [01/12] " Sui Jingfeng
  1 sibling, 0 replies; 44+ messages in thread
From: Javier Martinez Canillas @ 2023-07-04 16:23 UTC (permalink / raw)
  To: Thomas Zimmermann, arnd, deller, daniel, airlied
  Cc: linux-hyperv, linux-efi, linux-ia64, linux-sh, Catalin Marinas,
	linux-fbdev, dri-devel, linux-mips, sparclinux, linux-riscv,
	Will Deacon, Ard Biesheuvel, linux-arch, linux-hexagon,
	linux-staging, Russell King, linux-csky, loongarch,
	linux-arm-kernel, linux-kernel, Thomas Zimmermann, linux-alpha,
	linuxppc-dev

Thomas Zimmermann <tzimmermann@suse.de> writes:

> The header file <linux/efi.h> does not need anything from
> <linux/screen_info.h>. Declare struct screen_info and remove
> the include statements. Update a number of source files that
> require struct screen_info's definition.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Ard Biesheuvel <ardb@kernel.org>
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> ---

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 02/12] fbdev/sm712fb: Do not include <linux/screen_info.h>
  2023-06-29 11:45 ` [PATCH 02/12] fbdev/sm712fb: Do not include <linux/screen_info.h> Thomas Zimmermann
@ 2023-07-04 16:25   ` Javier Martinez Canillas
  0 siblings, 0 replies; 44+ messages in thread
From: Javier Martinez Canillas @ 2023-07-04 16:25 UTC (permalink / raw)
  To: Thomas Zimmermann, arnd, deller, daniel, airlied
  Cc: linux-arch, linux-hyperv, linux-efi, linux-ia64, loongarch,
	linux-sh, linux-hexagon, linux-staging, linux-kernel, linux-csky,
	linux-mips, linux-fbdev, dri-devel, Thomas Zimmermann,
	linux-alpha, sparclinux, linux-riscv, linuxppc-dev,
	Sudip Mukherjee, linux-arm-kernel, Teddy Wang

Thomas Zimmermann <tzimmermann@suse.de> writes:

> Sm712fb's dependency on <linux/screen_info.h> is artificial in that
> it only uses struct screen_info for its internals. Replace the use of
> struct screen_info with a custom data structure and remove the include
> of <linux/screen_info.h>.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
> Cc: Teddy Wang <teddy.wang@siliconmotion.com>
> Cc: Helge Deller <deller@gmx.de>
> ---

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 03/12] sysfb: Do not include <linux/screen_info.h> from sysfb header
  2023-06-29 11:45 ` [PATCH 03/12] sysfb: Do not include <linux/screen_info.h> from sysfb header Thomas Zimmermann
@ 2023-07-04 16:26   ` Javier Martinez Canillas
  2023-07-05  1:41   ` [03/12] " Sui Jingfeng
  1 sibling, 0 replies; 44+ messages in thread
From: Javier Martinez Canillas @ 2023-07-04 16:26 UTC (permalink / raw)
  To: Thomas Zimmermann, arnd, deller, daniel, airlied
  Cc: linux-arch, linux-hyperv, linux-efi, linux-ia64,
	Thomas Zimmermann, linux-sh, linux-hexagon, linux-staging,
	linux-kernel, linux-csky, linux-mips, Hans de Goede, linux-fbdev,
	dri-devel, loongarch, linux-alpha, sparclinux, linux-riscv,
	linuxppc-dev, Ard Biesheuvel, linux-arm-kernel

Thomas Zimmermann <tzimmermann@suse.de> writes:

> The header file <linux/sysfb.h> does not need anything from
> <linux/screen_info.h>. Declare struct screen_info and remove
> the include statements.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Ard Biesheuvel <ardb@kernel.org>
> Cc: Hans de Goede <hdegoede@redhat.com>
> Cc: Javier Martinez Canillas <javierm@redhat.com>
> ---

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 04/12] staging/sm750fb: Do not include <linux/screen_info.h>
  2023-06-29 11:45 ` [PATCH 04/12] staging/sm750fb: Do not include <linux/screen_info.h> Thomas Zimmermann
@ 2023-07-04 16:27   ` Javier Martinez Canillas
  0 siblings, 0 replies; 44+ messages in thread
From: Javier Martinez Canillas @ 2023-07-04 16:27 UTC (permalink / raw)
  To: Thomas Zimmermann, arnd, deller, daniel, airlied
  Cc: linux-arch, linux-hyperv, linux-efi, linux-ia64, loongarch,
	linux-sh, linux-hexagon, linux-staging, linux-kernel, linux-csky,
	linux-mips, linux-fbdev, dri-devel, Thomas Zimmermann,
	linux-alpha, sparclinux, linux-riscv, linuxppc-dev,
	Sudip Mukherjee, linux-arm-kernel, Teddy Wang

Thomas Zimmermann <tzimmermann@suse.de> writes:

> The sm750fb driver does not need anything from <linux/screen_info.h>.
> Remove the include statements.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
> Cc: Teddy Wang <teddy.wang@siliconmotion.com>
> ---

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 05/12] arch: Remove trailing whitespaces
  2023-06-29 11:45 ` [PATCH 05/12] arch: Remove trailing whitespaces Thomas Zimmermann
@ 2023-07-04 16:27   ` Javier Martinez Canillas
  2023-07-05  1:25   ` [05/12] " Sui Jingfeng
  1 sibling, 0 replies; 44+ messages in thread
From: Javier Martinez Canillas @ 2023-07-04 16:27 UTC (permalink / raw)
  To: Thomas Zimmermann, arnd, deller, daniel, airlied
  Cc: linux-hyperv, linux-efi, linux-ia64, Anshuman Khandual, linux-sh,
	Peter Zijlstra, linux-fbdev, dri-devel, linux-kernel,
	Rich Felker, sparclinux, linux-riscv, linux-arch, Yoshinori Sato,
	linux-hexagon, linux-staging, linux-csky, Geert Uytterhoeven,
	Zi Yan, Niklas Schnelle, loongarch, John Paul Adrian Glaubitz,
	linux-arm-kernel, Arnd Bergmann, linux-mips, Kirill A. Shutemov,
	Thomas Zimmermann, linux-alpha, Andrew Morton, linuxppc-dev,
	Mike Rapoport (IBM)

Thomas Zimmermann <tzimmermann@suse.de> writes:

> Fix coding style. No functional changes.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
> Cc: Rich Felker <dalias@libc.org>
> Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Arnd Bergmann <arnd@kernel.org>
> Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
> Cc: Anshuman Khandual <anshuman.khandual@arm.com>
> Cc: Niklas Schnelle <schnelle@linux.ibm.com>
> Cc: Zi Yan <ziy@nvidia.com>
> Cc: "Mike Rapoport (IBM)" <rppt@kernel.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> ---

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [06/12] arch: Declare screen_info in <asm/screen_info.h>
  2023-06-29 11:45 ` [PATCH 06/12] arch: Declare screen_info in <asm/screen_info.h> Thomas Zimmermann
  2023-06-29 12:55   ` WANG Xuerui
  2023-06-29 13:03   ` Arnd Bergmann
@ 2023-07-05  1:21   ` Sui Jingfeng
  2023-07-05  8:02     ` Thomas Zimmermann
  2023-08-18 14:04   ` suijingfeng
  3 siblings, 1 reply; 44+ messages in thread
From: Sui Jingfeng @ 2023-07-05  1:21 UTC (permalink / raw)
  To: Thomas Zimmermann, arnd, deller, daniel, airlied
  Cc: linux-hyperv, linux-efi, linux-ia64, linux-sh, Peter Zijlstra,
	Catalin Marinas, Dave Hansen, linux-fbdev, dri-devel,
	Sebastian Reichel, Max Filippov, Rich Felker, Guo Ren,
	Christophe Leroy, H. Peter Anvin, sparclinux, linux-riscv,
	Will Deacon, WANG Xuerui, linux-arch, x86, Yoshinori Sato,
	Michael Ellerman, linux-staging, Russell King, linux-csky,
	Ard Biesheuvel, Paul Walmsley, Niklas Schnelle, Ingo Molnar,
	Geert Uytterhoeven, Sami Tolvanen, Palmer Dabbelt, Matt Turner,
	Huacai Chen, Albert Ou, Kees Cook, Paul E. McKenney,
	Anshuman Khandual, Frederic Weisbecker, linux-alpha,
	Richard Henderson, Nicholas Piggin, Russell King (Oracle),
	Ivan Kokshaysky, loongarch, John Paul Adrian Glaubitz,
	Thomas Gleixner, Zi Yan, linux-arm-kernel, Brian Cain,
	Chris Zankel, Thomas Bogendoerfer, linux-mips, linux-kernel,
	Dinh Nguyen, Juerg Haefliger, Mike Rapoport (IBM),
	linux-hexagon, Borislav Petkov, Andrew Morton, linuxppc-dev,
	David S. Miller, Kirill A. Shutemov

Hi, Thomas


I love your patch, yet after applied your patch, the linux kernel fail 
to compile on my LoongArch machine.


```

   CC      arch/loongarch/kernel/efi.o
arch/loongarch/kernel/efi.c: In function ‘init_screen_info’:
arch/loongarch/kernel/efi.c:77:54: error: invalid application of 
‘sizeof’ to incomplete type ‘struct screen_info’
    77 |         si = early_memremap(screen_info_table, sizeof(*si));
       |                                                      ^
arch/loongarch/kernel/efi.c:82:9: error: ‘screen_info’ undeclared (first 
use in this function)
    82 |         screen_info = *si;
       |         ^~~~~~~~~~~
arch/loongarch/kernel/efi.c:82:9: note: each undeclared identifier is 
reported only once for each function it appears in
arch/loongarch/kernel/efi.c:82:23: error: invalid use of undefined type 
‘struct screen_info’
    82 |         screen_info = *si;
       |                       ^
arch/loongarch/kernel/efi.c:83:29: error: invalid application of 
‘sizeof’ to incomplete type ‘struct screen_info’
    83 |         memset(si, 0, sizeof(*si));
       |                             ^
arch/loongarch/kernel/efi.c:84:34: error: invalid application of 
‘sizeof’ to incomplete type ‘struct screen_info’
    84 |         early_memunmap(si, sizeof(*si));
       |                                  ^
make[3]: *** [scripts/Makefile.build:252: arch/loongarch/kernel/efi.o] 
Error 1
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [scripts/Makefile.build:494: arch/loongarch/kernel] Error 2
make[1]: *** [scripts/Makefile.build:494: arch/loongarch] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:2026: .] Error 2

```

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@suse.de>
> Cc: Richard Henderson <richard.henderson@linaro.org>
> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
> Cc: Matt Turner <mattst88@gmail.com>
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Guo Ren <guoren@kernel.org>
> Cc: Brian Cain <bcain@quicinc.com>
> Cc: Huacai Chen <chenhuacai@kernel.org>
> Cc: WANG Xuerui <kernel@xen0n.name>
> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> Cc: Dinh Nguyen <dinguyen@kernel.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
> Cc: Paul Walmsley <paul.walmsley@sifive.com>
> Cc: Palmer Dabbelt <palmer@dabbelt.com>
> Cc: Albert Ou <aou@eecs.berkeley.edu>
> Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
> Cc: Rich Felker <dalias@libc.org>
> Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Dave Hansen <dave.hansen@linux.intel.com>
> Cc: x86@kernel.org
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: Chris Zankel <chris@zankel.net>
> Cc: Max Filippov <jcmvbkbc@gmail.com>
> Cc: Helge Deller <deller@gmx.de>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Kees Cook <keescook@chromium.org>
> Cc: "Paul E. McKenney" <paulmck@kernel.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Frederic Weisbecker <frederic@kernel.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Ard Biesheuvel <ardb@kernel.org>
> Cc: Sami Tolvanen <samitolvanen@google.com>
> Cc: Juerg Haefliger <juerg.haefliger@canonical.com>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Anshuman Khandual <anshuman.khandual@arm.com>
> Cc: Niklas Schnelle <schnelle@linux.ibm.com>
> Cc: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Sebastian Reichel <sebastian.reichel@collabora.com>
> Cc: "Mike Rapoport (IBM)" <rppt@kernel.org>
> Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
> Cc: Zi Yan <ziy@nvidia.com>
> Acked-by: WANG Xuerui <git@xen0n.name> # loongarch
> ---
>   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"
> diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
> index a5c2b1aa46b02..d749011d88b14 100644
> --- a/arch/alpha/Kconfig
> +++ b/arch/alpha/Kconfig
> @@ -4,6 +4,7 @@ config ALPHA
>   	default y
>   	select ARCH_32BIT_USTAT_F_TINODE
>   	select ARCH_HAS_CURRENT_STACK_POINTER
> +	select ARCH_HAS_SCREEN_INFO
>   	select ARCH_MIGHT_HAVE_PC_PARPORT
>   	select ARCH_MIGHT_HAVE_PC_SERIO
>   	select ARCH_NO_PREEMPT
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 0fb4b218f6658..a9d01ee67a90e 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -15,6 +15,7 @@ config ARM
>   	select ARCH_HAS_MEMBARRIER_SYNC_CORE
>   	select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
>   	select ARCH_HAS_PTE_SPECIAL if ARM_LPAE
> +	select ARCH_HAS_SCREEN_INFO
>   	select ARCH_HAS_SETUP_DMA_OPS
>   	select ARCH_HAS_SET_MEMORY
>   	select ARCH_STACKWALK
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 343e1e1cae10a..21addc4715bb3 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -36,6 +36,7 @@ config ARM64
>   	select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
>   	select ARCH_HAS_PTE_DEVMAP
>   	select ARCH_HAS_PTE_SPECIAL
> +	select ARCH_HAS_SCREEN_INFO
>   	select ARCH_HAS_SETUP_DMA_OPS
>   	select ARCH_HAS_SET_DIRECT_MAP
>   	select ARCH_HAS_SET_MEMORY
> diff --git a/arch/csky/Kconfig b/arch/csky/Kconfig
> index 4df1f8c9d170b..28444e581fc1f 100644
> --- a/arch/csky/Kconfig
> +++ b/arch/csky/Kconfig
> @@ -10,6 +10,7 @@ config CSKY
>   	select ARCH_USE_QUEUED_RWLOCKS
>   	select ARCH_USE_QUEUED_SPINLOCKS
>   	select ARCH_HAS_CURRENT_STACK_POINTER
> +	select ARCH_HAS_SCREEN_INFO
>   	select ARCH_INLINE_READ_LOCK if !PREEMPTION
>   	select ARCH_INLINE_READ_LOCK_BH if !PREEMPTION
>   	select ARCH_INLINE_READ_LOCK_IRQ if !PREEMPTION
> diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig
> index 54eadf2651786..cc683c0a43d34 100644
> --- a/arch/hexagon/Kconfig
> +++ b/arch/hexagon/Kconfig
> @@ -5,6 +5,7 @@ comment "Linux Kernel Configuration for Hexagon"
>   config HEXAGON
>   	def_bool y
>   	select ARCH_32BIT_OFF_T
> +	select ARCH_HAS_SCREEN_INFO
>   	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
>   	select ARCH_NO_PREEMPT
>   	select DMA_GLOBAL_POOL
> diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
> index e79f15e32a451..8b1e785e6d53d 100644
> --- a/arch/ia64/Kconfig
> +++ b/arch/ia64/Kconfig
> @@ -10,6 +10,7 @@ config IA64
>   	bool
>   	select ARCH_BINFMT_ELF_EXTRA_PHDRS
>   	select ARCH_HAS_DMA_MARK_CLEAN
> +	select ARCH_HAS_SCREEN_INFO
>   	select ARCH_HAS_STRNCPY_FROM_USER
>   	select ARCH_HAS_STRNLEN_USER
>   	select ARCH_MIGHT_HAVE_PC_PARPORT
> 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
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index 675a8660cb85a..c0ae09789cb6d 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -10,6 +10,7 @@ config MIPS
>   	select ARCH_HAS_KCOV
>   	select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE if !EVA
>   	select ARCH_HAS_PTE_SPECIAL if !(32BIT && CPU_HAS_RIXI)
> +	select ARCH_HAS_SCREEN_INFO
>   	select ARCH_HAS_STRNCPY_FROM_USER
>   	select ARCH_HAS_STRNLEN_USER
>   	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
> diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig
> index e5936417d3cd3..7183eea282212 100644
> --- a/arch/nios2/Kconfig
> +++ b/arch/nios2/Kconfig
> @@ -3,6 +3,7 @@ config NIOS2
>   	def_bool y
>   	select ARCH_32BIT_OFF_T
>   	select ARCH_HAS_DMA_PREP_COHERENT
> +	select ARCH_HAS_SCREEN_INFO
>   	select ARCH_HAS_SYNC_DMA_FOR_CPU
>   	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
>   	select ARCH_HAS_DMA_SET_UNCACHED
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index bff5820b7cda1..b1acad3076180 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -148,6 +148,7 @@ config PPC
>   	select ARCH_HAS_PTE_DEVMAP		if PPC_BOOK3S_64
>   	select ARCH_HAS_PTE_SPECIAL
>   	select ARCH_HAS_SCALED_CPUTIME		if VIRT_CPU_ACCOUNTING_NATIVE && PPC_BOOK3S_64
> +	select ARCH_HAS_SCREEN_INFO
>   	select ARCH_HAS_SET_MEMORY
>   	select ARCH_HAS_STRICT_KERNEL_RWX	if (PPC_BOOK3S || PPC_8xx || 40x) && !HIBERNATION
>   	select ARCH_HAS_STRICT_KERNEL_RWX	if PPC_85xx && !HIBERNATION && !RANDOMIZE_BASE
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 5966ad97c30c3..b5a48f8424af9 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -29,6 +29,7 @@ config RISCV
>   	select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
>   	select ARCH_HAS_PMEM_API
>   	select ARCH_HAS_PTE_SPECIAL
> +	select ARCH_HAS_SCREEN_INFO
>   	select ARCH_HAS_SET_DIRECT_MAP if MMU
>   	select ARCH_HAS_SET_MEMORY if MMU
>   	select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
> diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
> index 04b9550cf0070..001f5149952b4 100644
> --- a/arch/sh/Kconfig
> +++ b/arch/sh/Kconfig
> @@ -10,6 +10,7 @@ config SUPERH
>   	select ARCH_HAS_GIGANTIC_PAGE
>   	select ARCH_HAS_GCOV_PROFILE_ALL
>   	select ARCH_HAS_PTE_SPECIAL
> +	select ARCH_HAS_SCREEN_INFO
>   	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
>   	select ARCH_HIBERNATION_POSSIBLE if MMU
>   	select ARCH_MIGHT_HAVE_PC_PARPORT
> diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
> index 8535e19062f65..e4bfb80b48cfe 100644
> --- a/arch/sparc/Kconfig
> +++ b/arch/sparc/Kconfig
> @@ -13,6 +13,7 @@ config 64BIT
>   config SPARC
>   	bool
>   	default y
> +	select ARCH_HAS_SCREEN_INFO
>   	select ARCH_MIGHT_HAVE_PC_PARPORT if SPARC64 && PCI
>   	select ARCH_MIGHT_HAVE_PC_SERIO
>   	select DMA_OPS
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 53bab123a8ee4..d7c2bf4ee403d 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -91,6 +91,7 @@ config X86
>   	select ARCH_HAS_NONLEAF_PMD_YOUNG	if PGTABLE_LEVELS > 2
>   	select ARCH_HAS_UACCESS_FLUSHCACHE	if X86_64
>   	select ARCH_HAS_COPY_MC			if X86_64
> +	select ARCH_HAS_SCREEN_INFO
>   	select ARCH_HAS_SET_MEMORY
>   	select ARCH_HAS_SET_DIRECT_MAP
>   	select ARCH_HAS_STRICT_KERNEL_RWX
> diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
> index 3c6e5471f025b..c6cbd7459939c 100644
> --- a/arch/xtensa/Kconfig
> +++ b/arch/xtensa/Kconfig
> @@ -8,6 +8,7 @@ config XTENSA
>   	select ARCH_HAS_DMA_PREP_COHERENT if MMU
>   	select ARCH_HAS_GCOV_PROFILE_ALL
>   	select ARCH_HAS_KCOV
> +	select ARCH_HAS_SCREEN_INFO
>   	select ARCH_HAS_SYNC_DMA_FOR_CPU if MMU
>   	select ARCH_HAS_SYNC_DMA_FOR_DEVICE if MMU
>   	select ARCH_HAS_DMA_SET_UNCACHED if MMU
> diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
> index 8b2b9ac37c3df..d4a72bea56be0 100644
> --- a/drivers/video/Kconfig
> +++ b/drivers/video/Kconfig
> @@ -21,6 +21,9 @@ config STI_CORE
>   config VIDEO_CMDLINE
>   	bool
>   
> +config ARCH_HAS_SCREEN_INFO
> +	bool
> +
>   config VIDEO_NOMODESET
>   	bool
>   	default n
> diff --git a/include/asm-generic/Kbuild b/include/asm-generic/Kbuild
> index 941be574bbe00..5e5d4158a4b4b 100644
> --- a/include/asm-generic/Kbuild
> +++ b/include/asm-generic/Kbuild
> @@ -47,6 +47,7 @@ mandatory-y += percpu.h
>   mandatory-y += pgalloc.h
>   mandatory-y += preempt.h
>   mandatory-y += rwonce.h
> +mandatory-y += screen_info.h
>   mandatory-y += sections.h
>   mandatory-y += serial.h
>   mandatory-y += shmparam.h
> diff --git a/include/asm-generic/screen_info.h b/include/asm-generic/screen_info.h
> new file mode 100644
> index 0000000000000..6fd0e50fabfcd
> --- /dev/null
> +++ b/include/asm-generic/screen_info.h
> @@ -0,0 +1,12 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +
> +#ifndef _ASM_GENERIC_SCREEN_INFO_H
> +#define _ASM_GENERIC_SCREEN_INFO_H
> +
> +#include <uapi/linux/screen_info.h>
> +
> +#if defined(CONFIG_ARCH_HAS_SCREEN_INFO)
> +extern struct screen_info screen_info;
> +#endif
> +
> +#endif /* _ASM_GENERIC_SCREEN_INFO_H */
> diff --git a/include/linux/screen_info.h b/include/linux/screen_info.h
> index eab7081392d50..c764b9a51c24b 100644
> --- a/include/linux/screen_info.h
> +++ b/include/linux/screen_info.h
> @@ -4,6 +4,6 @@
>   
>   #include <uapi/linux/screen_info.h>
>   
> -extern struct screen_info screen_info;
> +#include <asm/screen_info.h>
>   
>   #endif /* _SCREEN_INFO_H */


^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [05/12] arch: Remove trailing whitespaces
  2023-06-29 11:45 ` [PATCH 05/12] arch: Remove trailing whitespaces Thomas Zimmermann
  2023-07-04 16:27   ` Javier Martinez Canillas
@ 2023-07-05  1:25   ` Sui Jingfeng
  1 sibling, 0 replies; 44+ messages in thread
From: Sui Jingfeng @ 2023-07-05  1:25 UTC (permalink / raw)
  To: Thomas Zimmermann, arnd, deller, daniel, airlied
  Cc: linux-hyperv, linux-efi, linux-ia64, Anshuman Khandual, linux-sh,
	Peter Zijlstra, linux-fbdev, dri-devel, linux-kernel,
	Rich Felker, sparclinux, linux-riscv, linux-arch, Yoshinori Sato,
	linux-hexagon, linux-staging, linux-csky, Geert Uytterhoeven,
	Zi Yan, Niklas Schnelle, loongarch, John Paul Adrian Glaubitz,
	linux-arm-kernel, Arnd Bergmann, linux-mips, Kirill A. Shutemov,
	linux-alpha, Andrew Morton, linuxppc-dev, Mike Rapoport (IBM)


On 2023/6/29 19:45, Thomas Zimmermann wrote:
> Fix coding style. No functional changes.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
> Cc: Rich Felker <dalias@libc.org>
> Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Arnd Bergmann <arnd@kernel.org>
> Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
> Cc: Anshuman Khandual <anshuman.khandual@arm.com>
> Cc: Niklas Schnelle <schnelle@linux.ibm.com>
> Cc: Zi Yan <ziy@nvidia.com>
> Cc: "Mike Rapoport (IBM)" <rppt@kernel.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

Reviewed-by: Sui Jingfeng <suijingfeng@loongson.cn>

> ---
>   arch/ia64/Kconfig | 4 ++--
>   arch/sh/Kconfig   | 6 +++---
>   2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
> index 21fa63ce5ffc0..e79f15e32a451 100644
> --- a/arch/ia64/Kconfig
> +++ b/arch/ia64/Kconfig
> @@ -260,7 +260,7 @@ config PERMIT_BSP_REMOVE
>   	default n
>   	help
>   	Say Y here if your platform SAL will support removal of BSP with HOTPLUG_CPU
> -	support.
> +	support.
>   
>   config FORCE_CPEI_RETARGET
>   	bool "Force assumption that CPEI can be re-targeted"
> @@ -335,7 +335,7 @@ config IA64_PALINFO
>   config IA64_MC_ERR_INJECT
>   	tristate "MC error injection support"
>   	help
> -	  Adds support for MC error injection. If enabled, the kernel
> +	  Adds support for MC error injection. If enabled, the kernel
>   	  will provide a sysfs interface for user applications to
>   	  call MC error injection PAL procedures to inject various errors.
>   	  This is a useful tool for MCA testing.
> diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
> index 9652d367fc377..04b9550cf0070 100644
> --- a/arch/sh/Kconfig
> +++ b/arch/sh/Kconfig
> @@ -234,7 +234,7 @@ config CPU_SUBTYPE_SH7201
>   	select CPU_SH2A
>   	select CPU_HAS_FPU
>   	select SYS_SUPPORTS_SH_MTU2
> -
> +
>   config CPU_SUBTYPE_SH7203
>   	bool "Support SH7203 processor"
>   	select CPU_SH2A
> @@ -496,7 +496,7 @@ config CPU_SUBTYPE_SH7366
>   endchoice
>   
>   source "arch/sh/mm/Kconfig"
> -
> +
>   source "arch/sh/Kconfig.cpu"
>   
>   source "arch/sh/boards/Kconfig"
> @@ -647,7 +647,7 @@ config GUSA
>   	  This is the default implementation for both UP and non-ll/sc
>   	  CPUs, and is used by the libc, amongst others.
>   
> -	  For additional information, design information can be found
> +	  For additional information, design information can be found
>   	  in <http://lc.linux.or.jp/lc2002/papers/niibe0919p.pdf>.
>   
>   	  This should only be disabled for special cases where alternate


^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [08/12] drivers/firmware: Remove trailing whitespaces
  2023-06-29 11:45 ` [PATCH 08/12] drivers/firmware: Remove trailing whitespaces Thomas Zimmermann
@ 2023-07-05  1:26   ` Sui Jingfeng
  2023-07-05  7:46   ` [PATCH 08/12] " Javier Martinez Canillas
  1 sibling, 0 replies; 44+ messages in thread
From: Sui Jingfeng @ 2023-07-05  1:26 UTC (permalink / raw)
  To: Thomas Zimmermann, arnd, deller, daniel, airlied
  Cc: linux-arch, linux-hyperv, linux-efi, linux-ia64, loongarch,
	linux-sh, linux-hexagon, linux-staging, linux-kernel, linux-csky,
	linux-mips, dri-devel, linux-fbdev, linux-alpha, sparclinux,
	linux-riscv, linuxppc-dev, linux-arm-kernel

Hi,

On 2023/6/29 19:45, Thomas Zimmermann wrote:
> Fix coding style. No functional changes.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>


Reviewed-by: Sui Jingfeng <suijingfeng@loongson.cn>


> ---
>   drivers/firmware/Kconfig | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
> index b59e3041fd627..0432737bbb8b4 100644
> --- a/drivers/firmware/Kconfig
> +++ b/drivers/firmware/Kconfig
> @@ -99,7 +99,7 @@ config EFI_PCDP
>   	  You must also enable the appropriate drivers (serial, VGA, etc.)
>   
>   	  See DIG64_HCDPv20_042804.pdf available from
> -	  <http://www.dig64.org/specifications/>
> +	  <http://www.dig64.org/specifications/>
>   
>   config DMIID
>       bool "Export DMI identification via sysfs to userspace"


^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [01/12] efi: Do not include <linux/screen_info.h> from EFI header
  2023-06-29 11:45 ` [PATCH 01/12] efi: Do not include <linux/screen_info.h> from EFI header Thomas Zimmermann
  2023-07-04 16:23   ` Javier Martinez Canillas
@ 2023-07-05  1:40   ` Sui Jingfeng
  2023-07-05  8:00     ` Thomas Zimmermann
  1 sibling, 1 reply; 44+ messages in thread
From: Sui Jingfeng @ 2023-07-05  1:40 UTC (permalink / raw)
  To: Thomas Zimmermann, arnd, deller, daniel, airlied
  Cc: linux-hyperv, linux-efi, linux-ia64, linux-sh, Catalin Marinas,
	linux-fbdev, dri-devel, linux-mips, sparclinux, linux-riscv,
	Will Deacon, Ard Biesheuvel, linux-arch, linux-hexagon,
	linux-staging, Russell King, linux-csky, loongarch,
	linux-arm-kernel, linux-kernel, linux-alpha, linuxppc-dev

Hi, Thomas


I love your patch, LoongArch also have UEFI GOP support,

Maybe the arch/loongarch/kernel/efi.c don't include the '#include 
<linux/screen_info.h>' explicitly.


```

diff --git a/arch/loongarch/kernel/efi.c b/arch/loongarch/kernel/efi.c
index 3d448fef3af4..04f4d217aefb 100644
--- a/arch/loongarch/kernel/efi.c
+++ b/arch/loongarch/kernel/efi.c
@@ -19,6 +19,7 @@
  #include <linux/memblock.h>
  #include <linux/reboot.h>
  #include <linux/uaccess.h>
+#include <linux/screen_info.h>

  #include <asm/early_ioremap.h>
  #include <asm/efi.h>
```


On 2023/6/29 19:45, Thomas Zimmermann wrote:
> The header file <linux/efi.h> does not need anything from
> <linux/screen_info.h>. Declare struct screen_info and remove
> the include statements. Update a number of source files that
> require struct screen_info's definition.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Ard Biesheuvel <ardb@kernel.org>
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

With the above issue solved, please take my R-B if you would like.


Reviewed-by: Sui Jingfeng <suijingfeng@loongson.cn>

> ---
>   arch/arm/kernel/efi.c                         | 2 ++
>   arch/arm64/kernel/efi.c                       | 1 +
>   drivers/firmware/efi/libstub/efi-stub-entry.c | 2 ++
>   drivers/firmware/efi/libstub/screen_info.c    | 2 ++
>   include/linux/efi.h                           | 3 ++-
>   5 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/kernel/efi.c b/arch/arm/kernel/efi.c
> index e2b9d2618c672..e94655ef16bb3 100644
> --- a/arch/arm/kernel/efi.c
> +++ b/arch/arm/kernel/efi.c
> @@ -5,6 +5,8 @@
>   
>   #include <linux/efi.h>
>   #include <linux/memblock.h>
> +#include <linux/screen_info.h>
> +
>   #include <asm/efi.h>
>   #include <asm/mach/map.h>
>   #include <asm/mmu_context.h>
> diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
> index baab8dd3ead3c..3afbe503b066f 100644
> --- a/arch/arm64/kernel/efi.c
> +++ b/arch/arm64/kernel/efi.c
> @@ -9,6 +9,7 @@
>   
>   #include <linux/efi.h>
>   #include <linux/init.h>
> +#include <linux/screen_info.h>
>   
>   #include <asm/efi.h>
>   #include <asm/stacktrace.h>
> diff --git a/drivers/firmware/efi/libstub/efi-stub-entry.c b/drivers/firmware/efi/libstub/efi-stub-entry.c
> index cc4dcaea67fa6..2f1902e5d4075 100644
> --- a/drivers/firmware/efi/libstub/efi-stub-entry.c
> +++ b/drivers/firmware/efi/libstub/efi-stub-entry.c
> @@ -1,6 +1,8 @@
>   // SPDX-License-Identifier: GPL-2.0-only
>   
>   #include <linux/efi.h>
> +#include <linux/screen_info.h>
> +
>   #include <asm/efi.h>
>   
>   #include "efistub.h"
> diff --git a/drivers/firmware/efi/libstub/screen_info.c b/drivers/firmware/efi/libstub/screen_info.c
> index 4be1c4d1f922b..a51ec201ca3cb 100644
> --- a/drivers/firmware/efi/libstub/screen_info.c
> +++ b/drivers/firmware/efi/libstub/screen_info.c
> @@ -1,6 +1,8 @@
>   // SPDX-License-Identifier: GPL-2.0
>   
>   #include <linux/efi.h>
> +#include <linux/screen_info.h>
> +
>   #include <asm/efi.h>
>   
>   #include "efistub.h"
> diff --git a/include/linux/efi.h b/include/linux/efi.h
> index 571d1a6e1b744..360895a5572c0 100644
> --- a/include/linux/efi.h
> +++ b/include/linux/efi.h
> @@ -24,10 +24,11 @@
>   #include <linux/range.h>
>   #include <linux/reboot.h>
>   #include <linux/uuid.h>
> -#include <linux/screen_info.h>
>   
>   #include <asm/page.h>
>   
> +struct screen_info;
> +
>   #define EFI_SUCCESS		0
>   #define EFI_LOAD_ERROR		( 1 | (1UL << (BITS_PER_LONG-1)))
>   #define EFI_INVALID_PARAMETER	( 2 | (1UL << (BITS_PER_LONG-1)))


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* Re: [03/12] sysfb: Do not include <linux/screen_info.h> from sysfb header
  2023-06-29 11:45 ` [PATCH 03/12] sysfb: Do not include <linux/screen_info.h> from sysfb header Thomas Zimmermann
  2023-07-04 16:26   ` Javier Martinez Canillas
@ 2023-07-05  1:41   ` Sui Jingfeng
  1 sibling, 0 replies; 44+ messages in thread
From: Sui Jingfeng @ 2023-07-05  1:41 UTC (permalink / raw)
  To: Thomas Zimmermann, arnd, deller, daniel, airlied
  Cc: linux-arch, linux-hyperv, linux-efi, linux-ia64, linux-sh,
	linux-hexagon, linux-staging, linux-kernel, linux-fbdev,
	dri-devel, linux-mips, Hans de Goede, linux-csky, loongarch,
	linux-alpha, sparclinux, Javier Martinez Canillas, linux-riscv,
	linuxppc-dev, Ard Biesheuvel, linux-arm-kernel


On 2023/6/29 19:45, Thomas Zimmermann wrote:
> The header file <linux/sysfb.h> does not need anything from
> <linux/screen_info.h>. Declare struct screen_info and remove
> the include statements.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Ard Biesheuvel <ardb@kernel.org>
> Cc: Hans de Goede <hdegoede@redhat.com>
> Cc: Javier Martinez Canillas <javierm@redhat.com>
> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>


Reviewed-by: Sui Jingfeng <suijingfeng@loongson.cn>


> ---
>   include/linux/sysfb.h | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/sysfb.h b/include/linux/sysfb.h
> index c1ef5fc60a3cb..19cb803dd5ecd 100644
> --- a/include/linux/sysfb.h
> +++ b/include/linux/sysfb.h
> @@ -9,7 +9,8 @@
>   
>   #include <linux/kernel.h>
>   #include <linux/platform_data/simplefb.h>
> -#include <linux/screen_info.h>
> +
> +struct screen_info;
>   
>   enum {
>   	M_I17,		/* 17-Inch iMac */


^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [11/12] fbdev/core: Protect edid_info with CONFIG_ARCH_HAS_EDID_INFO
  2023-06-29 11:45 ` [PATCH 11/12] fbdev/core: Protect edid_info with CONFIG_ARCH_HAS_EDID_INFO Thomas Zimmermann
@ 2023-07-05  1:43   ` Sui Jingfeng
  0 siblings, 0 replies; 44+ messages in thread
From: Sui Jingfeng @ 2023-07-05  1:43 UTC (permalink / raw)
  To: Thomas Zimmermann, arnd, deller, daniel, airlied
  Cc: linux-arch, linux-hyperv, linux-efi, linux-ia64, loongarch,
	linux-sh, linux-hexagon, dri-devel, linux-staging, linux-kernel,
	linux-csky, linux-mips, Randy Dunlap, linux-fbdev, linux-alpha,
	sparclinux, linux-riscv, linuxppc-dev, linux-arm-kernel

Hi,


On 2023/6/29 19:45, Thomas Zimmermann wrote:
> Guard usage of edid_info with CONFIG_ARCH_HAS_EDID_INFO instead
> of CONFIG_X86. No functional changes.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>


Reviewed-by: Sui Jingfeng <suijingfeng@loongson.cn>


> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Helge Deller <deller@gmx.de>
> Cc: Randy Dunlap <rdunlap@infradead.org>
> ---
>   drivers/video/fbdev/core/fbmon.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/video/fbdev/core/fbmon.c b/drivers/video/fbdev/core/fbmon.c
> index 35be4431f649a..9ae063021e431 100644
> --- a/drivers/video/fbdev/core/fbmon.c
> +++ b/drivers/video/fbdev/core/fbmon.c
> @@ -1480,17 +1480,19 @@ int fb_validate_mode(const struct fb_var_screeninfo *var, struct fb_info *info)
>   		-EINVAL : 0;
>   }
>   
> -#if defined(CONFIG_FIRMWARE_EDID) && defined(CONFIG_X86)
> +#if defined(CONFIG_FIRMWARE_EDID)
>   const unsigned char *fb_firmware_edid(struct fb_info *info)
>   {
>   	unsigned char *edid = NULL;
>   
> +#if defined(CONFIG_ARCH_HAS_EDID_INFO)
>   	/*
>   	 * We need to ensure that the EDID block is only
>   	 * returned for the primary graphics adapter.
>   	 */
>   	if (fb_is_primary_device(info))
>   		edid = edid_info.dummy;
> +#endif
>   
>   	return edid;
>   }


^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 08/12] drivers/firmware: Remove trailing whitespaces
  2023-06-29 11:45 ` [PATCH 08/12] drivers/firmware: Remove trailing whitespaces Thomas Zimmermann
  2023-07-05  1:26   ` [08/12] " Sui Jingfeng
@ 2023-07-05  7:46   ` Javier Martinez Canillas
  1 sibling, 0 replies; 44+ messages in thread
From: Javier Martinez Canillas @ 2023-07-05  7:46 UTC (permalink / raw)
  To: Thomas Zimmermann, arnd, deller, daniel, airlied
  Cc: linux-arch, linux-hyperv, linux-efi, linux-ia64, loongarch,
	linux-sh, linux-hexagon, linux-staging, linux-kernel, linux-csky,
	linux-mips, linux-fbdev, dri-devel, Thomas Zimmermann,
	linux-alpha, sparclinux, linux-riscv, linuxppc-dev,
	linux-arm-kernel

Thomas Zimmermann <tzimmermann@suse.de> writes:

> Fix coding style. No functional changes.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>


-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [01/12] efi: Do not include <linux/screen_info.h> from EFI header
  2023-07-05  1:40   ` [01/12] " Sui Jingfeng
@ 2023-07-05  8:00     ` Thomas Zimmermann
  0 siblings, 0 replies; 44+ messages in thread
From: Thomas Zimmermann @ 2023-07-05  8:00 UTC (permalink / raw)
  To: Sui Jingfeng, arnd, deller, daniel, airlied
  Cc: linux-hyperv, linux-efi, linux-ia64, linux-sh, Catalin Marinas,
	linux-fbdev, dri-devel, linux-mips, sparclinux, linux-riscv,
	Will Deacon, Ard Biesheuvel, linux-arch, linux-hexagon,
	linux-staging, Russell King, linux-csky, loongarch,
	linux-arm-kernel, linux-kernel, linux-alpha, linuxppc-dev


[-- Attachment #1.1: Type: text/plain, Size: 4609 bytes --]

Hi

Am 05.07.23 um 03:40 schrieb Sui Jingfeng:
> Hi, Thomas
> 
> 
> I love your patch, LoongArch also have UEFI GOP support,
> 
> Maybe the arch/loongarch/kernel/efi.c don't include the '#include 
> <linux/screen_info.h>' explicitly.

Oh, thank you for testing. I try to build arch/ changes on all of the 
affected platforms, but I cannot build for all of them. I have no means 
of building for loongarch ATM.

I'll update the patch according to your feedback.

Best regards
Thomas

> 
> 
> ```
> 
> diff --git a/arch/loongarch/kernel/efi.c b/arch/loongarch/kernel/efi.c
> index 3d448fef3af4..04f4d217aefb 100644
> --- a/arch/loongarch/kernel/efi.c
> +++ b/arch/loongarch/kernel/efi.c
> @@ -19,6 +19,7 @@
>   #include <linux/memblock.h>
>   #include <linux/reboot.h>
>   #include <linux/uaccess.h>
> +#include <linux/screen_info.h>
> 
>   #include <asm/early_ioremap.h>
>   #include <asm/efi.h>
> ```
> 
> 
> On 2023/6/29 19:45, Thomas Zimmermann wrote:
>> The header file <linux/efi.h> does not need anything from
>> <linux/screen_info.h>. Declare struct screen_info and remove
>> the include statements. Update a number of source files that
>> require struct screen_info's definition.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> Cc: Ard Biesheuvel <ardb@kernel.org>
>> Cc: Russell King <linux@armlinux.org.uk>
>> Cc: Catalin Marinas <catalin.marinas@arm.com>
>> Cc: Will Deacon <will@kernel.org>
>> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
> 
> With the above issue solved, please take my R-B if you would like.
> 
> 
> Reviewed-by: Sui Jingfeng <suijingfeng@loongson.cn>
> 
>> ---
>>   arch/arm/kernel/efi.c                         | 2 ++
>>   arch/arm64/kernel/efi.c                       | 1 +
>>   drivers/firmware/efi/libstub/efi-stub-entry.c | 2 ++
>>   drivers/firmware/efi/libstub/screen_info.c    | 2 ++
>>   include/linux/efi.h                           | 3 ++-
>>   5 files changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/kernel/efi.c b/arch/arm/kernel/efi.c
>> index e2b9d2618c672..e94655ef16bb3 100644
>> --- a/arch/arm/kernel/efi.c
>> +++ b/arch/arm/kernel/efi.c
>> @@ -5,6 +5,8 @@
>>   #include <linux/efi.h>
>>   #include <linux/memblock.h>
>> +#include <linux/screen_info.h>
>> +
>>   #include <asm/efi.h>
>>   #include <asm/mach/map.h>
>>   #include <asm/mmu_context.h>
>> diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
>> index baab8dd3ead3c..3afbe503b066f 100644
>> --- a/arch/arm64/kernel/efi.c
>> +++ b/arch/arm64/kernel/efi.c
>> @@ -9,6 +9,7 @@
>>   #include <linux/efi.h>
>>   #include <linux/init.h>
>> +#include <linux/screen_info.h>
>>   #include <asm/efi.h>
>>   #include <asm/stacktrace.h>
>> diff --git a/drivers/firmware/efi/libstub/efi-stub-entry.c 
>> b/drivers/firmware/efi/libstub/efi-stub-entry.c
>> index cc4dcaea67fa6..2f1902e5d4075 100644
>> --- a/drivers/firmware/efi/libstub/efi-stub-entry.c
>> +++ b/drivers/firmware/efi/libstub/efi-stub-entry.c
>> @@ -1,6 +1,8 @@
>>   // SPDX-License-Identifier: GPL-2.0-only
>>   #include <linux/efi.h>
>> +#include <linux/screen_info.h>
>> +
>>   #include <asm/efi.h>
>>   #include "efistub.h"
>> diff --git a/drivers/firmware/efi/libstub/screen_info.c 
>> b/drivers/firmware/efi/libstub/screen_info.c
>> index 4be1c4d1f922b..a51ec201ca3cb 100644
>> --- a/drivers/firmware/efi/libstub/screen_info.c
>> +++ b/drivers/firmware/efi/libstub/screen_info.c
>> @@ -1,6 +1,8 @@
>>   // SPDX-License-Identifier: GPL-2.0
>>   #include <linux/efi.h>
>> +#include <linux/screen_info.h>
>> +
>>   #include <asm/efi.h>
>>   #include "efistub.h"
>> diff --git a/include/linux/efi.h b/include/linux/efi.h
>> index 571d1a6e1b744..360895a5572c0 100644
>> --- a/include/linux/efi.h
>> +++ b/include/linux/efi.h
>> @@ -24,10 +24,11 @@
>>   #include <linux/range.h>
>>   #include <linux/reboot.h>
>>   #include <linux/uuid.h>
>> -#include <linux/screen_info.h>
>>   #include <asm/page.h>
>> +struct screen_info;
>> +
>>   #define EFI_SUCCESS        0
>>   #define EFI_LOAD_ERROR        ( 1 | (1UL << (BITS_PER_LONG-1)))
>>   #define EFI_INVALID_PARAMETER    ( 2 | (1UL << (BITS_PER_LONG-1)))
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [06/12] arch: Declare screen_info in <asm/screen_info.h>
  2023-07-05  1:21   ` [06/12] " Sui Jingfeng
@ 2023-07-05  8:02     ` Thomas Zimmermann
  0 siblings, 0 replies; 44+ messages in thread
From: Thomas Zimmermann @ 2023-07-05  8:02 UTC (permalink / raw)
  To: Sui Jingfeng, arnd, deller, daniel, airlied
  Cc: linux-hyperv, linux-efi, linux-ia64, linux-sh, Peter Zijlstra,
	Catalin Marinas, Dave Hansen, linux-fbdev, dri-devel,
	Sebastian Reichel, Max Filippov, Rich Felker, Guo Ren,
	Christophe Leroy, H. Peter Anvin, sparclinux, linux-riscv,
	Will Deacon, WANG Xuerui, linux-arch, x86, Yoshinori Sato,
	Michael Ellerman, linux-staging, Russell King, linux-csky,
	Ard Biesheuvel, Paul Walmsley, Niklas Schnelle, Ingo Molnar,
	Geert Uytterhoeven, Sami Tolvanen, Palmer Dabbelt, Matt Turner,
	Huacai Chen, Albert Ou, Kees Cook, Paul E. McKenney,
	Anshuman Khandual, Frederic Weisbecker, linux-alpha,
	Richard Henderson, Nicholas Piggin, Russell King (Oracle),
	Ivan Kokshaysky, loongarch, John Paul Adrian Glaubitz,
	Thomas Gleixner, Zi Yan, linux-arm-kernel, Brian Cain,
	Chris Zankel, Thomas Bogendoerfer, linux-mips, linux-kernel,
	Dinh Nguyen, Juerg Haefliger, Mike Rapoport (IBM),
	linux-hexagon, Borislav Petkov, Andrew Morton, linuxppc-dev,
	David S. Miller, Kirill A. Shutemov


[-- Attachment #1.1: Type: text/plain, Size: 17182 bytes --]

Hi

Am 05.07.23 um 03:21 schrieb Sui Jingfeng:
> Hi, Thomas
> 
> 
> I love your patch, yet after applied your patch, the linux kernel fail 
> to compile on my LoongArch machine.

screen_info is missing. I think this should be solved with your update 
to patch 1.

Best regards
Thomas

> 
> 
> ```
> 
>    CC      arch/loongarch/kernel/efi.o
> arch/loongarch/kernel/efi.c: In function ‘init_screen_info’:
> arch/loongarch/kernel/efi.c:77:54: error: invalid application of 
> ‘sizeof’ to incomplete type ‘struct screen_info’
>     77 |         si = early_memremap(screen_info_table, sizeof(*si));
>        |                                                      ^
> arch/loongarch/kernel/efi.c:82:9: error: ‘screen_info’ undeclared (first 
> use in this function)
>     82 |         screen_info = *si;
>        |         ^~~~~~~~~~~
> arch/loongarch/kernel/efi.c:82:9: note: each undeclared identifier is 
> reported only once for each function it appears in
> arch/loongarch/kernel/efi.c:82:23: error: invalid use of undefined type 
> ‘struct screen_info’
>     82 |         screen_info = *si;
>        |                       ^
> arch/loongarch/kernel/efi.c:83:29: error: invalid application of 
> ‘sizeof’ to incomplete type ‘struct screen_info’
>     83 |         memset(si, 0, sizeof(*si));
>        |                             ^
> arch/loongarch/kernel/efi.c:84:34: error: invalid application of 
> ‘sizeof’ to incomplete type ‘struct screen_info’
>     84 |         early_memunmap(si, sizeof(*si));
>        |                                  ^
> make[3]: *** [scripts/Makefile.build:252: arch/loongarch/kernel/efi.o] 
> Error 1
> make[3]: *** Waiting for unfinished jobs....
> make[2]: *** [scripts/Makefile.build:494: arch/loongarch/kernel] Error 2
> make[1]: *** [scripts/Makefile.build:494: arch/loongarch] Error 2
> make[1]: *** Waiting for unfinished jobs....
> make: *** [Makefile:2026: .] Error 2
> 
> ```
> 
> 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@suse.de>
>> Cc: Richard Henderson <richard.henderson@linaro.org>
>> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
>> Cc: Matt Turner <mattst88@gmail.com>
>> Cc: Russell King <linux@armlinux.org.uk>
>> Cc: Catalin Marinas <catalin.marinas@arm.com>
>> Cc: Will Deacon <will@kernel.org>
>> Cc: Guo Ren <guoren@kernel.org>
>> Cc: Brian Cain <bcain@quicinc.com>
>> Cc: Huacai Chen <chenhuacai@kernel.org>
>> Cc: WANG Xuerui <kernel@xen0n.name>
>> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
>> Cc: Dinh Nguyen <dinguyen@kernel.org>
>> Cc: Michael Ellerman <mpe@ellerman.id.au>
>> Cc: Nicholas Piggin <npiggin@gmail.com>
>> Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
>> Cc: Paul Walmsley <paul.walmsley@sifive.com>
>> Cc: Palmer Dabbelt <palmer@dabbelt.com>
>> Cc: Albert Ou <aou@eecs.berkeley.edu>
>> Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
>> Cc: Rich Felker <dalias@libc.org>
>> Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
>> Cc: "David S. Miller" <davem@davemloft.net>
>> Cc: Thomas Gleixner <tglx@linutronix.de>
>> Cc: Ingo Molnar <mingo@redhat.com>
>> Cc: Borislav Petkov <bp@alien8.de>
>> Cc: Dave Hansen <dave.hansen@linux.intel.com>
>> Cc: x86@kernel.org
>> Cc: "H. Peter Anvin" <hpa@zytor.com>
>> Cc: Chris Zankel <chris@zankel.net>
>> Cc: Max Filippov <jcmvbkbc@gmail.com>
>> Cc: Helge Deller <deller@gmx.de>
>> Cc: Arnd Bergmann <arnd@arndb.de>
>> Cc: Kees Cook <keescook@chromium.org>
>> Cc: "Paul E. McKenney" <paulmck@kernel.org>
>> Cc: Peter Zijlstra <peterz@infradead.org>
>> Cc: Frederic Weisbecker <frederic@kernel.org>
>> Cc: Andrew Morton <akpm@linux-foundation.org>
>> Cc: Ard Biesheuvel <ardb@kernel.org>
>> Cc: Sami Tolvanen <samitolvanen@google.com>
>> Cc: Juerg Haefliger <juerg.haefliger@canonical.com>
>> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
>> Cc: Anshuman Khandual <anshuman.khandual@arm.com>
>> Cc: Niklas Schnelle <schnelle@linux.ibm.com>
>> Cc: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
>> Cc: Linus Walleij <linus.walleij@linaro.org>
>> Cc: Sebastian Reichel <sebastian.reichel@collabora.com>
>> Cc: "Mike Rapoport (IBM)" <rppt@kernel.org>
>> Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
>> Cc: Zi Yan <ziy@nvidia.com>
>> Acked-by: WANG Xuerui <git@xen0n.name> # loongarch
>> ---
>>   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"
>> diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
>> index a5c2b1aa46b02..d749011d88b14 100644
>> --- a/arch/alpha/Kconfig
>> +++ b/arch/alpha/Kconfig
>> @@ -4,6 +4,7 @@ config ALPHA
>>       default y
>>       select ARCH_32BIT_USTAT_F_TINODE
>>       select ARCH_HAS_CURRENT_STACK_POINTER
>> +    select ARCH_HAS_SCREEN_INFO
>>       select ARCH_MIGHT_HAVE_PC_PARPORT
>>       select ARCH_MIGHT_HAVE_PC_SERIO
>>       select ARCH_NO_PREEMPT
>> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
>> index 0fb4b218f6658..a9d01ee67a90e 100644
>> --- a/arch/arm/Kconfig
>> +++ b/arch/arm/Kconfig
>> @@ -15,6 +15,7 @@ config ARM
>>       select ARCH_HAS_MEMBARRIER_SYNC_CORE
>>       select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
>>       select ARCH_HAS_PTE_SPECIAL if ARM_LPAE
>> +    select ARCH_HAS_SCREEN_INFO
>>       select ARCH_HAS_SETUP_DMA_OPS
>>       select ARCH_HAS_SET_MEMORY
>>       select ARCH_STACKWALK
>> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
>> index 343e1e1cae10a..21addc4715bb3 100644
>> --- a/arch/arm64/Kconfig
>> +++ b/arch/arm64/Kconfig
>> @@ -36,6 +36,7 @@ config ARM64
>>       select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
>>       select ARCH_HAS_PTE_DEVMAP
>>       select ARCH_HAS_PTE_SPECIAL
>> +    select ARCH_HAS_SCREEN_INFO
>>       select ARCH_HAS_SETUP_DMA_OPS
>>       select ARCH_HAS_SET_DIRECT_MAP
>>       select ARCH_HAS_SET_MEMORY
>> diff --git a/arch/csky/Kconfig b/arch/csky/Kconfig
>> index 4df1f8c9d170b..28444e581fc1f 100644
>> --- a/arch/csky/Kconfig
>> +++ b/arch/csky/Kconfig
>> @@ -10,6 +10,7 @@ config CSKY
>>       select ARCH_USE_QUEUED_RWLOCKS
>>       select ARCH_USE_QUEUED_SPINLOCKS
>>       select ARCH_HAS_CURRENT_STACK_POINTER
>> +    select ARCH_HAS_SCREEN_INFO
>>       select ARCH_INLINE_READ_LOCK if !PREEMPTION
>>       select ARCH_INLINE_READ_LOCK_BH if !PREEMPTION
>>       select ARCH_INLINE_READ_LOCK_IRQ if !PREEMPTION
>> diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig
>> index 54eadf2651786..cc683c0a43d34 100644
>> --- a/arch/hexagon/Kconfig
>> +++ b/arch/hexagon/Kconfig
>> @@ -5,6 +5,7 @@ comment "Linux Kernel Configuration for Hexagon"
>>   config HEXAGON
>>       def_bool y
>>       select ARCH_32BIT_OFF_T
>> +    select ARCH_HAS_SCREEN_INFO
>>       select ARCH_HAS_SYNC_DMA_FOR_DEVICE
>>       select ARCH_NO_PREEMPT
>>       select DMA_GLOBAL_POOL
>> diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
>> index e79f15e32a451..8b1e785e6d53d 100644
>> --- a/arch/ia64/Kconfig
>> +++ b/arch/ia64/Kconfig
>> @@ -10,6 +10,7 @@ config IA64
>>       bool
>>       select ARCH_BINFMT_ELF_EXTRA_PHDRS
>>       select ARCH_HAS_DMA_MARK_CLEAN
>> +    select ARCH_HAS_SCREEN_INFO
>>       select ARCH_HAS_STRNCPY_FROM_USER
>>       select ARCH_HAS_STRNLEN_USER
>>       select ARCH_MIGHT_HAVE_PC_PARPORT
>> 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
>> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
>> index 675a8660cb85a..c0ae09789cb6d 100644
>> --- a/arch/mips/Kconfig
>> +++ b/arch/mips/Kconfig
>> @@ -10,6 +10,7 @@ config MIPS
>>       select ARCH_HAS_KCOV
>>       select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE if !EVA
>>       select ARCH_HAS_PTE_SPECIAL if !(32BIT && CPU_HAS_RIXI)
>> +    select ARCH_HAS_SCREEN_INFO
>>       select ARCH_HAS_STRNCPY_FROM_USER
>>       select ARCH_HAS_STRNLEN_USER
>>       select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
>> diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig
>> index e5936417d3cd3..7183eea282212 100644
>> --- a/arch/nios2/Kconfig
>> +++ b/arch/nios2/Kconfig
>> @@ -3,6 +3,7 @@ config NIOS2
>>       def_bool y
>>       select ARCH_32BIT_OFF_T
>>       select ARCH_HAS_DMA_PREP_COHERENT
>> +    select ARCH_HAS_SCREEN_INFO
>>       select ARCH_HAS_SYNC_DMA_FOR_CPU
>>       select ARCH_HAS_SYNC_DMA_FOR_DEVICE
>>       select ARCH_HAS_DMA_SET_UNCACHED
>> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
>> index bff5820b7cda1..b1acad3076180 100644
>> --- a/arch/powerpc/Kconfig
>> +++ b/arch/powerpc/Kconfig
>> @@ -148,6 +148,7 @@ config PPC
>>       select ARCH_HAS_PTE_DEVMAP        if PPC_BOOK3S_64
>>       select ARCH_HAS_PTE_SPECIAL
>>       select ARCH_HAS_SCALED_CPUTIME        if 
>> VIRT_CPU_ACCOUNTING_NATIVE && PPC_BOOK3S_64
>> +    select ARCH_HAS_SCREEN_INFO
>>       select ARCH_HAS_SET_MEMORY
>>       select ARCH_HAS_STRICT_KERNEL_RWX    if (PPC_BOOK3S || PPC_8xx 
>> || 40x) && !HIBERNATION
>>       select ARCH_HAS_STRICT_KERNEL_RWX    if PPC_85xx && !HIBERNATION 
>> && !RANDOMIZE_BASE
>> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
>> index 5966ad97c30c3..b5a48f8424af9 100644
>> --- a/arch/riscv/Kconfig
>> +++ b/arch/riscv/Kconfig
>> @@ -29,6 +29,7 @@ config RISCV
>>       select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
>>       select ARCH_HAS_PMEM_API
>>       select ARCH_HAS_PTE_SPECIAL
>> +    select ARCH_HAS_SCREEN_INFO
>>       select ARCH_HAS_SET_DIRECT_MAP if MMU
>>       select ARCH_HAS_SET_MEMORY if MMU
>>       select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
>> diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
>> index 04b9550cf0070..001f5149952b4 100644
>> --- a/arch/sh/Kconfig
>> +++ b/arch/sh/Kconfig
>> @@ -10,6 +10,7 @@ config SUPERH
>>       select ARCH_HAS_GIGANTIC_PAGE
>>       select ARCH_HAS_GCOV_PROFILE_ALL
>>       select ARCH_HAS_PTE_SPECIAL
>> +    select ARCH_HAS_SCREEN_INFO
>>       select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
>>       select ARCH_HIBERNATION_POSSIBLE if MMU
>>       select ARCH_MIGHT_HAVE_PC_PARPORT
>> diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
>> index 8535e19062f65..e4bfb80b48cfe 100644
>> --- a/arch/sparc/Kconfig
>> +++ b/arch/sparc/Kconfig
>> @@ -13,6 +13,7 @@ config 64BIT
>>   config SPARC
>>       bool
>>       default y
>> +    select ARCH_HAS_SCREEN_INFO
>>       select ARCH_MIGHT_HAVE_PC_PARPORT if SPARC64 && PCI
>>       select ARCH_MIGHT_HAVE_PC_SERIO
>>       select DMA_OPS
>> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
>> index 53bab123a8ee4..d7c2bf4ee403d 100644
>> --- a/arch/x86/Kconfig
>> +++ b/arch/x86/Kconfig
>> @@ -91,6 +91,7 @@ config X86
>>       select ARCH_HAS_NONLEAF_PMD_YOUNG    if PGTABLE_LEVELS > 2
>>       select ARCH_HAS_UACCESS_FLUSHCACHE    if X86_64
>>       select ARCH_HAS_COPY_MC            if X86_64
>> +    select ARCH_HAS_SCREEN_INFO
>>       select ARCH_HAS_SET_MEMORY
>>       select ARCH_HAS_SET_DIRECT_MAP
>>       select ARCH_HAS_STRICT_KERNEL_RWX
>> diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
>> index 3c6e5471f025b..c6cbd7459939c 100644
>> --- a/arch/xtensa/Kconfig
>> +++ b/arch/xtensa/Kconfig
>> @@ -8,6 +8,7 @@ config XTENSA
>>       select ARCH_HAS_DMA_PREP_COHERENT if MMU
>>       select ARCH_HAS_GCOV_PROFILE_ALL
>>       select ARCH_HAS_KCOV
>> +    select ARCH_HAS_SCREEN_INFO
>>       select ARCH_HAS_SYNC_DMA_FOR_CPU if MMU
>>       select ARCH_HAS_SYNC_DMA_FOR_DEVICE if MMU
>>       select ARCH_HAS_DMA_SET_UNCACHED if MMU
>> diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
>> index 8b2b9ac37c3df..d4a72bea56be0 100644
>> --- a/drivers/video/Kconfig
>> +++ b/drivers/video/Kconfig
>> @@ -21,6 +21,9 @@ config STI_CORE
>>   config VIDEO_CMDLINE
>>       bool
>> +config ARCH_HAS_SCREEN_INFO
>> +    bool
>> +
>>   config VIDEO_NOMODESET
>>       bool
>>       default n
>> diff --git a/include/asm-generic/Kbuild b/include/asm-generic/Kbuild
>> index 941be574bbe00..5e5d4158a4b4b 100644
>> --- a/include/asm-generic/Kbuild
>> +++ b/include/asm-generic/Kbuild
>> @@ -47,6 +47,7 @@ mandatory-y += percpu.h
>>   mandatory-y += pgalloc.h
>>   mandatory-y += preempt.h
>>   mandatory-y += rwonce.h
>> +mandatory-y += screen_info.h
>>   mandatory-y += sections.h
>>   mandatory-y += serial.h
>>   mandatory-y += shmparam.h
>> diff --git a/include/asm-generic/screen_info.h 
>> b/include/asm-generic/screen_info.h
>> new file mode 100644
>> index 0000000000000..6fd0e50fabfcd
>> --- /dev/null
>> +++ b/include/asm-generic/screen_info.h
>> @@ -0,0 +1,12 @@
>> +/* SPDX-License-Identifier: GPL-2.0 */
>> +
>> +#ifndef _ASM_GENERIC_SCREEN_INFO_H
>> +#define _ASM_GENERIC_SCREEN_INFO_H
>> +
>> +#include <uapi/linux/screen_info.h>
>> +
>> +#if defined(CONFIG_ARCH_HAS_SCREEN_INFO)
>> +extern struct screen_info screen_info;
>> +#endif
>> +
>> +#endif /* _ASM_GENERIC_SCREEN_INFO_H */
>> diff --git a/include/linux/screen_info.h b/include/linux/screen_info.h
>> index eab7081392d50..c764b9a51c24b 100644
>> --- a/include/linux/screen_info.h
>> +++ b/include/linux/screen_info.h
>> @@ -4,6 +4,6 @@
>>   #include <uapi/linux/screen_info.h>
>> -extern struct screen_info screen_info;
>> +#include <asm/screen_info.h>
>>   #endif /* _SCREEN_INFO_H */
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 10/12] fbdev/core: Use fb_is_primary_device() in fb_firmware_edid()
  2023-06-29 11:45 ` [PATCH 10/12] fbdev/core: Use fb_is_primary_device() in fb_firmware_edid() Thomas Zimmermann
@ 2023-07-05  8:02   ` Javier Martinez Canillas
  0 siblings, 0 replies; 44+ messages in thread
From: Javier Martinez Canillas @ 2023-07-05  8:02 UTC (permalink / raw)
  To: Thomas Zimmermann, arnd, deller, daniel, airlied
  Cc: linux-hyperv, linux-efi, linux-ia64, linux-sh, linux-fbdev,
	dri-devel, linux-kernel, sparclinux, linux-riscv, linux-arch,
	linux-hexagon, linux-staging, linux-csky, Antonino Daplas,
	Maik Broemme, loongarch, linux-arm-kernel, Randy Dunlap,
	linux-mips, Thomas Zimmermann, linux-alpha, linuxppc-dev

Thomas Zimmermann <tzimmermann@suse.de> writes:

> Detect the primary VGA device with fb_is_primary_device() in the
> implementation of fb_firmware_edid(). Remove the existing code.
>

An explanation about why this is possible would be useful here.

> Adapt the function to receive an instance of struct fb_info and
> update all callers.
>

[...]

> -const unsigned char *fb_firmware_edid(struct device *device)
> +const unsigned char *fb_firmware_edid(struct fb_info *info)
>  {
> -	struct pci_dev *dev = NULL;
> -	struct resource *res = NULL;
>  	unsigned char *edid = NULL;
>  
> -	if (device)
> -		dev = to_pci_dev(device);
> -
> -	if (dev)
> -		res = &dev->resource[PCI_ROM_RESOURCE];
> -
> -	if (res && res->flags & IORESOURCE_ROM_SHADOW)

This open codes what used to be the fb_is_primary_device() logic before
commit 5ca1479cd35d ("fbdev: Simplify fb_is_primary_device for x86").
But now after that commit there is functional change since the ROM
shadowing check would be dropped.

I believe that's OK and Sima explains in their commit message that
vga_default_device() should be enough and the check is redundant.

Still, I think that this change should be documented in your commit
message. 

With that change,

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 07/12] arch/x86: Declare edid_info in <asm/screen_info.h>
  2023-06-30 11:53           ` Arnd Bergmann
@ 2023-07-05  8:18             ` Thomas Zimmermann
  2023-07-18 14:47               ` Arnd Bergmann
  0 siblings, 1 reply; 44+ messages in thread
From: Thomas Zimmermann @ 2023-07-05  8:18 UTC (permalink / raw)
  To: Arnd Bergmann, Helge Deller, Daniel Vetter, Dave Airlie
  Cc: linux-hyperv, linux-efi, linux-ia64, linux-sh, Peter Zijlstra,
	Dave Hansen, linux-fbdev, dri-devel, linux-kernel,
	H. Peter Anvin, sparclinux, linux-riscv, Ard Biesheuvel,
	Linux-Arch, linux-hexagon, linux-staging, linux-csky,
	Ingo Molnar, Sami Tolvanen, Kees Cook, Paul E. McKenney,
	Frederic Weisbecker, Nicholas Piggin, Borislav Petkov, loongarch,
	Thomas Gleixner, linux-arm-kernel, x86, linux-mips,
	Juerg Haefliger, linux-alpha, Andrew Morton, linuxppc-dev


[-- Attachment #1.1: Type: text/plain, Size: 4223 bytes --]

Hi Arnd

Am 30.06.23 um 13:53 schrieb Arnd Bergmann:
> On Fri, Jun 30, 2023, at 09:46, Thomas Zimmermann wrote:
>> Am 29.06.23 um 15:21 schrieb Arnd Bergmann:
>>> On Thu, Jun 29, 2023, at 15:01, Thomas Zimmermann wrote:
>>>> Am 29.06.23 um 14:35 schrieb Arnd Bergmann:
>>>>> On Thu, Jun 29, 2023, at 13:45, Thomas Zimmermann wrote:
>>
>>>>
>>>> FIRMWARE_EDID is a user-selectable feature, while ARCH_HAS_EDID_INFO
>>>> announces an architecture feature. They do different things.
>>>
>>> I still have trouble seeing the difference.
>>
>> The idea here is that ARCH_HAS_ signals the architecture's support for
>> the feature.  Drivers set 'depends on' in their Kconfig.
>>
>> Another Kconfig token, VIDEO_SCREEN_INFO or FIRMWARE_EDID, would then
>> actually enable the feature.  Drivers select VIDEO_SCREEN_INFO or
>> FIRMWARE_EDID and the architectures contains code like
> 
> Fair enough. In that case, I guess FIRMWARE_EDID will just depend on
> ARCH_HAS_EDID_INFO, or possibly "depends on FIRMWARE_EDID || EFI"
> after it starts calling into an EFI specific function, right?
> 
>> #ifdef VIDEO_SCREEN_INFO
>> struct screen_info screen_info = {
>> 	/* set values here */
>> }
>> #endif
>>
>> This allows us to disable code that requires screen_info/edid_info, but
>> also disable screen_info/edid_info unless such code has been enabled in
>> the kernel config.
>>
>> Some architectures currently mimic this by guarding screen_info with
>> ifdef CONFIG_VT or similar. I'd like to make this more flexible. The
>> cost of a few more internal Kconfig tokens seems negligible.
> 
> I definitely get it for the screen_info, which needs the complexity.
> For ARCHARCH_HAS_EDID_INFO I would hope that it's never selected by
> anything other than x86, so I would still go with just a dependency
> on x86 for simplicity, but I don't mind having the extra symbol if that
> keeps it more consistent with how the screen_info is handled.

Well, I'd like to add edid_info to platforms with EFI. What would be 
arm/arm64 and loongarch, I guess. See below for the future plans.

> 
>>> I suppose you could use FIRMWARE_EDID on EFI or OF systems without
>>> the need for a global edid_info structure, but that would not
>>> share any code with the current fb_firmware_edid() function.
>>
>> The current code is build on top of screen_info and edid_info. I'd
>> preferably not replace that, if possible.
> 
> One way I could imagine this looking in the end would be
> something like
> 
> struct screen_info *fb_screen_info(struct device *dev)
> {
>        struct screen_info *si = NULL;
> 
>        if (IS_ENABLED(CONFIG_EFI))
>              si = efi_get_screen_info(dev);
> 
>        if (IS_ENABLED(CONFIG_ARCH_HAS_SCREEN_INFO) && !si)
>              si = screen_info;
> 
>        return si;
> }
> 
> corresponding to fb_firmware_edid(). With this, any driver
> that wants to access screen_info would call this function
> instead of using the global pointer, plus either NULL pointer
> check or a CONFIG_ARCH_HAS_SCREEN_INFO dependency.
> 
> This way we could completely eliminate the global screen_info
> on arm64, riscv, and loongarch but still use the efi and
> hyperv framebuffer/drm drivers.

If possible, I'd like to remove global screen_info and edid_info 
entirely from fbdev and the various consoles.

We currently use screen_info to set up the generic framebuffer device in 
drivers/firmware/sysfb.c. I'd like to use edid_info here as well, so 
that the generic graphics drivers can get EDID information.

For the few fbdev drivers and consoles that require the global 
screen_info/edid_info, I'd rather provide lookup functions in sysfb 
(e.g., sysfb_get_screen_info(), sysfb_get_edid_info()). The global 
screen_info/edid_info state would then become an internal artifact of 
the sysfb code.

Hopefully that explains some of the decisions made in this patchset.

Best regards
Thomas

> 
>      Arnd

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 07/12] arch/x86: Declare edid_info in <asm/screen_info.h>
  2023-07-05  8:18             ` Thomas Zimmermann
@ 2023-07-18 14:47               ` Arnd Bergmann
  0 siblings, 0 replies; 44+ messages in thread
From: Arnd Bergmann @ 2023-07-18 14:47 UTC (permalink / raw)
  To: Thomas Zimmermann, Helge Deller, Daniel Vetter, Dave Airlie
  Cc: linux-hyperv, linux-efi, linux-ia64, linux-sh, Peter Zijlstra,
	Dave Hansen, linux-fbdev, dri-devel, linux-kernel,
	H. Peter Anvin, sparclinux, linux-riscv, Ard Biesheuvel,
	Linux-Arch, linux-hexagon, linux-staging, linux-csky,
	Ingo Molnar, Sami Tolvanen, Kees Cook, Paul E. McKenney,
	Frederic Weisbecker, Nicholas Piggin, Borislav Petkov, loongarch,
	Thomas Gleixner, linux-arm-kernel, x86, linux-mips,
	Juerg Haefliger, linux-alpha, Andrew Morton, linuxppc-dev

On Wed, Jul 5, 2023, at 10:18, Thomas Zimmermann wrote:
> Am 30.06.23 um 13:53 schrieb Arnd Bergmann:
>> On Fri, Jun 30, 2023, at 09:46, Thomas Zimmermann wrote:
>>> Am 29.06.23 um 15:21 schrieb Arnd Bergmann:
>> 
>> I definitely get it for the screen_info, which needs the complexity.
>> For ARCHARCH_HAS_EDID_INFO I would hope that it's never selected by
>> anything other than x86, so I would still go with just a dependency
>> on x86 for simplicity, but I don't mind having the extra symbol if that
>> keeps it more consistent with how the screen_info is handled.
>
> Well, I'd like to add edid_info to platforms with EFI. What would be 
> arm/arm64 and loongarch, I guess. See below for the future plans.

To be clear: I don't mind using a 'struct edid_info' being passed
around between subsystems, that is clearly an improvement over
'struct screen_info'. It's the global variable that seems like
an artifact of linux-2.4 days, and I think we can do better than that.

>>>> I suppose you could use FIRMWARE_EDID on EFI or OF systems without
>>>> the need for a global edid_info structure, but that would not
>>>> share any code with the current fb_firmware_edid() function.
>>>
>>> The current code is build on top of screen_info and edid_info. I'd
>>> preferably not replace that, if possible.
>> 
>> One way I could imagine this looking in the end would be
>> something like
>> 
>> struct screen_info *fb_screen_info(struct device *dev)
>> {
>>        struct screen_info *si = NULL;
>> 
>>        if (IS_ENABLED(CONFIG_EFI))
>>              si = efi_get_screen_info(dev);
>> 
>>        if (IS_ENABLED(CONFIG_ARCH_HAS_SCREEN_INFO) && !si)
>>              si = screen_info;
>> 
>>        return si;
>> }
>> 
>> corresponding to fb_firmware_edid(). With this, any driver
>> that wants to access screen_info would call this function
>> instead of using the global pointer, plus either NULL pointer
>> check or a CONFIG_ARCH_HAS_SCREEN_INFO dependency.
>> 
>> This way we could completely eliminate the global screen_info
>> on arm64, riscv, and loongarch but still use the efi and
>> hyperv framebuffer/drm drivers.
>
> If possible, I'd like to remove global screen_info and edid_info 
> entirely from fbdev and the various consoles.

ok

> We currently use screen_info to set up the generic framebuffer device in 
> drivers/firmware/sysfb.c. I'd like to use edid_info here as well, so 
> that the generic graphics drivers can get EDID information.
>
> For the few fbdev drivers and consoles that require the global 
> screen_info/edid_info, I'd rather provide lookup functions in sysfb 
> (e.g., sysfb_get_screen_info(), sysfb_get_edid_info()). The global 
> screen_info/edid_info state would then become an internal artifact of 
> the sysfb code.
>
> Hopefully that explains some of the decisions made in this patchset.

I spent some more time looking at the screen_info side, after my
first set of patches to refine the #ifdefs, and I think we don't
even need to make screen_info available to non-x86 drivers at all:

- All the vgacon users except for x86 can just register a static
  screen_info (or simplified into a simpler structure) with the
  driver itself. This even includes ia64, which does not support
  EFI framebuffers.

- The VESA, vga16, SIS, Intel and HyperV framebuffer drivers only
  need access to screen_info on x86. HyperV is the only driver that
  can currently access the data from EFI firmware on arm64, but
  that is only used for 'gen 1' guests, which I'm pretty sure
  only exist on x86.

- All the other references to screen_info are specific to EFI
  firmware, so we can move the global definition from arm,
  arm64, loongarch, riscv and ia64 into the EFI firmware
  code itself. It is still accessed by efifb and efi-earlycon
  at this point.

I have uploaded version 2 of my series to
https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/log/?h=screen-info-v2
and will send it out after I get the green light from build
bots. 

       Arnd

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [06/12] arch: Declare screen_info in <asm/screen_info.h>
  2023-06-29 11:45 ` [PATCH 06/12] arch: Declare screen_info in <asm/screen_info.h> Thomas Zimmermann
                     ` (2 preceding siblings ...)
  2023-07-05  1:21   ` [06/12] " Sui Jingfeng
@ 2023-08-18 14:04   ` suijingfeng
  2023-08-18 14:18     ` suijingfeng
  3 siblings, 1 reply; 44+ messages in thread
From: suijingfeng @ 2023-08-18 14:04 UTC (permalink / raw)
  To: Thomas Zimmermann, arnd, deller, daniel, airlied
  Cc: linux-hyperv, linux-efi, linux-ia64, linux-sh, Peter Zijlstra,
	Catalin Marinas, Dave Hansen, linux-fbdev, dri-devel,
	Sebastian Reichel, Max Filippov, Rich Felker, Guo Ren,
	Christophe Leroy, H. Peter Anvin, sparclinux, linux-riscv,
	Will Deacon, WANG Xuerui, linux-arch, x86, Yoshinori Sato,
	Michael Ellerman, linux-staging, Russell King, linux-csky,
	Ard Biesheuvel, Paul Walmsley, Niklas Schnelle, Ingo Molnar,
	Geert Uytterhoeven, Sami Tolvanen, Palmer Dabbelt, Matt Turner,
	Huacai Chen, Albert Ou, Kees Cook, Paul E. McKenney,
	Anshuman Khandual, Frederic Weisbecker, linux-alpha,
	Richard Henderson, Nicholas Piggin, Russell King (Oracle),
	Ivan Kokshaysky, loongarch, John Paul Adrian Glaubitz,
	Thomas Gleixner, Zi Yan, linux-arm-kernel, Brian Cain,
	Chris Zankel, Thomas Bogendoerfer, linux-mips, linux-kernel,
	Dinh Nguyen, Juerg Haefliger, Mike Rapoport (IBM),
	linux-hexagon, Borislav Petkov, Andrew Morton, linuxppc-dev,
	David S. Miller, Kirill A. Shutemov

Hi,


Why this patch get dropped in the end?

Since the global screen_info is an arch-specific thing,
Whenever an arch-neutral module or subsystem references the global screen_info,
There are some complaints from either compile testing robot.
Well, a programmer may handle it by using the CONFIG_SYSFB guard,
but it is not as precise as what this patch provided.

Personally, I think this patch is still valuable.
I suggest either forcing all other architectures to export screen_info,
like the X86 and IA64 arch does, after all the screen_info is a good thing.
or provide the fine-control version like this patch does.


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@suse.de>
> Cc: Richard Henderson <richard.henderson@linaro.org>
> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
> Cc: Matt Turner <mattst88@gmail.com>
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Guo Ren <guoren@kernel.org>
> Cc: Brian Cain <bcain@quicinc.com>
> Cc: Huacai Chen <chenhuacai@kernel.org>
> Cc: WANG Xuerui <kernel@xen0n.name>
> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> Cc: Dinh Nguyen <dinguyen@kernel.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
> Cc: Paul Walmsley <paul.walmsley@sifive.com>
> Cc: Palmer Dabbelt <palmer@dabbelt.com>
> Cc: Albert Ou <aou@eecs.berkeley.edu>
> Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
> Cc: Rich Felker <dalias@libc.org>
> Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Dave Hansen <dave.hansen@linux.intel.com>
> Cc: x86@kernel.org
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: Chris Zankel <chris@zankel.net>
> Cc: Max Filippov <jcmvbkbc@gmail.com>
> Cc: Helge Deller <deller@gmx.de>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Kees Cook <keescook@chromium.org>
> Cc: "Paul E. McKenney" <paulmck@kernel.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Frederic Weisbecker <frederic@kernel.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Ard Biesheuvel <ardb@kernel.org>
> Cc: Sami Tolvanen <samitolvanen@google.com>
> Cc: Juerg Haefliger <juerg.haefliger@canonical.com>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Anshuman Khandual <anshuman.khandual@arm.com>
> Cc: Niklas Schnelle <schnelle@linux.ibm.com>
> Cc: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Sebastian Reichel <sebastian.reichel@collabora.com>
> Cc: "Mike Rapoport (IBM)" <rppt@kernel.org>
> Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
> Cc: Zi Yan <ziy@nvidia.com>
> Acked-by: WANG Xuerui <git@xen0n.name> # loongarch
> ---
>   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"
> diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
> index a5c2b1aa46b02..d749011d88b14 100644
> --- a/arch/alpha/Kconfig
> +++ b/arch/alpha/Kconfig
> @@ -4,6 +4,7 @@ config ALPHA
>   	default y
>   	select ARCH_32BIT_USTAT_F_TINODE
>   	select ARCH_HAS_CURRENT_STACK_POINTER
> +	select ARCH_HAS_SCREEN_INFO
>   	select ARCH_MIGHT_HAVE_PC_PARPORT
>   	select ARCH_MIGHT_HAVE_PC_SERIO
>   	select ARCH_NO_PREEMPT
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 0fb4b218f6658..a9d01ee67a90e 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -15,6 +15,7 @@ config ARM
>   	select ARCH_HAS_MEMBARRIER_SYNC_CORE
>   	select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
>   	select ARCH_HAS_PTE_SPECIAL if ARM_LPAE
> +	select ARCH_HAS_SCREEN_INFO
>   	select ARCH_HAS_SETUP_DMA_OPS
>   	select ARCH_HAS_SET_MEMORY
>   	select ARCH_STACKWALK
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 343e1e1cae10a..21addc4715bb3 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -36,6 +36,7 @@ config ARM64
>   	select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
>   	select ARCH_HAS_PTE_DEVMAP
>   	select ARCH_HAS_PTE_SPECIAL
> +	select ARCH_HAS_SCREEN_INFO
>   	select ARCH_HAS_SETUP_DMA_OPS
>   	select ARCH_HAS_SET_DIRECT_MAP
>   	select ARCH_HAS_SET_MEMORY
> diff --git a/arch/csky/Kconfig b/arch/csky/Kconfig
> index 4df1f8c9d170b..28444e581fc1f 100644
> --- a/arch/csky/Kconfig
> +++ b/arch/csky/Kconfig
> @@ -10,6 +10,7 @@ config CSKY
>   	select ARCH_USE_QUEUED_RWLOCKS
>   	select ARCH_USE_QUEUED_SPINLOCKS
>   	select ARCH_HAS_CURRENT_STACK_POINTER
> +	select ARCH_HAS_SCREEN_INFO
>   	select ARCH_INLINE_READ_LOCK if !PREEMPTION
>   	select ARCH_INLINE_READ_LOCK_BH if !PREEMPTION
>   	select ARCH_INLINE_READ_LOCK_IRQ if !PREEMPTION
> diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig
> index 54eadf2651786..cc683c0a43d34 100644
> --- a/arch/hexagon/Kconfig
> +++ b/arch/hexagon/Kconfig
> @@ -5,6 +5,7 @@ comment "Linux Kernel Configuration for Hexagon"
>   config HEXAGON
>   	def_bool y
>   	select ARCH_32BIT_OFF_T
> +	select ARCH_HAS_SCREEN_INFO
>   	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
>   	select ARCH_NO_PREEMPT
>   	select DMA_GLOBAL_POOL
> diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
> index e79f15e32a451..8b1e785e6d53d 100644
> --- a/arch/ia64/Kconfig
> +++ b/arch/ia64/Kconfig
> @@ -10,6 +10,7 @@ config IA64
>   	bool
>   	select ARCH_BINFMT_ELF_EXTRA_PHDRS
>   	select ARCH_HAS_DMA_MARK_CLEAN
> +	select ARCH_HAS_SCREEN_INFO
>   	select ARCH_HAS_STRNCPY_FROM_USER
>   	select ARCH_HAS_STRNLEN_USER
>   	select ARCH_MIGHT_HAVE_PC_PARPORT
> 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
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index 675a8660cb85a..c0ae09789cb6d 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -10,6 +10,7 @@ config MIPS
>   	select ARCH_HAS_KCOV
>   	select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE if !EVA
>   	select ARCH_HAS_PTE_SPECIAL if !(32BIT && CPU_HAS_RIXI)
> +	select ARCH_HAS_SCREEN_INFO
>   	select ARCH_HAS_STRNCPY_FROM_USER
>   	select ARCH_HAS_STRNLEN_USER
>   	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
> diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig
> index e5936417d3cd3..7183eea282212 100644
> --- a/arch/nios2/Kconfig
> +++ b/arch/nios2/Kconfig
> @@ -3,6 +3,7 @@ config NIOS2
>   	def_bool y
>   	select ARCH_32BIT_OFF_T
>   	select ARCH_HAS_DMA_PREP_COHERENT
> +	select ARCH_HAS_SCREEN_INFO
>   	select ARCH_HAS_SYNC_DMA_FOR_CPU
>   	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
>   	select ARCH_HAS_DMA_SET_UNCACHED
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index bff5820b7cda1..b1acad3076180 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -148,6 +148,7 @@ config PPC
>   	select ARCH_HAS_PTE_DEVMAP		if PPC_BOOK3S_64
>   	select ARCH_HAS_PTE_SPECIAL
>   	select ARCH_HAS_SCALED_CPUTIME		if VIRT_CPU_ACCOUNTING_NATIVE && PPC_BOOK3S_64
> +	select ARCH_HAS_SCREEN_INFO
>   	select ARCH_HAS_SET_MEMORY
>   	select ARCH_HAS_STRICT_KERNEL_RWX	if (PPC_BOOK3S || PPC_8xx || 40x) && !HIBERNATION
>   	select ARCH_HAS_STRICT_KERNEL_RWX	if PPC_85xx && !HIBERNATION && !RANDOMIZE_BASE
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 5966ad97c30c3..b5a48f8424af9 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -29,6 +29,7 @@ config RISCV
>   	select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
>   	select ARCH_HAS_PMEM_API
>   	select ARCH_HAS_PTE_SPECIAL
> +	select ARCH_HAS_SCREEN_INFO
>   	select ARCH_HAS_SET_DIRECT_MAP if MMU
>   	select ARCH_HAS_SET_MEMORY if MMU
>   	select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
> diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
> index 04b9550cf0070..001f5149952b4 100644
> --- a/arch/sh/Kconfig
> +++ b/arch/sh/Kconfig
> @@ -10,6 +10,7 @@ config SUPERH
>   	select ARCH_HAS_GIGANTIC_PAGE
>   	select ARCH_HAS_GCOV_PROFILE_ALL
>   	select ARCH_HAS_PTE_SPECIAL
> +	select ARCH_HAS_SCREEN_INFO
>   	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
>   	select ARCH_HIBERNATION_POSSIBLE if MMU
>   	select ARCH_MIGHT_HAVE_PC_PARPORT
> diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
> index 8535e19062f65..e4bfb80b48cfe 100644
> --- a/arch/sparc/Kconfig
> +++ b/arch/sparc/Kconfig
> @@ -13,6 +13,7 @@ config 64BIT
>   config SPARC
>   	bool
>   	default y
> +	select ARCH_HAS_SCREEN_INFO
>   	select ARCH_MIGHT_HAVE_PC_PARPORT if SPARC64 && PCI
>   	select ARCH_MIGHT_HAVE_PC_SERIO
>   	select DMA_OPS
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 53bab123a8ee4..d7c2bf4ee403d 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -91,6 +91,7 @@ config X86
>   	select ARCH_HAS_NONLEAF_PMD_YOUNG	if PGTABLE_LEVELS > 2
>   	select ARCH_HAS_UACCESS_FLUSHCACHE	if X86_64
>   	select ARCH_HAS_COPY_MC			if X86_64
> +	select ARCH_HAS_SCREEN_INFO
>   	select ARCH_HAS_SET_MEMORY
>   	select ARCH_HAS_SET_DIRECT_MAP
>   	select ARCH_HAS_STRICT_KERNEL_RWX
> diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
> index 3c6e5471f025b..c6cbd7459939c 100644
> --- a/arch/xtensa/Kconfig
> +++ b/arch/xtensa/Kconfig
> @@ -8,6 +8,7 @@ config XTENSA
>   	select ARCH_HAS_DMA_PREP_COHERENT if MMU
>   	select ARCH_HAS_GCOV_PROFILE_ALL
>   	select ARCH_HAS_KCOV
> +	select ARCH_HAS_SCREEN_INFO
>   	select ARCH_HAS_SYNC_DMA_FOR_CPU if MMU
>   	select ARCH_HAS_SYNC_DMA_FOR_DEVICE if MMU
>   	select ARCH_HAS_DMA_SET_UNCACHED if MMU
> diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
> index 8b2b9ac37c3df..d4a72bea56be0 100644
> --- a/drivers/video/Kconfig
> +++ b/drivers/video/Kconfig
> @@ -21,6 +21,9 @@ config STI_CORE
>   config VIDEO_CMDLINE
>   	bool
>   
> +config ARCH_HAS_SCREEN_INFO
> +	bool
> +
>   config VIDEO_NOMODESET
>   	bool
>   	default n
> diff --git a/include/asm-generic/Kbuild b/include/asm-generic/Kbuild
> index 941be574bbe00..5e5d4158a4b4b 100644
> --- a/include/asm-generic/Kbuild
> +++ b/include/asm-generic/Kbuild
> @@ -47,6 +47,7 @@ mandatory-y += percpu.h
>   mandatory-y += pgalloc.h
>   mandatory-y += preempt.h
>   mandatory-y += rwonce.h
> +mandatory-y += screen_info.h
>   mandatory-y += sections.h
>   mandatory-y += serial.h
>   mandatory-y += shmparam.h
> diff --git a/include/asm-generic/screen_info.h b/include/asm-generic/screen_info.h
> new file mode 100644
> index 0000000000000..6fd0e50fabfcd
> --- /dev/null
> +++ b/include/asm-generic/screen_info.h
> @@ -0,0 +1,12 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +
> +#ifndef _ASM_GENERIC_SCREEN_INFO_H
> +#define _ASM_GENERIC_SCREEN_INFO_H
> +
> +#include <uapi/linux/screen_info.h>
> +
> +#if defined(CONFIG_ARCH_HAS_SCREEN_INFO)
> +extern struct screen_info screen_info;
> +#endif
> +
> +#endif /* _ASM_GENERIC_SCREEN_INFO_H */
> diff --git a/include/linux/screen_info.h b/include/linux/screen_info.h
> index eab7081392d50..c764b9a51c24b 100644
> --- a/include/linux/screen_info.h
> +++ b/include/linux/screen_info.h
> @@ -4,6 +4,6 @@
>   
>   #include <uapi/linux/screen_info.h>
>   
> -extern struct screen_info screen_info;
> +#include <asm/screen_info.h>
>   
>   #endif /* _SCREEN_INFO_H */


^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [06/12] arch: Declare screen_info in <asm/screen_info.h>
  2023-08-18 14:04   ` suijingfeng
@ 2023-08-18 14:18     ` suijingfeng
  0 siblings, 0 replies; 44+ messages in thread
From: suijingfeng @ 2023-08-18 14:18 UTC (permalink / raw)
  To: Thomas Zimmermann, arnd, deller, daniel, airlied
  Cc: linux-hyperv, linux-efi, linux-ia64, linux-sh, Peter Zijlstra,
	Catalin Marinas, Dave Hansen, linux-fbdev, dri-devel,
	Sebastian Reichel, Max Filippov, Rich Felker, Guo Ren,
	Christophe Leroy, H. Peter Anvin, sparclinux, linux-riscv,
	Will Deacon, WANG Xuerui, linux-arch, x86, Yoshinori Sato,
	Michael Ellerman, linux-staging, Russell King, linux-csky,
	Ard Biesheuvel, Paul Walmsley, Niklas Schnelle, Ingo Molnar,
	Geert Uytterhoeven, Sami Tolvanen, Palmer Dabbelt, Matt Turner,
	Huacai Chen, Albert Ou, Kees Cook, Paul E. McKenney,
	Anshuman Khandual, Frederic Weisbecker, linux-alpha,
	Richard Henderson, Nicholas Piggin, Russell King (Oracle),
	Ivan Kokshaysky, loongarch, John Paul Adrian Glaubitz,
	Thomas Gleixner, Zi Yan, linux-arm-kernel, Brian Cain,
	Chris Zankel, Thomas Bogendoerfer, linux-mips, linux-kernel,
	Dinh Nguyen, Juerg Haefliger, Mike Rapoport (IBM),
	linux-hexagon, Borislav Petkov, Andrew Morton, linuxppc-dev,
	David S. Miller, Kirill A. Shutemov


On 2023/8/18 22:04, suijingfeng wrote:
> Hi,
>
>
> Why this patch get dropped in the end?
>
> Since the global screen_info is an arch-specific thing,
> Whenever an arch-neutral module or subsystem references the global 
> screen_info,
> There are some complaints from either compile testing robot.


There are some complaints from either compile testing robot or domain 
specific reviewers who doubt why you select the CONFIG_SYSFB not 
CONFIG_VT or CONFIG_EFI.


> Well, a programmer may handle it by using the CONFIG_SYSFB guard,
> but it is not as precise as what this patch provided.
>
> Personally, I think this patch is still valuable.
> I suggest either forcing all other architectures to export screen_info,
> like the X86 and IA64 arch does, after all the screen_info is a good 
> thing.
> or provide the fine-control version like this patch does.
>

Because all of the three tokens(CONFIG_SYSFB not CONFIG_VT or CONFIG_EFI.)

have no direct relationship with the global screen_info if an arch is 
not mentioned first.



> 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@suse.de>
>> Cc: Richard Henderson <richard.henderson@linaro.org>
>> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
>> Cc: Matt Turner <mattst88@gmail.com>
>> Cc: Russell King <linux@armlinux.org.uk>
>> Cc: Catalin Marinas <catalin.marinas@arm.com>
>> Cc: Will Deacon <will@kernel.org>
>> Cc: Guo Ren <guoren@kernel.org>
>> Cc: Brian Cain <bcain@quicinc.com>
>> Cc: Huacai Chen <chenhuacai@kernel.org>
>> Cc: WANG Xuerui <kernel@xen0n.name>
>> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
>> Cc: Dinh Nguyen <dinguyen@kernel.org>
>> Cc: Michael Ellerman <mpe@ellerman.id.au>
>> Cc: Nicholas Piggin <npiggin@gmail.com>
>> Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
>> Cc: Paul Walmsley <paul.walmsley@sifive.com>
>> Cc: Palmer Dabbelt <palmer@dabbelt.com>
>> Cc: Albert Ou <aou@eecs.berkeley.edu>
>> Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
>> Cc: Rich Felker <dalias@libc.org>
>> Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
>> Cc: "David S. Miller" <davem@davemloft.net>
>> Cc: Thomas Gleixner <tglx@linutronix.de>
>> Cc: Ingo Molnar <mingo@redhat.com>
>> Cc: Borislav Petkov <bp@alien8.de>
>> Cc: Dave Hansen <dave.hansen@linux.intel.com>
>> Cc: x86@kernel.org
>> Cc: "H. Peter Anvin" <hpa@zytor.com>
>> Cc: Chris Zankel <chris@zankel.net>
>> Cc: Max Filippov <jcmvbkbc@gmail.com>
>> Cc: Helge Deller <deller@gmx.de>
>> Cc: Arnd Bergmann <arnd@arndb.de>
>> Cc: Kees Cook <keescook@chromium.org>
>> Cc: "Paul E. McKenney" <paulmck@kernel.org>
>> Cc: Peter Zijlstra <peterz@infradead.org>
>> Cc: Frederic Weisbecker <frederic@kernel.org>
>> Cc: Andrew Morton <akpm@linux-foundation.org>
>> Cc: Ard Biesheuvel <ardb@kernel.org>
>> Cc: Sami Tolvanen <samitolvanen@google.com>
>> Cc: Juerg Haefliger <juerg.haefliger@canonical.com>
>> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
>> Cc: Anshuman Khandual <anshuman.khandual@arm.com>
>> Cc: Niklas Schnelle <schnelle@linux.ibm.com>
>> Cc: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
>> Cc: Linus Walleij <linus.walleij@linaro.org>
>> Cc: Sebastian Reichel <sebastian.reichel@collabora.com>
>> Cc: "Mike Rapoport (IBM)" <rppt@kernel.org>
>> Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
>> Cc: Zi Yan <ziy@nvidia.com>
>> Acked-by: WANG Xuerui <git@xen0n.name> # loongarch
>> ---
>>   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"
>> diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
>> index a5c2b1aa46b02..d749011d88b14 100644
>> --- a/arch/alpha/Kconfig
>> +++ b/arch/alpha/Kconfig
>> @@ -4,6 +4,7 @@ config ALPHA
>>       default y
>>       select ARCH_32BIT_USTAT_F_TINODE
>>       select ARCH_HAS_CURRENT_STACK_POINTER
>> +    select ARCH_HAS_SCREEN_INFO
>>       select ARCH_MIGHT_HAVE_PC_PARPORT
>>       select ARCH_MIGHT_HAVE_PC_SERIO
>>       select ARCH_NO_PREEMPT
>> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
>> index 0fb4b218f6658..a9d01ee67a90e 100644
>> --- a/arch/arm/Kconfig
>> +++ b/arch/arm/Kconfig
>> @@ -15,6 +15,7 @@ config ARM
>>       select ARCH_HAS_MEMBARRIER_SYNC_CORE
>>       select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
>>       select ARCH_HAS_PTE_SPECIAL if ARM_LPAE
>> +    select ARCH_HAS_SCREEN_INFO
>>       select ARCH_HAS_SETUP_DMA_OPS
>>       select ARCH_HAS_SET_MEMORY
>>       select ARCH_STACKWALK
>> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
>> index 343e1e1cae10a..21addc4715bb3 100644
>> --- a/arch/arm64/Kconfig
>> +++ b/arch/arm64/Kconfig
>> @@ -36,6 +36,7 @@ config ARM64
>>       select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
>>       select ARCH_HAS_PTE_DEVMAP
>>       select ARCH_HAS_PTE_SPECIAL
>> +    select ARCH_HAS_SCREEN_INFO
>>       select ARCH_HAS_SETUP_DMA_OPS
>>       select ARCH_HAS_SET_DIRECT_MAP
>>       select ARCH_HAS_SET_MEMORY
>> diff --git a/arch/csky/Kconfig b/arch/csky/Kconfig
>> index 4df1f8c9d170b..28444e581fc1f 100644
>> --- a/arch/csky/Kconfig
>> +++ b/arch/csky/Kconfig
>> @@ -10,6 +10,7 @@ config CSKY
>>       select ARCH_USE_QUEUED_RWLOCKS
>>       select ARCH_USE_QUEUED_SPINLOCKS
>>       select ARCH_HAS_CURRENT_STACK_POINTER
>> +    select ARCH_HAS_SCREEN_INFO
>>       select ARCH_INLINE_READ_LOCK if !PREEMPTION
>>       select ARCH_INLINE_READ_LOCK_BH if !PREEMPTION
>>       select ARCH_INLINE_READ_LOCK_IRQ if !PREEMPTION
>> diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig
>> index 54eadf2651786..cc683c0a43d34 100644
>> --- a/arch/hexagon/Kconfig
>> +++ b/arch/hexagon/Kconfig
>> @@ -5,6 +5,7 @@ comment "Linux Kernel Configuration for Hexagon"
>>   config HEXAGON
>>       def_bool y
>>       select ARCH_32BIT_OFF_T
>> +    select ARCH_HAS_SCREEN_INFO
>>       select ARCH_HAS_SYNC_DMA_FOR_DEVICE
>>       select ARCH_NO_PREEMPT
>>       select DMA_GLOBAL_POOL
>> diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
>> index e79f15e32a451..8b1e785e6d53d 100644
>> --- a/arch/ia64/Kconfig
>> +++ b/arch/ia64/Kconfig
>> @@ -10,6 +10,7 @@ config IA64
>>       bool
>>       select ARCH_BINFMT_ELF_EXTRA_PHDRS
>>       select ARCH_HAS_DMA_MARK_CLEAN
>> +    select ARCH_HAS_SCREEN_INFO
>>       select ARCH_HAS_STRNCPY_FROM_USER
>>       select ARCH_HAS_STRNLEN_USER
>>       select ARCH_MIGHT_HAVE_PC_PARPORT
>> 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
>> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
>> index 675a8660cb85a..c0ae09789cb6d 100644
>> --- a/arch/mips/Kconfig
>> +++ b/arch/mips/Kconfig
>> @@ -10,6 +10,7 @@ config MIPS
>>       select ARCH_HAS_KCOV
>>       select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE if !EVA
>>       select ARCH_HAS_PTE_SPECIAL if !(32BIT && CPU_HAS_RIXI)
>> +    select ARCH_HAS_SCREEN_INFO
>>       select ARCH_HAS_STRNCPY_FROM_USER
>>       select ARCH_HAS_STRNLEN_USER
>>       select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
>> diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig
>> index e5936417d3cd3..7183eea282212 100644
>> --- a/arch/nios2/Kconfig
>> +++ b/arch/nios2/Kconfig
>> @@ -3,6 +3,7 @@ config NIOS2
>>       def_bool y
>>       select ARCH_32BIT_OFF_T
>>       select ARCH_HAS_DMA_PREP_COHERENT
>> +    select ARCH_HAS_SCREEN_INFO
>>       select ARCH_HAS_SYNC_DMA_FOR_CPU
>>       select ARCH_HAS_SYNC_DMA_FOR_DEVICE
>>       select ARCH_HAS_DMA_SET_UNCACHED
>> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
>> index bff5820b7cda1..b1acad3076180 100644
>> --- a/arch/powerpc/Kconfig
>> +++ b/arch/powerpc/Kconfig
>> @@ -148,6 +148,7 @@ config PPC
>>       select ARCH_HAS_PTE_DEVMAP        if PPC_BOOK3S_64
>>       select ARCH_HAS_PTE_SPECIAL
>>       select ARCH_HAS_SCALED_CPUTIME        if 
>> VIRT_CPU_ACCOUNTING_NATIVE && PPC_BOOK3S_64
>> +    select ARCH_HAS_SCREEN_INFO
>>       select ARCH_HAS_SET_MEMORY
>>       select ARCH_HAS_STRICT_KERNEL_RWX    if (PPC_BOOK3S || PPC_8xx 
>> || 40x) && !HIBERNATION
>>       select ARCH_HAS_STRICT_KERNEL_RWX    if PPC_85xx && 
>> !HIBERNATION && !RANDOMIZE_BASE
>> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
>> index 5966ad97c30c3..b5a48f8424af9 100644
>> --- a/arch/riscv/Kconfig
>> +++ b/arch/riscv/Kconfig
>> @@ -29,6 +29,7 @@ config RISCV
>>       select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
>>       select ARCH_HAS_PMEM_API
>>       select ARCH_HAS_PTE_SPECIAL
>> +    select ARCH_HAS_SCREEN_INFO
>>       select ARCH_HAS_SET_DIRECT_MAP if MMU
>>       select ARCH_HAS_SET_MEMORY if MMU
>>       select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
>> diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
>> index 04b9550cf0070..001f5149952b4 100644
>> --- a/arch/sh/Kconfig
>> +++ b/arch/sh/Kconfig
>> @@ -10,6 +10,7 @@ config SUPERH
>>       select ARCH_HAS_GIGANTIC_PAGE
>>       select ARCH_HAS_GCOV_PROFILE_ALL
>>       select ARCH_HAS_PTE_SPECIAL
>> +    select ARCH_HAS_SCREEN_INFO
>>       select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
>>       select ARCH_HIBERNATION_POSSIBLE if MMU
>>       select ARCH_MIGHT_HAVE_PC_PARPORT
>> diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
>> index 8535e19062f65..e4bfb80b48cfe 100644
>> --- a/arch/sparc/Kconfig
>> +++ b/arch/sparc/Kconfig
>> @@ -13,6 +13,7 @@ config 64BIT
>>   config SPARC
>>       bool
>>       default y
>> +    select ARCH_HAS_SCREEN_INFO
>>       select ARCH_MIGHT_HAVE_PC_PARPORT if SPARC64 && PCI
>>       select ARCH_MIGHT_HAVE_PC_SERIO
>>       select DMA_OPS
>> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
>> index 53bab123a8ee4..d7c2bf4ee403d 100644
>> --- a/arch/x86/Kconfig
>> +++ b/arch/x86/Kconfig
>> @@ -91,6 +91,7 @@ config X86
>>       select ARCH_HAS_NONLEAF_PMD_YOUNG    if PGTABLE_LEVELS > 2
>>       select ARCH_HAS_UACCESS_FLUSHCACHE    if X86_64
>>       select ARCH_HAS_COPY_MC            if X86_64
>> +    select ARCH_HAS_SCREEN_INFO
>>       select ARCH_HAS_SET_MEMORY
>>       select ARCH_HAS_SET_DIRECT_MAP
>>       select ARCH_HAS_STRICT_KERNEL_RWX
>> diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
>> index 3c6e5471f025b..c6cbd7459939c 100644
>> --- a/arch/xtensa/Kconfig
>> +++ b/arch/xtensa/Kconfig
>> @@ -8,6 +8,7 @@ config XTENSA
>>       select ARCH_HAS_DMA_PREP_COHERENT if MMU
>>       select ARCH_HAS_GCOV_PROFILE_ALL
>>       select ARCH_HAS_KCOV
>> +    select ARCH_HAS_SCREEN_INFO
>>       select ARCH_HAS_SYNC_DMA_FOR_CPU if MMU
>>       select ARCH_HAS_SYNC_DMA_FOR_DEVICE if MMU
>>       select ARCH_HAS_DMA_SET_UNCACHED if MMU
>> diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
>> index 8b2b9ac37c3df..d4a72bea56be0 100644
>> --- a/drivers/video/Kconfig
>> +++ b/drivers/video/Kconfig
>> @@ -21,6 +21,9 @@ config STI_CORE
>>   config VIDEO_CMDLINE
>>       bool
>>   +config ARCH_HAS_SCREEN_INFO
>> +    bool
>> +
>>   config VIDEO_NOMODESET
>>       bool
>>       default n
>> diff --git a/include/asm-generic/Kbuild b/include/asm-generic/Kbuild
>> index 941be574bbe00..5e5d4158a4b4b 100644
>> --- a/include/asm-generic/Kbuild
>> +++ b/include/asm-generic/Kbuild
>> @@ -47,6 +47,7 @@ mandatory-y += percpu.h
>>   mandatory-y += pgalloc.h
>>   mandatory-y += preempt.h
>>   mandatory-y += rwonce.h
>> +mandatory-y += screen_info.h
>>   mandatory-y += sections.h
>>   mandatory-y += serial.h
>>   mandatory-y += shmparam.h
>> diff --git a/include/asm-generic/screen_info.h 
>> b/include/asm-generic/screen_info.h
>> new file mode 100644
>> index 0000000000000..6fd0e50fabfcd
>> --- /dev/null
>> +++ b/include/asm-generic/screen_info.h
>> @@ -0,0 +1,12 @@
>> +/* SPDX-License-Identifier: GPL-2.0 */
>> +
>> +#ifndef _ASM_GENERIC_SCREEN_INFO_H
>> +#define _ASM_GENERIC_SCREEN_INFO_H
>> +
>> +#include <uapi/linux/screen_info.h>
>> +
>> +#if defined(CONFIG_ARCH_HAS_SCREEN_INFO)
>> +extern struct screen_info screen_info;
>> +#endif
>> +
>> +#endif /* _ASM_GENERIC_SCREEN_INFO_H */
>> diff --git a/include/linux/screen_info.h b/include/linux/screen_info.h
>> index eab7081392d50..c764b9a51c24b 100644
>> --- a/include/linux/screen_info.h
>> +++ b/include/linux/screen_info.h
>> @@ -4,6 +4,6 @@
>>     #include <uapi/linux/screen_info.h>
>>   -extern struct screen_info screen_info;
>> +#include <asm/screen_info.h>
>>     #endif /* _SCREEN_INFO_H */


^ permalink raw reply	[flat|nested] 44+ messages in thread

end of thread, other threads:[~2023-08-18 14:19 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-29 11:45 [PATCH 00/12] arch,fbdev: Move screen_info into arch/ Thomas Zimmermann
2023-06-29 11:45 ` [PATCH 01/12] efi: Do not include <linux/screen_info.h> from EFI header Thomas Zimmermann
2023-07-04 16:23   ` Javier Martinez Canillas
2023-07-05  1:40   ` [01/12] " Sui Jingfeng
2023-07-05  8:00     ` Thomas Zimmermann
2023-06-29 11:45 ` [PATCH 02/12] fbdev/sm712fb: Do not include <linux/screen_info.h> Thomas Zimmermann
2023-07-04 16:25   ` Javier Martinez Canillas
2023-06-29 11:45 ` [PATCH 03/12] sysfb: Do not include <linux/screen_info.h> from sysfb header Thomas Zimmermann
2023-07-04 16:26   ` Javier Martinez Canillas
2023-07-05  1:41   ` [03/12] " Sui Jingfeng
2023-06-29 11:45 ` [PATCH 04/12] staging/sm750fb: Do not include <linux/screen_info.h> Thomas Zimmermann
2023-07-04 16:27   ` Javier Martinez Canillas
2023-06-29 11:45 ` [PATCH 05/12] arch: Remove trailing whitespaces Thomas Zimmermann
2023-07-04 16:27   ` Javier Martinez Canillas
2023-07-05  1:25   ` [05/12] " Sui Jingfeng
2023-06-29 11:45 ` [PATCH 06/12] arch: Declare screen_info in <asm/screen_info.h> Thomas Zimmermann
2023-06-29 12:55   ` WANG Xuerui
2023-06-29 13:03   ` Arnd Bergmann
2023-06-29 13:18     ` Thomas Zimmermann
2023-07-05  1:21   ` [06/12] " Sui Jingfeng
2023-07-05  8:02     ` Thomas Zimmermann
2023-08-18 14:04   ` suijingfeng
2023-08-18 14:18     ` suijingfeng
2023-06-29 11:45 ` [PATCH 07/12] arch/x86: Declare edid_info " Thomas Zimmermann
2023-06-29 12:35   ` Arnd Bergmann
2023-06-29 13:01     ` Thomas Zimmermann
2023-06-29 13:21       ` Arnd Bergmann
2023-06-30  7:46         ` Thomas Zimmermann
2023-06-30 11:53           ` Arnd Bergmann
2023-07-05  8:18             ` Thomas Zimmermann
2023-07-18 14:47               ` Arnd Bergmann
2023-06-29 11:45 ` [PATCH 08/12] drivers/firmware: Remove trailing whitespaces Thomas Zimmermann
2023-07-05  1:26   ` [08/12] " Sui Jingfeng
2023-07-05  7:46   ` [PATCH 08/12] " Javier Martinez Canillas
2023-06-29 11:45 ` [PATCH 09/12] drivers: Add dependencies on CONFIG_ARCH_HAS_SCREEN_INFO Thomas Zimmermann
2023-06-29 11:45 ` [PATCH 10/12] fbdev/core: Use fb_is_primary_device() in fb_firmware_edid() Thomas Zimmermann
2023-07-05  8:02   ` Javier Martinez Canillas
2023-06-29 11:45 ` [PATCH 11/12] fbdev/core: Protect edid_info with CONFIG_ARCH_HAS_EDID_INFO Thomas Zimmermann
2023-07-05  1:43   ` [11/12] " Sui Jingfeng
2023-06-29 11:45 ` [PATCH 12/12] fbdev/core: Define empty fb_firmware_edid() in <linux/fb.h> Thomas Zimmermann
2023-06-29 13:31 ` [PATCH 00/12] arch,fbdev: Move screen_info into arch/ Arnd Bergmann
2023-06-29 14:15   ` Thomas Zimmermann
2023-06-29 14:42     ` Arnd Bergmann
2023-06-29 14:29   ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).