vgacon: prevent vgacon from reloading
Subsystems (2)
PATCH 1/1 vgacon: prevent vgacon from reloading
If vgacon got unloaded for any reason, we can never be sure that vga registers are still accessible. fbdev/DRM/xycon might reconfigure graphics devices in a way that prevents vgacon from working again. Therefore, inhibit rebinding vgacon.
Note that this _might_ break use-cases where users unbind vgacon and then rebind it without breaking VGA mode. However, this seems to be rarely useful and given that several GPUs cannot even restore VGA mode it seems safer to prevent it entirely.
This also adds a dependency to dummy_con as the VT layer does not allow failure during console-rebinding. Hence, we need a guarantee that dummy_con is available.
To avoid recursive Kconfig dependencies, we move the vga-con/sgi-con conflict directly into VGA_CONSOLE and make DUMMY_CONSOLE always active.
--- drivers/video/console/Kconfig | 2 +- drivers/video/console/vgacon.c | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-)
drivers/video/console/Kconfig +1 -1
@@ -8,6 +8,7 @@ config VGA_CONSOLE bool "VGA text console" if EXPERT || !X86 depends on !4xx && !8xx && !SPARC && !M68K && !PARISC && !FRV && \ !SUPERH && !BLACKFIN && !AVR32 && !MN10300 && !CRIS && \ + SGI_NEWPORT_CONSOLE!=y && DUMMY_CONSOLE && \ (!ARM || ARCH_FOOTBRIDGE || ARCH_INTEGRATOR || ARCH_NETWINDER) default y help
@@ -71,7 +72,6 @@ config SGI_NEWPORT_CONSOLE config DUMMY_CONSOLE bool - depends on VGA_CONSOLE!=y || SGI_NEWPORT_CONSOLE!=y default y config DUMMY_CONSOLE_COLUMNS
drivers/video/console/vgacon.c +6 -4
@@ -368,6 +368,7 @@ static int vgacon_scrolldelta(struct vc_data *c, int lines)static const char *vgacon_startup (void ) { +static bool vgacon_inhibit;const char *display_desc =NULL ;u16 saved1, saved2;volatile u16 *p;
@@ -375,14 +376,15 @@ static const char *vgacon_startup(void)if (screen_info.orig_video_isVGA ==VIDEO_TYPE_VLFB || screen_info.orig_video_isVGA ==VIDEO_TYPE_EFI ) { no_vga: -#ifdef CONFIG_DUMMY_CONSOLE conswitchp = &dummy_con;return conswitchp->con_startup (); -#else -return NULL ; -#endif } +/* fbdev/DRM can disable VGA-mode so prevent reloading */ +if (vgacon_inhibit) + goto no_vga; + vgacon_inhibit = true; +/* boot_params.screen_info initialized? */ if ((screen_info.orig_video_mode == 0) && (screen_info.orig_video_lines == 0) &&
Signature · 1 line
1.8.4
Hi
Quoted 55 lines · David Herrmann
If vgacon got unloaded for any reason, we can never be sure that vga registers are still accessible. fbdev/DRM/xycon might reconfigure graphics devices in a way that prevents vgacon from working again. Therefore, inhibit rebinding vgacon.
Note that this _might_ break use-cases where users unbind vgacon and then rebind it without breaking VGA mode. However, this seems to be rarely useful and given that several GPUs cannot even restore VGA mode it seems safer to prevent it entirely.
This also adds a dependency to
dummy_conas the VT layer does not allow failure during console-rebinding. Hence, we need a guarantee thatdummy_conis available.
To avoid recursiveKconfigdependencies, we move the vga-con/sgi-con conflict directly intoVGA_CONSOLEand makeDUMMY_CONSOLEalways active.Signed-off-by David Herrmann <[email protected]>--- drivers/video/console/Kconfig | 2 +- drivers/video/console/vgacon.c | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-)drivers/video/console/Kconfig +1
-1@@ -8,6 +8,7 @@ config VGA_CONSOLE bool "VGA text console" if EXPERT || !X86 depends on !4xx && !8xx && !SPARC && !M68K && !PARISC && !FRV && \ !SUPERH && !BLACKFIN && !AVR32 && !MN10300 && !CRIS && \ + SGI_NEWPORT_CONSOLE!=y && DUMMY_CONSOLE && \ (!ARM || ARCH_FOOTBRIDGE || ARCH_INTEGRATOR || ARCH_NETWINDER) default y help@@ -71,7 +72,6 @@ config SGI_NEWPORT_CONSOLE config DUMMY_CONSOLE bool - depends on VGA_CONSOLE!=y || SGI_NEWPORT_CONSOLE!=y default y config DUMMY_CONSOLE_COLUMNSdrivers/video/console/vgacon.c +1
-0@@ -368,6 +368,7 @@ static int vgacon_scrolldelta(struct vc_data *c, int lines)static const char *vgacon_startup (void ) { +static bool vgacon_inhibit;const char *display_desc =NULL ;u16 saved1, saved2;volatile u16 *p;
drivers/video/console/vgacon.c static const char *vgacon_startup(void) · line 379
Quoted 5 lines
drivers/video/console/vgacon.c +0
-1@@ -375,14 +376,15 @@ static const char *vgacon_startup(void)if (screen_info.orig_video_isVGA ==VIDEO_TYPE_VLFB || screen_info.orig_video_isVGA ==VIDEO_TYPE_EFI ) { no_vga: -#ifdef CONFIG_DUMMY_CONSOLE conswitchp = &dummy_con;
Ok this one doesn't really work on reloading but only on con_init().. We might have to manually register dummy_con first. Ugh, man, I don't see the point of fixing that, let's just drop vgacon and use efifb/vesafb.
David
Quoted 17 lines
drivers/video/console/vgacon.c +5
-4return conswitchp->con_startup (); -#else -return NULL ; -#endif } +/* fbdev/DRM can disable VGA-mode so prevent reloading */ +if (vgacon_inhibit) + goto no_vga; + vgacon_inhibit = true; +/* boot_params.screen_info initialized? */ if ((screen_info.orig_video_mode == 0) && (screen_info.orig_video_lines == 0) && --1.8.4