[edk2-devel] [PATCH v4 4/4] UefiCpuPkg: Store SEV-SNP AP jump table in the secrets page

Roth, Michael via groups.io Michael.Roth=amd.com at groups.io
Wed Dec 21 15:50:47 UTC 2022


A full-featured SEV-SNP guest will not rely on the AP jump table, and
will instead use the AP Creation interface defined by the GHCB. However,
a guest is still allowed to use the AP jump table if desired.

However, unlike with SEV-ES guests, SEV-SNP guests should not
store/retrieve the jump table address via GHCB requests to the
hypervisor, they should instead store/retrieve it via the SEV-SNP
secrets page. Implement the store side of this for OVMF.

Suggested-by: Tom Lendacky <thomas.lendacky at amd.com>
Reviewed-by: Tom Lendacky <thomas.lendacky at amd.com>
Signed-off-by: Michael Roth <michael.roth at amd.com>
---
 UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf |  1 +
 UefiCpuPkg/Library/MpInitLib/DxeMpLib.c       | 10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
index 8c8b81d933..0c36538d59 100644
--- a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
+++ b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
@@ -85,3 +85,4 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard                      ## CONSUMES

   gEfiMdeModulePkgTokenSpaceGuid.PcdGhcbBase                           ## CONSUMES

   gEfiMdePkgTokenSpaceGuid.PcdConfidentialComputingGuestAttr           ## CONSUMES

+  gEfiMdePkgTokenSpaceGuid.PcdSevSnpSecretsAddress                     ## CONSUMES

diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
index beab06a5b1..8edc612772 100644
--- a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
@@ -15,6 +15,7 @@
 #include <Library/CcExitLib.h>

 #include <Register/Amd/Fam17Msr.h>

 #include <Register/Amd/Ghcb.h>

+#include <Register/Amd/SnpSecretsPage.h>

 

 #include <Protocol/Timer.h>

 

@@ -217,6 +218,15 @@ GetSevEsAPMemory (
 

   DEBUG ((DEBUG_INFO, "Dxe: SevEsAPMemory = %lx\n", (UINTN)StartAddress));

 

+  if (ConfidentialComputingGuestHas (CCAttrAmdSevSnp)) {

+    SNP_SECRETS_PAGE  *Secrets;

+

+    Secrets                       = (SNP_SECRETS_PAGE *)(INTN)PcdGet64 (PcdSevSnpSecretsAddress);

+    Secrets->OsArea.ApJumpTablePa = (UINT64)(UINTN)StartAddress;

+

+    return (UINTN)StartAddress;

+  }

+

   //

   // Save the SevEsAPMemory as the AP jump table.

   //

-- 
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#97700): https://edk2.groups.io/g/devel/message/97700
Mute This Topic: https://groups.io/mt/95815538/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list