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.251.1662476820207519776 for ; Tue, 06 Sep 2022 08:07:00 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MQs1TRZd; 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 45FC9B81908; Tue, 6 Sep 2022 15:06:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B7B8C43470; Tue, 6 Sep 2022 15:06:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1662476817; bh=4FUXuLB+Gs+vRpWNIy7sdOSUlpNps3YERurYJBoQdGM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MQs1TRZdoKLtjL8ovmHguA7kjNPLdR5ojoh/9Z5KVGjcONQ8EWUifHioAjMYruWjL xBA1VGrB2Qt+mgAfErKav6rrCAR74/NoTvvB/l+Dyt6YlxMT62Ioji3Lg6Oh0HB0co piV12zFOIabfG6ztiDFGJBv7+RtfUAaYijGS5eVm8AYArmGD8thfklpWttrkD/8tF9 1Zg1DmWZGS8ZCJjgu2yGDz2ZktYiaNK9LLURSCFDTN7IZR9TxFhjXG03Zj8QgkJzUk d7f8QIb+ccfNHT+p/kIRrMYzt3F3dLyiWcrMXvCv9kwWM5rZukl2RGuNau8tRzqSeM fFQm0Rry5qIwg== From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: quic_llindhol@quicinc.com, sami.mujawar@arm.com, Ard Biesheuvel Subject: [PATCH v2 7/7] ArmVirtPkg/ArmVirtQemu: enable initial ID map at early boot Date: Tue, 6 Sep 2022 17:06:39 +0200 Message-Id: <20220906150639.157227-8-ardb@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220906150639.157227-1-ardb@kernel.org> References: <20220906150639.157227-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 | 12 +++++++++--- ArmVirtPkg/ArmVirtQemu.fdf | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc index 302c0d2a4e29..2bf360d1b87b 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,7 @@ [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 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