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.web09.26238.1664180742307786920 for ; Mon, 26 Sep 2022 01:25:42 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eWdcRj3G; 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 70E2E6190B; Mon, 26 Sep 2022 08:25:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7155C43141; Mon, 26 Sep 2022 08:25:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664180740; bh=JQLPaz9qu2MDqrQBWMOBfrfmBZrlc+FjGlXHipSk1jc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eWdcRj3Gj0kuzaB+3W0OBAQtXm+Vh8fT3c9fsoIxQ9umn/RcuCntbU49EAivpGxQh 01AeX/EQIR2mxiVSQ7gHCwOYNrvbexxl/cJjeo5X1uBA1UupyR2vvaMNu70ryLHhn7 beimH7+aQ2CgRons51dVZ3Z9vVKJsAuTqGB7d1+63q8vdBjSEeaEZHMZ35VKDm41If D7stadLYotcbBD75RSEpTlE37Qk+fxVwnd6ain0C0WRnzHtzv+qrhDlgIa8tT/ECdJ gH0nf/qJ7IMpyf52VPzzc5HOpkydAtSMN87dGEP7VxQm99sgXdlOO9TjVT+rkHc8Ac 8PWIJhMnKzhJg== From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Alexander Graf Subject: [PATCH v3 16/16] ArmVirtPkg/ArmVirtQemu: omit PCD PEIM unless TPM support is enabled Date: Mon, 26 Sep 2022 10:25:11 +0200 Message-Id: <20220926082511.2110797-17-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 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] #=0D # TPM2 support=0D #=0D - gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress|0x0=0D !if $(TPM2_ENABLE) =3D=3D TRUE=0D + gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress|0x0=0D gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid|{0x00, 0x00, 0x00, 0x00= , 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}=0D gEfiSecurityPkgTokenSpaceGuid.PcdTpm2HashMask|0=0D +!else=0D +[PcdsPatchableInModule]=0D + # make this PCD patchable instead of dynamic when TPM support is not ena= bled=0D + # this permits setting the PCD in unreachable code without pulling in dy= namic PCD support=0D + gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress|0x0=0D !endif=0D =0D [PcdsDynamicHii]=0D @@ -303,6 +308,13 @@ [PcdsDynamicHii] =0D gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVar= iableGuid|0x0|5=0D =0D +[LibraryClasses.common.PEI_CORE, LibraryClasses.common.PEIM]=0D +!if $(TPM2_ENABLE) =3D=3D TRUE=0D + PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf=0D +!else=0D + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf=0D +!endif=0D +=0D ##########################################################################= ######=0D #=0D # Components Section - list of all EDK II Modules needed by this Platform= =0D @@ -314,10 +326,6 @@ [Components.common] #=0D ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf=0D MdeModulePkg/Core/Pei/PeiMain.inf=0D - MdeModulePkg/Universal/PCD/Pei/Pcd.inf {=0D - =0D - PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf=0D - }=0D ArmPlatformPkg/PlatformPei/PlatformPeim.inf=0D ArmVirtPkg/MemoryInitPei/MemoryInitPeim.inf {=0D =0D @@ -328,6 +336,10 @@ [Components.common] ArmPkg/Drivers/CpuPei/CpuPei.inf=0D =0D !if $(TPM2_ENABLE) =3D=3D TRUE=0D + MdeModulePkg/Universal/PCD/Pei/Pcd.inf {=0D + =0D + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf=0D + }=0D MdeModulePkg/Universal/ResetSystemPei/ResetSystemPei.inf {=0D =0D ResetSystemLib|ArmVirtPkg/Library/ArmVirtPsciResetSystemPeiLib/ArmVi= rtPsciResetSystemPeiLib.inf=0D 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=0D INF ArmVirtPkg/MemoryInitPei/MemoryInitPeim.inf=0D INF ArmPkg/Drivers/CpuPei/CpuPei.inf=0D - INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf=0D INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf=0D =0D !if $(TPM2_ENABLE) =3D=3D TRUE=0D + INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf=0D INF MdeModulePkg/Universal/ResetSystemPei/ResetSystemPei.inf=0D INF OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf=0D INF SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.inf=0D --=20 2.35.1