video: screen_info cleanups
Subsystems (22)
v3 cover video: screen_info cleanups
From: Arnd Bergmann <[email protected]>
v3 changelog
No real changes, just rebased for context changes, and picked up the Acks.
This now conflicts with the ia64 removal and introduces one new dependency on IA64, but that is harmless and trivial to deal with later.
---
v2 changelog
I refreshed the first four patches that I sent before with very minor updates, and then added some more to further disaggregate the use of screen_info:
- I found that powerpc wasn't using vga16fb any more
- vgacon can be almost entirely separated from the global screen_info, except on x86
- similarly, the EFI framebuffer initialization can be kept separate, except on x86.
I did extensive build testing on arm/arm64/x86 and the normal built bot testing for the other architectures.
Which tree should this get merged through?
Arnd Bergmann (9):
vgacon: rework Kconfig dependencies
vgacon: rework screen_info #ifdef checks
dummycon: limit Arm console size hack to footbridge vgacon, arch/*: remove unused screen_info definitions
vgacon: remove screen_info dependency
vgacon: clean up global screen_info instances
vga16fb: drop powerpc support
hyperv: avoid dependency on screen_info
efi: move screen_info into efi init code
arch/alpha/kernel/proto.h | 2 + arch/alpha/kernel/setup.c | 8 +-- arch/alpha/kernel/sys_sio.c | 8 ++- arch/arm/include/asm/setup.h | 5 ++ arch/arm/kernel/atags_parse.c | 20 +++--- arch/arm/kernel/efi.c | 6 -- arch/arm/kernel/setup.c | 11 +-- arch/arm64/kernel/efi.c | 4 -- arch/arm64/kernel/image-vars.h | 2 + arch/csky/kernel/setup.c | 12 ---- arch/hexagon/kernel/Makefile | 2 - arch/hexagon/kernel/screen_info.c | 3 - arch/ia64/kernel/setup.c | 53 ++++++++------- arch/loongarch/kernel/efi.c | 3 +- arch/loongarch/kernel/image-vars.h | 2 + arch/loongarch/kernel/setup.c | 3 - arch/mips/jazz/setup.c | 9 --- arch/mips/kernel/setup.c | 11 --- arch/mips/mti-malta/malta-setup.c | 4 +- arch/mips/sibyte/swarm/setup.c | 26 ++++--- arch/mips/sni/setup.c | 18 ++--- arch/nios2/kernel/setup.c | 5 -- arch/powerpc/kernel/setup-common.c | 16 ----- arch/riscv/kernel/image-vars.h | 2 + arch/riscv/kernel/setup.c | 12 ---- arch/sh/kernel/setup.c | 5 -- arch/sparc/kernel/setup_32.c | 13 ---- arch/sparc/kernel/setup_64.c | 13 ---- arch/x86/kernel/setup.c | 2 +- arch/xtensa/kernel/setup.c | 12 ---- drivers/firmware/efi/efi-init.c | 14 +++- drivers/firmware/efi/libstub/efi-stub-entry.c | 8 ++- drivers/firmware/pcdp.c | 1 - drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 7 +- drivers/hv/vmbus_drv.c | 6 +- drivers/video/console/Kconfig | 11 +-- drivers/video/console/dummycon.c | 2 +- drivers/video/console/vgacon.c | 68 +++++++++++-------- drivers/video/fbdev/Kconfig | 2 +- drivers/video/fbdev/hyperv_fb.c | 8 +-- drivers/video/fbdev/vga16fb.c | 9 +-- include/linux/console.h | 7 ++ 42 files changed, 183 insertions(+), 252 deletions(-) delete mode 100644 arch/hexagon/kernel/screen_info.c
Signature · 54 lines
2.39.2 Cc: "David S. Miller" <[email protected]> Cc: "K. Y. Srinivasan" <[email protected]> Cc: Ard Biesheuvel <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Brian Cain <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Christophe Leroy <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: Dave Hansen <[email protected]> Cc: David Airlie <[email protected]> Cc: Deepak Rawat <[email protected]> Cc: Dexuan Cui <[email protected]> Cc: Dinh Nguyen <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Guo Ren <[email protected]> Cc: Haiyang Zhang <[email protected]> Cc: Helge Deller <[email protected]> Cc: Huacai Chen <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Javier Martinez Canillas <[email protected]> Cc: John Paul Adrian Glaubitz <[email protected]> Cc: Khalid Aziz <[email protected]> Cc: Linus Walleij <[email protected]> Cc: Matt Turner <[email protected]> Cc: Max Filippov <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Nicholas Piggin <[email protected]> Cc: Palmer Dabbelt <[email protected]> Cc: Russell King <[email protected]> Cc: Thomas Bogendoerfer <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Thomas Zimmermann <[email protected]> Cc: WANG Xuerui <[email protected]> Cc: Wei Liu <[email protected]> Cc: Will Deacon <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected]
PATCH v3 1/9 vgacon: rework Kconfig dependencies
From: Arnd Bergmann <[email protected]>
The list of dependencies here is phrased as an opt-out, but this is missing a lot of architectures that don't actually support VGA consoles, and some of the entries are stale:
- powerpc used to support VGA consoles in the old arch/ppc codebase, but the merged arch/powerpc never did
- arm lists footbridge, integrator and netwinder, but netwinder is actually part of footbridge, and integrator does not appear to have an actual VGA hardware, or list it in its ATAG or DT.
- mips has a few platforms (malta, sibyte, and sni) that initialize screen_info, on everything else the console is selected but cannot actually work.
- csky, hexgagon, loongarch, nios2, riscv and xtensa are not listed in the opt-out table and declare a screen_info to allow building vga_con, but this cannot work because the console is never selected.
Replace this with an opt-in table that lists only the platforms that remain. This is effectively x86, plus a couple of historic workstation and server machines that reused parts of the x86 system architecture.
--- drivers/video/console/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/video/console/Kconfig +3 -3
@@ -7,9 +7,9 @@ menu "Console display driver support" config VGA_CONSOLE bool "VGA text console" if EXPERT || !X86 - depends on !4xx && !PPC_8xx && !SPARC && !M68K && !PARISC && !SUPERH && \ - (!ARM || ARCH_FOOTBRIDGE || ARCH_INTEGRATOR || ARCH_NETWINDER) && \ - !ARM64 && !ARC && !MICROBLAZE && !OPENRISC && !S390 && !UML + depends on ALPHA || IA64 || X86 || \ + (ARM && ARCH_FOOTBRIDGE) || \ + (MIPS && (MIPS_MALTA || SIBYTE_BCM112X || SIBYTE_SB1250 || SIBYTE_BCM1x80 || SNI_RM)) select APERTURE_HELPERS if (DRM || FB || VFIO_PCI_CORE) default y help
Signature · 1 line
2.39.2
Re: [PATCH v3 1/9] vgacon: rework Kconfig dependencies
Hi Arnd,
Quoted 25 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
The list of dependencies here is phrased as an opt-out, but this is missing a lot of architectures that don't actually support VGA consoles, and some of the entries are stale:
- powerpc used to support VGA consoles in the old
arch/ppccodebase, but the mergedarch/powerpcnever did- arm lists footbridge, integrator and netwinder, but netwinder is actually part of footbridge, and integrator does not appear to have an actual VGA hardware, or list it in its ATAG or DT.
- mips has a few platforms (malta, sibyte, and sni) that initialize
screen_info, on everything else the console is selected but cannot actually work.- csky, hexgagon, loongarch, nios2, riscv and xtensa are not listed in the opt-out table and declare a
screen_infoto allow buildingvga_con, but this cannot work because the console is never selected.Replace this with an opt-in table that lists only the platforms that remain. This is effectively x86, plus a couple of historic workstation and server machines that reused parts of the x86 system architecture.
Quoted 5 lines
Reviewed-by Javier Martinez Canillas <[email protected]>Reviewed-by Thomas Zimmermann <[email protected]>Reviewed-by Khalid Aziz <[email protected]>Acked-by Helge Deller <[email protected]>Signed-off-by Arnd Bergmann <[email protected]>
Thanks for your patch!
A few suggestions for simplification below...
drivers/video/console/Kconfig menu "Console display driver support" · line 11
Quoted 11 lines
drivers/video/console/Kconfig +2
-3@@ -7,9 +7,9 @@ menu "Console display driver support" config VGA_CONSOLE bool "VGA text console" if EXPERT || !X86 - depends on !4xx && !PPC_8xx && !SPARC && !M68K && !PARISC && !SUPERH && \ - (!ARM || ARCH_FOOTBRIDGE || ARCH_INTEGRATOR || ARCH_NETWINDER) && \ - !ARM64 && !ARC && !MICROBLAZE && !OPENRISC && !S390 && !UML + depends on ALPHA || IA64 || X86 || \ + (ARM && ARCH_FOOTBRIDGE) || \
You can drop "ARM &&", as it is implied by ARCH_FOOTBRIDGE.
drivers/video/console/Kconfig menu "Console display driver support" · line 12
Quoted 1 line
drivers/video/console/Kconfig +1
-0+ (MIPS && (MIPS_MALTA || SIBYTE_BCM112X || SIBYTE_SB1250 || SIBYTE_BCM1x80 || SNI_RM))
Likewise for "MIPS &&".
The 3 SIBYTE dependencies can be replaced by SIBYTE_SB1xxx_SOC.
drivers/video/console/Kconfig menu "Console display driver support" · line 15
Quoted 3 lines
drivers/video/console/Kconfig +0
-0select APERTURE_HELPERS if (DRM || FB || VFIO_PCI_CORE) default y help
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
PATCH v3 2/9 vgacon: rework screen_info #ifdef checks
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
On non-x86 architectures, the screen_info variable is generally only used for the VGA console where supported, and in some cases the EFI framebuffer or vga16fb.
Now that we have a definite list of which architectures actually use it for what, use consistent #ifdef checks so the global variable is only defined when it is actually used on those architectures.
Loongarch and riscv have no support for vgacon or vga16fb, but they support EFI firmware, so only that needs to be checked, and the initialization can be removed because that is handled by EFI. IA64 has both vgacon and EFI, though EFI apparently never uses a framebuffer here.
---
v2 changes:
- split out mips/jazz change
- improve ia64 #ifdef changes
--- arch/alpha/kernel/setup.c | 2 ++ arch/alpha/kernel/sys_sio.c | 2 ++ arch/ia64/kernel/setup.c | 6 ++++++ arch/loongarch/kernel/setup.c | 2 ++ arch/mips/kernel/setup.c | 2 +- arch/mips/sibyte/swarm/setup.c | 2 +- arch/mips/sni/setup.c | 2 +- arch/riscv/kernel/setup.c | 11 ++--------- 8 files changed, 17 insertions(+), 12 deletions(-)
arch/alpha/kernel/setup.c +2 -0
@@ -131,6 +131,7 @@ static void determine_cpu_caches (unsigned int);static char __initdata command_line[COMMAND_LINE_SIZE ]; +#ifdef CONFIG_VGA_CONSOLE /* * The format of "screen_info" is strange, and due to early * i386-setup code. This is just enough to make the console
@@ -147,6 +148,7 @@ struct screen_info screen_info = { };EXPORT_SYMBOL (screen_info); +#endif /* * The direct map I/O window, if any. This should be the same
arch/alpha/kernel/sys_sio.c +2 -0
@@ -57,11 +57,13 @@ sio_init_irq(void)static inline void __init alphabook1_init_arch (void ) { +#ifdef CONFIG_VGA_CONSOLE /* The AlphaBook1 has LCD video fixed at 800x600, 37 rows and 100 cols. */ screen_info.orig_y =37 ; screen_info.orig_video_cols =100 ; screen_info.orig_video_lines =37 ; +#endif lca_init_arch (); }
arch/ia64/kernel/setup.c +6 -0
@@ -86,9 +86,13 @@ EXPORT_SYMBOL(local_per_cpu_offset);#endif unsigned long ia64_cycles_per_usec;struct ia64_boot_param *ia64_boot_param; +#if defined(CONFIG_VGA_CONSOLE ) || defined(CONFIG_EFI )struct screen_info screen_info; +#endif +#ifdef CONFIG_VGA_CONSOLE unsigned long vga_console_iobase;unsigned long vga_console_membase; +#endif static struct resource data_resource = { .name ="Kernel data" ,
@@ -497,6 +501,7 @@ early_console_setup (char *cmdline)static void __init screen_info_setup (void ) { +#ifdef CONFIG_VGA_CONSOLE unsigned int orig_x, orig_y, num_cols, num_rows, font_height;memset (&screen_info,0 ,sizeof (screen_info));
@@ -525,6 +530,7 @@ screen_info_setup(void) screen_info.orig_video_mode =3 ;/* XXX fake */ screen_info.orig_video_isVGA =1 ;/* XXX fake */ screen_info.orig_video_ega_bx =3 ;/* XXX fake */ +#endif } static inline void
arch/loongarch/kernel/setup.c +2 -0
@@ -57,7 +57,9 @@#define SMBIOS_CORE_PACKAGE_OFFSET 0x23#define LOONGSON_EFI_ENABLE (1 << 3) +#ifdef CONFIG_EFI struct screen_info screen_info __section(".data"); +#endif unsigned long fw_arg0, fw_arg1, fw_arg2; DEFINE_PER_CPU(unsigned long, kernelsp);
arch/mips/kernel/setup.c +1 -1
@@ -54,7 +54,7 @@ struct cpuinfo_mips cpu_data[NR_CPUS] __read_mostly;EXPORT_SYMBOL (cpu_data); -#ifdef CONFIG_VT +#ifdef CONFIG_VGA_CONSOLE struct screen_info screen_info;#endif
arch/mips/sibyte/swarm/setup.c +1 -1
@@ -129,7 +129,7 @@ void __init plat_mem_setup(void)if (m41t81_probe ()) swarm_rtc_type =RTC_M41T81 ; -#ifdef CONFIG_VT +#ifdef CONFIG_VGA_CONSOLE screen_info = (struct screen_info ) { .orig_video_page =52 , .orig_video_mode = 3,
arch/mips/sni/setup.c +1 -1
@@ -38,7 +38,7 @@ extern void sni_machine_power_off(void);static void __init sni_display_setup (void ) { -#if defined(CONFIG_VT ) && defined(CONFIG_VGA_CONSOLE ) && defined(CONFIG_FW_ARC ) +#if defined(CONFIG_VGA_CONSOLE ) && defined(CONFIG_FW_ARC )struct screen_info *si = &screen_info;DISPLAY_STATUS *di;
arch/riscv/kernel/setup.c +2 -9
@@ -40,15 +40,8 @@#include "head.h" -#if defined(CONFIG_DUMMY_CONSOLE ) || defined(CONFIG_EFI ) -struct screen_info screen_info __section(".data") = { - .orig_video_lines = 30, - .orig_video_cols = 80, - .orig_video_mode = 0, - .orig_video_ega_bx = 0, - .orig_video_isVGA = 1, - .orig_video_points =8 -}; +#if defined(CONFIG_EFI ) +struct screen_info screen_info __section(".data");#endif /*
Signature · 1 line
2.39.2
PATCH v3 3/9 dummycon: limit Arm console size hack to footbridge
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
The dummycon default console size used to be determined by architecture, but now this is a Kconfig setting on everything except ARM. Tracing this back in the historic git trees, this was used to match the size of VGA console or VGA framebuffer on early machines, but nowadays that code is no longer used, except probably on the old footbridge/netwinder since that is the only one that supports vgacon.
On machines with a framebuffer, booting with DT so far results in always using the hardcoded 80x30 size in dummycon, while on ATAGS the setting can come from a bootloader specific override. Both seem to be worse choices than the Kconfig setting, since the actual text size for fbcon also depends on the selected font.
Make this work the same way as everywhere else and use the normal Kconfig setting, except for the footbridge with vgacon, which keeps using the traditional code. If vgacon is disabled, footbridge can also ignore the setting. This means the screen_info only has to be provided when either vgacon or EFI are enabled now.
To limit the amount of surprises on Arm, change the Kconfig default to the previously used 80x30 setting instead of the usual 80x25.
--- arch/arm/kernel/atags_parse.c | 2 +- arch/arm/kernel/setup.c | 3 +-- drivers/video/console/Kconfig | 5 +++-- drivers/video/console/dummycon.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-)
arch/arm/kernel/atags_parse.c +1 -1
@@ -69,7 +69,7 @@ static int __init parse_tag_mem32(const struct tag *tag)__tagtable (ATAG_MEM , parse_tag_mem32); -#if defined(CONFIG_VGA_CONSOLE ) || defined(CONFIG_DUMMY_CONSOLE ) +#if defined(CONFIG_ARCH_FOOTBRIDGE ) && defined(CONFIG_VGA_CONSOLE )static int __init parse_tag_videotext (const struct tag *tag) { screen_info.orig_x = tag->u.videotext.x;
arch/arm/kernel/setup.c +1 -2
@@ -928,8 +928,7 @@ static void __init request_standard_resources(const struct machine_desc *mdesc)request_resource (&ioport_resource, &lp2); } -#if defined(CONFIG_VGA_CONSOLE ) || defined(CONFIG_DUMMY_CONSOLE ) || \ - defined(CONFIG_EFI ) +#if defined(CONFIG_VGA_CONSOLE ) || defined(CONFIG_EFI )struct screen_info screen_info = { .orig_video_lines =30 , .orig_video_cols = 80,
drivers/video/console/Kconfig +3 -2
@@ -52,7 +52,7 @@ config DUMMY_CONSOLE config DUMMY_CONSOLE_COLUMNS int "Initial number of console screen columns" - depends on DUMMY_CONSOLE && !ARM + depends on DUMMY_CONSOLE && !ARCH_FOOTBRIDGE default 160 if PARISC default 80 help
@@ -62,8 +62,9 @@ config DUMMY_CONSOLE_COLUMNS config DUMMY_CONSOLE_ROWS int "Initial number of console screen rows" - depends on DUMMY_CONSOLE && !ARM + depends on DUMMY_CONSOLE && !ARCH_FOOTBRIDGE default 64 if PARISC + default 30 if ARM default 25 help On PA-RISC, the default value is 64, which should fit a 1280x1024
drivers/video/console/dummycon.c +1 -1
@@ -18,7 +18,7 @@* Dummy console driver */ -#if defined(__arm__) +#if defined(CONFIG_ARCH_FOOTBRIDGE ) && defined(CONFIG_VGA_CONSOLE )#define DUMMY_COLUMNS screen_info.orig_video_cols#define DUMMY_ROWS screen_info.orig_video_lines#else
Signature · 1 line
2.39.2
PATCH v3 4/9 vgacon, arch/*: remove unused screen_info definitions
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
A number of architectures either kept the screen_info definition for historical purposes as it used to be required by the generic VT code, or they copied it from another architecture in order to build the VGA console driver in an allmodconfig build. The mips definition is used by some platforms, but the initialization on jazz is not needed.
Now that vgacon no longer builds on these architectures, remove the stale definitions and initializations.
--- arch/csky/kernel/setup.c | 12 ------------ arch/hexagon/kernel/Makefile | 2 -- arch/hexagon/kernel/screen_info.c | 3 --- arch/mips/jazz/setup.c | 9 --------- arch/nios2/kernel/setup.c | 5 ----- arch/sh/kernel/setup.c | 5 ----- arch/sparc/kernel/setup_32.c | 13 ------------- arch/sparc/kernel/setup_64.c | 13 ------------- arch/xtensa/kernel/setup.c | 12 ------------ 9 files changed, 74 deletions(-) delete mode 100644 arch/hexagon/kernel/screen_info.c
arch/csky/kernel/setup.c +0 -12
@@ -8,22 +8,10 @@#include <linux/of_fdt.h> #include <linux/start_kernel.h> #include <linux/dma-map-ops.h> -#include <linux/screen_info.h> #include <asm/sections.h> #include <asm/mmu_context.h> #include <asm/pgalloc.h> -#ifdef CONFIG_DUMMY_CONSOLE -struct screen_info screen_info = { - .orig_video_lines =30 , - .orig_video_cols =80 , - .orig_video_mode =0 , - .orig_video_ega_bx =0 , - .orig_video_isVGA =1 , - .orig_video_points =8 -}; -#endif -static void __init csky_memblock_init (void ) {unsigned long lowmem_size =PFN_DOWN (LOWMEM_LIMIT -PHYS_OFFSET_OFFSET );
arch/hexagon/kernel/Makefile +0 -2
@@ -17,5 +17,3 @@ obj-y += vm_vectors.o obj-$(CONFIG_HAS_DMA) += dma.o obj-$(CONFIG_STACKTRACE) += stacktrace.o - -obj-$(CONFIG_VGA_CONSOLE) += screen_info.o
arch/hexagon/kernel/screen_info.c deleted +0 -3
@@ -1,3 +0,0 @@ -#include <linux/screen_info.h> - -struct screen_info screen_info;
arch/mips/jazz/setup.c +0 -9
@@ -13,7 +13,6 @@#include <linux/init.h> #include <linux/ioport.h> #include <linux/console.h> -#include <linux/screen_info.h> #include <linux/platform_device.h> #include <linux/serial_8250.h> #include <linux/dma-mapping.h>
@@ -76,14 +75,6 @@ void __init plat_mem_setup(void) _machine_restart = jazz_machine_restart; -#ifdef CONFIG_VT - screen_info = (struct screen_info ) { - .orig_video_cols =160 , - .orig_video_lines =64 , - .orig_video_points =16 , - }; -#endif -add_preferred_console ("ttyS" ,0 ,"9600" ); }
arch/nios2/kernel/setup.c +0 -5
@@ -19,7 +19,6 @@#include <linux/memblock.h> #include <linux/initrd.h> #include <linux/of_fdt.h> -#include <linux/screen_info.h> #include <asm/mmu_context.h> #include <asm/sections.h>
@@ -36,10 +35,6 @@ static struct pt_regs fake_regs = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0 ,0 ,0 ,0 ,0 ,0 , 0}; -#ifdef CONFIG_VT -struct screen_info screen_info; -#endif -/* Copy a short hook instruction sequence to the exception address */ static inline void copy_exception_handler (unsigned int addr) {
arch/sh/kernel/setup.c +0 -5
@@ -7,7 +7,6 @@* Copyright (C) 1999 Niibe Yutaka * Copyright (C) 2002 - 2010 Paul Mundt */ -#include <linux/screen_info.h> #include <linux/ioport.h> #include <linux/init.h> #include <linux/initrd.h>
@@ -69,10 +68,6 @@ EXPORT_SYMBOL(cpu_data);struct sh_machine_vector sh_mv = { .mv_name ="generic" , };EXPORT_SYMBOL (sh_mv); -#ifdef CONFIG_VT -struct screen_info screen_info; -#endif -extern int root_mountflags;#define RAMDISK_IMAGE_START_MASK 0x07FF
arch/sparc/kernel/setup_32.c +0 -13
@@ -17,7 +17,6 @@#include <linux/initrd.h> #include <asm/smp.h> #include <linux/user.h> -#include <linux/screen_info.h> #include <linux/delay.h> #include <linux/fs.h> #include <linux/seq_file.h>
@@ -51,18 +50,6 @@#include "kernel.h" -struct screen_info screen_info = { -0 ,0 ,/* orig-x, orig-y */ -0 ,/* unused */ -0 ,/* orig-video-page */ -0 ,/* orig-video-mode */ -128 ,/* orig-video-cols */ -0 ,0 ,0 ,/* ega_ax, ega_bx, ega_cx */ -54 ,/* orig-video-lines */ -0 ,/* orig-video-isVGA */ -16 /* orig-video-points */ -}; -/* Typing sync at the prom prompt calls the function pointed to by * romvec->pv_synchook which I set to the following function. * This should sync all filesystems and return, for now it just
arch/sparc/kernel/setup_64.c +0 -13
@@ -15,7 +15,6 @@#include <linux/ptrace.h> #include <asm/smp.h> #include <linux/user.h> -#include <linux/screen_info.h> #include <linux/delay.h> #include <linux/fs.h> #include <linux/seq_file.h>
@@ -68,18 +67,6 @@DEFINE_SPINLOCK (ns87303_lock);EXPORT_SYMBOL (ns87303_lock); -struct screen_info screen_info = { -0 ,0 ,/* orig-x, orig-y */ -0 ,/* unused */ -0 ,/* orig-video-page */ -0 ,/* orig-video-mode */ -128 ,/* orig-video-cols */ -0 ,0 ,0 ,/* unused, ega_bx, unused */ -54 ,/* orig-video-lines */ -0 ,/* orig-video-isVGA */ -16 /* orig-video-points */ -}; -static void prom_console_write (struct console *con,const char *s,unsigned int n) {
arch/xtensa/kernel/setup.c +0 -12
@@ -19,7 +19,6 @@#include <linux/init.h> #include <linux/mm.h> #include <linux/proc_fs.h> -#include <linux/screen_info.h> #include <linux/kernel.h> #include <linux/percpu.h> #include <linux/reboot.h>
@@ -49,17 +48,6 @@#include <asm/timex.h> #include <asm/traps.h> -#if defined(CONFIG_VGA_CONSOLE ) || defined(CONFIG_DUMMY_CONSOLE ) -struct screen_info screen_info = { - .orig_x =0 , - .orig_y =24 , - .orig_video_cols =80 , - .orig_video_lines =24 , - .orig_video_isVGA =1 , - .orig_video_points =16 , -}; -#endif -#ifdef CONFIG_BLK_DEV_INITRD extern unsigned long initrd_start;extern unsigned long initrd_end;
Signature · 1 line
2.39.2
PATCH v3 5/9 vgacon: remove screen_info dependency
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
The vga console driver is fairly self-contained, and only used by architectures that explicitly initialize the screen_info settings.
Chance every instance that picks the vga console by setting conswitchp to call a function instead, and pass a reference to the screen_info there.
--- arch/alpha/kernel/setup.c | 2 +- arch/arm/kernel/setup.c | 2 +- arch/ia64/kernel/setup.c | 2 +- arch/mips/kernel/setup.c | 2 +- arch/x86/kernel/setup.c | 2 +- drivers/firmware/pcdp.c | 2 +- drivers/video/console/vgacon.c | 68 ++++++++++++++++++++-------------- include/linux/console.h | 7 ++++ 8 files changed, 53 insertions(+), 34 deletions(-)
arch/alpha/kernel/setup.c +1 -1
@@ -654,7 +654,7 @@ setup_arch(char **cmdline_p)#ifdef CONFIG_VT #if defined(CONFIG_VGA_CONSOLE ) - conswitchp = &vga_con; +vgacon_register_screen (&screen_info);#endif #endif
arch/arm/kernel/setup.c +1 -1
@@ -1197,7 +1197,7 @@ void __init setup_arch(char **cmdline_p)#ifdef CONFIG_VT #if defined(CONFIG_VGA_CONSOLE ) - conswitchp = &vga_con; +vgacon_register_screen (&screen_info);#endif #endif
arch/ia64/kernel/setup.c +1 -1
@@ -619,7 +619,7 @@ setup_arch (char **cmdline_p)* memory so we can avoid this problem. */ if (efi_mem_type (0xA0000 ) !=EFI_CONVENTIONAL_MEMORY ) - conswitchp = &vga_con; +vgacon_register_screen (&screen_info); # endif }#endif
arch/mips/kernel/setup.c +1 -1
@@ -795,7 +795,7 @@ void __init setup_arch(char **cmdline_p)#if defined(CONFIG_VT )#if defined(CONFIG_VGA_CONSOLE ) - conswitchp = &vga_con; +vgacon_register_screen (&screen_info);#endif #endif
arch/x86/kernel/setup.c +1 -1
@@ -1168,7 +1168,7 @@ void __init setup_arch(char **cmdline_p)#ifdef CONFIG_VT #if defined(CONFIG_VGA_CONSOLE )if (!efi_enabled (EFI_BOOT ) || (efi_mem_type (0xa0000 ) !=EFI_CONVENTIONAL_MEMORY )) - conswitchp = &vga_con; +vgacon_register_screen (&screen_info);#endif #endif x86_init.oem.banner ();
drivers/firmware/pcdp.c +1 -1
@@ -72,7 +72,7 @@ setup_vga_console(struct pcdp_device *dev) return -ENODEV; } - conswitchp = &vga_con; +vgacon_register_screen (&screen_info);printk (KERN_INFO "PCDP: VGA console\n" );return 0 ;#else
drivers/video/console/vgacon.c +40 -28
155 lines not on this page · raw message
include/linux/console.h +7 -0
@@ -101,6 +101,13 @@ extern const struct consw dummy_con; /* dummy console buffer */extern const struct consw vga_con;/* VGA text console */ extern const struct consw newport_con;/* SGI Newport console */ +struct screen_info ; +#ifdef CONFIG_VGA_CONSOLE +void vgacon_register_screen (struct screen_info *si); +#else +static inline void vgacon_register_screen (struct screen_info *si) { } +#endif +int con_is_bound (const struct consw *csw);int do_unregister_con_driver (const struct consw *csw);int do_take_over_console (const struct consw *sw,int first,int last,int deflt);
Signature · 1 line
2.39.2
PATCH v3 6/9 vgacon: clean up global screen_info instances
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
To prepare for completely separating the VGA console screen_info from the one used in EFI/sysfb, rename the vgacon instances and make them local as much as possible.
ia64 and arm both have confurations with vgacon and efi, but the contents never overlaps because ia64 has no EFI framebuffer, and arm only has vga console on legacy platforms without EFI. Renaming these is required before the EFI screen_info can be moved into drivers/firmware.
The ia64 vga console is actually registered in two places from setup_arch(), but one of them is wrong, so drop the one in pcdp.c and fix the one in setup.c to use the correct conditional.
x86 has to keep them together, as the boot protocol is used to switch between VGA text console and framebuffer through the screen_info data.
--- arch/alpha/kernel/proto.h | 2 ++ arch/alpha/kernel/setup.c | 6 ++-- arch/alpha/kernel/sys_sio.c | 6 ++-- arch/arm/include/asm/setup.h | 5 ++++ arch/arm/kernel/atags_parse.c | 18 ++++++------ arch/arm/kernel/efi.c | 6 ---- arch/arm/kernel/setup.c | 6 ++-- arch/ia64/kernel/setup.c | 49 +++++++++++++++---------------- arch/mips/kernel/setup.c | 11 ------- arch/mips/mti-malta/malta-setup.c | 4 ++- arch/mips/sibyte/swarm/setup.c | 24 ++++++++------- arch/mips/sni/setup.c | 16 +++++----- drivers/firmware/pcdp.c | 1 - 13 files changed, 74 insertions(+), 80 deletions(-)
arch/alpha/kernel/proto.h +2 -0
@@ -1,5 +1,6 @@/* SPDX-License-Identifier: GPL-2.0 */ #include <linux/interrupt.h> +#include <linux/screen_info.h> #include <linux/io.h> /* Prototypes of functions used across modules here in this directory. */
@@ -113,6 +114,7 @@ extern int boot_cpuid;#ifdef CONFIG_VERBOSE_MCHECK extern unsigned long alpha_verbose_mcheck;#endif +extern struct screen_info vgacon_screen_info;/* srmcons.c */ #if defined(CONFIG_ALPHA_GENERIC ) || defined(CONFIG_ALPHA_SRM )
arch/alpha/kernel/setup.c +2 -4
@@ -138,7 +138,7 @@ static char __initdata command_line[COMMAND_LINE_SIZE];* code think we're on a VGA color display. */ -struct screen_info screen_info = { +struct screen_info vgacon_screen_info = { .orig_x =0 , .orig_y =25 , .orig_video_cols =80 ,
@@ -146,8 +146,6 @@ struct screen_info screen_info = { .orig_video_isVGA = 1, .orig_video_points =16 }; - -EXPORT_SYMBOL (screen_info);#endif /*
@@ -654,7 +652,7 @@ setup_arch(char **cmdline_p)#ifdef CONFIG_VT #if defined(CONFIG_VGA_CONSOLE ) -vgacon_register_screen (&screen_info); +vgacon_register_screen (&vgacon_screen_info);#endif #endif
arch/alpha/kernel/sys_sio.c +3 -3
@@ -60,9 +60,9 @@ alphabook1_init_arch(void)#ifdef CONFIG_VGA_CONSOLE /* The AlphaBook1 has LCD video fixed at 800x600, 37 rows and 100 cols. */ - screen_info.orig_y =37 ; - screen_info.orig_video_cols =100 ; - screen_info.orig_video_lines =37 ; + vgacon_screen_info.orig_y =37 ; + vgacon_screen_info.orig_video_cols =100 ; + vgacon_screen_info.orig_video_lines =37 ;#endif lca_init_arch ();
arch/arm/include/asm/setup.h +5 -0
@@ -11,6 +11,7 @@#ifndef __ASMARM_SETUP_H#define __ASMARM_SETUP_H +#include <linux/screen_info.h> #include <uapi/asm/setup.h>
@@ -35,4 +36,8 @@ void early_mm_init(const struct machine_desc *);void adjust_lowmem_bounds (void );void setup_dma_zone (const struct machine_desc *desc); +#ifdef CONFIG_VGA_CONSOLE +extern struct screen_info vgacon_screen_info; +#endif +#endif
arch/arm/kernel/atags_parse.c +9 -9
@@ -72,15 +72,15 @@ __tagtable(ATAG_MEM, parse_tag_mem32);#if defined(CONFIG_ARCH_FOOTBRIDGE ) && defined(CONFIG_VGA_CONSOLE )static int __init parse_tag_videotext (const struct tag *tag) { - screen_info.orig_x = tag->u.videotext.x; - screen_info.orig_y = tag->u.videotext.y; - screen_info.orig_video_page = tag->u.videotext.video_page; - screen_info.orig_video_mode = tag->u.videotext.video_mode; - screen_info.orig_video_cols = tag->u.videotext.video_cols; - screen_info.orig_video_ega_bx = tag->u.videotext.video_ega_bx; - screen_info.orig_video_lines = tag->u.videotext.video_lines; - screen_info.orig_video_isVGA = tag->u.videotext.video_isvga; - screen_info.orig_video_points = tag->u.videotext.video_points; + vgacon_screen_info.orig_x = tag->u.videotext.x; + vgacon_screen_info.orig_y = tag->u.videotext.y; + vgacon_screen_info.orig_video_page = tag->u.videotext.video_page; + vgacon_screen_info.orig_video_mode = tag->u.videotext.video_mode; + vgacon_screen_info.orig_video_cols = tag->u.videotext.video_cols; + vgacon_screen_info.orig_video_ega_bx = tag->u.videotext.video_ega_bx; + vgacon_screen_info.orig_video_lines = tag->u.videotext.video_lines; + vgacon_screen_info.orig_video_isVGA = tag->u.videotext.video_isvga; + vgacon_screen_info.orig_video_points = tag->u.videotext.video_points;return 0 ; }
arch/arm/kernel/efi.c +0 -6
@@ -123,12 +123,6 @@ void __init arm_efi_init(void) {efi_init (); -if (screen_info.orig_video_isVGA ==VIDEO_TYPE_EFI ) { -/* dummycon on ARM needs non-zero values for columns/lines */ - screen_info.orig_video_cols =80 ; - screen_info.orig_video_lines =25 ; - } -/* ARM does not permit early mappings to persist across paging_init() */ efi_memmap_unmap ();
arch/arm/kernel/setup.c +3 -3
@@ -928,8 +928,8 @@ static void __init request_standard_resources(const struct machine_desc *mdesc)request_resource (&ioport_resource, &lp2); } -#if defined(CONFIG_VGA_CONSOLE ) || defined(CONFIG_EFI ) -struct screen_info screen_info = { +#if defined(CONFIG_VGA_CONSOLE ) +static struct screen_info vgacon_screen_info = { .orig_video_lines =30 , .orig_video_cols =80 , .orig_video_mode = 0,
@@ -1197,7 +1197,7 @@ void __init setup_arch(char **cmdline_p)#ifdef CONFIG_VT #if defined(CONFIG_VGA_CONSOLE ) -vgacon_register_screen (&screen_info); +vgacon_register_screen (&vgacon_screen_info);#endif #endif
arch/ia64/kernel/setup.c +24 -25
74 lines not on this page · raw message
arch/mips/kernel/setup.c +0 -11
@@ -15,7 +15,6 @@#include <linux/delay.h> #include <linux/ioport.h> #include <linux/export.h> -#include <linux/screen_info.h> #include <linux/memblock.h> #include <linux/initrd.h> #include <linux/root_dev.h>
@@ -54,10 +53,6 @@ struct cpuinfo_mips cpu_data[NR_CPUS] __read_mostly;EXPORT_SYMBOL (cpu_data); -#ifdef CONFIG_VGA_CONSOLE -struct screen_info screen_info; -#endif -/* * Setup information *
@@ -793,12 +788,6 @@ void __init setup_arch(char **cmdline_p)if (IS_ENABLED (CONFIG_CPU_R4X00_BUGS64 ))check_bugs64_early (); -#if defined(CONFIG_VT ) -#if defined(CONFIG_VGA_CONSOLE ) -vgacon_register_screen (&screen_info); -#endif -#endif -arch_mem_init (cmdline_p);dmi_setup ();
arch/mips/mti-malta/malta-setup.c +3 -1
@@ -161,7 +161,7 @@ static void __init pci_clock_check(void) #if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE) static void __init screen_info_setup(void) { - screen_info = (struct screen_info) { + static struct screen_info si = { .orig_x = 0, .orig_y = 25, .ext_mem_k = 0,
@@ -175,6 +175,8 @@ static void __init screen_info_setup(void) .orig_video_isVGA = VIDEO_TYPE_VGAC, .orig_video_points =16 }; + +vgacon_register_screen (&si); }#endif
arch/mips/sibyte/swarm/setup.c +14 -10
@@ -112,6 +112,19 @@ int update_persistent_clock64(struct timespec64 now) } } +#ifdef CONFIG_VGA_CONSOLE +static struct screen_info vgacon_screen_info = { + .orig_video_page =52 , + .orig_video_mode =3 , + .orig_video_cols =80 , + .flags =12 , + .orig_video_ega_bx =3 , + .orig_video_lines =25 , + .orig_video_isVGA =0x22 , + .orig_video_points =16 , +}; +#endif +void __init plat_mem_setup (void ) {#ifdef CONFIG_SIBYTE_BCM1x80
@@ -130,16 +143,7 @@ void __init plat_mem_setup(void) swarm_rtc_type =RTC_M41T81 ;#ifdef CONFIG_VGA_CONSOLE - screen_info = (struct screen_info ) { - .orig_video_page =52 , - .orig_video_mode =3 , - .orig_video_cols =80 , - .flags =12 , - .orig_video_ega_bx =3 , - .orig_video_lines =25 , - .orig_video_isVGA =0x22 , - .orig_video_points =16 , - }; +vgacon_register_screen (&vgacon_screen_info);/* XXXKW for CFE, get lines/cols from environment */ #endif }
arch/mips/sni/setup.c +9 -7
@@ -39,18 +39,20 @@ extern void sni_machine_power_off(void);static void __init sni_display_setup (void ) {#if defined(CONFIG_VGA_CONSOLE ) && defined(CONFIG_FW_ARC ) -struct screen_info *si = &screen_info; +static struct screen_info si;DISPLAY_STATUS *di; di =ArcGetDisplayStatus (1 );if (di) { - si->orig_x = di->CursorXPosition; - si->orig_y = di->CursorYPosition; - si->orig_video_cols = di->CursorMaxXPosition; - si->orig_video_lines = di->CursorMaxYPosition; - si->orig_video_isVGA =VIDEO_TYPE_VGAC ; - si->orig_video_points =16 ; + si.orig_x = di->CursorXPosition; + si.orig_y = di->CursorYPosition; + si.orig_video_cols = di->CursorMaxXPosition; + si.orig_video_lines = di->CursorMaxYPosition; + si.orig_video_isVGA =VIDEO_TYPE_VGAC ; + si.orig_video_points =16 ; + +vgacon_register_screen (&si); }#endif }
drivers/firmware/pcdp.c +0 -1
@@ -72,7 +72,6 @@ setup_vga_console(struct pcdp_device *dev) return -ENODEV; } -vgacon_register_screen (&screen_info);printk (KERN_INFO "PCDP: VGA console\n" );return 0 ;#else
Signature · 1 line
2.39.2
PATCH v3 7/9 vga16fb: drop powerpc support
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
I noticed that commit 0db5b61e0dc07 ("fbdev/vga16fb: Create EGA/VGA devices in sysfb code") broke vga16fb on non-x86 platforms, because the sysfb code never creates a vga-framebuffer device when screen_info.orig_video_isVGA is set to '1' instead of VIDEO_TYPE_VGAC.
However, it turns out that the only architecture that has allowed building vga16fb in the past 20 years is powerpc, and this only worked on two 32-bit platforms and never on 64-bit powerpc. The last machine that actually used this was removed in linux-3.10, so this is all dead code and can be removed.
The big-endian support in vga16fb.c could also be removed, but I'd just leave this in place.
--- arch/powerpc/kernel/setup-common.c | 16 ---------------- drivers/video/fbdev/Kconfig | 2 +- drivers/video/fbdev/vga16fb.c | 9 +-------- 3 files changed, 2 insertions(+), 25 deletions(-)
arch/powerpc/kernel/setup-common.c +0 -16
@@ -22,7 +22,6 @@#include <linux/seq_file.h> #include <linux/ioport.h> #include <linux/console.h> -#include <linux/screen_info.h> #include <linux/root_dev.h> #include <linux/cpu.h> #include <linux/unistd.h>
@@ -98,21 +97,6 @@ int boot_cpu_hwid = -1;int dcache_bsize;int icache_bsize; -/* -* This still seems to be needed... -- paulus -*/ -struct screen_info screen_info = { - .orig_x =0 , - .orig_y =25 , - .orig_video_cols =80 , - .orig_video_lines =25 , - .orig_video_isVGA =1 , - .orig_video_points =16 -}; -#if defined(CONFIG_FB_VGA16_MODULE ) -EXPORT_SYMBOL (screen_info); -#endif -/* Variables required to store legacy IO irq routing */ int of_i8042_kbd_irq;EXPORT_SYMBOL_GPL (of_i8042_kbd_irq);
drivers/video/fbdev/Kconfig +1 -1
@@ -364,7 +364,7 @@ config FB_IMSTT config FB_VGA16 tristate "VGA 16-color graphics support" - depends on FB && (X86 || PPC) + depends on FB && X86 select APERTURE_HELPERS select FB_CFB_FILLRECT select FB_CFB_COPYAREA
drivers/video/fbdev/vga16fb.c +1 -8
@@ -185,8 +185,6 @@ static inline void setindex(int index)/* Check if the video mode is supported by the driver */ static inline int check_mode_supported (const struct screen_info *si) { -/* non-x86 architectures treat orig_video_isVGA as a boolean flag */ -#if defined(CONFIG_X86 )/* only EGA and VGA in 16 color graphic mode are supported */ if (si->orig_video_isVGA !=VIDEO_TYPE_EGAC && si->orig_video_isVGA !=VIDEO_TYPE_VGAC )
@@ -197,7 +195,7 @@ static inline int check_mode_supported(const struct screen_info *si) si->orig_video_mode !=0x10 &&/* 640x350/4 (EGA) */ si->orig_video_mode != 0x12) /* 640x480/4 (VGA) */ return -ENODEV; -#endif +return 0 ; }
@@ -1338,12 +1336,7 @@ static int vga16fb_probe(struct platform_device *dev)printk (KERN_INFO "vga16fb: mapped to 0x%p\n" , info->screen_base); par = info->par; -#if defined(CONFIG_X86 ) par->isVGA = si->orig_video_isVGA ==VIDEO_TYPE_VGAC ; -#else -/* non-x86 architectures treat orig_video_isVGA as a boolean flag */ - par->isVGA = si->orig_video_isVGA; -#endif par->palette_blanked =0 ; par->vesa_blanked =0 ;
Signature · 1 line
2.39.2
PATCH v3 8/9 hyperv: avoid dependency on screen_info
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
The two hyperv framebuffer drivers (hyperv_fb or hyperv_drm_drv) access the global screen_info in order to take over from the sysfb framebuffer, which in turn could be handled by simplefb, simpledrm or efifb. Similarly, the vmbus_drv code marks the original EFI framebuffer as reserved, but this is not required if there is no sysfb.
As a preparation for making screen_info itself more local to the sysfb helper code, add a compile-time conditional in all three files that relate to hyperv fb and just skip this code if there is no sysfb that needs to be unregistered.
--- drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 7 ++++--- drivers/hv/vmbus_drv.c | 6 ++++-- drivers/video/fbdev/hyperv_fb.c | 8 ++++---- 3 files changed, 12 insertions(+), 9 deletions(-)
drivers/gpu/drm/hyperv/hyperv_drm_drv.c +4 -3
@@ -73,9 +73,10 @@ static int hyperv_setup_vram(struct hyperv_drm_device *hv,struct drm_device *dev = &hv->dev;int ret; -drm_aperture_remove_conflicting_framebuffers (screen_info.lfb_base, - screen_info.lfb_size, - &hyperv_driver); +if (IS_ENABLED (CONFIG_SYSFB )) +drm_aperture_remove_conflicting_framebuffers (screen_info.lfb_base, + screen_info.lfb_size, + &hyperv_driver); hv->fb_size = (unsigned long )hv->mmio_megabytes *1024 *1024 ;
drivers/hv/vmbus_drv.c +4 -2
@@ -2100,8 +2100,10 @@ static void __maybe_unused vmbus_reserve_fb(void)if (efi_enabled (EFI_BOOT )) {/* Gen2 VM: get FB base from EFI framebuffer */ - start = screen_info.lfb_base; - size =max_t (__u32, screen_info.lfb_size,0x800000 ); +if (IS_ENABLED (CONFIG_SYSFB )) { + start = screen_info.lfb_base; + size =max_t (__u32, screen_info.lfb_size,0x800000 ); + } }else {/* Gen1 VM: get FB base from PCI */ pdev = pci_get_device(PCI_VENDOR_ID_MICROSOFT,
drivers/video/fbdev/hyperv_fb.c +4 -4
@@ -1010,7 +1010,7 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info) goto getmem_done; }pr_info ("Unable to allocate enough contiguous physical memory on Gen 1 VM. Using MMIO instead.\n" ); - }else { + }else if (IS_ENABLED (CONFIG_SYSFB )) { base = screen_info.lfb_base; size = screen_info.lfb_size; }
@@ -1056,13 +1056,13 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info) getmem_done:aperture_remove_conflicting_devices (base, size,KBUILD_MODNAME ); -if (gen2vm) { +if (!gen2vm) { +pci_dev_put (pdev); + }else if (IS_ENABLED (CONFIG_SYSFB )) {/* framebuffer is reallocated, clear screen_info to avoid misuse from kexec */ screen_info.lfb_size =0 ; screen_info.lfb_base =0 ; screen_info.orig_video_isVGA =0 ; - }else { -pci_dev_put (pdev); }return 0 ;
Signature · 1 line
2.39.2
PATCH v3 9/9 efi: move screen_info into efi init code
In reply to Arnd BergmannFrom: Arnd Bergmann <[email protected]>
After the vga console no longer relies on global screen_info, there are only two remaining use cases:
- on the x86 architecture, it is used for multiple boot methods (bzImage, EFI, Xen, kexec) to commucate the initial VGA or framebuffer settings to a number of device drivers.
- on other architectures, it is only used as part of the EFI stub, and only for the three sysfb framebuffers (simpledrm, simplefb, efifb).
Remove the duplicate data structure definitions by moving it into the efi-init.c file that sets it up initially for the EFI case, leaving x86 as an exception that retains its own definition for non-EFI boots.
The added #ifdefs here are optional, I added them to further limit the reach of screen_info to configurations that have at least one of the users enabled.
--- arch/arm/kernel/setup.c | 4 ---- arch/arm64/kernel/efi.c | 4 ---- arch/arm64/kernel/image-vars.h | 2 ++ arch/loongarch/kernel/efi.c | 3 ++- arch/loongarch/kernel/image-vars.h | 2 ++ arch/loongarch/kernel/setup.c | 5 ----- arch/riscv/kernel/image-vars.h | 2 ++ arch/riscv/kernel/setup.c | 5 ----- drivers/firmware/efi/efi-init.c | 14 +++++++++++++- drivers/firmware/efi/libstub/efi-stub-entry.c | 8 +++++++- 10 files changed, 28 insertions(+), 21 deletions(-)
arch/arm/kernel/setup.c +0 -4
@@ -939,10 +939,6 @@ static struct screen_info vgacon_screen_info = { };#endif -#if defined(CONFIG_EFI ) -struct screen_info screen_info; -#endif -static int __init customize_machine (void ) {/*
arch/arm64/kernel/efi.c +0 -4
@@ -71,10 +71,6 @@ static __init pteval_t create_mapping_protection(efi_memory_desc_t *md)return pgprot_val (PAGE_KERNEL_EXEC ); } -/* we will fill this structure from the stub, so don't put it in .bss */ -struct screen_info screen_info __section(".data"); -EXPORT_SYMBOL (screen_info); -int __init efi_create_mapping (struct mm_struct *mm,efi_memory_desc_t *md) {pteval_t prot_val =create_mapping_protection (md);
arch/arm64/kernel/image-vars.h +2 -0
@@ -27,7 +27,9 @@ PROVIDE(__efistub__text = _text);PROVIDE (__efistub__end = _end);PROVIDE (__efistub___inittext_end = __inittext_end);PROVIDE (__efistub__edata = _edata); +#if defined(CONFIG_EFI_EARLYCON ) || defined(CONFIG_SYSFB )PROVIDE (__efistub_screen_info = screen_info); +#endif PROVIDE (__efistub__ctype = _ctype);PROVIDE (__pi___memcpy = __pi_memcpy);
arch/loongarch/kernel/efi.c +2 -1
@@ -115,7 +115,8 @@ void __init efi_init(void)set_bit (EFI_CONFIG_TABLES , &efi.flags); -init_screen_info (); +if (IS_ENABLED (CONFIG_EFI_EARLYCON ) ||IS_ENABLED (CONFIG_SYSFB )) +init_screen_info ();if (boot_memmap ==EFI_INVALID_TABLE_ADDR )return ;
arch/loongarch/kernel/image-vars.h +2 -0
@@ -12,7 +12,9 @@ __efistub_kernel_entry = kernel_entry; __efistub_kernel_asize = kernel_asize; __efistub_kernel_fsize = kernel_fsize; __efistub_kernel_offset = kernel_offset; +#if defined(CONFIG_EFI_EARLYCON ) || defined(CONFIG_SYSFB ) __efistub_screen_info = screen_info; +#endif #endif
arch/loongarch/kernel/setup.c +0 -5
@@ -16,7 +16,6 @@#include <linux/dmi.h> #include <linux/efi.h> #include <linux/export.h> -#include <linux/screen_info.h> #include <linux/memblock.h> #include <linux/initrd.h> #include <linux/ioport.h>
@@ -57,10 +56,6 @@#define SMBIOS_CORE_PACKAGE_OFFSET 0x23#define LOONGSON_EFI_ENABLE (1 << 3) -#ifdef CONFIG_EFI -struct screen_info screen_info __section(".data"); -#endif -unsigned long fw_arg0, fw_arg1, fw_arg2; DEFINE_PER_CPU(unsigned long, kernelsp);struct cpuinfo_loongarch cpu_data[NR_CPUS ]__read_mostly ;
arch/riscv/kernel/image-vars.h +2 -0
@@ -28,7 +28,9 @@ __efistub__start_kernel = _start_kernel; __efistub__end = _end; __efistub__edata = _edata; __efistub___init_text_end = __init_text_end; +#if defined(CONFIG_EFI_EARLYCON ) || defined(CONFIG_SYSFB ) __efistub_screen_info = screen_info; +#endif #endif
arch/riscv/kernel/setup.c +0 -5
@@ -15,7 +15,6 @@#include <linux/memblock.h> #include <linux/sched.h> #include <linux/console.h> -#include <linux/screen_info.h> #include <linux/of_fdt.h> #include <linux/sched/task.h> #include <linux/smp.h>
@@ -40,10 +39,6 @@#include "head.h" -#if defined(CONFIG_EFI ) -struct screen_info screen_info __section(".data"); -#endif -/* * The lucky hart to first increment this variable will boot the other cores. * This is used before the kernel initializes the BSS so it can't be in the
drivers/firmware/efi/efi-init.c +13 -1
@@ -55,6 +55,15 @@ static phys_addr_t __init efi_to_phys(unsigned long addr)extern __weak const efi_config_table_type_t efi_arch_tables[]; +/* +* x86 defines its own screen_info and uses it even without EFI, +* everything else can get it from here. +*/ +#if !defined(CONFIG_X86 ) && (defined(CONFIG_SYSFB ) || defined(CONFIG_EFI_EARLYCON )) +struct screen_info screen_info __section(".data"); +EXPORT_SYMBOL_GPL (screen_info); +#endif +static void __init init_screen_info (void ) {struct screen_info *si;
@@ -240,5 +249,8 @@ void __init efi_init(void)memblock_reserve (data.phys_map &PAGE_MASK ,PAGE_ALIGN (data.size + (data.phys_map & ~PAGE_MASK ))); -init_screen_info (); +if (IS_ENABLED (CONFIG_X86 ) || +IS_ENABLED (CONFIG_SYSFB ) || +IS_ENABLED (CONFIG_EFI_EARLYCON )) +init_screen_info (); }
drivers/firmware/efi/libstub/efi-stub-entry.c +7 -1
@@ -13,7 +13,13 @@ struct screen_info *alloc_screen_info(void) {if (IS_ENABLED (CONFIG_ARM ))return __alloc_screen_info (); -return (void *)&screen_info + screen_info_offset; + +if (IS_ENABLED (CONFIG_X86 ) || +IS_ENABLED (CONFIG_EFI_EARLYCON ) || +IS_ENABLED (CONFIG_SYSFB )) +return (void *)&screen_info + screen_info_offset; + +return NULL ; }/*
Signature · 1 line
2.39.2
Re: [PATCH v3 9/9] efi: move screen_info into efi init code
Quoted 20 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
After the vga console no longer relies on global
screen_info, there are only two remaining use cases:- on the x86 architecture, it is used for multiple boot methods (bzImage, EFI, Xen, kexec) to commucate the initial VGA or framebuffer settings to a number of device drivers.
- on other architectures, it is only used as part of the EFI stub, and only for the three sysfb framebuffers (simpledrm, simplefb, efifb).
Remove the duplicate data structure definitions by moving it into the
efi-init.cfile that sets it up initially for the EFI case, leaving x86 as an exception that retains its own definition for non-EFI boots.The added #ifdefs here are optional, I added them to further limit the reach of
screen_infoto configurations that have at least one of the users enabled.
Quoted 8 lines
Reviewed-by Ard Biesheuvel <[email protected]>Reviewed-by Javier Martinez Canillas <[email protected]>Acked-by Helge Deller <[email protected]>Signed-off-by Arnd Bergmann <[email protected]>--- arch/arm/kernel/setup.c | 4 ---- arch/arm64/kernel/efi.c | 4 ---- arch/arm64/kernel/image-vars.h | 2 ++
It's more Ard's thing and he reviewed it already but if you need another ack:
Quoted 22 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
v3 changelog
No real changes, just rebased for context changes, and picked up the Acks.
This now conflicts with the ia64 removal and introduces one new dependency on IA64, but that is harmless and trivial to deal with later.
---
v2 changelogI refreshed the first four patches that I sent before with very minor updates, and then added some more to further disaggregate the use of
screen_info:- I found that powerpc wasn't using vga16fb any more
- vgacon can be almost entirely separated from the global
screen_info, except on x86
Quoted 7 lines
- similarly, the EFI framebuffer initialization can be kept separate, except on x86.
I did extensive build testing on arm/arm64/x86 and the normal built bot testing for the other architectures.
Which tree should this get merged through?
I guess if no one else volunteers (Greg maybe?) I can stuff this into drm-misc ...
-Sima
Quoted 116 lines
Arnd Bergmann (9):
vgacon: reworkKconfigdependencies
vgacon: reworkscreen_info#ifdef checks
dummycon: limit Arm console size hack to footbridge vgacon,arch/*: remove unusedscreen_infodefinitions
vgacon: removescreen_infodependency
vgacon: clean up globalscreen_infoinstances
vga16fb: drop powerpc support
hyperv: avoid dependency onscreen_info
efi: movescreen_infointo efi init codearch/alpha/kernel/proto.h | 2 + arch/alpha/kernel/setup.c | 8 +-- arch/alpha/kernel/sys_sio.c | 8 ++- arch/arm/include/asm/setup.h | 5 ++ arch/arm/kernel/atags_parse.c | 20 +++--- arch/arm/kernel/efi.c | 6 -- arch/arm/kernel/setup.c | 11 +-- arch/arm64/kernel/efi.c | 4 -- arch/arm64/kernel/image-vars.h | 2 + arch/csky/kernel/setup.c | 12 ---- arch/hexagon/kernel/Makefile | 2 - arch/hexagon/kernel/screen_info.c | 3 - arch/ia64/kernel/setup.c | 53 ++++++++------- arch/loongarch/kernel/efi.c | 3 +- arch/loongarch/kernel/image-vars.h | 2 + arch/loongarch/kernel/setup.c | 3 - arch/mips/jazz/setup.c | 9 --- arch/mips/kernel/setup.c | 11 --- arch/mips/mti-malta/malta-setup.c | 4 +- arch/mips/sibyte/swarm/setup.c | 26 ++++--- arch/mips/sni/setup.c | 18 ++--- arch/nios2/kernel/setup.c | 5 -- arch/powerpc/kernel/setup-common.c | 16 ----- arch/riscv/kernel/image-vars.h | 2 + arch/riscv/kernel/setup.c | 12 ---- arch/sh/kernel/setup.c | 5 -- arch/sparc/kernel/setup_32.c | 13 ---- arch/sparc/kernel/setup_64.c | 13 ---- arch/x86/kernel/setup.c | 2 +- arch/xtensa/kernel/setup.c | 12 ---- drivers/firmware/efi/efi-init.c | 14 +++- drivers/firmware/efi/libstub/efi-stub-entry.c | 8 ++- drivers/firmware/pcdp.c | 1 - drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 7 +- drivers/hv/vmbus_drv.c | 6 +- drivers/video/console/Kconfig | 11 +-- drivers/video/console/dummycon.c | 2 +- drivers/video/console/vgacon.c | 68 +++++++++++-------- drivers/video/fbdev/Kconfig | 2 +- drivers/video/fbdev/hyperv_fb.c | 8 +-- drivers/video/fbdev/vga16fb.c | 9 +-- include/linux/console.h | 7 ++ 42 files changed, 183 insertions(+), 252 deletions(-) delete mode 100644 arch/hexagon/kernel/screen_info.cSignature · 54 lines
2.39.2 Cc: "David S. Miller" <[email protected]> Cc: "K. Y. Srinivasan" <[email protected]> Cc: Ard Biesheuvel <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Brian Cain <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Christophe Leroy <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: Dave Hansen <[email protected]> Cc: David Airlie <[email protected]> Cc: Deepak Rawat <[email protected]> Cc: Dexuan Cui <[email protected]> Cc: Dinh Nguyen <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Guo Ren <[email protected]> Cc: Haiyang Zhang <[email protected]> Cc: Helge Deller <[email protected]> Cc: Huacai Chen <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Javier Martinez Canillas <[email protected]> Cc: John Paul Adrian Glaubitz <[email protected]> Cc: Khalid Aziz <[email protected]> Cc: Linus Walleij <[email protected]> Cc: Matt Turner <[email protected]> Cc: Max Filippov <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Nicholas Piggin <[email protected]> Cc: Palmer Dabbelt <[email protected]> Cc: Russell King <[email protected]> Cc: Thomas Bogendoerfer <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Thomas Zimmermann <[email protected]> Cc: WANG Xuerui <[email protected]> Cc: Wei Liu <[email protected]> Cc: Will Deacon <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected]
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Greg Kroah-Hartman
maintainerQuoted 26 lines · Daniel Vetter
Quoted 25 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
v3 changelog
No real changes, just rebased for context changes, and picked up the Acks.
This now conflicts with the ia64 removal and introduces one new dependency on IA64, but that is harmless and trivial to deal with later.
---
v2 changelogI refreshed the first four patches that I sent before with very minor updates, and then added some more to further disaggregate the use of
screen_info:- I found that powerpc wasn't using vga16fb any more
- vgacon can be almost entirely separated from the global
screen_info, except on x86- similarly, the EFI framebuffer initialization can be kept separate, except on x86.
Quoted 7 lines
Quoted 4 lines
I did extensive build testing on arm/arm64/x86 and the normal built bot testing for the other architectures.
Which tree should this get merged through?
I guess if no one else volunteers (Greg maybe?) I can stuff this into drm-misc ...
Oh, hey, console code is for me, I keep forgetting.
I can take it, looks like we have enough acks now, thanks for reminding me!
greg k-h