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.web08.5946.1666171365063593823 for ; Wed, 19 Oct 2022 02:22:45 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TFDLBfv+; 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 9C05AB82471; Wed, 19 Oct 2022 09:22:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECB22C4347C; Wed, 19 Oct 2022 09:22:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666171363; bh=JQLPaz9qu2MDqrQBWMOBfrfmBZrlc+FjGlXHipSk1jc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TFDLBfv+7fbtYMOAQ/Rhewg4mlpO3TwYZAaCAAHM6xZn/+FoV0pjlwETFziUTjcVa huLPWt4ctOte/WdEvCwMZeS/Oe3JtT3XXw3u6NUpBPlIoIDYs2Tm4k3ZDc0rS7PXlb SRukMq/tbe3jAluXhDVrBz5k0RmJFY9jlBYizZ4axv6Z6l+Wno+ZuDHI31l4U3jKYV mJesB1PYc1TxF3I68p4d0TqZrPT7bDQAFtPxt/BQzqA+mYGURiSq7x1uYSG1mJRqXP SPvMQITOkJlUTxTFPKT8yGPJAqce+GLpd/jllc/Mk5zcY8kTkDM1qOVgGI+pneuWdU KezxBzv4tnbBg== From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Alexander Graf , Gerd Hoffmann , Sami Mujawar Subject: [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> 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 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