[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH RFC 1/3] xen/efi: Always query the console information and get GOP


  • To: Julien Grall <julien@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 7 Feb 2022 09:46:36 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lxlGo5YVbELHevjqX0pMZXl6Q5m9uHmz6oHkG3ocQqc=; b=XIHAIvX71hifnvhefRDZL4JxDXgYsEMooI135VrkYroASpNe0HtVLzaMA8cwtzMj0D2hfmSyMGJh7sFhct5VQrW59ENinHDvdMrhcoFQQAKSlqgbPTwZelrlJFQO0z8Ja53QCUrT8Uyih5S8CgxR9PDHzxbctVUxCIE0YIwHdCmjpXudgpVmTeUHEnGRDL3aq/H06RwCE+/g55Jh9R+KO7RhEuaPPhRpuDEKAkOdq3S702nJ6eZDgkXXbrUrcanxkuVno0DytXZJd3prU7eZ11lqawLK8msp/t/ofdFj9xRJX+0e6/lzn0K4qWgktWcmZsTJ+jM614wqA9nqIaqP7w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lOIb9WFdhu3EOVVQ0iLUYBQPeT0fi0Ksgq+yI43vhq7W4PVawveVzPeFX5mEDZ+75g1gJ3UT2eMbniawLs1uJPQ7JC41fEZvZKs+WxOLJAAR9eHvVSS5XA0w+RG02FXj/Z/rAVu5TNr/kI7IUe4EwHJJjBAqOp94OQ/nk61kYhZ/nt7HIpVBVkJsk66S2qNVRzME7CPOGJmd+NgSj2wAB9wvAgCRqi7o3mOKZsQsVazDMbDCW6UfJHAc6jvrSMV8gpfWsV/E6Lcy9i8sc1jQR2VXymj6ZEm9LXhS+7aeXknlSn35/VzFKRfqmnDBXCD4I9ymRm+pEFqli5Gz7JqiBw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: ehem+xen@xxxxxxx, Julien Grall <jgrall@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, Daniel Kiper <daniel.kiper@xxxxxxxxxx>
  • Delivery-date: Mon, 07 Feb 2022 08:46:54 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 06.02.2022 20:28, Julien Grall wrote:
> From: Julien Grall <jgrall@xxxxxxxxxx>
> 
> Currently, the EFI stub will only query the console information and
> get the GOP when using the configuration file.
> 
> However, GRUB is never providing the a configuration file. So the
> EFI framebuffer will not be usable at least on Arm (support will
> be added in a follow-up patch).
> 
> Move out the code outside of the configuration file section.
> 
> Take the opportunity to remove the variable 'size' which was
> set but never used (interestingly GCC is only complaining if it is
> initialization when declaring the variable).
> 
> With this change, GCC 8.3 will complain of argc potentially been
> used unitiatlized. I suspect this is because the argc will
> be iniitalized and used in a different if code-blocks. Yet they
> are using the same check.

I'm inclined to suggest this wants to be a separate change, with its
own justification. You're not touching any use of argc here, after
all.

> Signed-off-by: Julien Grall <jgrall@xxxxxxxxxx>
> 
> ----
> 
> It is not entirely clear to me why the GOP was only fetched when
> the configuration file is used.
> 
> I have tested this on RPI4 and it seems to work. Any chance this
> was done to workaround an x86 platform?

This was done so in the context of making the code work for Arm. See
commit c38cf865ec82 ("EFI: ignore EFI commandline, skip console setup
when booted from GRUB"), the description of which explicitly says

"Don't do EFI console or video configuration when booted by GRUB.  The EFI boot
 code does some console and video initialization to support native EFI boot from
 the EFI boot manager or EFI shell.  This initlization should not be done when
 booted using GRUB."

What you say now is effectively the opposite (and unlike back then
x86 is now able to use this code path as well, so needs considering
too). Cc-ing Daniel for possibly having a GrUB-side opinion.

Jan

> --- a/xen/common/efi/boot.c
> +++ b/xen/common/efi/boot.c
> @@ -1129,9 +1129,11 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE 
> *SystemTable)
>      static EFI_GUID __initdata shim_lock_guid = SHIM_LOCK_PROTOCOL_GUID;
>      EFI_LOADED_IMAGE *loaded_image;
>      EFI_STATUS status;
> -    unsigned int i, argc;
> +    /* Initialize argc to stop GCC complaining */
> +    unsigned int i, argc = 0;
>      CHAR16 **argv, *file_name, *cfg_file_name = NULL, *options = NULL;
> -    UINTN gop_mode = ~0;
> +    UINTN gop_mode = ~0, cols = 0, rows = 0;
> +
>      EFI_SHIM_LOCK_PROTOCOL *shim_lock;
>      EFI_GRAPHICS_OUTPUT_PROTOCOL *gop = NULL;
>      union string section = { NULL }, name;
> @@ -1219,18 +1221,16 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE 
> *SystemTable)
>  
>      efi_arch_relocate_image(0);
>  
> +    if ( StdOut->QueryMode(StdOut, StdOut->Mode->Mode,
> +                           &cols, &rows) == EFI_SUCCESS )
> +        efi_arch_console_init(cols, rows);
> +
> +    gop = efi_get_gop();
> +
>      if ( use_cfg_file )
>      {
>          EFI_FILE_HANDLE dir_handle;
> -        UINTN depth, cols, rows, size;
> -
> -        size = cols = rows = depth = 0;
> -
> -        if ( StdOut->QueryMode(StdOut, StdOut->Mode->Mode,
> -                               &cols, &rows) == EFI_SUCCESS )
> -            efi_arch_console_init(cols, rows);
> -
> -        gop = efi_get_gop();
> +        UINTN depth = 0;
>  
>          /* Get the file system interface. */
>          dir_handle = get_parent_handle(loaded_image, &file_name);




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.