[PATCH] vgacon: prevent vgacon from reloading

David Herrmann dh.herrmann at gmail.com
Wed Oct 2 11:41:16 CEST 2013


Hi

On Wed, Oct 2, 2013 at 11:25 AM, David Herrmann <dh.herrmann at 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 at 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
>


More information about the dri-devel mailing list