EFI GOP fixes
v2 cover EFI GOP fixes
Igor Druzhinin (3):
efi/boot: add missing pointer dereference in set_color x86/efi: properly handle 0 in pixel reserved bitmask efi/boot: make sure graphics mode is set while booting through MB2
xen/arch/x86/efi/efi-boot.h | 12 +++++++++--- xen/common/efi/boot.c | 10 +++++++--- 2 files changed, 16 insertions(+), 6 deletions(-)
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v2 1/3 efi/boot: add missing pointer dereference in set_color
--- xen/common/efi/boot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/common/efi/boot.c +1 -1
@@ -1116,7 +1116,7 @@ static int __init __maybe_unused set_color(u32 mask, int bpp, u8 *pos, u8 *sz)return -EINVAL ;for ( *pos =0 ; !(mask &1 ); ++*pos ) mask >>=1 ; -for ( *sz =0 ; mask &1 ; ++sz) +for ( *sz =0 ; mask &1 ; ++*sz) mask >>=1 ;if ( mask )return -EINVAL ;
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH for-4.13 v2 1/3] efi/boot: add missing pointer dereference in set_color
Quoted 1 line · Igor Druzhinin
Signed-off-by Igor Druzhinin <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v2 2/3 x86/efi: properly handle 0 in pixel reserved bitmask
In reply to Igor DruzhininIn some graphics modes firmware is allowed to return 0 in pixel reserved bitmask which doesn't go against UEFI Spec 2.8 (12.9 Graphics Output Protocol).
Without this change non-TrueColor modes won't work which will cause GOP init to fail - observed while trying to boot EFI Xen with Cirrus VGA.
--- xen/arch/x86/efi/efi-boot.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
xen/arch/x86/efi/efi-boot.h +9 -3
@@ -528,9 +528,15 @@ static void __init efi_arch_video_init(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, bpp =set_color (mode_info->PixelInformation.BlueMask, bpp, &vga_console_info.u.vesa_lfb.blue_pos, &vga_console_info.u.vesa_lfb.blue_size); - bpp =set_color (mode_info->PixelInformation.ReservedMask, bpp, - &vga_console_info.u.vesa_lfb.rsvd_pos, - &vga_console_info.u.vesa_lfb.rsvd_size); +if ( !mode_info->PixelInformation.ReservedMask ) + { + vga_console_info.u.vesa_lfb.rsvd_pos =0 ; + vga_console_info.u.vesa_lfb.rsvd_size =0 ; + } +else + bpp =set_color (mode_info->PixelInformation.ReservedMask, bpp, + &vga_console_info.u.vesa_lfb.rsvd_pos, + &vga_console_info.u.vesa_lfb.rsvd_size);if ( bpp >0 )break ;/* fall through */
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH for-4.13 v2 2/3] x86/efi: properly handle 0 in pixel reserved bitmask
Quoted 8 lines · Igor Druzhinin
xen/arch/x86/efi/efi-boot.h +0
-2@@ -528,9 +528,15 @@ static void __init efi_arch_video_init(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, bpp =set_color (mode_info->PixelInformation.BlueMask, bpp, &vga_console_info.u.vesa_lfb.blue_pos, &vga_console_info.u.vesa_lfb.blue_size); - bpp = set_color(mode_info->PixelInformation.ReservedMask, bpp, - &vga_console_info.u.vesa_lfb.rsvd_pos,
xen/arch/x86/efi/efi-boot.h static void __init efi_arch_video_init(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, · line 539
Quoted 10 lines
xen/arch/x86/efi/efi-boot.h +9
-1- &vga_console_info.u.vesa_lfb.rsvd_size); +if ( !mode_info->PixelInformation.ReservedMask ) + { + vga_console_info.u.vesa_lfb.rsvd_pos =0 ; + vga_console_info.u.vesa_lfb.rsvd_size =0 ; + } +else + bpp =set_color (mode_info->PixelInformation.ReservedMask, bpp, + &vga_console_info.u.vesa_lfb.rsvd_pos, + &vga_console_info.u.vesa_lfb.rsvd_size);
Why not simply
if ( mode_info->PixelInformation.ReservedMask )
bpp = set_color(mode_info->PixelInformation.ReservedMask, bpp,
&vga_console_info.u.vesa_lfb.rsvd_pos,
&vga_console_info.u.vesa_lfb.rsvd_size);? There's nothing I can see which might have changed vga_console_info.u.vesa_lfb.rsvd_{pos,size} from its zero-initialized value. With this adjustment (which could be done while committing) or with a reason supplied for the more complex code
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH for-4.13 v2 2/3] x86/efi: properly handle 0 in pixel reserved bitmask
Quoted 27 lines · Jan Beulich
Quoted 8 lines · Igor Druzhinin
xen/arch/x86/efi/efi-boot.h +0
-2@@ -528,9 +528,15 @@ static void __init efi_arch_video_init(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, bpp =set_color (mode_info->PixelInformation.BlueMask, bpp, &vga_console_info.u.vesa_lfb.blue_pos, &vga_console_info.u.vesa_lfb.blue_size); - bpp = set_color(mode_info->PixelInformation.ReservedMask, bpp, - &vga_console_info.u.vesa_lfb.rsvd_pos,xen/arch/x86/efi/efi-boot.h static void __init efi_arch_video_init(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, · line 539
Quoted 10 lines
xen/arch/x86/efi/efi-boot.h +9
-1- &vga_console_info.u.vesa_lfb.rsvd_size); +if ( !mode_info->PixelInformation.ReservedMask ) + { + vga_console_info.u.vesa_lfb.rsvd_pos =0 ; + vga_console_info.u.vesa_lfb.rsvd_size =0 ; + } +else + bpp =set_color (mode_info->PixelInformation.ReservedMask, bpp, + &vga_console_info.u.vesa_lfb.rsvd_pos, + &vga_console_info.u.vesa_lfb.rsvd_size);Why not simply
if ( mode_info->PixelInformation.ReservedMask ) bpp = set_color(mode_info->PixelInformation.ReservedMask, bpp, &vga_console_info.u.vesa_lfb.rsvd_pos, &vga_console_info.u.vesa_lfb.rsvd_size);
Quoted 6 lines
? There's nothing I can see which might have changed vga_console_info.u.vesa_lfb.rsvd_{pos,size} from its zero-initialized value. With this adjustment (which could be done while committing) or with a reason supplied for the more complex code
Reviewed-by Jan Beulich <[email protected]>
Didn't notice it was actually statically zero-initialized. Perfectly fine with the suggested change.
Igor
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH v2 3/3 efi/boot: make sure graphics mode is set while booting through MB2
In reply to Igor DruzhininIf a bootloader is using native driver instead of EFI GOP it might reset graphics mode to be different from what has been originally set by firmware. While booting through MB2 Xen either need to parse video setting passed by MB2 and use them instead of what GOP reports or reset the mode to synchronise it with firmware - prefer the latter.
Observed while booting Xen using MB2 with EFI GRUB2 compiled with all possible video drivers where native drivers take priority over firmware.
--- xen/common/efi/boot.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
xen/common/efi/boot.c +6 -2
@@ -1051,8 +1051,12 @@ static void __init efi_set_gop_mode(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, UINTN gopEFI_STATUS status;UINTN info_size; -/* Set graphics mode. */ -if ( gop_mode < gop->Mode->MaxMode && gop_mode != gop->Mode->Mode ) +/* +* Set graphics mode to a selected one and reset it if we didn't come +* directly from EFI loader as video settings might have been already modified. +*/ +if ( gop_mode < gop->Mode->MaxMode && + (gop_mode != gop->Mode->Mode || !efi_enabled (EFI_LOADER )) ) gop->SetMode (gop, gop_mode);/* Get graphics and frame buffer info. */
Signature · 7 lines
2.7.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH for-4.13 v2 3/3] efi/boot: make sure graphics mode is set while booting through MB2
Quoted 10 lines · Igor Druzhinin
If a bootloader is using native driver instead of EFI GOP it might reset graphics mode to be different from what has been originally set by firmware. While booting through MB2 Xen either need to parse video setting passed by MB2 and use them instead of what GOP reports or reset the mode to synchronise it with firmware - prefer the latter.
Observed while booting Xen using MB2 with EFI GRUB2 compiled with all possible video drivers where native drivers take priority over firmware.
Signed-off-by Igor Druzhinin <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 9 lines · Igor Druzhinin
Igor Druzhinin (3):
efi/boot: add missing pointer dereference inset_colorx86/efi: properly handle 0 in pixel reserved bitmask efi/boot: make sure graphics mode is set while booting through MB2xen/arch/x86/efi/efi-boot.h | 12 +++++++++--- xen/common/efi/boot.c | 10 +++++++--- 2 files changed, 16 insertions(+), 6 deletions(-)
For the series:
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel