* [PATCH] vgacon: prevent vgacon from reloading
@ 2013-10-02 9:25 David Herrmann
2013-10-02 9:41 ` David Herrmann
0 siblings, 1 reply; 2+ messages in thread
From: David Herrmann @ 2013-10-02 9:25 UTC (permalink / raw)
To: dri-devel
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.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
---
drivers/video/console/Kconfig | 2 +-
drivers/video/console/vgacon.c | 10 ++++++----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
index 846caab..173f1e7 100644
--- a/drivers/video/console/Kconfig
+++ b/drivers/video/console/Kconfig
@@ -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
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index 9d8feac..d598af6 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -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) &&
--
1.8.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] vgacon: prevent vgacon from reloading
2013-10-02 9:25 [PATCH] vgacon: prevent vgacon from reloading David Herrmann
@ 2013-10-02 9:41 ` David Herrmann
0 siblings, 0 replies; 2+ messages in thread
From: David Herrmann @ 2013-10-02 9:41 UTC (permalink / raw)
To: dri-devel@lists.freedesktop.org
Hi
On Wed, Oct 2, 2013 at 11:25 AM, David Herrmann <dh.herrmann@gmail.com> wrote:
> 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.
>
> Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
> ---
> drivers/video/console/Kconfig | 2 +-
> drivers/video/console/vgacon.c | 10 ++++++----
> 2 files changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
> index 846caab..173f1e7 100644
> --- a/drivers/video/console/Kconfig
> +++ b/drivers/video/console/Kconfig
> @@ -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
> diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
> index 9d8feac..d598af6 100644
> --- a/drivers/video/console/vgacon.c
> +++ b/drivers/video/console/vgacon.c
> @@ -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;
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
> 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) &&
> --
> 1.8.4
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-10-02 9:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-02 9:25 [PATCH] vgacon: prevent vgacon from reloading David Herrmann
2013-10-02 9:41 ` David Herrmann
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.