From nobody Fri Nov 29 18:50:28 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; 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; dmarc=fail(p=none dis=none) header.from=arm.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 163232005760727.304695990956816; Wed, 22 Sep 2021 07:14:17 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.192811.343464 (Exim 4.92) (envelope-from ) id 1mT30e-0003p9-1G; Wed, 22 Sep 2021 14:14:04 +0000 Received: by outflank-mailman (output) from mailman id 192811.343464; Wed, 22 Sep 2021 14:14:04 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mT30d-0003p2-U8; Wed, 22 Sep 2021 14:14:03 +0000 Received: by outflank-mailman (input) for mailman id 192811; Wed, 22 Sep 2021 14:14:02 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mT30c-0003bo-4G for xen-devel@lists.xenproject.org; Wed, 22 Sep 2021 14:14:02 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id 5536c1ea-1baf-11ec-b995-12813bfff9fa; Wed, 22 Sep 2021 14:14:00 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2607A11D4; Wed, 22 Sep 2021 07:14:00 -0700 (PDT) Received: from e125770.cambridge.arm.com (e125770.cambridge.arm.com [10.1.197.16]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AFCDB3F59C; Wed, 22 Sep 2021 07:13:58 -0700 (PDT) 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" X-Inumbo-ID: 5536c1ea-1baf-11ec-b995-12813bfff9fa From: Luca Fancellu To: xen-devel@lists.xenproject.org Cc: bertrand.marquis@arm.com, wei.chen@arm.com, Andrew Cooper , George Dunlap , Ian Jackson , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu , Volodymyr Babchuk Subject: [PATCH v2 1/2] arm/efi: Introduce uefi,cfg-load DT property Date: Wed, 22 Sep 2021 15:13:40 +0100 Message-Id: <20210922141341.42288-2-luca.fancellu@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210922141341.42288-1-luca.fancellu@arm.com> References: <20210922141341.42288-1-luca.fancellu@arm.com> X-ZM-MESSAGEID: 1632320058523100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Introduce the uefi,cfg-load DT property of /chosen node for ARM whose presence decide whether to force the load of the UEFI Xen configuration file. The logic is that if any multiboot,module is found in the DT, then the uefi,cfg-load property is used to see if the UEFI Xen configuration file is needed. Signed-off-by: Luca Fancellu --- v2 changes: - Introduced uefi,cfg-load property - Add documentation about the property --- docs/misc/efi.pandoc | 2 ++ xen/arch/arm/efi/efi-boot.h | 28 +++++++++++++++++++++++----- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/docs/misc/efi.pandoc b/docs/misc/efi.pandoc index ac3cd58cae..e289c5e7ba 100644 --- a/docs/misc/efi.pandoc +++ b/docs/misc/efi.pandoc @@ -14,6 +14,8 @@ loaded the modules and describes them in the device tree = provided to Xen. If a bootloader provides a device tree containing modules then any configuration files are ignored, and the bootloader is responsible for populating all relevant device tree nodes. +The property "uefi,cfg-load" can be specified in the /chosen node to force= Xen +to load the configuration file even if multiboot modules are found. =20 Once built, `make install-xen` will place the resulting binary directly in= to the EFI boot partition, provided `EFI_VENDOR` is set in the environment (a= nd diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h index cf9c37153f..8ceeba4ad1 100644 --- a/xen/arch/arm/efi/efi-boot.h +++ b/xen/arch/arm/efi/efi-boot.h @@ -581,22 +581,40 @@ static void __init efi_arch_load_addr_check(EFI_LOADE= D_IMAGE *loaded_image) =20 static bool __init efi_arch_use_config_file(EFI_SYSTEM_TABLE *SystemTable) { + bool skip_cfg_file =3D false; /* * For arm, we may get a device tree from GRUB (or other bootloader) * that contains modules that have already been loaded into memory. In - * this case, we do not use a configuration file, and rely on the - * bootloader to have loaded all required modules and appropriate - * options. + * this case, we search for the property uefi,cfg-load in the /chosen = node + * to decide whether to skip the UEFI Xen configuration file or not. */ =20 fdt =3D lookup_fdt_config_table(SystemTable); dtbfile.ptr =3D fdt; dtbfile.need_to_free =3D false; /* Config table memory can't be freed.= */ - if ( !fdt || fdt_node_offset_by_compatible(fdt, 0, "multiboot,module")= < 0 ) + + if ( fdt_node_offset_by_compatible(fdt, 0, "multiboot,module") > 0 ) + { + /* Locate chosen node */ + int node =3D fdt_subnode_offset(fdt, 0, "chosen"); + const void *cfg_load_prop; + int cfg_load_len; + + if ( node > 0 ) + { + /* Check if uefi,cfg-load property exists */ + cfg_load_prop =3D fdt_getprop(fdt, node, "uefi,cfg-load", + &cfg_load_len); + if ( !cfg_load_prop ) + skip_cfg_file =3D true; + } + } + + if ( !fdt || !skip_cfg_file ) { /* * We either have no FDT, or one without modules, so we must have a - * Xen EFI configuration file to specify modules. (dom0 required) + * Xen EFI configuration file to specify modules. */ return true; } --=20 2.17.1