From nobody Tue Feb 10 13:34:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1644175755; cv=none; d=zohomail.com; s=zohoarc; b=PR7pRzbu9ANMtVnwRcWo6+wdjCYD7xzXAX+Ex171HYTlZek1N++FNRslIonpghQoC04+6Kum+yIpbRJj+tBNzaMfdPWHtFQZeA67GsplxeWsxHyj8rqL/ruD25+UuXk7CcDjfGxNvhbWTjpBXrL0he9qOVk301dUmMHKQfxSV3s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644175755; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=afEtY43khqyixlLlQcgO+P5/SZzjDhtwscVQfHzNp6w=; b=FmAA8oZpDfAc/OL5X/mM5q38D5rh3K/5K1OWLgqPrVbx8NCjEwq4eU77cAPVizFe5i440QpAn6bbTc7zd1h3jB3XFvDdhbqkHKUeQ9YPekAPZ+sbYnm3Uy733dUgRBsx98vsoqGd9hUGcDOfFDeoJMujLe8+LOIYFbPbuGqIlIc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1644175755613859.637891055483; Sun, 6 Feb 2022 11:29:15 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.266314.459994 (Exim 4.92) (envelope-from ) id 1nGnDK-0001mv-Em; Sun, 06 Feb 2022 19:28:46 +0000 Received: by outflank-mailman (output) from mailman id 266314.459994; Sun, 06 Feb 2022 19:28:46 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nGnDK-0001mo-Bo; Sun, 06 Feb 2022 19:28:46 +0000 Received: by outflank-mailman (input) for mailman id 266314; Sun, 06 Feb 2022 19:28:45 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nGnDJ-0001Yz-9u for xen-devel@lists.xenproject.org; Sun, 06 Feb 2022 19:28:45 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nGnDJ-0005sk-2e; Sun, 06 Feb 2022 19:28:45 +0000 Received: from 54-240-197-224.amazon.com ([54.240.197.224] helo=dev-dsk-jgrall-1b-035652ec.eu-west-1.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nGnDI-0007Ok-Pk; Sun, 06 Feb 2022 19:28:45 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=afEtY43khqyixlLlQcgO+P5/SZzjDhtwscVQfHzNp6w=; b=3VtDXi3lemG7IAYf+DmdTdw7XG 49nHZrGfVfH6KIvICROvXnt8LH95v6Sej6Sy7FnViBrQXDiaJJb1l+o+QRrc1ldMXYFjpYQAv1eYJ X3NDNAzLRWK5CGxby0CF8bXGWhzQaeQ333HMRgF785hVqYEJTA4e9biey1Mb5SmPPmyI=; From: Julien Grall To: xen-devel@lists.xenproject.org Cc: ehem+xen@m5p.com, Julien Grall , Jan Beulich Subject: [PATCH RFC 1/3] xen/efi: Always query the console information and get GOP Date: Sun, 6 Feb 2022 19:28:37 +0000 Message-Id: <20220206192839.75711-2-julien@xen.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220206192839.75711-1-julien@xen.org> References: <20220206192839.75711-1-julien@xen.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @xen.org) X-ZM-MESSAGEID: 1644175758237100001 Content-Type: text/plain; charset="utf-8" From: Julien Grall 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. Signed-off-by: Julien Grall ---- 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? --- xen/common/efi/boot.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index 12fd0844bd55..80e4e32623c4 100644 --- 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 =3D 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 =3D 0; CHAR16 **argv, *file_name, *cfg_file_name =3D NULL, *options =3D NULL; - UINTN gop_mode =3D ~0; + UINTN gop_mode =3D ~0, cols =3D 0, rows =3D 0; + EFI_SHIM_LOCK_PROTOCOL *shim_lock; EFI_GRAPHICS_OUTPUT_PROTOCOL *gop =3D NULL; union string section =3D { NULL }, name; @@ -1219,18 +1221,16 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE = *SystemTable) =20 efi_arch_relocate_image(0); =20 + if ( StdOut->QueryMode(StdOut, StdOut->Mode->Mode, + &cols, &rows) =3D=3D EFI_SUCCESS ) + efi_arch_console_init(cols, rows); + + gop =3D efi_get_gop(); + if ( use_cfg_file ) { EFI_FILE_HANDLE dir_handle; - UINTN depth, cols, rows, size; - - size =3D cols =3D rows =3D depth =3D 0; - - if ( StdOut->QueryMode(StdOut, StdOut->Mode->Mode, - &cols, &rows) =3D=3D EFI_SUCCESS ) - efi_arch_console_init(cols, rows); - - gop =3D efi_get_gop(); + UINTN depth =3D 0; =20 /* Get the file system interface. */ dir_handle =3D get_parent_handle(loaded_image, &file_name); --=20 2.32.0