From nobody Wed May 15 02:43:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+95370+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95370+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1666171350; cv=none; d=zohomail.com; s=zohoarc; b=JxeTtLugjxZo3eYSxy5AX1I5smz416dHE45PW8R6ud+ykNYph48MDJhPj4mKD10L4eNimuSSgN9Ysq5wsbLn8xqRSLjWdKEwCcaqrL7eaYk3lrMbjKRAbzs76AoNvDB3SnLDADJGCon6kKiBr0EfVdJEcxNWt/W9nBl7xdLMcrc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666171350; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=nSIUFlQmOU2ROoXIhgakfq5Mpk1CVmMwKwwhSTgbxXQ=; b=Ki9RuPTQqIwSN+fvBMCB54mJBHf65XOsq0IsAGoG2BeZv+wxVwjm0VVvFNK8HF+ZQs4CYSVsxEzzl9QPbocHxncOaTao7UK/Siu1tD6jTqPPIm13JUR/6DOXHkli/j8W/8jSCB5bo2yqwCnOP053KD5iZxx5jiLOfR8uZsK4p1w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95370+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 16661713507512.77706888128273; Wed, 19 Oct 2022 02:22:30 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id WDccYY1788612xeqONAyA40t; Wed, 19 Oct 2022 02:22:30 -0700 X-Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mx.groups.io with SMTP id smtpd.web11.5760.1666171349430959421 for ; Wed, 19 Oct 2022 02:22:29 -0700 X-Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 48E2FB80D47; Wed, 19 Oct 2022 09:22:27 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5714C433D6; Wed, 19 Oct 2022 09:22:23 +0000 (UTC) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Alexander Graf , Gerd Hoffmann , Sami Mujawar Subject: [edk2-devel] [PATCH v3 resend 01/11] ArmVirtPkg: remove EbcDxe from all platforms Date: Wed, 19 Oct 2022 11:22:01 +0200 Message-Id: <20221019092211.465699-2-ardb@kernel.org> In-Reply-To: <20221019092211.465699-1-ardb@kernel.org> References: <20221019092211.465699-1-ardb@kernel.org> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ardb@kernel.org X-Gm-Message-State: XhZvSNq3ptTZZTx3NNu8XgzDx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1666171350; bh=ZIodbJ479JGNv3L8WIKZPTFYcgUox2qoA1gLWZylsE8=; h=Cc:Date:From:Reply-To:Subject:To; b=mC3IBV5H0KsOxmeFLB/VIXWiqjQ0QxC2uL1uSsVFXedvFPmApx95lB38a1lJj20qajY jeiSEiz3bilOGo1enOSK6lpS4xQSNhaq8g11s3vuW4KYwVC55yFW1JI/HLy/YDWKKkd7l MWdi7JAzM+FWE/kJb/xJ6OfuOz1asGZdJMM= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1666171352301100006 Content-Type: text/plain; charset="utf-8" The EBC interpreter is rarely, if ever, used on ARM, and is especially pointless on virtual machines. So let's drop it from the builds. Signed-off-by: Ard Biesheuvel Reviewed-by: Leif Lindholm --- ArmVirtPkg/ArmVirt.dsc.inc | 5 ----- ArmVirtPkg/ArmVirtCloudHv.fdf | 5 ----- ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc | 5 ----- ArmVirtPkg/ArmVirtXen.fdf | 5 ----- 4 files changed, 20 deletions(-) diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc index c39e2506a3ea..34575585adbb 100644 --- a/ArmVirtPkg/ArmVirt.dsc.inc +++ b/ArmVirtPkg/ArmVirt.dsc.inc @@ -422,8 +422,3 @@ [Components.AARCH64] NULL|EmbeddedPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.inf } - - # - # EBC support - # - MdeModulePkg/Universal/EbcDxe/EbcDxe.inf diff --git a/ArmVirtPkg/ArmVirtCloudHv.fdf b/ArmVirtPkg/ArmVirtCloudHv.fdf index 81c539590a76..a5f172d79bfc 100644 --- a/ArmVirtPkg/ArmVirtCloudHv.fdf +++ b/ArmVirtPkg/ArmVirtCloudHv.fdf @@ -195,11 +195,6 @@ [FV.FvMain] INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf INF MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphic= sResourceTableDxe.inf INF ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf - - # - # EBC support - # - INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf !endif =20 # diff --git a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc b/ArmVirtPkg/ArmVirtQemuF= vMain.fdf.inc index d4df6dede0fe..787286133095 100644 --- a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc +++ b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc @@ -146,11 +146,6 @@ [FV.FvMain] INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf INF MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphic= sResourceTableDxe.inf INF OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf - - # - # EBC support - # - INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf !endif =20 # diff --git a/ArmVirtPkg/ArmVirtXen.fdf b/ArmVirtPkg/ArmVirtXen.fdf index 132480f03059..770fbf7289be 100644 --- a/ArmVirtPkg/ArmVirtXen.fdf +++ b/ArmVirtPkg/ArmVirtXen.fdf @@ -201,11 +201,6 @@ [FV.FvMain] !if $(ARCH) =3D=3D AARCH64 INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf INF ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf - - # - # EBC support - # - INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf !endif =20 # --=20 2.35.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#95370): https://edk2.groups.io/g/devel/message/95370 Mute This Topic: https://groups.io/mt/94427013/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 15 02:43:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+95369+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95369+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1666171349; cv=none; d=zohomail.com; s=zohoarc; b=GX83mb3OoSP20bUwC4v/1bi75YfUnbGf2LEsh29h8YlJFK7CYzVU/sRERqehLj2Zqwc5q51TGVGDgu2Uq+cJGL/7T+7Y7t7qNaMx4fjLLbYBGdXJwfcUXqac8+bpN+ILohqlXGpA5CfkCMMmxHEFAJTkfftTYOKiQ0yHfhSwoWg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666171349; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=Em4eW44ukrrFhxzGYusVIs9PRs+2DZGjaiAazeXkDQE=; b=AnpQdp/qZXV4NJOIHH43+0OBk22VT/skfQxW3H91U2pySeZbQQTXmrS0o3rnyDFfwAE3b8PsHy5+PBfiIhOHPkZyuhOzBI4qU3ltQb+iWv+E2dPq0H5K2uL/wnsX2DFc6eOrMgfpcpzsJmF86nUn+BDrC6Xdu4BIZ3WW63tzEI0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95369+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1666171349111863.4106611504402; Wed, 19 Oct 2022 02:22:29 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id zwjCYY1788612xQKNdyWIhgf; Wed, 19 Oct 2022 02:22:28 -0700 X-Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web09.5842.1666171348009091003 for ; Wed, 19 Oct 2022 02:22:28 -0700 X-Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5F8F4617B0; Wed, 19 Oct 2022 09:22:27 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72BDDC43470; Wed, 19 Oct 2022 09:22:25 +0000 (UTC) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Alexander Graf , Gerd Hoffmann , Sami Mujawar Subject: [edk2-devel] [PATCH v3 resend 02/11] ArmVirtPkg: do not enable iSCSI driver by default Date: Wed, 19 Oct 2022 11:22:02 +0200 Message-Id: <20221019092211.465699-3-ardb@kernel.org> In-Reply-To: <20221019092211.465699-1-ardb@kernel.org> References: <20221019092211.465699-1-ardb@kernel.org> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ardb@kernel.org X-Gm-Message-State: PmSNrJMcvuCDzUgzDDBDykvqx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1666171348; bh=AomJYD6/VnC714H3LS5BracghnmO1bkuslFXoDMkcnc=; h=Cc:Date:From:Reply-To:Subject:To; b=GtzhDL04gPHaeXHeU/NEOMZXbnws8RrDYKki8d+rTLrD7NI6TKJOnGL/GKKG4CQZgg2 zOgAyH9tjXj/aKMfMMKGmyh/Vvv/x4Q6XIgIxiDLnsinrLYGIFFP1veyBAAu43Yw2dVuu QBrMR6mDS/5CMpkN25OCH0qhTHViQTTmeb4= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1666171350255100001 Content-Type: text/plain; charset="utf-8" The iSCSI driver slows down the boot on a pristine variable store flash image, as it creates a couple of large EFI non-volatile variables to preserve state between boots. Since iSCSI boot for VMs is kind of niche anyway, let's default to disabled. If someone needs it in their build, they can use the -D build command option to re-enable it on the fly. Signed-off-by: Ard Biesheuvel Acked-by: Leif Lindholm --- ArmVirtPkg/ArmVirtQemu.dsc | 1 - ArmVirtPkg/ArmVirtQemuKernel.dsc | 1 - 2 files changed, 2 deletions(-) diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc index 9369a88858fd..45c4a8fc84e0 100644 --- a/ArmVirtPkg/ArmVirtQemu.dsc +++ b/ArmVirtPkg/ArmVirtQemu.dsc @@ -40,7 +40,6 @@ [Defines] DEFINE NETWORK_SNP_ENABLE =3D FALSE DEFINE NETWORK_TLS_ENABLE =3D FALSE DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS =3D TRUE - DEFINE NETWORK_ISCSI_ENABLE =3D TRUE =20 !if $(NETWORK_SNP_ENABLE) =3D=3D TRUE !error "NETWORK_SNP_ENABLE is IA32/X64/EBC only" diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKerne= l.dsc index 7f7d15d6eee3..66039f07f41b 100644 --- a/ArmVirtPkg/ArmVirtQemuKernel.dsc +++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc @@ -38,7 +38,6 @@ [Defines] DEFINE NETWORK_SNP_ENABLE =3D FALSE DEFINE NETWORK_TLS_ENABLE =3D FALSE DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS =3D TRUE - DEFINE NETWORK_ISCSI_ENABLE =3D TRUE =20 !if $(NETWORK_SNP_ENABLE) =3D=3D TRUE !error "NETWORK_SNP_ENABLE is IA32/X64/EBC only" --=20 2.35.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#95369): https://edk2.groups.io/g/devel/message/95369 Mute This Topic: https://groups.io/mt/94427012/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 15 02:43:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+95371+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95371+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1666171351; cv=none; d=zohomail.com; s=zohoarc; b=ejBRnF6Sm9SgwlWceGwc2azRr6Ewxs2HVgZaDxWqNZ9D1WcxNeckly2OVo6gaQc7vWUjoaQQHla6ICun0D+fG/qk/c24s5HbT//ID8aDZNTswfbuX3or3gDAsbYrDDzFD4WPilx/QGwHMfXbyFoQ47uW2LrSnNp69sFAHB6GaBI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666171351; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=SSJd0w0nPrOnkHxAE6b9OBxy4gGL9xPvvNfR9b4/qk8=; b=PYWjop/Ri0pJwDp4LoVH43ZCyxkhzUgeJ/iRLjXTERbqejqERbLFUCfashrDp5/veczikgpsIfTLZVYsyhnnnltdkYLkJA5LRtp+BSW2Oc6Zilgk62zbyftG7KwAwDmvro0dF7TqWl8zWnGgpdkT1JZGKQcHrVq+4sQY49RorpA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95371+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1666171351265491.0667840163957; Wed, 19 Oct 2022 02:22:31 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id vdtdYY1788612xHoeLXyqaqH; Wed, 19 Oct 2022 02:22:30 -0700 X-Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web08.5942.1666171350032450064 for ; Wed, 19 Oct 2022 02:22:30 -0700 X-Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8ACDF617DF; Wed, 19 Oct 2022 09:22:29 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F102C43143; Wed, 19 Oct 2022 09:22:27 +0000 (UTC) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Alexander Graf , Gerd Hoffmann , Sami Mujawar Subject: [edk2-devel] [PATCH v3 resend 03/11] ArmVirtPkg: make EFI_LOADER_DATA non-executable Date: Wed, 19 Oct 2022 11:22:03 +0200 Message-Id: <20221019092211.465699-4-ardb@kernel.org> In-Reply-To: <20221019092211.465699-1-ardb@kernel.org> References: <20221019092211.465699-1-ardb@kernel.org> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ardb@kernel.org X-Gm-Message-State: Yhs0p6mlFVkvLB6QSyKS1ps3x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1666171350; bh=9Yv4r2c+W3dg0RjGbiRv7AKqh48EVyR7m8ritr48WKQ=; h=Cc:Date:From:Reply-To:Subject:To; b=hsTe9LD8Vj/TItZm/FDj0ZT4YuCWQt6CrCbls/kLkxXXPNsBSJPZklwWJ5zR7E2uqpA 9qcRfcULTFxRt0exBskqv88JrAL2VPM2qJHGEJyh97G29TE9oHYvuhp7MqiuaPbmr8+LK uII4gOURVnYKcuuTRyfC0CJde6onCI2zRvQ= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1666171352295100003 Content-Type: text/plain; charset="utf-8" When the memory protections were implemented and enabled on ArmVirtQemu 5+ years ago, we had to work around the fact that GRUB at the time expected EFI_LOADER_DATA to be executable, as that is the memory type it allocates when loading its modules. This has been fixed in GRUB in August 2017, so by now, we should be able to tighten this, and remove execute permissions from EFI_LOADER_DATA allocations. Signed-off-by: Ard Biesheuvel --- ArmVirtPkg/ArmVirt.dsc.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc index 34575585adbb..462073517a22 100644 --- a/ArmVirtPkg/ArmVirt.dsc.inc +++ b/ArmVirtPkg/ArmVirt.dsc.inc @@ -368,7 +368,7 @@ [PcdsFixedAtBuild.common] # reserved ones, with the exception of LoaderData regions, of which OS l= oaders # (i.e., GRUB) may assume that its contents are executable. # - gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy|0xC0000000= 00007FD1 + gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy|0xC0000000= 00007FD5 =20 [Components.common] # --=20 2.35.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#95371): https://edk2.groups.io/g/devel/message/95371 Mute This Topic: https://groups.io/mt/94427014/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 15 02:43:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+95372+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95372+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1666171353; cv=none; d=zohomail.com; s=zohoarc; b=oEiE8ib/1yUU6fWkp6P8cOtcgBxm6C6DUP/5zmdqIt4dc1EoEJ1aNXAsdQ8qngq7mbkEpXvTShcrqGSx+YUFCRp8CTRNLivlYnEi/vbKcYuYAPKAZcPZ8fT0bVyuC3Krje9mvm4E7hmQePrxcDhmdaIZVIECyo7U1QpZy3l6Nzg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666171353; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=ZSsFTKJuVvm1keNNyfASudCZmt9zdyWqK+VBnd9bLxA=; b=le8Ltam+36qhaoLkeLNGdmrWpeKmfn0parTLwZOLSNgHpb0DnRP5CrMVPsFwx/hkugiQSfhFBZKOOi6UOn029y3Lp0X2nMVQ5xBaBeCtC7vCZL8x9+9MjM78yDfcoucsYSWsF+Dux2QAKISxE3IOukqQ1kU+0bIf6C1DhaZbAcE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95372+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1666171353071336.3758556495703; Wed, 19 Oct 2022 02:22:33 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id UQh3YY1788612xcC7N458oMI; Wed, 19 Oct 2022 02:22:32 -0700 X-Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web08.5943.1666171351944226668 for ; Wed, 19 Oct 2022 02:22:32 -0700 X-Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5A480617D4; Wed, 19 Oct 2022 09:22:31 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66437C433D6; Wed, 19 Oct 2022 09:22:29 +0000 (UTC) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Alexander Graf , Gerd Hoffmann , Sami Mujawar Subject: [edk2-devel] [PATCH v3 resend 04/11] ArmVirtPkg/ArmVirtQemu: wire up timeout PCD to Timeout variable Date: Wed, 19 Oct 2022 11:22:04 +0200 Message-Id: <20221019092211.465699-5-ardb@kernel.org> In-Reply-To: <20221019092211.465699-1-ardb@kernel.org> References: <20221019092211.465699-1-ardb@kernel.org> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ardb@kernel.org X-Gm-Message-State: pETlyDohBDeo0dsOKgfJjCcmx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1666171352; bh=NoNheNEtAu52Iyp3sHrQ6LhxfFGnXRDruQqKRpZCtOY=; h=Cc:Date:From:Reply-To:Subject:To; b=tE7ZubEIxIcQd7K8NHrr2hN3SorzzkIdnQ+8jk4tq76dOasmlfbQP3s4YVIAe9lA71J X1ergKeoaKd73zgIfurWrMUt2SoVijhpyE/6vrw5RTnGlxZQsoIcrdXRPkl4XDqkqcvDg 8xe6z+acoRwOi5iEFX2gIyaOeckwoa+o4BU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1666171354274100013 Content-Type: text/plain; charset="utf-8" Use the appropriate PCD definition in the ArmVirtQemu DSC so that the boot timeout is taken from the Timeout variable automatically, which is what Linux tools such as efibootmgr expect. Signed-off-by: Ard Biesheuvel --- ArmVirtPkg/ArmVirtQemu.dsc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc index 45c4a8fc84e0..302c0d2a4e29 100644 --- a/ArmVirtPkg/ArmVirtQemu.dsc +++ b/ArmVirtPkg/ArmVirtQemu.dsc @@ -292,6 +292,8 @@ [PcdsDynamicHii] gEfiSecurityPkgTokenSpaceGuid.PcdTpm2AcpiTableRev|L"TCG2_VERSION"|gTcg2C= onfigFormSetGuid|0x8|3|NV,BS !endif =20 + gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVar= iableGuid|0x0|5 + ##########################################################################= ###### # # Components Section - list of all EDK II Modules needed by this Platform --=20 2.35.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#95372): https://edk2.groups.io/g/devel/message/95372 Mute This Topic: https://groups.io/mt/94427015/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 15 02:43:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+95373+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95373+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1666171354; cv=none; d=zohomail.com; s=zohoarc; b=GkYSmYo+felgxTBhBrdRKmvMERkIyB7vWnYbu6EFoj3e8Fm9uIVPBRrVQjis13ZsXU3sg8SxC5K/qNHFEi+Bd2TJSUlqCON6rdkGdkCsyfhcBJ3LRvXfOqdkvxHXDV8IBzGSFU5PZFX+4xQXe0qvWbV8Dq+UDO4nDateNRN3LxE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666171354; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=huiMjcBZWBmCymYpCM2GkatE9ZaKinyYOoQEf/XV1Lo=; b=IT5UExGwUZkpKf1JrfsMziPBiNHUYx0RJIwCH0PxPM34BrR/q8LDfu/gjKufqtHWeIetZ1xa49FRBBN0Rr7DGK4E3j619s/adzuPq1JFatRnJd2HsSCyXXCvmuDYdCFLzaBAwryUWG6dPTLg/B599b6w2Tc4lkp9+b5amImBo84= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95373+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 166617135434783.86162256764499; Wed, 19 Oct 2022 02:22:34 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 8kEsYY1788612xiwCrce5cEd; Wed, 19 Oct 2022 02:22:34 -0700 X-Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web10.5947.1666171353225691976 for ; Wed, 19 Oct 2022 02:22:33 -0700 X-Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BBACF61802; Wed, 19 Oct 2022 09:22:32 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 374E2C43150; Wed, 19 Oct 2022 09:22:31 +0000 (UTC) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Alexander Graf , Gerd Hoffmann , Sami Mujawar Subject: [edk2-devel] [PATCH v3 resend 05/11] ArmVirtPkg/ArmVirtQemu: implement ArmPlatformLib with static ID map Date: Wed, 19 Oct 2022 11:22:05 +0200 Message-Id: <20221019092211.465699-6-ardb@kernel.org> In-Reply-To: <20221019092211.465699-1-ardb@kernel.org> References: <20221019092211.465699-1-ardb@kernel.org> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ardb@kernel.org X-Gm-Message-State: N1vzw7snsjJBXIgm4rHNq3M5x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1666171354; bh=ZpJJr0GYI6PqrWvtwHNj7BkluHfa1Mz2aUmVXwdvRq4=; h=Cc:Date:From:Reply-To:Subject:To; b=iyb+aIvUYrnl02hCRWir1vpnpYyVVdJd7QHb0H4NTnCOI5orn1kfelNzFmna2dRME9p 9uw8jUvM/M6DTXQzM+DRrfg//dJw6V06DmZ6I6pYYeFm9MFAyb/iD4gvz02J/WxdKA6Ct j14tY376tthc9PdZnn5yNeWh8507fqcNst0= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1666171356290100017 Content-Type: text/plain; charset="utf-8" To substantially reduce the amount of processing that takes place with the MMU and caches off, implement a version of ArmPlatformLib specific for QEMU/mach-virt in AArch64 mode that carries a statically allocated and populated ID map that covers the NOR flash and device region, and 128 MiB of DRAM at the base of memory (0x4000_0000). Note that 128 MiB has always been the minimum amount of DRAM we support for this configuration, and the existing code already ASSERT()s in DEBUG mode when booting with less. Signed-off-by: Ard Biesheuvel --- ArmVirtPkg/Library/ArmPlatformLibQemu/AArch64/ArmPlatformHelper.S | 115 ++= ++++++++++++++++++ ArmVirtPkg/Library/ArmPlatformLibQemu/ArmPlatformLibQemu.c | 64 ++= +++++++++ ArmVirtPkg/Library/ArmPlatformLibQemu/ArmPlatformLibQemu.inf | 40 ++= +++++ ArmVirtPkg/Library/ArmPlatformLibQemu/IdMap.S | 57 ++= ++++++++ 4 files changed, 276 insertions(+) diff --git a/ArmVirtPkg/Library/ArmPlatformLibQemu/AArch64/ArmPlatformHelpe= r.S b/ArmVirtPkg/Library/ArmPlatformLibQemu/AArch64/ArmPlatformHelper.S new file mode 100644 index 000000000000..05ccc7f9f043 --- /dev/null +++ b/ArmVirtPkg/Library/ArmPlatformLibQemu/AArch64/ArmPlatformHelper.S @@ -0,0 +1,115 @@ +// +// Copyright (c) 2022, Google LLC. All rights reserved. +// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// + +#include + + .macro mov_i, reg:req, imm:req + movz \reg, :abs_g3:\imm + movk \reg, :abs_g2_nc:\imm + movk \reg, :abs_g1_nc:\imm + movk \reg, :abs_g0_nc:\imm + .endm + + .set MAIR_DEV_nGnRnE, 0x00 + .set MAIR_MEM_NC, 0x44 + .set MAIR_MEM_WT, 0xbb + .set MAIR_MEM_WBWA, 0xff + .set mairval, MAIR_DEV_nGnRnE | (MAIR_MEM_NC << 8) | (MAIR_MEM_WT << 1= 6) | (MAIR_MEM_WBWA << 24) + + .set TCR_TG0_4KB, 0x0 << 14 + .set TCR_TG1_4KB, 0x2 << 30 + .set TCR_IPS_SHIFT, 32 + .set TCR_EPD1, 0x1 << 23 + .set TCR_SH_INNER, 0x3 << 12 + .set TCR_RGN_OWB, 0x1 << 10 + .set TCR_RGN_IWB, 0x1 << 8 + .set tcrval, TCR_TG0_4KB | TCR_TG1_4KB | TCR_EPD1 | TCR_RGN_OWB + .set tcrval, tcrval | TCR_RGN_IWB | TCR_SH_INNER + + .set SCTLR_ELx_I, 0x1 << 12 + .set SCTLR_ELx_SA, 0x1 << 3 + .set SCTLR_ELx_C, 0x1 << 2 + .set SCTLR_ELx_M, 0x1 << 0 + .set SCTLR_EL1_SPAN, 0x1 << 23 + .set SCTLR_EL1_WXN, 0x1 << 19 + .set SCTLR_EL1_SED, 0x1 << 8 + .set SCTLR_EL1_ITD, 0x1 << 7 + .set SCTLR_EL1_RES1, (0x1 << 11) | (0x1 << 20) | (0x1 << 22) | (0= x1 << 28) | (0x1 << 29) + .set sctlrval, SCTLR_ELx_M | SCTLR_ELx_C | SCTLR_ELx_SA | SCTLR_EL1_IT= D | SCTLR_EL1_SED + .set sctlrval, sctlrval | SCTLR_ELx_I | SCTLR_EL1_SPAN | SCTLR_EL1_RES1 + + +ASM_FUNC(ArmPlatformPeiBootAction) + mrs x0, CurrentEL // check current exception level + tbz x0, #3, 0f // bail if above EL1 + ret + +0:mov_i x0, mairval + mov_i x1, tcrval + adrp x2, idmap + orr x2, x2, #0xff << 48 // set non-zero ASID + mov_i x3, sctlrval + + mrs x6, id_aa64mmfr0_el1 // get the supported PA range + and x6, x6, #0xf // isolate PArange bits + cmp x6, #6 // 0b0110 =3D=3D 52 bits + sub x6, x6, #1 // subtract 1 + cinc x6, x6, ne // add back 1 unless PArange =3D=3D 52 bi= ts + bfi x1, x6, #32, #3 // copy updated PArange into TCR_EL1.IPS + + cmp x6, #3 // 0b0011 =3D=3D 42 bits + sub x6, x6, #1 // subtract 1 + cinc x6, x6, lt // add back 1 unless VA range >=3D 42 + + mov x7, #32 + sub x6, x7, x6, lsl #2 // T0SZ for PArange !=3D 42 + mov x7, #64 - 42 // T0SZ for PArange =3D=3D 42 + csel x6, x6, x7, ne + orr x1, x1, x6 // set T0SZ field in TCR + + cmp x6, #64 - 40 // VA size < 40 bits? + add x4, x2, #0x1000 // advance to level 1 descriptor + csel x2, x4, x2, gt + + msr mair_el1, x0 // set up the 1:1 mapping + msr tcr_el1, x1 + msr ttbr0_el1, x2 + isb + + tlbi vmalle1 // invalidate any cached translations + ic iallu // invalidate the I-cache + dsb nsh + isb + + msr sctlr_el1, x3 // enable MMU and caches + isb + ret + +//UINTN +//ArmPlatformGetCorePosition ( +// IN UINTN MpId +// ); +// With this function: CorePos =3D (ClusterId * 4) + CoreId +ASM_FUNC(ArmPlatformGetCorePosition) + mov x0, xzr + ret + +//UINTN +//ArmPlatformGetPrimaryCoreMpId ( +// VOID +// ); +ASM_FUNC(ArmPlatformGetPrimaryCoreMpId) + MOV32 (w0, FixedPcdGet32 (PcdArmPrimaryCore)) + ret + +//UINTN +//ArmPlatformIsPrimaryCore ( +// IN UINTN MpId +// ); +ASM_FUNC(ArmPlatformIsPrimaryCore) + mov x0, #1 + ret diff --git a/ArmVirtPkg/Library/ArmPlatformLibQemu/ArmPlatformLibQemu.c b/A= rmVirtPkg/Library/ArmPlatformLibQemu/ArmPlatformLibQemu.c new file mode 100644 index 000000000000..1de80422ee4c --- /dev/null +++ b/ArmVirtPkg/Library/ArmPlatformLibQemu/ArmPlatformLibQemu.c @@ -0,0 +1,64 @@ +/** @file + + Copyright (c) 2011-2012, ARM Limited. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include + +/** + Return the current Boot Mode. + + This function returns the boot reason on the platform + + @return Return the current Boot Mode of the platform + +**/ +EFI_BOOT_MODE +ArmPlatformGetBootMode ( + VOID + ) +{ + return BOOT_WITH_FULL_CONFIGURATION; +} + +/** + Initialize controllers that must setup in the normal world. + + This function is called by the ArmPlatformPkg/PrePi or + ArmPlatformPkg/PlatformPei in the PEI phase. + + @param[in] MpId ID of the calling CPU + + @return RETURN_SUCCESS unless the operation failed +**/ +RETURN_STATUS +ArmPlatformInitialize ( + IN UINTN MpId + ) +{ + return RETURN_SUCCESS; +} + +/** + Return the Platform specific PPIs. + + This function exposes the Platform Specific PPIs. They can be used by any + PrePi modules or passed to the PeiCore by PrePeiCore. + + @param[out] PpiListSize Size in Bytes of the Platform PPI List + @param[out] PpiList Platform PPI List + +**/ +VOID +ArmPlatformGetPlatformPpiList ( + OUT UINTN *PpiListSize, + OUT EFI_PEI_PPI_DESCRIPTOR **PpiList + ) +{ + *PpiListSize =3D 0; + *PpiList =3D NULL; +} diff --git a/ArmVirtPkg/Library/ArmPlatformLibQemu/ArmPlatformLibQemu.inf b= /ArmVirtPkg/Library/ArmPlatformLibQemu/ArmPlatformLibQemu.inf new file mode 100644 index 000000000000..b2ecdfa061cb --- /dev/null +++ b/ArmVirtPkg/Library/ArmPlatformLibQemu/ArmPlatformLibQemu.inf @@ -0,0 +1,40 @@ +## @file +# ArmPlatformLib implementation for QEMU/mach-virt on AArch64 that contai= ns a +# statically allocated 1:1 mapping of the first 128 MiB of DRAM, as well = as +# the NOR flash and the device region +# +# Copyright (c) 2011-2012, ARM Limited. All rights reserved. +# Copyright (c) 2022, Google LLC. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 1.27 + BASE_NAME =3D ArmPlatformLibQemu + FILE_GUID =3D 40af3a25-f02c-4aef-94ef-7ac0282d21d4 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D ArmPlatformLib + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + +[LibraryClasses] + ArmLib + DebugLib + +[Sources.common] + ArmPlatformLibQemu.c + IdMap.S + +[Sources.AArch64] + AArch64/ArmPlatformHelper.S + +[FixedPcd] + gArmTokenSpaceGuid.PcdArmPrimaryCoreMask + gArmTokenSpaceGuid.PcdArmPrimaryCore diff --git a/ArmVirtPkg/Library/ArmPlatformLibQemu/IdMap.S b/ArmVirtPkg/Lib= rary/ArmPlatformLibQemu/IdMap.S new file mode 100644 index 000000000000..4a4b7b77ed83 --- /dev/null +++ b/ArmVirtPkg/Library/ArmPlatformLibQemu/IdMap.S @@ -0,0 +1,57 @@ +// SPDX-License-Identifier: BSD-2-Clause-Patent +// Copyright 2022 Google LLC +// Author: Ard Biesheuvel + + .set TT_TYPE_BLOCK, 0x1 + .set TT_TYPE_PAGE, 0x3 + .set TT_TYPE_TABLE, 0x3 + + .set TT_AF, 0x1 << 10 + .set TT_NG, 0x1 << 11 + .set TT_RO, 0x2 << 6 + .set TT_XN, 0x3 << 53 + + .set TT_MT_DEV, 0x0 << 2 // MAIR #0 + .set TT_MT_MEM, (0x3 << 2) | (0x3 << 8) // MAIR #3 + + .set PAGE_XIP, TT_TYPE_PAGE | TT_MT_MEM | TT_AF | TT_RO | TT_NG + .set BLOCK_DEV, TT_TYPE_BLOCK | TT_MT_DEV | TT_AF | TT_XN | TT_NG + .set BLOCK_MEM, TT_TYPE_BLOCK | TT_MT_MEM | TT_AF | TT_XN | TT_NG + + .globl idmap + .section ".rodata.idmap", "a", %progbits + .align 12 + +idmap: /* level 0 */ + .quad 1f + TT_TYPE_TABLE + .fill 511, 8, 0x0 + +1: /* level 1 */ + .quad 20f + TT_TYPE_TABLE // 1 GB of flash and device mapp= ings + .quad 21f + TT_TYPE_TABLE // up to 1 GB of DRAM + .fill 510, 8, 0x0 // 510 GB of remaining VA space + +20: /* level 2 */ + .quad 3f + TT_TYPE_TABLE // up to 2 MB of flash + .fill 63, 8, 0x0 // 126 MB of unused flash + .set idx, 64 + .rept 448 + .quad BLOCK_DEV | (idx << 21) // 896 MB of RW- device mappings + .set idx, idx + 1 + .endr + +21: /* level 2 */ + .set idx, 0x40000000 >> 21 + .rept 64 + .quad BLOCK_MEM | (idx << 21) // 128 MB of RW- memory mappings + .set idx, idx + 1 + .endr + .fill 448, 8, 0x0 + +3: /* level 3 */ + .quad 0x0 // omit first 4k page + .set idx, 1 + .rept 511 + .quad PAGE_XIP | (idx << 12) // 2044 KiB of R-X flash mappings + .set idx, idx + 1 + .endr --=20 2.35.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#95373): https://edk2.groups.io/g/devel/message/95373 Mute This Topic: https://groups.io/mt/94427016/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 15 02:43:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+95374+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95374+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1666171357; cv=none; d=zohomail.com; s=zohoarc; b=Cu1XtWHknYbKCahcvwXTdc3H58OF7FMUZ7X8d4ZheBGexrJa/i6NTYHZxsiUdhv22NEZLODmkk9l/eWRZvd4LOMBrr+waa5+XSts2v8JMQQt+GL0Z5IWAroynNk2KI+ZmtwyEdo5bLsl7bNf3rriKNNyUuCmCCSQNm4eWcNoEug= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666171357; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=FpGalcAti8o6IxQBAY0c4Al7Mc/kmPOSfz6jGxrM8Jc=; b=HNG272a9Z52T2fFHOAWTJD0z8nTFiHFFZNidm3r09ScjAreE+5HVhS2Em/p76isie50G8XyP69J8jLTgSKXLK665WqEBOET1jTgJg80r4cR9THobgv8wevZTuOyXMfTrojNL0wdwktOFS7Zdzefaau+dlSTFlrwGC4QPj/1eepE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95374+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 166617135760984.45692894885781; Wed, 19 Oct 2022 02:22:37 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id EuoDYY1788612xrIESjPXw4P; Wed, 19 Oct 2022 02:22:37 -0700 X-Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mx.groups.io with SMTP id smtpd.web08.5944.1666171356243007568 for ; Wed, 19 Oct 2022 02:22:36 -0700 X-Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A82D7B80D47; Wed, 19 Oct 2022 09:22:34 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04ECDC433C1; Wed, 19 Oct 2022 09:22:32 +0000 (UTC) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Alexander Graf , Gerd Hoffmann , Sami Mujawar Subject: [edk2-devel] [PATCH v3 resend 06/11] ArmVirtPkg/ArmVirtQemu: use first 128 MiB as permanent PEI memory Date: Wed, 19 Oct 2022 11:22:06 +0200 Message-Id: <20221019092211.465699-7-ardb@kernel.org> In-Reply-To: <20221019092211.465699-1-ardb@kernel.org> References: <20221019092211.465699-1-ardb@kernel.org> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ardb@kernel.org X-Gm-Message-State: TZXc4rHOcFcgPKDmMBD3hjQ5x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1666171357; bh=w5Pt0wJLAmKQSskgNaYTRC1iAUtuSdT7uhQZNx2H+TQ=; h=Cc:Date:From:Reply-To:Subject:To; b=MHOB/Pt+N7gjGqVsulCXGZ9JsNy4T23Ey+fJ2wZg4VoB2dEaXIH1MWK7KLV9hgB5vF6 DScar0ZTsCS1t46apncCcpdYrHuQOcutm7rdFAczmxIL4rE450FeHHwP61WsUnifQgyjH xREEg4I1CqxrPwgHCLV3YUzK3cTwNoqTbWA= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1666171358309100021 Content-Type: text/plain; charset="utf-8" In order to allow booting with the MMU and caches enabled really early, we need to ensure that the code that populates the page tables can access those page tables with the statically defined ID map active. So let's put the permanent PEI RAM in the first 128 MiB of memory, which we will cover with this initial ID map (as it is the minimum supported DRAM size for ArmVirtQemu). Signed-off-by: Ard Biesheuvel --- ArmVirtPkg/MemoryInitPei/MemoryInitPeim.c | 104 ++++++++++++++++++++ ArmVirtPkg/MemoryInitPei/MemoryInitPeim.inf | 59 +++++++++++ 2 files changed, 163 insertions(+) diff --git a/ArmVirtPkg/MemoryInitPei/MemoryInitPeim.c b/ArmVirtPkg/MemoryI= nitPei/MemoryInitPeim.c new file mode 100644 index 000000000000..ef88a9df1d62 --- /dev/null +++ b/ArmVirtPkg/MemoryInitPei/MemoryInitPeim.c @@ -0,0 +1,104 @@ +/** @file + + Copyright (c) 2011, ARM Limited. All rights reserved. + Copyright (c) 2022, Google LLC. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include +#include +#include + +EFI_STATUS +EFIAPI +MemoryPeim ( + IN EFI_PHYSICAL_ADDRESS UefiMemoryBase, + IN UINT64 UefiMemorySize + ); + +/** + Build the memory type information HOB that describes how many pages of e= ach + type to preallocate when initializing the GCD memory map. +**/ +VOID +EFIAPI +BuildMemoryTypeInformationHob ( + VOID + ) +{ + EFI_MEMORY_TYPE_INFORMATION Info[10]; + + Info[0].Type =3D EfiACPIReclaimMemory; + Info[0].NumberOfPages =3D FixedPcdGet32 (PcdMemoryTypeEfiACPIReclaimMemo= ry); + Info[1].Type =3D EfiACPIMemoryNVS; + Info[1].NumberOfPages =3D FixedPcdGet32 (PcdMemoryTypeEfiACPIMemoryNVS); + Info[2].Type =3D EfiReservedMemoryType; + Info[2].NumberOfPages =3D FixedPcdGet32 (PcdMemoryTypeEfiReservedMemoryT= ype); + Info[3].Type =3D EfiRuntimeServicesData; + Info[3].NumberOfPages =3D FixedPcdGet32 (PcdMemoryTypeEfiRuntimeServices= Data); + Info[4].Type =3D EfiRuntimeServicesCode; + Info[4].NumberOfPages =3D FixedPcdGet32 (PcdMemoryTypeEfiRuntimeServices= Code); + Info[5].Type =3D EfiBootServicesCode; + Info[5].NumberOfPages =3D FixedPcdGet32 (PcdMemoryTypeEfiBootServicesCod= e); + Info[6].Type =3D EfiBootServicesData; + Info[6].NumberOfPages =3D FixedPcdGet32 (PcdMemoryTypeEfiBootServicesDat= a); + Info[7].Type =3D EfiLoaderCode; + Info[7].NumberOfPages =3D FixedPcdGet32 (PcdMemoryTypeEfiLoaderCode); + Info[8].Type =3D EfiLoaderData; + Info[8].NumberOfPages =3D FixedPcdGet32 (PcdMemoryTypeEfiLoaderData); + + // Terminator for the list + Info[9].Type =3D EfiMaxMemoryType; + Info[9].NumberOfPages =3D 0; + + BuildGuidDataHob (&gEfiMemoryTypeInformationGuid, &Info, sizeof (Info)); +} + +/** + Module entry point. + + @param[in] FileHandle Handle of the file being invoked. + @param[in] PeiServices Describes the list of possible PEI Services. + + @return EFI_SUCCESS unless the operation failed. +**/ +EFI_STATUS +EFIAPI +InitializeMemory ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ) +{ + UINTN UefiMemoryBase; + EFI_STATUS Status; + + ASSERT (FixedPcdGet64 (PcdSystemMemoryBase) < (UINT64)MAX_ALLOC_ADDRESS); + + // + // Put the permanent PEI memory in the first 128 MiB of DRAM so that + // it is covered by the statically configured ID map. + // + UefiMemoryBase =3D (UINTN)FixedPcdGet64 (PcdSystemMemoryBase) + SIZE_128= MB + - FixedPcdGet32 (PcdSystemMemoryUefiRegionSize); + + Status =3D PeiServicesInstallPeiMemory ( + UefiMemoryBase, + FixedPcdGet32 (PcdSystemMemoryUefiRegionSize) + ); + ASSERT_EFI_ERROR (Status); + + Status =3D MemoryPeim ( + UefiMemoryBase, + FixedPcdGet32 (PcdSystemMemoryUefiRegionSize) + ); + ASSERT_EFI_ERROR (Status); + + return Status; +} diff --git a/ArmVirtPkg/MemoryInitPei/MemoryInitPeim.inf b/ArmVirtPkg/Memor= yInitPei/MemoryInitPeim.inf new file mode 100644 index 000000000000..2039f71a0ebe --- /dev/null +++ b/ArmVirtPkg/MemoryInitPei/MemoryInitPeim.inf @@ -0,0 +1,59 @@ +## @file +# Implementation of MemoryInitPeim that uses the first 128 MiB at the bas= e of +# DRAM as permanent PEI memory +# +# Copyright (c) 2011-2014, ARM Ltd. All rights reserved.
+# Copyright (c) 2022, Google LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 1.27 + BASE_NAME =3D MemoryInit + FILE_GUID =3D 0fbffd44-f98f-4e1c-9922-e9b21f13c3f8 + MODULE_TYPE =3D PEIM + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D InitializeMemory + +[Sources] + MemoryInitPeim.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + EmbeddedPkg/EmbeddedPkg.dec + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + +[LibraryClasses] + PeimEntryPoint + DebugLib + HobLib + ArmLib + ArmPlatformLib + MemoryInitPeiLib + +[Guids] + gEfiMemoryTypeInformationGuid + +[FeaturePcd] + gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob + +[FixedPcd] + gArmTokenSpaceGuid.PcdSystemMemoryBase + gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize + + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData + +[Depex] + TRUE --=20 2.35.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#95374): https://edk2.groups.io/g/devel/message/95374 Mute This Topic: https://groups.io/mt/94427018/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 15 02:43:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+95375+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95375+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1666171359; cv=none; d=zohomail.com; s=zohoarc; b=SaXkFDATVsAhQk79+hgyS9+RA581872QIzZlB6dhwUD+r0N/by6+Uhh4P8POJUkiX1GKxEjz00Wt5HnEOxnNDkf5TjczDUTowQlafTHK8Z2Blkx/ZfIna3oin1BinWBX1qrh2qQqx4lYjjEp52m9/J0M1BSXwgkN1ulfk/1LIyo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666171359; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=Dst5PblV8bxeTxD80WcxSNQqQg6I7mRRMEMtCmBkAQk=; b=WBvFge8TPCdT8HKUA064TCYnab9wgZ3jJ0HAH/IAVVux6j7qhRHSS8ovm74BVr9h7ieDFBKDWNqpP4kMK7ZwbnN7eGEoVlSts1Tp1oOpgHLP5topy6sNO/vjDS+gAVoJOE9+kUijUOSLFS0brYHIN8trY8NOQLA+/MFmpKzVcpI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95375+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1666171359616113.62776110830464; Wed, 19 Oct 2022 02:22:39 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id RzvNYY1788612x9hN1Un17an; Wed, 19 Oct 2022 02:22:39 -0700 X-Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web12.5882.1666171358272817197 for ; Wed, 19 Oct 2022 02:22:38 -0700 X-Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 78ED9617ED; Wed, 19 Oct 2022 09:22:37 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5954C43143; Wed, 19 Oct 2022 09:22:34 +0000 (UTC) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Alexander Graf , Gerd Hoffmann , Sami Mujawar Subject: [edk2-devel] [PATCH v3 resend 07/11] ArmVirtPkg/ArmVirtQemu: enable initial ID map at early boot Date: Wed, 19 Oct 2022 11:22:07 +0200 Message-Id: <20221019092211.465699-8-ardb@kernel.org> In-Reply-To: <20221019092211.465699-1-ardb@kernel.org> References: <20221019092211.465699-1-ardb@kernel.org> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ardb@kernel.org X-Gm-Message-State: y51IsVq6Olp9KPBB7davfQZ4x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1666171359; bh=Vbj+FPWHl6vztqFsGuN+jEgPTVdxf4lclEcybYcCEIM=; h=Cc:Date:From:Reply-To:Subject:To; b=RCSBG3WyePfdvTaKEFbpBBYcmYuopP6+8K6xxjErAfiT5gw7H0kGzmYijCTcKM3x0e1 8A5hoaY1XOJIRxmopv1EqhZbpVGX/oHoDouAZrAHli8HAPBv/wEjE7BfOLjBCtJ91Wndk Y1BbtZqYlxopQFdWb4Y1BwDKQEsQG8hCJF0= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1666171360304100024 Content-Type: text/plain; charset="utf-8" Now that we have all the pieces in place, switch the AArch64 version of ArmVirtQemu to a mode where the first thing it does out of reset is enable a preliminary ID map that covers the NOR flash and sufficient DRAM to create the UEFI page tables as usual. The advantage of this is that no manipulation of memory occurs any longer before the MMU is enabled, which removes the need for explicit coherency management, which is cumbersome and bad for performance. It also means we no longer need to build all components that may execute with the MMU off (including BASE libraries) with strict alignment. Signed-off-by: Ard Biesheuvel --- ArmVirtPkg/ArmVirtQemu.dsc | 17 ++++++++++++++--- ArmVirtPkg/ArmVirtQemu.fdf | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc index 302c0d2a4e29..21a321e35794 100644 --- a/ArmVirtPkg/ArmVirtQemu.dsc +++ b/ArmVirtPkg/ArmVirtQemu.dsc @@ -63,8 +63,6 @@ [LibraryClasses.common] QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFw= CfgSimpleParserLib.inf QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoad= ImageLib.inf =20 - ArmPlatformLib|ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibN= ull.inf - TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf NorFlashPlatformLib|ArmVirtPkg/Library/NorFlashQemuLib/NorFlashQemuLib.i= nf =20 @@ -92,6 +90,12 @@ [LibraryClasses.common] TpmPlatformHierarchyLib|SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLi= bNull/PeiDxeTpmPlatformHierarchyLib.inf !endif =20 +[LibraryClasses.AARCH64] + ArmPlatformLib|ArmVirtPkg/Library/ArmPlatformLibQemu/ArmPlatformLibQemu.= inf + +[LibraryClasses.ARM] + ArmPlatformLib|ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibN= ull.inf + [LibraryClasses.common.PEIM] ArmVirtMemInfoLib|ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoP= eiLib.inf =20 @@ -112,6 +116,8 @@ [LibraryClasses.common.UEFI_DRIVER] UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf =20 [BuildOptions] + GCC:*_*_AARCH64_CC_XIPFLAGS =3D -mno-strict-align + !include NetworkPkg/NetworkBuildOptions.dsc.inc =20 ##########################################################################= ###### @@ -310,7 +316,12 @@ [Components.common] PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf } ArmPlatformPkg/PlatformPei/PlatformPeim.inf - ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf + ArmVirtPkg/MemoryInitPei/MemoryInitPeim.inf { + +!if $(ARCH) =3D=3D AARCH64 + ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf +!endif + } ArmPkg/Drivers/CpuPei/CpuPei.inf =20 MdeModulePkg/Universal/Variable/Pei/VariablePei.inf diff --git a/ArmVirtPkg/ArmVirtQemu.fdf b/ArmVirtPkg/ArmVirtQemu.fdf index b5e2253295fe..7f17aeb3ad0d 100644 --- a/ArmVirtPkg/ArmVirtQemu.fdf +++ b/ArmVirtPkg/ArmVirtQemu.fdf @@ -107,7 +107,7 @@ [FV.FVMAIN_COMPACT] INF ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf INF MdeModulePkg/Core/Pei/PeiMain.inf INF ArmPlatformPkg/PlatformPei/PlatformPeim.inf - INF ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf + INF ArmVirtPkg/MemoryInitPei/MemoryInitPeim.inf INF ArmPkg/Drivers/CpuPei/CpuPei.inf INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf --=20 2.35.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#95375): https://edk2.groups.io/g/devel/message/95375 Mute This Topic: https://groups.io/mt/94427019/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 15 02:43:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+95376+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95376+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1666171360; cv=none; d=zohomail.com; s=zohoarc; b=GHivXAdaNOa9GkF5PtemRT+ix/Pc8jVTFvJ5y7kq9FhbQIm1pJxTszmKCDNtebFucqTgak+Qf+UflCOshRCKTr4Z/H6R2T6auMKOCA+B3+CqgLafTckvphkRVw+QleC8SKTtZflNgFTICeNoFga0Y5DJ00lGEm6OYj6IwSoXCjo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666171360; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=uBU0YAChB6Etohkg0HxYB9smmd7KX56P3LpeYUmplw8=; b=JZ9UVc/Y884DkHuGc1MmR2QEYvRnFoP4PUY3fDwM+70IughUZI2OWLlEFpBACvmzDhL0nm3ASBvMjv/vKLIote2DgSbgPI3n9cTKbbr6maFBd/fFHHT+ncoU6F+oIJArzKqHt0RkBLSEzjYYsrwJjmQqqsHI+B50GBn6N/z0vJ4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95376+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1666171360840333.52783899456347; Wed, 19 Oct 2022 02:22:40 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 9EepYY1788612x2Teb0CLY4a; Wed, 19 Oct 2022 02:22:40 -0700 X-Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mx.groups.io with SMTP id smtpd.web08.5945.1666171359671920038 for ; Wed, 19 Oct 2022 02:22:39 -0700 X-Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4C188B82471; Wed, 19 Oct 2022 09:22:38 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91E77C43151; Wed, 19 Oct 2022 09:22:36 +0000 (UTC) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Alexander Graf , Gerd Hoffmann , Sami Mujawar Subject: [edk2-devel] [PATCH v3 resend 08/11] ArmVirtPkg/ArmVirtQemu: Drop unused variable PEIM Date: Wed, 19 Oct 2022 11:22:08 +0200 Message-Id: <20221019092211.465699-9-ardb@kernel.org> In-Reply-To: <20221019092211.465699-1-ardb@kernel.org> References: <20221019092211.465699-1-ardb@kernel.org> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ardb@kernel.org X-Gm-Message-State: IDZVG0vBU2u0FwH53Qy2fRnfx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1666171360; bh=5+GBStxvVhiZET2741Tujn6kn5eJ1L4hvZ43C+OySsc=; h=Cc:Date:From:Reply-To:Subject:To; b=xJH0eeVN5OMOpM2Uktyk4NkzN72Y49Tt02MAloTS/OwxkckyS3ng7KdScTQdPMrNzam q7NJoi5+DUZ8oOGPhB28AtUeuKEYqLL5mT/4GPEDkfHRy8rL8LKOAjUTpwhWCrqDCIguX 7ncIDepoKUNumi/FX5GFp7BjmoPZMyYkFk4= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1666171362285100030 Content-Type: text/plain; charset="utf-8" The variable PEIM is included in the build but its runtime prerequisites are absent so it is never dispatched. Just drop it. Signed-off-by: Ard Biesheuvel --- ArmVirtPkg/ArmVirtQemu.dsc | 2 -- ArmVirtPkg/ArmVirtQemu.fdf | 1 - 2 files changed, 3 deletions(-) diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc index 21a321e35794..de34481673ea 100644 --- a/ArmVirtPkg/ArmVirtQemu.dsc +++ b/ArmVirtPkg/ArmVirtQemu.dsc @@ -324,8 +324,6 @@ [Components.common] } ArmPkg/Drivers/CpuPei/CpuPei.inf =20 - MdeModulePkg/Universal/Variable/Pei/VariablePei.inf - !if $(TPM2_ENABLE) =3D=3D TRUE MdeModulePkg/Universal/ResetSystemPei/ResetSystemPei.inf { diff --git a/ArmVirtPkg/ArmVirtQemu.fdf b/ArmVirtPkg/ArmVirtQemu.fdf index 7f17aeb3ad0d..c85e36b185d3 100644 --- a/ArmVirtPkg/ArmVirtQemu.fdf +++ b/ArmVirtPkg/ArmVirtQemu.fdf @@ -110,7 +110,6 @@ [FV.FVMAIN_COMPACT] INF ArmVirtPkg/MemoryInitPei/MemoryInitPeim.inf INF ArmPkg/Drivers/CpuPei/CpuPei.inf INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf - INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf =20 !if $(TPM2_ENABLE) =3D=3D TRUE --=20 2.35.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#95376): https://edk2.groups.io/g/devel/message/95376 Mute This Topic: https://groups.io/mt/94427020/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 15 02:43:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+95377+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95377+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1666171363; cv=none; d=zohomail.com; s=zohoarc; b=jgXaNIklQGltdhTC6Jk78D44BjTJD69fGk74+cFX+UKeLmh2+tfWbuqSxTw3zQks9DXzfnjfX/Rrp3pl5qqyrXNBsxKDxob4jnJxHg8KQjk+YB2YsIAN1jCKZ1yq+PCSAv7ZsKSkvRRAno9rYBa4dmB/VFxFOlxnTX4ImbkcX4c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666171363; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=SnDRhqf8tiSMwPggzRCWp3LxC8/D/ASwXgElp26oeM0=; b=j/59MTqKM2Ce12F0fzoE+PMZiFyVjiId2klM2wseiW6MSjhnpmLr/XaRSQN8W3etdssQZfh2gEhgu+t4+RnIs5Cb6yAb5EiizxDtyOFl0eNyZpkJbZvIr5Psiv4PHz94B8wBSxwcSoH8zpSFozk3wDrEbzoxc8OAIaRyyGo20gI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95377+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1666171363780419.9660973541181; Wed, 19 Oct 2022 02:22:43 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id IpBIYY1788612xIp0tMzxM2H; Wed, 19 Oct 2022 02:22:43 -0700 X-Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mx.groups.io with SMTP id smtpd.web11.5761.1666171362502456752 for ; Wed, 19 Oct 2022 02:22:42 -0700 X-Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 04F08B82465; Wed, 19 Oct 2022 09:22:41 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EB00C43470; Wed, 19 Oct 2022 09:22:38 +0000 (UTC) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Alexander Graf , Gerd Hoffmann , Sami Mujawar Subject: [edk2-devel] [PATCH v3 resend 09/11] ArmVirtPkg/ArmVirtQemu: avoid shadowing PEIMs unless necessary Date: Wed, 19 Oct 2022 11:22:09 +0200 Message-Id: <20221019092211.465699-10-ardb@kernel.org> In-Reply-To: <20221019092211.465699-1-ardb@kernel.org> References: <20221019092211.465699-1-ardb@kernel.org> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ardb@kernel.org X-Gm-Message-State: 64WRXcPARiWu26WJlulBNk5Qx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1666171363; bh=jmheSJ8BrtBSBsI8+C04ewp3oJ2aXeio9qTQK56ILSw=; h=Cc:Date:From:Reply-To:Subject:To; b=jvX4nnBamb4oAunxR4ZooNWuY4BnNtgVvlXh7HXS+pfaK7dwSW30gHOEdrudpy+OGZ0 bgwd4ss1oCuYasXEw75b/+i0TXMhmWhunoYQE4ES0ye/MD8aLBmqmCAl4g9r9zrMnI38F 25zAnwJJOOKuSe141PKjEUY2cTDuISn3n5U= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1666171364328100033 Content-Type: text/plain; charset="utf-8" Some PEIMs register for shadow execution explicitly, but others exist that don't care and can happily execute in place. Since the emulated NOR flash is just RAM, shadowing has no performance benefits so let's only do this if needed. Signed-off-by: Ard Biesheuvel --- ArmVirtPkg/ArmVirtQemu.dsc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc index de34481673ea..c3d264077bce 100644 --- a/ArmVirtPkg/ArmVirtQemu.dsc +++ b/ArmVirtPkg/ArmVirtQemu.dsc @@ -217,6 +217,9 @@ [PcdsFixedAtBuild.common] gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|3 gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize|0x20000 =20 + # Shadowing PEI modules is absolutely pointless when the NOR flash is em= ulated + gEfiMdeModulePkgTokenSpaceGuid.PcdShadowPeimOnBoot|FALSE + [PcdsFixedAtBuild.AARCH64] # Clearing BIT0 in this PCD prevents installing a 32-bit SMBIOS entry po= int, # if the entry point version is >=3D 3.0. AARCH64 OSes cannot assume the --=20 2.35.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#95377): https://edk2.groups.io/g/devel/message/95377 Mute This Topic: https://groups.io/mt/94427021/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 15 02:43:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+95378+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95378+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1666171365; cv=none; d=zohomail.com; s=zohoarc; b=CnUXaBhj84bPsw6ViYeqJC8ErejDaYMNVqEGVA4izhGU0S3zLg1ok0QX1yZMC63e48lmdbjNkIjdDOvjFeeL4ve4lsfhHR9wRApcESRpJMnN6SLVj2WPkNG2MmBcCLdMK040JErsrSL19567yGlQcIVwsFHBelAzNoI5DZm9At4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666171365; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=9s4zUhBG8WYbvlLaIf2gwQR/v7ivjz8u9bjPH0RhM8I=; b=l0sWjX71WdUq9Bdd2BssL5xOJMsBdWzBaGPSrkwymqBAorMAGvQ2OVJhdgz/mD/D7a0QGSDm7OVhYs+VArHnb6wABy6Qq6ST22fZPgvJO/ZbMwc723srk8hYYobENr9B26XvaAE0JFO9t0rj+AeHXiw2us/kWcBZXsRQITVzxhQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95378+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1666171365791836.1244656024636; Wed, 19 Oct 2022 02:22:45 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id EroJYY1788612xvXobJeEUHY; Wed, 19 Oct 2022 02:22:45 -0700 X-Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mx.groups.io with SMTP id smtpd.web10.5949.1666171364274379741 for ; Wed, 19 Oct 2022 02:22:44 -0700 X-Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C387CB81D14; Wed, 19 Oct 2022 09:22:42 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2ABA6C43142; Wed, 19 Oct 2022 09:22:40 +0000 (UTC) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Alexander Graf , Gerd Hoffmann , Sami Mujawar Subject: [edk2-devel] [PATCH v3 resend 10/11] ArmVirtPkg/QemuVirtMemInfoLib: use HOB not PCD to record the memory size Date: Wed, 19 Oct 2022 11:22:10 +0200 Message-Id: <20221019092211.465699-11-ardb@kernel.org> In-Reply-To: <20221019092211.465699-1-ardb@kernel.org> References: <20221019092211.465699-1-ardb@kernel.org> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ardb@kernel.org X-Gm-Message-State: zXX8chUqmzrGeJFfIFVyO37Dx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1666171365; bh=wtRjy0QIH5q3ey2Y0haWtpl2BJfSyqvBLtlXJia/1Vs=; h=Cc:Date:From:Reply-To:Subject:To; b=lceuZvLN6bvGd8gjDGPq3gvkBSncX6hXjN6gcdluWVhOZ2BNjRqMkh5vmLA6TGtepoR AmmwRnToBgu0cW/SqPI5uCBdxVE12j1glp+1ozJG8ajzboE387jpInlvuZRJiIQ3bIu41 exUtbDZYdbpTkejJg1Q1SyKASoJwZ9amKwE= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1666171366371100037 Content-Type: text/plain; charset="utf-8" Due to the way we inherited the formerly fixed PCDs to describe the system memory base and size from ArmPlatformPkg, we ended up with a MemoryInit PEIM that relies on dynamic PCDs to communicate the size of system memory between the constructor of one of its library dependencies and the core module. This is unnecessary, and forces us to incorporate the PCD PEIM as well, for no good reason. So instead, let's use a HOB. Signed-off-by: Ard Biesheuvel --- ArmVirtPkg/ArmVirtPkg.dec |= 1 + ArmVirtPkg/ArmVirtQemu.dsc |= 6 ++-- ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c |= 14 ++++++-- ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.inf |= 1 + ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.c |= 35 ++++++++++++++++++-- ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.inf |= 5 ++- ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLib.inf |= 8 ++--- ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLibConstructor.c |= 30 ++++++++++------- 8 files changed, 75 insertions(+), 25 deletions(-) diff --git a/ArmVirtPkg/ArmVirtPkg.dec b/ArmVirtPkg/ArmVirtPkg.dec index 4e165f6cd845..89d21ec3a364 100644 --- a/ArmVirtPkg/ArmVirtPkg.dec +++ b/ArmVirtPkg/ArmVirtPkg.dec @@ -32,6 +32,7 @@ [Guids.common] gArmVirtTokenSpaceGuid =3D { 0x0B6F5CA7, 0x4F53, 0x445A, { 0xB7, 0x6E, 0= x2E, 0x36, 0x5B, 0x80, 0x63, 0x66 } } gEarlyPL011BaseAddressGuid =3D { 0xB199DEA9, 0xFD5C, 0x4A84, { 0x8= 0, 0x82, 0x2F, 0x41, 0x70, 0x78, 0x03, 0x05 } } gEarly16550UartBaseAddressGuid =3D { 0xea67ca3e, 0x1f54, 0x436b, { 0x9= 7, 0x88, 0xd4, 0xeb, 0x29, 0xc3, 0x42, 0x67 } } + gArmVirtSystemMemorySizeGuid =3D { 0x504eccb9, 0x1bf0, 0x4420, { 0x8= 6, 0x5d, 0xdc, 0x66, 0x06, 0xd4, 0x13, 0xbf } } =20 gArmVirtVariableGuid =3D { 0x50bea1e5, 0xa2c5, 0x46e9, { 0x9b, 0x3a, 0= x59, 0x59, 0x65, 0x16, 0xb0, 0x0a } } =20 diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc index c3d264077bce..43e19f605084 100644 --- a/ArmVirtPkg/ArmVirtQemu.dsc +++ b/ArmVirtPkg/ArmVirtQemu.dsc @@ -220,6 +220,9 @@ [PcdsFixedAtBuild.common] # Shadowing PEI modules is absolutely pointless when the NOR flash is em= ulated gEfiMdeModulePkgTokenSpaceGuid.PcdShadowPeimOnBoot|FALSE =20 + # System Memory Size -- 128 MB initially, actual size will be fetched fr= om DT + gArmTokenSpaceGuid.PcdSystemMemorySize|0x8000000 + [PcdsFixedAtBuild.AARCH64] # Clearing BIT0 in this PCD prevents installing a 32-bit SMBIOS entry po= int, # if the entry point version is >=3D 3.0. AARCH64 OSes cannot assume the @@ -236,9 +239,6 @@ [PcdsDynamicDefault.common] # enumeration to complete before installing ACPI tables. gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|TRUE =20 - # System Memory Size -- 1 MB initially, actual size will be fetched from= DT - gArmTokenSpaceGuid.PcdSystemMemorySize|0x00100000 - gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum|0x0 gArmTokenSpaceGuid.PcdArmArchTimerIntrNum|0x0 gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum|0x0 diff --git a/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPe= iLib.c b/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib= .c index 98d90ad4200d..72e5c65af79e 100644 --- a/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c +++ b/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c @@ -52,10 +52,19 @@ MemoryPeim ( { EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttributes; UINT64 SystemMemoryTop; + UINT64 SystemMemorySize; + VOID *Hob; =20 // Ensure PcdSystemMemorySize has been set ASSERT (PcdGet64 (PcdSystemMemorySize) !=3D 0); =20 + SystemMemorySize =3D PcdGet64 (PcdSystemMemorySize); + + Hob =3D GetFirstGuidHob (&gArmVirtSystemMemorySizeGuid); + if (Hob !=3D NULL) { + SystemMemorySize =3D *(UINT64 *)GET_GUID_HOB_DATA (Hob); + } + // // Now, the permanent memory has been installed, we can call AllocatePag= es() // @@ -66,8 +75,7 @@ MemoryPeim ( EFI_RESOURCE_ATTRIBUTE_TESTED ); =20 - SystemMemoryTop =3D PcdGet64 (PcdSystemMemoryBase) + - PcdGet64 (PcdSystemMemorySize); + SystemMemoryTop =3D PcdGet64 (PcdSystemMemoryBase) + SystemMemorySize; =20 if (SystemMemoryTop - 1 > MAX_ALLOC_ADDRESS) { BuildResourceDescriptorHob ( @@ -87,7 +95,7 @@ MemoryPeim ( EFI_RESOURCE_SYSTEM_MEMORY, ResourceAttributes, PcdGet64 (PcdSystemMemoryBase), - PcdGet64 (PcdSystemMemorySize) + SystemMemorySize ); } =20 diff --git a/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPe= iLib.inf b/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiL= ib.inf index 21327f79f4b9..48d9c66b22db 100644 --- a/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.inf +++ b/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.inf @@ -34,6 +34,7 @@ [LibraryClasses] CacheMaintenanceLib =20 [Guids] + gArmVirtSystemMemorySizeGuid gEfiMemoryTypeInformationGuid =20 [FeaturePcd] diff --git a/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.c b/A= rmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.c index cf569bed99c4..9cf43f06c073 100644 --- a/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.c +++ b/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.c @@ -6,10 +6,12 @@ =20 **/ =20 -#include +#include +#include #include #include #include +#include #include =20 // Number of Virtual Memory Map Descriptors @@ -24,6 +26,28 @@ #define MACH_VIRT_PERIPH_BASE 0x08000000 #define MACH_VIRT_PERIPH_SIZE SIZE_128MB =20 +/** + Default library constructur that obtains the memory size from a PCD. + + @return Always returns RETURN_SUCCESS + +**/ +RETURN_STATUS +EFIAPI +QemuVirtMemInfoLibConstructor ( + VOID + ) +{ + UINT64 Size; + VOID *Hob; + + Size =3D PcdGet64 (PcdSystemMemorySize); + Hob =3D BuildGuidDataHob (&gArmVirtSystemMemorySizeGuid, &Size, sizeof = Size); + ASSERT (Hob !=3D NULL); + + return RETURN_SUCCESS; +} + /** Return the Virtual Memory Map of your platform =20 @@ -43,9 +67,16 @@ ArmVirtGetMemoryMap ( ) { ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable; + VOID *MemorySizeHob; =20 ASSERT (VirtualMemoryMap !=3D NULL); =20 + MemorySizeHob =3D GetFirstGuidHob (&gArmVirtSystemMemorySizeGuid); + ASSERT (MemorySizeHob !=3D NULL); + if (MemorySizeHob =3D=3D NULL) { + return; + } + VirtualMemoryTable =3D AllocatePool ( sizeof (ARM_MEMORY_REGION_DESCRIPTOR) * MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS @@ -59,7 +90,7 @@ ArmVirtGetMemoryMap ( // System DRAM VirtualMemoryTable[0].PhysicalBase =3D PcdGet64 (PcdSystemMemoryBase); VirtualMemoryTable[0].VirtualBase =3D VirtualMemoryTable[0].PhysicalBas= e; - VirtualMemoryTable[0].Length =3D PcdGet64 (PcdSystemMemorySize); + VirtualMemoryTable[0].Length =3D *(UINT64 *)GET_GUID_HOB_DATA (Mem= orySizeHob); VirtualMemoryTable[0].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_WRITE= _BACK; =20 DEBUG (( diff --git a/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.inf b= /ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.inf index 7150de6c10d0..6acad8bbd7f3 100644 --- a/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.inf +++ b/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.inf @@ -14,6 +14,7 @@ [Defines] MODULE_TYPE =3D BASE VERSION_STRING =3D 1.0 LIBRARY_CLASS =3D ArmVirtMemInfoLib + CONSTRUCTOR =3D QemuVirtMemInfoLibConstructor =20 [Sources] QemuVirtMemInfoLib.c @@ -30,7 +31,9 @@ [LibraryClasses] BaseMemoryLib DebugLib MemoryAllocationLib - PcdLib + +[Guids] + gArmVirtSystemMemorySizeGuid =20 [Pcd] gArmTokenSpaceGuid.PcdFvBaseAddress diff --git a/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLib.in= f b/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLib.inf index 7ecf6dfbb786..f045e39a4131 100644 --- a/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLib.inf +++ b/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLib.inf @@ -32,16 +32,16 @@ [LibraryClasses] BaseMemoryLib DebugLib FdtLib - PcdLib MemoryAllocationLib =20 -[Pcd] +[Guids] + gArmVirtSystemMemorySizeGuid + +[FixedPcd] gArmTokenSpaceGuid.PcdFdBaseAddress gArmTokenSpaceGuid.PcdFvBaseAddress gArmTokenSpaceGuid.PcdSystemMemoryBase gArmTokenSpaceGuid.PcdSystemMemorySize - -[FixedPcd] gArmTokenSpaceGuid.PcdFdSize gArmTokenSpaceGuid.PcdFvSize gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress diff --git a/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLibCon= structor.c b/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLibCon= structor.c index 33d3597d57ab..c47ab8296622 100644 --- a/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLibConstructo= r.c +++ b/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLibConstructo= r.c @@ -6,9 +6,10 @@ =20 **/ =20 -#include +#include +#include #include -#include +#include #include =20 RETURN_STATUS @@ -17,14 +18,14 @@ QemuVirtMemInfoPeiLibConstructor ( VOID ) { - VOID *DeviceTreeBase; - INT32 Node, Prev; - UINT64 NewBase, CurBase; - UINT64 NewSize, CurSize; - CONST CHAR8 *Type; - INT32 Len; - CONST UINT64 *RegProp; - RETURN_STATUS PcdStatus; + VOID *DeviceTreeBase; + INT32 Node, Prev; + UINT64 NewBase, CurBase; + UINT64 NewSize, CurSize; + CONST CHAR8 *Type; + INT32 Len; + CONST UINT64 *RegProp; + VOID *Hob; =20 NewBase =3D 0; NewSize =3D 0; @@ -86,8 +87,13 @@ QemuVirtMemInfoPeiLibConstructor ( // Make sure the start of DRAM matches our expectation // ASSERT (FixedPcdGet64 (PcdSystemMemoryBase) =3D=3D NewBase); - PcdStatus =3D PcdSet64S (PcdSystemMemorySize, NewSize); - ASSERT_RETURN_ERROR (PcdStatus); + + Hob =3D BuildGuidDataHob ( + &gArmVirtSystemMemorySizeGuid, + &NewSize, + sizeof NewSize + ); + ASSERT (Hob !=3D NULL); =20 // // We need to make sure that the machine we are running on has at least --=20 2.35.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#95378): https://edk2.groups.io/g/devel/message/95378 Mute This Topic: https://groups.io/mt/94427023/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Wed May 15 02:43:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+95379+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95379+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1666171371; cv=none; d=zohomail.com; s=zohoarc; b=RdGxVX7gNIADH99rJdfTZMl0qOmwX4M19uaTH8riu6W3609o8Ey57S6BI00cTaWWepFRto1KLeRghaI0D1wlYmvKHPjJ33Jz/y9t4G89pwLbcOvd55bJyFrZpGGYK5pYuAiVHWyAkvBK5tomye6+4sFR6NYFo8trIZeQp1C97zU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666171371; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=IlIH2F3Q1IBV/XIs4uH5dhh5UKVao/bhu5Z5wzqNt9Y=; b=Ya6E4235rqW+dzVqh1oMO0pGoz3La9dRdKGqHI6Y5s1vlNeBUgqZkU9QZP93r7tegYjlRrutYpmPoVZekVrQHxb+3YQPcrtupqm1Fbm+QrvwQgcnkIGJJrA5PtndAwgm3NXjM+uZ379yxC6+SuMIJQGIYxnY8cTV5zErEZhdaTc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+95379+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1666171371472392.2995199739163; Wed, 19 Oct 2022 02:22:51 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id qUDNYY1788612xKmvgQPHiOD; Wed, 19 Oct 2022 02:22:51 -0700 X-Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mx.groups.io with SMTP id smtpd.web08.5946.1666171365063593823 for ; Wed, 19 Oct 2022 02:22:45 -0700 X-Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9C05AB82471; Wed, 19 Oct 2022 09:22:43 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECB22C4347C; Wed, 19 Oct 2022 09:22:41 +0000 (UTC) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Alexander Graf , Gerd Hoffmann , Sami Mujawar Subject: [edk2-devel] [PATCH v3 resend 11/11] ArmVirtPkg/ArmVirtQemu: omit PCD PEIM unless TPM support is enabled Date: Wed, 19 Oct 2022 11:22:11 +0200 Message-Id: <20221019092211.465699-12-ardb@kernel.org> In-Reply-To: <20221019092211.465699-1-ardb@kernel.org> References: <20221019092211.465699-1-ardb@kernel.org> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ardb@kernel.org X-Gm-Message-State: ZuvSkIaZ4W5wWKCECl4UaSiBx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1666171371; bh=q2h2xifsqsCqmLbginR9a+tTtSH6ii8x78gTnFsDXmw=; h=Cc:Date:From:Reply-To:Subject:To; b=p0Kl+KNfDNY8PvniYlGUoQZurYZAadVDJ1a9jrQ5oJTZaY/U9IffwX4x3rZWMYqvBNe HliN3QmP5p0/RnAgNyqT70n6YKUAnyZ99CtE2rNJ1/d/6XDea64upsurMSnQem5CFLA8k Jm0FoACVMl24KmEVHWSBrMtdxnE/3Pibne0= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1666171372333100001 Content-Type: text/plain; charset="utf-8" The TPM discovery code relies on a dynamic PCD to communicate the TPM base address to other components. But no other code relies on dynamic PCDs in the PEI phase so let's drop the PCD PEIM when TPM support is not enabled. Signed-off-by: Ard Biesheuvel --- ArmVirtPkg/ArmVirtQemu.dsc | 22 +++++++++++++++----- ArmVirtPkg/ArmVirtQemu.fdf | 2 +- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc index 43e19f605084..842a298e0435 100644 --- a/ArmVirtPkg/ArmVirtQemu.dsc +++ b/ArmVirtPkg/ArmVirtQemu.dsc @@ -287,10 +287,15 @@ [PcdsDynamicDefault.common] # # TPM2 support # - gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress|0x0 !if $(TPM2_ENABLE) =3D=3D TRUE + gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress|0x0 gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid|{0x00, 0x00, 0x00, 0x00= , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} gEfiSecurityPkgTokenSpaceGuid.PcdTpm2HashMask|0 +!else +[PcdsPatchableInModule] + # make this PCD patchable instead of dynamic when TPM support is not ena= bled + # this permits setting the PCD in unreachable code without pulling in dy= namic PCD support + gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress|0x0 !endif =20 [PcdsDynamicHii] @@ -303,6 +308,13 @@ [PcdsDynamicHii] =20 gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVar= iableGuid|0x0|5 =20 +[LibraryClasses.common.PEI_CORE, LibraryClasses.common.PEIM] +!if $(TPM2_ENABLE) =3D=3D TRUE + PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf +!else + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf +!endif + ##########################################################################= ###### # # Components Section - list of all EDK II Modules needed by this Platform @@ -314,10 +326,6 @@ [Components.common] # ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf MdeModulePkg/Core/Pei/PeiMain.inf - MdeModulePkg/Universal/PCD/Pei/Pcd.inf { - - PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf - } ArmPlatformPkg/PlatformPei/PlatformPeim.inf ArmVirtPkg/MemoryInitPei/MemoryInitPeim.inf { @@ -328,6 +336,10 @@ [Components.common] ArmPkg/Drivers/CpuPei/CpuPei.inf =20 !if $(TPM2_ENABLE) =3D=3D TRUE + MdeModulePkg/Universal/PCD/Pei/Pcd.inf { + + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + } MdeModulePkg/Universal/ResetSystemPei/ResetSystemPei.inf { ResetSystemLib|ArmVirtPkg/Library/ArmVirtPsciResetSystemPeiLib/ArmVi= rtPsciResetSystemPeiLib.inf diff --git a/ArmVirtPkg/ArmVirtQemu.fdf b/ArmVirtPkg/ArmVirtQemu.fdf index c85e36b185d3..764f652afd0e 100644 --- a/ArmVirtPkg/ArmVirtQemu.fdf +++ b/ArmVirtPkg/ArmVirtQemu.fdf @@ -109,10 +109,10 @@ [FV.FVMAIN_COMPACT] INF ArmPlatformPkg/PlatformPei/PlatformPeim.inf INF ArmVirtPkg/MemoryInitPei/MemoryInitPeim.inf INF ArmPkg/Drivers/CpuPei/CpuPei.inf - INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf =20 !if $(TPM2_ENABLE) =3D=3D TRUE + INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf INF MdeModulePkg/Universal/ResetSystemPei/ResetSystemPei.inf INF OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf INF SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.inf --=20 2.35.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#95379): https://edk2.groups.io/g/devel/message/95379 Mute This Topic: https://groups.io/mt/94427024/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-