mirror of https://github.com/acidanthera/audk.git
OvmfPkg/Sec: Install MpInitLibDepLib PPIs in SecMain.c
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3918 Td guest should use MpInitLibUp, other guest use the MpInitLib. So in SecMain.c different PPI is installed according to the working guest type. Cc: Eric Dong <eric.dong@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Brijesh Singh <brijesh.singh@amd.com> Cc: Erdem Aktas <erdemaktas@google.com> Cc: James Bottomley <jejb@linux.ibm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Min Xu <min.m.xu@intel.com> Tested-by: Tom Lendacky <thomas.lendacky@amd.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
This commit is contained in:
parent
2f06e5af47
commit
b63a49e056
|
@ -28,6 +28,7 @@
|
||||||
#include <Library/LocalApicLib.h>
|
#include <Library/LocalApicLib.h>
|
||||||
#include <Library/CpuExceptionHandlerLib.h>
|
#include <Library/CpuExceptionHandlerLib.h>
|
||||||
#include <Ppi/TemporaryRamSupport.h>
|
#include <Ppi/TemporaryRamSupport.h>
|
||||||
|
#include <Ppi/MpInitLibDep.h>
|
||||||
#include <Library/PlatformInitLib.h>
|
#include <Library/PlatformInitLib.h>
|
||||||
#include <Library/CcProbeLib.h>
|
#include <Library/CcProbeLib.h>
|
||||||
#include "AmdSev.h"
|
#include "AmdSev.h"
|
||||||
|
@ -61,12 +62,30 @@ EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI mTemporaryRamSupportPpi = {
|
||||||
TemporaryRamMigration
|
TemporaryRamMigration
|
||||||
};
|
};
|
||||||
|
|
||||||
EFI_PEI_PPI_DESCRIPTOR mPrivateDispatchTable[] = {
|
EFI_PEI_PPI_DESCRIPTOR mPrivateDispatchTableMp[] = {
|
||||||
{
|
{
|
||||||
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
|
(EFI_PEI_PPI_DESCRIPTOR_PPI),
|
||||||
&gEfiTemporaryRamSupportPpiGuid,
|
&gEfiTemporaryRamSupportPpiGuid,
|
||||||
&mTemporaryRamSupportPpi
|
&mTemporaryRamSupportPpi
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
|
||||||
|
&gEfiPeiMpInitLibMpDepPpiGuid,
|
||||||
|
NULL
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
EFI_PEI_PPI_DESCRIPTOR mPrivateDispatchTableUp[] = {
|
||||||
|
{
|
||||||
|
(EFI_PEI_PPI_DESCRIPTOR_PPI),
|
||||||
|
&gEfiTemporaryRamSupportPpiGuid,
|
||||||
|
&mTemporaryRamSupportPpi
|
||||||
|
},
|
||||||
|
{
|
||||||
|
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
|
||||||
|
&gEfiPeiMpInitLibUpDepPpiGuid,
|
||||||
|
NULL
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -936,6 +955,7 @@ SecStartupPhase2 (
|
||||||
EFI_SEC_PEI_HAND_OFF *SecCoreData;
|
EFI_SEC_PEI_HAND_OFF *SecCoreData;
|
||||||
EFI_FIRMWARE_VOLUME_HEADER *BootFv;
|
EFI_FIRMWARE_VOLUME_HEADER *BootFv;
|
||||||
EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint;
|
EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint;
|
||||||
|
EFI_PEI_PPI_DESCRIPTOR *EfiPeiPpiDescriptor;
|
||||||
|
|
||||||
SecCoreData = (EFI_SEC_PEI_HAND_OFF *)Context;
|
SecCoreData = (EFI_SEC_PEI_HAND_OFF *)Context;
|
||||||
|
|
||||||
|
@ -948,10 +968,20 @@ SecStartupPhase2 (
|
||||||
SecCoreData->BootFirmwareVolumeBase = BootFv;
|
SecCoreData->BootFirmwareVolumeBase = BootFv;
|
||||||
SecCoreData->BootFirmwareVolumeSize = (UINTN)BootFv->FvLength;
|
SecCoreData->BootFirmwareVolumeSize = (UINTN)BootFv->FvLength;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Td guest is required to use the MpInitLibUp (unique-processor version).
|
||||||
|
// Other guests use the MpInitLib (multi-processor version).
|
||||||
|
//
|
||||||
|
if (CcProbe () == CcGuestTypeIntelTdx) {
|
||||||
|
EfiPeiPpiDescriptor = (EFI_PEI_PPI_DESCRIPTOR *)&mPrivateDispatchTableUp;
|
||||||
|
} else {
|
||||||
|
EfiPeiPpiDescriptor = (EFI_PEI_PPI_DESCRIPTOR *)&mPrivateDispatchTableMp;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Transfer the control to the PEI core
|
// Transfer the control to the PEI core
|
||||||
//
|
//
|
||||||
(*PeiCoreEntryPoint)(SecCoreData, (EFI_PEI_PPI_DESCRIPTOR *)&mPrivateDispatchTable);
|
(*PeiCoreEntryPoint)(SecCoreData, EfiPeiPpiDescriptor);
|
||||||
|
|
||||||
//
|
//
|
||||||
// If we get here then the PEI Core returned, which is not recoverable.
|
// If we get here then the PEI Core returned, which is not recoverable.
|
||||||
|
|
|
@ -59,6 +59,8 @@
|
||||||
|
|
||||||
[Ppis]
|
[Ppis]
|
||||||
gEfiTemporaryRamSupportPpiGuid # PPI ALWAYS_PRODUCED
|
gEfiTemporaryRamSupportPpiGuid # PPI ALWAYS_PRODUCED
|
||||||
|
gEfiPeiMpInitLibMpDepPpiGuid
|
||||||
|
gEfiPeiMpInitLibUpDepPpiGuid
|
||||||
|
|
||||||
[Pcd]
|
[Pcd]
|
||||||
gUefiCpuPkgTokenSpaceGuid.PcdSevEsWorkAreaBase
|
gUefiCpuPkgTokenSpaceGuid.PcdSevEsWorkAreaBase
|
||||||
|
|
Loading…
Reference in New Issue