diff --git a/0009-fbcon-Only-defer-console-takeover-if-the-current-con.patch b/0009-fbcon-Only-defer-console-takeover-if-the-current-con.patch new file mode 100644 index 000000000..8735a62eb --- /dev/null +++ b/0009-fbcon-Only-defer-console-takeover-if-the-current-con.patch @@ -0,0 +1,100 @@ +From 317b698406457eb97277d4220126683a59c74fd8 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Wed, 1 Aug 2018 15:19:52 +0200 +Subject: [PATCH] fbcon: Only defer console takeover if the current + console driver is the dummycon + +We rely on dummycon's output notifier mechanism to defer the takeover. + +If say vgacon is the current console driver then dummycon will never get +used so its output notifier will also never get called and fbcon never +takes over. This commit fixes this by only deferring the console takeover +if the current console driver is the dummycon driver. + +This commit also moves the entirety of fbcon_start under the console_lock, +since the conswitchp which fbcon_start now checks is protected by it. + +This commit also inlines fbcon_register_output_notifier, since we now +need a #ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER in fbcon_start +anyways because of the write access to the deferred_takeover variable, +this has the added advantage that it puts the +dummycon_register_output_notifier() call directly after the "conswitchp != +&dummy_con" comparison making it clear why that check is there. + +Note the arch setup code will set conswitchp to either dummy_con or +vga_con, in the cases where it gets set to vga_con even though their is +no vga_con present we rely on vga_con_startup() to set conswitchp to +dummy_con. vga_con_startup() is guaranteed to happen before +fb_console_init() as it gets called as a console_initcall where as +fb_console_init() gets called as a subsys_initcall. + +Signed-off-by: Hans de Goede +--- + drivers/video/fbdev/core/fbcon.c | 24 ++++++++++-------------- + 1 file changed, 10 insertions(+), 14 deletions(-) + +diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c +index e30d3a138c97..ef8b2d0b7071 100644 +--- a/drivers/video/fbdev/core/fbcon.c ++++ b/drivers/video/fbdev/core/fbcon.c +@@ -3612,38 +3612,34 @@ static int fbcon_output_notifier(struct notifier_block *nb, + + return NOTIFY_OK; + } +- +-static void fbcon_register_output_notifier(void) +-{ +- fbcon_output_nb.notifier_call = fbcon_output_notifier; +- dummycon_register_output_notifier(&fbcon_output_nb); +-} +-#else +-static inline void fbcon_register_output_notifier(void) {} + #endif + + static void fbcon_start(void) + { ++ WARN_CONSOLE_UNLOCKED(); ++ ++#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER ++ if (conswitchp != &dummy_con) ++ deferred_takeover = false; ++ + if (deferred_takeover) { +- fbcon_register_output_notifier(); ++ fbcon_output_nb.notifier_call = fbcon_output_notifier; ++ dummycon_register_output_notifier(&fbcon_output_nb); + return; + } ++#endif + + if (num_registered_fb) { + int i; + +- console_lock(); +- + for (i = 0; i < FB_MAX; i++) { + if (registered_fb[i] != NULL) { + info_idx = i; + break; + } + } + + do_fbcon_takeover(0); +- console_unlock(); +- + } + } + +@@ -3724,8 +3720,8 @@ void __init fb_console_init(void) + for (i = 0; i < MAX_NR_CONSOLES; i++) + con2fb_map[i] = -1; + +- console_unlock(); + fbcon_start(); ++ console_unlock(); + } + + #ifdef MODULE +-- +2.18.0 + diff --git a/kernel.spec b/kernel.spec index a7874cbb8..2adc69f30 100644 --- a/kernel.spec +++ b/kernel.spec @@ -644,6 +644,8 @@ Patch525: 0005-efi-bgrt-Drop-__initdata-from-bgrt_image_size.patch Patch526: 0006-efifb-Copy-the-ACPI-BGRT-boot-graphics-to-the-frameb.patch Patch527: 0007-efifb-BGRT-Do-not-copy-the-boot-graphics-for-non-nat.patch Patch528: 0008-console-dummycon-export-dummycon_-un-register_output.patch +# Deferred fbcon takeover bugfix, pending upstream +Patch529: 0009-fbcon-Only-defer-console-takeover-if-the-current-con.patch # END OF PATCH DEFINITIONS @@ -1904,6 +1906,10 @@ fi # # %changelog +* Wed Aug 01 2018 Hans de Goede +- Add patch fixing FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER breaking + VT switching when combined with vgacon (rhbz#1610562) + * Wed Aug 01 2018 Laura Abbott - 4.18.0-0.rc7.git1.1 - Linux v4.18-rc7-90-gc1d61e7fe376