<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><a href="https://edk2-docs.gitbook.io/edk-ii-build-specification/2_design_discussion/23_boot_sequence">https://edk2-docs.gitbook.io/edk-ii-build-specification/2_design_discussion/23_boot_sequence</a><br><br><div dir="ltr"></div><div dir="ltr"><br><blockquote type="cite">On Apr 20, 2021, at 11:34 PM, Eric van Tassell <evantass@amd.com> wrote:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr"><span></span><br><span></span><br><span>On 4/20/21 5:54 PM, Tom Lendacky wrote:</span><br><blockquote type="cite"><span>From: Tom Lendacky <thomas.lendacky@amd.com></span><br></blockquote><blockquote type="cite"><span>BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3345</span><br></blockquote><blockquote type="cite"><span>The TPM support in OVMF performs MMIO accesses during the PEI phase. At</span><br></blockquote><span></span><br><span>where are the phases defined and how many other are there?</span><br><span></span><br><blockquote type="cite"><span>this point, MMIO ranges have not been marked un-encyrpted, so an SEV-ES</span><br></blockquote><blockquote type="cite"><span>guest will fail attempting to perform MMIO to an encrypted address.</span><br></blockquote><blockquote type="cite"><span>Read the PcdTpmBaseAddress and mark the specification defined range</span><br></blockquote><blockquote type="cite"><span>(0x5000 in length) as un-encrypted, to allow an SEV-ES guest to process</span><br></blockquote><blockquote type="cite"><span>the MMIO requests.</span><br></blockquote><blockquote type="cite"><span>Cc: Laszlo Ersek <lersek@redhat.com></span><br></blockquote><blockquote type="cite"><span>Cc: Ard Biesheuvel <ardb+tianocore@kernel.org></span><br></blockquote><blockquote type="cite"><span>Cc: Jordan Justen <jordan.l.justen@intel.com></span><br></blockquote><blockquote type="cite"><span>Cc: Brijesh Singh <brijesh.singh@amd.com></span><br></blockquote><blockquote type="cite"><span>Cc: James Bottomley <jejb@linux.ibm.com></span><br></blockquote><blockquote type="cite"><span>Cc: Jiewen Yao <jiewen.yao@intel.com></span><br></blockquote><blockquote type="cite"><span>Cc: Min Xu <min.m.xu@intel.com></span><br></blockquote><blockquote type="cite"><span>Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com></span><br></blockquote><blockquote type="cite"><span>---</span><br></blockquote><blockquote type="cite"><span>  OvmfPkg/PlatformPei/PlatformPei.inf |  1 +</span><br></blockquote><blockquote type="cite"><span>  OvmfPkg/PlatformPei/AmdSev.c        | 19 +++++++++++++++++++</span><br></blockquote><blockquote type="cite"><span>  2 files changed, 20 insertions(+)</span><br></blockquote><blockquote type="cite"><span>diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf b/OvmfPkg/PlatformPei/PlatformPei.inf</span><br></blockquote><blockquote type="cite"><span>index 6ef77ba7bb21..de60332e9390 100644</span><br></blockquote><blockquote type="cite"><span>--- a/OvmfPkg/PlatformPei/PlatformPei.inf</span><br></blockquote><blockquote type="cite"><span>+++ b/OvmfPkg/PlatformPei/PlatformPei.inf</span><br></blockquote><blockquote type="cite"><span>@@ -113,6 +113,7 @@ [Pcd]</span><br></blockquote><blockquote type="cite"><span>    [FixedPcd]</span><br></blockquote><blockquote type="cite"><span>    gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress</span><br></blockquote><blockquote type="cite"><span>+  gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress</span><br></blockquote><blockquote type="cite"><span>    gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS</span><br></blockquote><blockquote type="cite"><span>    gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory</span><br></blockquote><blockquote type="cite"><span>    gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType</span><br></blockquote><blockquote type="cite"><span>diff --git a/OvmfPkg/PlatformPei/AmdSev.c b/OvmfPkg/PlatformPei/AmdSev.c</span><br></blockquote><blockquote type="cite"><span>index dddffdebda4b..d524929f9e10 100644</span><br></blockquote><blockquote type="cite"><span>--- a/OvmfPkg/PlatformPei/AmdSev.c</span><br></blockquote><blockquote type="cite"><span>+++ b/OvmfPkg/PlatformPei/AmdSev.c</span><br></blockquote><blockquote type="cite"><span>@@ -141,6 +141,7 @@ AmdSevInitialize (</span><br></blockquote><blockquote type="cite"><span>    )</span><br></blockquote><blockquote type="cite"><span>  {</span><br></blockquote><blockquote type="cite"><span>    UINT64                            EncryptionMask;</span><br></blockquote><blockquote type="cite"><span>+  UINT64                            TpmBaseAddress;</span><br></blockquote><blockquote type="cite"><span>    RETURN_STATUS                     PcdStatus;</span><br></blockquote><blockquote type="cite"><span>      //</span><br></blockquote><blockquote type="cite"><span>@@ -206,6 +207,24 @@ AmdSevInitialize (</span><br></blockquote><blockquote type="cite"><span>      }</span><br></blockquote><blockquote type="cite"><span>    }</span><br></blockquote><blockquote type="cite"><span>  +  //</span><br></blockquote><blockquote type="cite"><span>+  // PEI TPM support will perform MMIO accesses, be sure this range is not</span><br></blockquote><blockquote type="cite"><span>+  // marked encrypted.</span><br></blockquote><blockquote type="cite"><span>+  //</span><br></blockquote><blockquote type="cite"><span>+  TpmBaseAddress = PcdGet64 (PcdTpmBaseAddress);</span><br></blockquote><blockquote type="cite"><span>+  if (TpmBaseAddress != 0) {</span><br></blockquote><blockquote type="cite"><span>+    RETURN_STATUS  DecryptStatus;</span><br></blockquote><blockquote type="cite"><span>+</span><br></blockquote><blockquote type="cite"><span>+    DecryptStatus = MemEncryptSevClearPageEncMask (</span><br></blockquote><blockquote type="cite"><span>+                      0,</span><br></blockquote><blockquote type="cite"><span>+                      TpmBaseAddress,</span><br></blockquote><blockquote type="cite"><span>+                      EFI_SIZE_TO_PAGES (0x5000),</span><br></blockquote><blockquote type="cite"><span>+                      FALSE</span><br></blockquote><blockquote type="cite"><span>+                      );</span><br></blockquote><blockquote type="cite"><span>+</span><br></blockquote><blockquote type="cite"><span>+    ASSERT_RETURN_ERROR (DecryptStatus);</span><br></blockquote><blockquote type="cite"><span>+  }</span><br></blockquote><blockquote type="cite"><span>+</span><br></blockquote><blockquote type="cite"><span>    //</span><br></blockquote><blockquote type="cite"><span>    // Check and perform SEV-ES initialization if required.</span><br></blockquote><blockquote type="cite"><span>    //</span><br></blockquote><span></span><br><span></span><br><span></span><br><span></span><br><span></span><br></div></blockquote></body></html>


 <div width="1" style="color:white;clear:both">_._,_._,_</div> <hr>   Groups.io Links:<p>   You receive all messages sent to this group.    <p> <a target="_blank" href="https://edk2.groups.io/g/devel/message/74334">View/Reply Online (#74334)</a> |    |  <a target="_blank" href="https://groups.io/mt/82247968/1813853">Mute This Topic</a>  | <a href="https://edk2.groups.io/g/devel/post">New Topic</a><br>    <a href="https://edk2.groups.io/g/devel/editsub/1813853">Your Subscription</a> | <a href="mailto:devel+owner@edk2.groups.io">Contact Group Owner</a> |  <a href="https://edk2.groups.io/g/devel/unsub">Unsubscribe</a>  [edk2-devel-archive@redhat.com]<br> <div width="1" style="color:white;clear:both">_._,_._,_</div>