From nobody Sat May 18 01:44:54 2024 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 From nobody Sat May 18 01:44:54 2024 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=1644175760; cv=none; d=zohomail.com; s=zohoarc; b=ZJvZRDD5gjtrH7ZaGSFx+/VFWKl95s88fD+JWXy0bQ/nPLcsfsmH3GvSpvxtKHAVOuFj6hCbBNv2WDa6bjDEEzgzTzc5qwkA6ndzCosDdWYFyJR6VLRxDJ/MLNuyIX0LJzLvL0jfSD2G7ly24r++kSLD3QOMtSxZpRQ4R8TbRvY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644175760; 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=At0G3eg7j5P+J2/OwNksy7nZbwWKktpJk5zKue+aCUs=; b=fOqoJ9H/pHRMM+BBWIQG7QkqZPFoSgUKlSXcVhPflGbuxkwwrtHL7U8O6bGFpuoFqMifuGGdAY//xu27JcxRuyhmRADdqKFhIYjnJSJkdKiIvLeoP03pCgOd8/hnqzNA90BrKKRyyaRQCEUyv7cS0xPzS9oAGY92hPv9pOZij9U= 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 1644175760432572.9078260432457; Sun, 6 Feb 2022 11:29:20 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.266315.460006 (Exim 4.92) (envelope-from ) id 1nGnDN-00023b-Mu; Sun, 06 Feb 2022 19:28:49 +0000 Received: by outflank-mailman (output) from mailman id 266315.460006; Sun, 06 Feb 2022 19:28:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nGnDN-00023R-Iu; Sun, 06 Feb 2022 19:28:49 +0000 Received: by outflank-mailman (input) for mailman id 266315; Sun, 06 Feb 2022 19:28:47 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nGnDL-00022Q-QV for xen-devel@lists.xenproject.org; Sun, 06 Feb 2022 19:28:47 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nGnDK-0005sy-RB; Sun, 06 Feb 2022 19:28:46 +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 1nGnDK-0007Ok-FF; Sun, 06 Feb 2022 19:28:46 +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=At0G3eg7j5P+J2/OwNksy7nZbwWKktpJk5zKue+aCUs=; b=ubR3d92i9BDoPIkoIXp2mhYIb+ OBGSxCNFxlOWArOHyLQStiLI8orDDJLe7W6wH2VaGjZTPh+GKndo7thAHa/ONpx42PpiFkxPfRzHM QPKZ8bfPIEYszy/WgqPggHewJbd7npapB6sb9Pqprmztr/xL2FLSohFz8x5NyRaTfsjI=; From: Julien Grall To: xen-devel@lists.xenproject.org Cc: ehem+xen@m5p.com, Julien Grall , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Andrew Cooper , George Dunlap , Jan Beulich , Wei Liu , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH RFC 2/3] xen/arm: efi: Introduce and fill the vga_console_info Date: Sun, 6 Feb 2022 19:28:38 +0000 Message-Id: <20220206192839.75711-3-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: 1644175761877100002 Content-Type: text/plain; charset="utf-8" From: Julien Grall In a follow-up patch will we want to add support for EFI framebuffer in dom0. Yet, Xen may not use the framebuffer, so it would be ideal to not have to enable CONFIG_VIDEO/CONFIG_VGA. Introduce vga_console_info in a hacky way and move the code to fill it up from x86 to common. Signed-off-by: Julien Grall ---- This is a bit of a hack. Sent early to gather opinion on whether we should enable allow Dom0 to use the EFI Framebuffer even if Xen is built with CONFIG_VIDEO=3Dn on Arm. --- xen/arch/arm/efi/efi-boot.h | 6 --- xen/arch/arm/setup.c | 4 ++ xen/arch/x86/efi/efi-boot.h | 72 ------------------------------------ xen/common/efi/boot.c | 74 ++++++++++++++++++++++++++++++++++++- xen/include/xen/vga.h | 2 +- 5 files changed, 78 insertions(+), 80 deletions(-) diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h index ae8627134e5a..17a3d46c59ae 100644 --- a/xen/arch/arm/efi/efi-boot.h +++ b/xen/arch/arm/efi/efi-boot.h @@ -1000,12 +1000,6 @@ static void __init efi_arch_console_init(UINTN cols,= UINTN rows) { } =20 -static void __init efi_arch_video_init(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, - UINTN info_size, - EFI_GRAPHICS_OUTPUT_MODE_INFORMATIO= N *mode_info) -{ -} - static void __init efi_arch_flush_dcache_area(const void *vaddr, UINTN siz= e) { __flush_dcache_area(vaddr, size); diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index d5d0792ed48a..a336ee58179c 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -71,6 +71,10 @@ static unsigned long opt_xenheap_megabytes __initdata; integer_param("xenheap_megabytes", opt_xenheap_megabytes); #endif =20 +#ifndef CONFIG_VIDEO +struct xen_vga_console_info vga_console_info; +#endif + domid_t __read_mostly max_init_domid; =20 static __used void init_done(void) diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h index f69509a2103a..cba3fa75a475 100644 --- a/xen/arch/x86/efi/efi-boot.h +++ b/xen/arch/x86/efi/efi-boot.h @@ -3,7 +3,6 @@ * is intended to be included by common/efi/boot.c _only_, and * therefore can define arch specific global variables. */ -#include #include #include #include @@ -497,77 +496,6 @@ static void __init efi_arch_console_init(UINTN cols, U= INTN rows) #endif } =20 -static void __init efi_arch_video_init(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, - UINTN info_size, - EFI_GRAPHICS_OUTPUT_MODE_INFORMATIO= N *mode_info) -{ -#ifdef CONFIG_VIDEO - int bpp =3D 0; - - switch ( mode_info->PixelFormat ) - { - case PixelRedGreenBlueReserved8BitPerColor: - vga_console_info.u.vesa_lfb.red_pos =3D 0; - vga_console_info.u.vesa_lfb.red_size =3D 8; - vga_console_info.u.vesa_lfb.green_pos =3D 8; - vga_console_info.u.vesa_lfb.green_size =3D 8; - vga_console_info.u.vesa_lfb.blue_pos =3D 16; - vga_console_info.u.vesa_lfb.blue_size =3D 8; - vga_console_info.u.vesa_lfb.rsvd_pos =3D 24; - vga_console_info.u.vesa_lfb.rsvd_size =3D 8; - bpp =3D 32; - break; - case PixelBlueGreenRedReserved8BitPerColor: - vga_console_info.u.vesa_lfb.red_pos =3D 16; - vga_console_info.u.vesa_lfb.red_size =3D 8; - vga_console_info.u.vesa_lfb.green_pos =3D 8; - vga_console_info.u.vesa_lfb.green_size =3D 8; - vga_console_info.u.vesa_lfb.blue_pos =3D 0; - vga_console_info.u.vesa_lfb.blue_size =3D 8; - vga_console_info.u.vesa_lfb.rsvd_pos =3D 24; - vga_console_info.u.vesa_lfb.rsvd_size =3D 8; - bpp =3D 32; - break; - case PixelBitMask: - bpp =3D set_color(mode_info->PixelInformation.RedMask, bpp, - &vga_console_info.u.vesa_lfb.red_pos, - &vga_console_info.u.vesa_lfb.red_size); - bpp =3D set_color(mode_info->PixelInformation.GreenMask, bpp, - &vga_console_info.u.vesa_lfb.green_pos, - &vga_console_info.u.vesa_lfb.green_size); - bpp =3D set_color(mode_info->PixelInformation.BlueMask, bpp, - &vga_console_info.u.vesa_lfb.blue_pos, - &vga_console_info.u.vesa_lfb.blue_size); - if ( mode_info->PixelInformation.ReservedMask ) - bpp =3D set_color(mode_info->PixelInformation.ReservedMask, bp= p, - &vga_console_info.u.vesa_lfb.rsvd_pos, - &vga_console_info.u.vesa_lfb.rsvd_size); - if ( bpp > 0 ) - break; - /* fall through */ - default: - PrintErr(L"Current graphics mode is unsupported!\r\n"); - bpp =3D 0; - break; - } - if ( bpp > 0 ) - { - vga_console_info.video_type =3D XEN_VGATYPE_EFI_LFB; - vga_console_info.u.vesa_lfb.gbl_caps =3D 2; /* possibly non-VGA */ - vga_console_info.u.vesa_lfb.width =3D - mode_info->HorizontalResolution; - vga_console_info.u.vesa_lfb.height =3D mode_info->VerticalResoluti= on; - vga_console_info.u.vesa_lfb.bits_per_pixel =3D bpp; - vga_console_info.u.vesa_lfb.bytes_per_line =3D - (mode_info->PixelsPerScanLine * bpp + 7) >> 3; - vga_console_info.u.vesa_lfb.lfb_base =3D gop->Mode->FrameBufferBas= e; - vga_console_info.u.vesa_lfb.ext_lfb_base =3D gop->Mode->FrameBuffe= rBase >> 32; - vga_console_info.u.vesa_lfb.lfb_size =3D - (gop->Mode->FrameBufferSize + 0xffff) >> 16; - } -#endif -} - static void __init efi_arch_memory_setup(void) { unsigned int i; diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index 80e4e32623c4..2bc38ae40fff 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -20,6 +20,7 @@ #endif #include #include +#include #ifdef CONFIG_X86 /* * Keep this arch-specific modified include in the common file, as moving @@ -1025,6 +1026,77 @@ static void __init efi_get_apple_properties(void) } } =20 +static void __init efi_video_init(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, + UINTN info_size, + EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *mo= de_info) +{ +#if defined(CONFIG_VIDEO) || defined(CONFIG_ARM) + int bpp =3D 0; + + switch ( mode_info->PixelFormat ) + { + case PixelRedGreenBlueReserved8BitPerColor: + vga_console_info.u.vesa_lfb.red_pos =3D 0; + vga_console_info.u.vesa_lfb.red_size =3D 8; + vga_console_info.u.vesa_lfb.green_pos =3D 8; + vga_console_info.u.vesa_lfb.green_size =3D 8; + vga_console_info.u.vesa_lfb.blue_pos =3D 16; + vga_console_info.u.vesa_lfb.blue_size =3D 8; + vga_console_info.u.vesa_lfb.rsvd_pos =3D 24; + vga_console_info.u.vesa_lfb.rsvd_size =3D 8; + bpp =3D 32; + break; + case PixelBlueGreenRedReserved8BitPerColor: + vga_console_info.u.vesa_lfb.red_pos =3D 16; + vga_console_info.u.vesa_lfb.red_size =3D 8; + vga_console_info.u.vesa_lfb.green_pos =3D 8; + vga_console_info.u.vesa_lfb.green_size =3D 8; + vga_console_info.u.vesa_lfb.blue_pos =3D 0; + vga_console_info.u.vesa_lfb.blue_size =3D 8; + vga_console_info.u.vesa_lfb.rsvd_pos =3D 24; + vga_console_info.u.vesa_lfb.rsvd_size =3D 8; + bpp =3D 32; + break; + case PixelBitMask: + bpp =3D set_color(mode_info->PixelInformation.RedMask, bpp, + &vga_console_info.u.vesa_lfb.red_pos, + &vga_console_info.u.vesa_lfb.red_size); + bpp =3D set_color(mode_info->PixelInformation.GreenMask, bpp, + &vga_console_info.u.vesa_lfb.green_pos, + &vga_console_info.u.vesa_lfb.green_size); + bpp =3D set_color(mode_info->PixelInformation.BlueMask, bpp, + &vga_console_info.u.vesa_lfb.blue_pos, + &vga_console_info.u.vesa_lfb.blue_size); + if ( mode_info->PixelInformation.ReservedMask ) + bpp =3D set_color(mode_info->PixelInformation.ReservedMask, bp= p, + &vga_console_info.u.vesa_lfb.rsvd_pos, + &vga_console_info.u.vesa_lfb.rsvd_size); + if ( bpp > 0 ) + break; + /* fall through */ + default: + PrintErr(L"Current graphics mode is unsupported!\r\n"); + bpp =3D 0; + break; + } + if ( bpp > 0 ) + { + vga_console_info.video_type =3D XEN_VGATYPE_EFI_LFB; + vga_console_info.u.vesa_lfb.gbl_caps =3D 2; /* possibly non-VGA */ + vga_console_info.u.vesa_lfb.width =3D + mode_info->HorizontalResolution; + vga_console_info.u.vesa_lfb.height =3D mode_info->VerticalResoluti= on; + vga_console_info.u.vesa_lfb.bits_per_pixel =3D bpp; + vga_console_info.u.vesa_lfb.bytes_per_line =3D + (mode_info->PixelsPerScanLine * bpp + 7) >> 3; + vga_console_info.u.vesa_lfb.lfb_base =3D gop->Mode->FrameBufferBas= e; + vga_console_info.u.vesa_lfb.ext_lfb_base =3D gop->Mode->FrameBuffe= rBase >> 32; + vga_console_info.u.vesa_lfb.lfb_size =3D + (gop->Mode->FrameBufferSize + 0xffff) >> 16; + } +#endif +} + static void __init efi_set_gop_mode(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, UIN= TN gop_mode) { EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *mode_info; @@ -1042,7 +1114,7 @@ static void __init efi_set_gop_mode(EFI_GRAPHICS_OUTP= UT_PROTOCOL *gop, UINTN gop /* Get graphics and frame buffer info. */ status =3D gop->QueryMode(gop, gop->Mode->Mode, &info_size, &mode_info= ); if ( !EFI_ERROR(status) ) - efi_arch_video_init(gop, info_size, mode_info); + efi_video_init(gop, info_size, mode_info); } =20 #define INVALID_VIRTUAL_ADDRESS (0xBAAADUL << \ diff --git a/xen/include/xen/vga.h b/xen/include/xen/vga.h index f72b63d446b1..39b4c2eae198 100644 --- a/xen/include/xen/vga.h +++ b/xen/include/xen/vga.h @@ -11,7 +11,7 @@ =20 #include =20 -#ifdef CONFIG_VGA +#if defined(CONFIG_VGA) || defined(CONFIG_ARM) extern struct xen_vga_console_info vga_console_info; #endif =20 --=20 2.32.0 From nobody Sat May 18 01:44:54 2024 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=1644175757; cv=none; d=zohomail.com; s=zohoarc; b=Iy6pLOeB91+QYpRLyZA8VKRlF8r0NgUFD1uk1/RLynyw4k8zPSHgJQzx1t1Aee+EMV9b/FugyURtFDT9VBQm3GsErSag72WBxU1ucdMwO/KSfPqpS41QBPq+h4C7bhWn21o0IYtKZ1gAGZkXcnTuXqBZ51XP78NuBVmO/NTMEJs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644175757; 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=dwa+CM0UGV4Uyu3tQxS0S6kaMZiyK2FzF7bR+EHTABc=; b=Uc7+Zvgp9Gw2tZx5sYDIHC+xovfyMllgBYMcRAaz+97rP48Y3NGZDbjncRfvDv12kAiP60nEHboKMwBqA1Wt3lv/kBhaRhOIQ8hjYz7tc35Qmh8av9pAkfsX+lb+nj5Js6BCCB6MWHEQm4uPUuxqMoLr0rKmYyMHbJXa03oQTow= 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 1644175757363631.0784500432039; Sun, 6 Feb 2022 11:29:17 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.266316.460017 (Exim 4.92) (envelope-from ) id 1nGnDP-0002Lo-V2; Sun, 06 Feb 2022 19:28:51 +0000 Received: by outflank-mailman (output) from mailman id 266316.460017; Sun, 06 Feb 2022 19:28:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nGnDP-0002Lf-Qg; Sun, 06 Feb 2022 19:28:51 +0000 Received: by outflank-mailman (input) for mailman id 266316; Sun, 06 Feb 2022 19:28:50 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nGnDO-0002J7-OM for xen-devel@lists.xenproject.org; Sun, 06 Feb 2022 19:28:50 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nGnDM-0005t8-Ch; Sun, 06 Feb 2022 19:28:48 +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 1nGnDM-0007Ok-4h; Sun, 06 Feb 2022 19:28:48 +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=dwa+CM0UGV4Uyu3tQxS0S6kaMZiyK2FzF7bR+EHTABc=; b=ppyd+fukvMObK1Y2M4+VtmDg6w 3E8oAypWDgoe7HSHp252yR2ftQtXhjHOYNlRTy4MoqwvT51uHuVZLl9dB/ukzZCJH1NS+SvloMmQd Ptj9JPP1BFMPwyEdx/+W+vz5LmL8AvDtspb/bndh37q80j1sTFckn+2CWLZiMNoCFwdU=; From: Julien Grall To: xen-devel@lists.xenproject.org Cc: ehem+xen@m5p.com, Julien Grall , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Andrew Cooper , George Dunlap , Jan Beulich , Wei Liu Subject: [PATCH RFC 3/3] xen: Introduce a platform sub-op to retrieve the VGA information Date: Sun, 6 Feb 2022 19:28:39 +0000 Message-Id: <20220206192839.75711-4-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: 1644175758238100002 Content-Type: text/plain; charset="utf-8" From: Julien Grall When using EFI, the VGA information is fetched using the EFI boot services. However, Xen will have exited the boot services. Therefore, we need to find a different way to pass the information to dom0. For PV dom0, they are part of the start_info. But this is not something that exists on Arm. So the best way would to be to use a hypercall. For now the structure layout is based on dom0_vga_console_info for convenience. I am open on another proposal. Signed-off-by: Julien Grall ---- TODO: - Check the structure size has not changed (I would like to avoid bumping the platform interface). --- xen/arch/arm/platform_hypercall.c | 15 +++++++++++++++ xen/include/public/platform.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/xen/arch/arm/platform_hypercall.c b/xen/arch/arm/platform_hype= rcall.c index 8efac7ee602a..78ad328e2ab8 100644 --- a/xen/arch/arm/platform_hypercall.c +++ b/xen/arch/arm/platform_hypercall.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -58,6 +59,20 @@ long do_platform_op(XEN_GUEST_HANDLE_PARAM(xen_platform_= op_t) u_xenpf_op) ret =3D -EINVAL; break; =20 + case XENPF_firmware_info: + switch ( op->u.firmware_info.type ) + { + case XEN_FW_VGA_INFO: + BUILD_BUG_ON(sizeof(op->u.firmware_info.u.vga) !=3D + sizeof(vga_console_info)); + memcpy(&op->u.firmware_info.u.vga, &vga_console_info, + sizeof(vga_console_info)); + if ( __copy_to_guest(u_xenpf_op, op, 1) ) + ret =3D -EFAULT; + break; + } + break; + default: ret =3D -ENOSYS; break; diff --git a/xen/include/public/platform.h b/xen/include/public/platform.h index a4c0eb62249a..4de42ce6cbc5 100644 --- a/xen/include/public/platform.h +++ b/xen/include/public/platform.h @@ -244,6 +244,7 @@ DEFINE_XEN_GUEST_HANDLE(xenpf_efi_runtime_call_t); #define XEN_FW_EFI_PCI_ROM 5 #define XEN_FW_EFI_APPLE_PROPERTIES 6 #define XEN_FW_KBD_SHIFT_FLAGS 5 +#define XEN_FW_VGA_INFO 6 struct xenpf_firmware_info { /* IN variables. */ uint32_t type; @@ -311,6 +312,7 @@ struct xenpf_firmware_info { =20 /* Int16, Fn02: Get keyboard shift flags. */ uint8_t kbd_shift_flags; /* XEN_FW_KBD_SHIFT_FLAGS */ + struct dom0_vga_console_info vga; } u; }; typedef struct xenpf_firmware_info xenpf_firmware_info_t; --=20 2.32.0