OvmfPkg/PlatformPei: AmdSev: stop using mPlatformInfoHob

Stop using the mPlatformInfoHob global variable in AmdSevInitialize()
and AmdSevEsInitialize() functions.  Pass a pointer to the
PlatformInfoHob instead.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Tom Lendacky <thomas.lendacky@amd.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
This commit is contained in:
Gerd Hoffmann 2022-12-02 14:09:58 +01:00 committed by mergify[bot]
parent 916825b84f
commit 78c373f2a5
3 changed files with 9 additions and 9 deletions

View File

@ -201,7 +201,7 @@ GhcbRegister (
STATIC STATIC
VOID VOID
AmdSevEsInitialize ( AmdSevEsInitialize (
VOID IN EFI_HOB_PLATFORM_INFO *PlatformInfoHob
) )
{ {
UINT8 *GhcbBase; UINT8 *GhcbBase;
@ -228,7 +228,7 @@ AmdSevEsInitialize (
// Since the pages must survive across the UEFI to OS transition // Since the pages must survive across the UEFI to OS transition
// make them reserved. // make them reserved.
// //
GhcbPageCount = mPlatformInfoHob.PcdCpuMaxLogicalProcessorNumber * 2; GhcbPageCount = PlatformInfoHob->PcdCpuMaxLogicalProcessorNumber * 2;
GhcbBase = AllocateReservedPages (GhcbPageCount); GhcbBase = AllocateReservedPages (GhcbPageCount);
ASSERT (GhcbBase != NULL); ASSERT (GhcbBase != NULL);
@ -266,7 +266,7 @@ AmdSevEsInitialize (
// Allocate #VC recursion backup pages. The number of backup pages needed is // Allocate #VC recursion backup pages. The number of backup pages needed is
// one less than the maximum VC count. // one less than the maximum VC count.
// //
GhcbBackupPageCount = mPlatformInfoHob.PcdCpuMaxLogicalProcessorNumber * (VMGEXIT_MAXIMUM_VC_COUNT - 1); GhcbBackupPageCount = PlatformInfoHob->PcdCpuMaxLogicalProcessorNumber * (VMGEXIT_MAXIMUM_VC_COUNT - 1);
GhcbBackupBase = AllocatePages (GhcbBackupPageCount); GhcbBackupBase = AllocatePages (GhcbBackupPageCount);
ASSERT (GhcbBackupBase != NULL); ASSERT (GhcbBackupBase != NULL);
@ -320,7 +320,7 @@ AmdSevEsInitialize (
**/ **/
VOID VOID
AmdSevInitialize ( AmdSevInitialize (
VOID IN OUT EFI_HOB_PLATFORM_INFO *PlatformInfoHob
) )
{ {
UINT64 EncryptionMask; UINT64 EncryptionMask;
@ -367,7 +367,7 @@ AmdSevInitialize (
// until after re-encryption, in order to prevent an information leak to the // until after re-encryption, in order to prevent an information leak to the
// hypervisor. // hypervisor.
// //
if (mPlatformInfoHob.SmmSmramRequire && (mPlatformInfoHob.BootMode != BOOT_ON_S3_RESUME)) { if (PlatformInfoHob->SmmSmramRequire && (PlatformInfoHob->BootMode != BOOT_ON_S3_RESUME)) {
RETURN_STATUS LocateMapStatus; RETURN_STATUS LocateMapStatus;
UINTN MapPagesBase; UINTN MapPagesBase;
UINTN MapPagesCount; UINTN MapPagesCount;
@ -378,7 +378,7 @@ AmdSevInitialize (
); );
ASSERT_RETURN_ERROR (LocateMapStatus); ASSERT_RETURN_ERROR (LocateMapStatus);
if (mPlatformInfoHob.Q35SmramAtDefaultSmbase) { if (PlatformInfoHob->Q35SmramAtDefaultSmbase) {
// //
// The initial SMRAM Save State Map has been covered as part of a larger // The initial SMRAM Save State Map has been covered as part of a larger
// reserved memory allocation in InitializeRamRegions(). // reserved memory allocation in InitializeRamRegions().
@ -400,7 +400,7 @@ AmdSevInitialize (
// //
// Check and perform SEV-ES initialization if required. // Check and perform SEV-ES initialization if required.
// //
AmdSevEsInitialize (); AmdSevEsInitialize (PlatformInfoHob);
// //
// Set the Confidential computing attr PCD to communicate which SEV // Set the Confidential computing attr PCD to communicate which SEV

View File

@ -379,7 +379,7 @@ InitializePlatform (
} }
InstallClearCacheCallback (); InstallClearCacheCallback ();
AmdSevInitialize (); AmdSevInitialize (&mPlatformInfoHob);
if (mPlatformInfoHob.HostBridgeDevId == 0xffff) { if (mPlatformInfoHob.HostBridgeDevId == 0xffff) {
MiscInitializationForMicrovm (&mPlatformInfoHob); MiscInitializationForMicrovm (&mPlatformInfoHob);
} else { } else {

View File

@ -82,7 +82,7 @@ InstallClearCacheCallback (
VOID VOID
AmdSevInitialize ( AmdSevInitialize (
VOID IN EFI_HOB_PLATFORM_INFO *PlatformInfoHob
); );
/** /**