From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IARNdo8f; spf=pass (domain: kernel.org, ip: 139.178.84.217, mailfrom: ardb@kernel.org) 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) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5954C43143; Wed, 19 Oct 2022 09:22:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666171356; bh=n87e5HuDll+LY0x390HJetSWuOtqDgTgWiOv5PZgNWc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IARNdo8flItREkkvLtODrcqA/S6z5WSH5cJMJ7dHuyRyCbO1CO8aekfUqq8NXEqzF YgvqqhPppKAwkeMgAyr09HcYCZ4lQ3XpKHvdFvuvpS3+2Y0AnWwmXq7tP0fU5Ib3Ak zYtWsjC0oHIjT/9unfBcEHXbLPZKskwE3BCS/r3RroOVMtgt+JCIb6jDxL4nt274so bAGgj6E/4Z1Trpag2GS+ORyXz+OiBuuTjG0uhvcOMTnhd2EGshZ/k3R/DkQp0TjAcb 7EkPM+DBSLG79mtdhD1mhKYFOe4svZ0WKRjVcs128JYRcvTjbb9/rjCgwNyngIPpTz j5z2sjnk8+SXg== From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Alexander Graf , Gerd Hoffmann , Sami Mujawar Subject: [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> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221019092211.465699-1-ardb@kernel.org> References: <20221019092211.465699-1-ardb@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=0D QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoad= ImageLib.inf=0D =0D - ArmPlatformLib|ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibN= ull.inf=0D -=0D TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf=0D NorFlashPlatformLib|ArmVirtPkg/Library/NorFlashQemuLib/NorFlashQemuLib.i= nf=0D =0D @@ -92,6 +90,12 @@ [LibraryClasses.common] TpmPlatformHierarchyLib|SecurityPkg/Library/PeiDxeTpmPlatformHierarchyLi= bNull/PeiDxeTpmPlatformHierarchyLib.inf=0D !endif=0D =0D +[LibraryClasses.AARCH64]=0D + ArmPlatformLib|ArmVirtPkg/Library/ArmPlatformLibQemu/ArmPlatformLibQemu.= inf=0D +=0D +[LibraryClasses.ARM]=0D + ArmPlatformLib|ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibN= ull.inf=0D +=0D [LibraryClasses.common.PEIM]=0D ArmVirtMemInfoLib|ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoP= eiLib.inf=0D =0D @@ -112,6 +116,8 @@ [LibraryClasses.common.UEFI_DRIVER] UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf=0D =0D [BuildOptions]=0D + GCC:*_*_AARCH64_CC_XIPFLAGS =3D -mno-strict-align=0D +=0D !include NetworkPkg/NetworkBuildOptions.dsc.inc=0D =0D ##########################################################################= ######=0D @@ -310,7 +316,12 @@ [Components.common] PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf=0D }=0D ArmPlatformPkg/PlatformPei/PlatformPeim.inf=0D - ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf=0D + ArmVirtPkg/MemoryInitPei/MemoryInitPeim.inf {=0D + =0D +!if $(ARCH) =3D=3D AARCH64=0D + ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf=0D +!endif=0D + }=0D ArmPkg/Drivers/CpuPei/CpuPei.inf=0D =0D MdeModulePkg/Universal/Variable/Pei/VariablePei.inf=0D 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=0D INF MdeModulePkg/Core/Pei/PeiMain.inf=0D INF ArmPlatformPkg/PlatformPei/PlatformPeim.inf=0D - INF ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf=0D + INF ArmVirtPkg/MemoryInitPei/MemoryInitPeim.inf=0D INF ArmPkg/Drivers/CpuPei/CpuPei.inf=0D INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf=0D INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf=0D --=20 2.35.1