diff mbox series

[v3,2/3] multiboot2: do not set StdOut mode unconditionally

Message ID 20230601130518.48874-3-roger.pau@citrix.com (mailing list archive)
State Superseded
Headers show
Series x86/gfx: early boot improvements | expand

Commit Message

Roger Pau Monné June 1, 2023, 1:05 p.m. UTC
Only initialize StdOut if the current StdOut mode is unusable.  This
avoids forcefully switching StdOut to the maximum supported
resolution, and thus very likely changing the GOP mode without having
first parsed the command line options.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
The code is very similar to the approach suggested by Jan, please let
me know if you would be OK with your suggested-by tag added.
---
Changes since v2:
 - Use approach suggested by Jan.

Changes since v1:
 - New in this version.
---
 xen/arch/x86/efi/efi-boot.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Jan Beulich June 7, 2023, 9:45 a.m. UTC | #1
On 01.06.2023 15:05, Roger Pau Monne wrote:
> Only initialize StdOut if the current StdOut mode is unusable.  This
> avoids forcefully switching StdOut to the maximum supported
> resolution, and thus very likely changing the GOP mode without having
> first parsed the command line options.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> ---
> The code is very similar to the approach suggested by Jan, please let
> me know if you would be OK with your suggested-by tag added.

I'm okay either way; I only suggested the "how", not the "that" after all.
In any event
Reviewed-by: Jan Beulich <jbeulich@suse.com>

Jan
diff mbox series

Patch

diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h
index 003ef037bf07..5314f4293b12 100644
--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -820,7 +820,13 @@  void __init efi_multiboot2(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable
 
     efi_init(ImageHandle, SystemTable);
 
-    efi_console_set_mode();
+    if ( StdOut->QueryMode(StdOut, StdOut->Mode->Mode,
+                           &cols, &rows) != EFI_SUCCESS )
+        /*
+         * If active StdOut mode is invalid init ConOut (StdOut) to the max
+         * supported size.
+         */
+        efi_console_set_mode();
 
     if ( StdOut->QueryMode(StdOut, StdOut->Mode->Mode,
                            &cols, &rows) == EFI_SUCCESS )