From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mx.groups.io with SMTP id smtpd.web11.26078.1664180736898475529 for ; Mon, 26 Sep 2022 01:25:37 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uxEBI54C; spf=pass (domain: kernel.org, ip: 145.40.68.75, 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 ams.source.kernel.org (Postfix) with ESMTPS id 7339EB8091B; Mon, 26 Sep 2022 08:25:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2AD82C43140; Mon, 26 Sep 2022 08:25:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664180735; bh=n87e5HuDll+LY0x390HJetSWuOtqDgTgWiOv5PZgNWc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uxEBI54CD+XJGg9r2i5IzDapQp8jrcekV+g3rpCBjsa1HSuLFF4JhVXwNFNvFdLqA QC6HEZC95qoOt/sVOpww0FuUs/IpZIgQBj1scgcGsmzCSUo6kyGHm14wMLyEr52e2W TlORKeRo3MX5ca3MS2smUa1nIlh5IOSrz2F/ci8Vkj0kFuV+UX45gSloJ+h+Gze4Eo OKW+Ox/HjjDD98tzoM1Ei9i8cTj+RK/2gKM1M2ZOJu9qVRStyWk8Jt9NMwsA2KRhjN Lt2HtALwRp2quiv98yZvFHe8hAf64Ge02nz3zkT0xJZIC1/u1CvkzTNrzsdx7Na62Y 9rFyyX8+3fu2Q== From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Alexander Graf Subject: [PATCH v3 12/16] ArmVirtPkg/ArmVirtQemu: enable initial ID map at early boot Date: Mon, 26 Sep 2022 10:25:07 +0200 Message-Id: <20220926082511.2110797-13-ardb@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220926082511.2110797-1-ardb@kernel.org> References: <20220926082511.2110797-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