StandaloneMmPkg: remove per-cpu feature on StandaloneMm

StandaloneMm in Arm is UP-migratable which means StandaloneMm
cannot run concurrently.

Therefore, remove per-cpu feature in StandaloneMm.

Signed-off-by: Levi Yun <yeoreum.yun@arm.com>
This commit is contained in:
Levi Yun 2024-10-11 09:44:35 +01:00 committed by mergify[bot]
parent 6c62f40df3
commit 6dd5375820
5 changed files with 65 additions and 329 deletions

View File

@ -1,7 +1,7 @@
/** @file /** @file
Copyright (c) 2016 HP Development Company, L.P. Copyright (c) 2016 HP Development Company, L.P.
Copyright (c) 2016 - 2021, Arm Limited. All rights reserved. Copyright (c) 2016 - 2024, Arm Limited. All rights reserved.
Copyright (c) 2021, Linaro Limited Copyright (c) 2021, Linaro Limited
Copyright (c) 2023, Ventana Micro System Inc. All rights reserved. Copyright (c) 2023, Ventana Micro System Inc. All rights reserved.
@ -36,14 +36,10 @@ MmFoundationEntryRegister (
// event. It will either be populated in a EFI_MM_COMMUNICATE_HEADER by the // event. It will either be populated in a EFI_MM_COMMUNICATE_HEADER by the
// caller of the event (e.g. MM_COMMUNICATE SMC) or by the CPU driver // caller of the event (e.g. MM_COMMUNICATE SMC) or by the CPU driver
// (e.g. during an asynchronous event). In either case, this context is // (e.g. during an asynchronous event). In either case, this context is
// maintained in an array which has an entry for each CPU. The pointer to this // maintained in single global variable because StandaloneMm is UP-migratable
// array is held in PerCpuGuidedEventContext. Memory is allocated once the // (which means it cannot run concurrently)
// number of CPUs in the system are made known through the
// MP_INFORMATION_HOB_DATA.
// //
EFI_MM_COMMUNICATE_HEADER **PerCpuGuidedEventContext = NULL; EFI_MM_COMMUNICATE_HEADER *gGuidedEventContext = NULL;
MP_INFORMATION_HOB_DATA *mMpInformationHobData;
EFI_MM_CONFIGURATION_PROTOCOL mMmConfig = { EFI_MM_CONFIGURATION_PROTOCOL mMmConfig = {
0, 0,
@ -60,8 +56,7 @@ STATIC EFI_MM_ENTRY_POINT mMmEntryPoint = NULL;
The PI Standalone MM entry point for the CPU driver. The PI Standalone MM entry point for the CPU driver.
@param [in] EventId The event Id. @param [in] EventId The event Id.
@param [in] CpuNumber The CPU number. @param [in] CommBufferAddr Address of the communication buffer.
@param [in] NsCommBufferAddr Address of the NS common buffer.
@retval EFI_SUCCESS Success. @retval EFI_SUCCESS Success.
@retval EFI_INVALID_PARAMETER A parameter was invalid. @retval EFI_INVALID_PARAMETER A parameter was invalid.
@ -72,77 +67,68 @@ STATIC EFI_MM_ENTRY_POINT mMmEntryPoint = NULL;
EFI_STATUS EFI_STATUS
PiMmStandaloneMmCpuDriverEntry ( PiMmStandaloneMmCpuDriverEntry (
IN UINTN EventId, IN UINTN EventId,
IN UINTN CpuNumber, IN UINTN CommBufferAddr
IN UINTN NsCommBufferAddr
) )
{ {
EFI_MM_COMMUNICATE_HEADER *GuidedEventContext;
EFI_MM_ENTRY_CONTEXT MmEntryPointContext; EFI_MM_ENTRY_CONTEXT MmEntryPointContext;
EFI_STATUS Status; EFI_STATUS Status;
UINTN NsCommBufferSize; UINTN CommBufferSize;
DEBUG ((DEBUG_INFO, "Received event - 0x%x on cpu %d\n", EventId, CpuNumber)); DEBUG ((DEBUG_INFO, "Received event - 0x%x\n", EventId));
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
// Perform parameter validation of NsCommBufferAddr // Perform parameter validation of NsCommBufferAddr
if (NsCommBufferAddr == (UINTN)NULL) { if (CommBufferAddr == (UINTN)NULL) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
// Find out the size of the buffer passed
NsCommBufferSize = ((EFI_MM_COMMUNICATE_HEADER *)NsCommBufferAddr)->MessageLength +
sizeof (EFI_MM_COMMUNICATE_HEADER);
GuidedEventContext = NULL;
// Now that the secure world can see the normal world buffer, allocate
// memory to copy the communication buffer to the secure world.
Status = mMmst->MmAllocatePool (
EfiRuntimeServicesData,
NsCommBufferSize,
(VOID **)&GuidedEventContext
);
if (Status != EFI_SUCCESS) {
DEBUG ((DEBUG_ERROR, "Mem alloc failed - 0x%x\n", EventId));
return EFI_OUT_OF_RESOURCES;
}
// X1 contains the VA of the normal world memory accessible from
// secure world.
CopyMem (GuidedEventContext, (CONST VOID *)NsCommBufferAddr, NsCommBufferSize);
// Stash the pointer to the allocated Event Context for this CPU
PerCpuGuidedEventContext[CpuNumber] = GuidedEventContext;
ZeroMem (&MmEntryPointContext, sizeof (EFI_MM_ENTRY_CONTEXT));
MmEntryPointContext.CurrentlyExecutingCpu = CpuNumber;
MmEntryPointContext.NumberOfCpus = mMpInformationHobData->NumberOfProcessors;
// Populate the MM system table with MP and state information
mMmst->CurrentlyExecutingCpu = CpuNumber;
mMmst->NumberOfCpus = mMpInformationHobData->NumberOfProcessors;
mMmst->CpuSaveStateSize = 0;
mMmst->CpuSaveState = NULL;
if (mMmEntryPoint == NULL) { if (mMmEntryPoint == NULL) {
DEBUG ((DEBUG_ERROR, "Mm Entry point Not Found\n")); DEBUG ((DEBUG_ERROR, "Mm Entry point Not Found\n"));
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
// Find out the size of the buffer passed
CommBufferSize = ((EFI_MM_COMMUNICATE_HEADER *)CommBufferAddr)->MessageLength +
sizeof (EFI_MM_COMMUNICATE_HEADER);
// Now that the secure world can see the normal world buffer, allocate
// memory to copy the communication buffer to the secure world.
Status = mMmst->MmAllocatePool (
EfiRuntimeServicesData,
CommBufferSize,
(VOID **)&gGuidedEventContext
);
if (EFI_ERROR (Status)) {
gGuidedEventContext = NULL;
DEBUG ((DEBUG_ERROR, "Mem alloc failed - 0x%x\n", EventId));
return Status;
}
CopyMem (gGuidedEventContext, (CONST VOID *)CommBufferAddr, CommBufferSize);
ZeroMem (&MmEntryPointContext, sizeof (EFI_MM_ENTRY_CONTEXT));
// StandaloneMm UP-migratable which means it cannot run concurrently.
// Therefore, set number of cpus as 1 and cpu number as 0.
MmEntryPointContext.CurrentlyExecutingCpu = 0;
MmEntryPointContext.NumberOfCpus = 1;
// Populate the MM system table with MP and state information
mMmst->CurrentlyExecutingCpu = 0;
mMmst->NumberOfCpus = 1;
mMmst->CpuSaveStateSize = 0;
mMmst->CpuSaveState = NULL;
mMmEntryPoint (&MmEntryPointContext); mMmEntryPoint (&MmEntryPointContext);
// Free the memory allocation done earlier and reset the per-cpu context // Free the memory allocation done earlier and reset the per-cpu context
ASSERT (GuidedEventContext); CopyMem ((VOID *)CommBufferAddr, (CONST VOID *)gGuidedEventContext, CommBufferSize);
CopyMem ((VOID *)NsCommBufferAddr, (CONST VOID *)GuidedEventContext, NsCommBufferSize);
Status = mMmst->MmFreePool ((VOID *)GuidedEventContext); Status = mMmst->MmFreePool ((VOID *)gGuidedEventContext);
if (Status != EFI_SUCCESS) { ASSERT_EFI_ERROR (Status);
return EFI_OUT_OF_RESOURCES; gGuidedEventContext = NULL;
}
PerCpuGuidedEventContext[CpuNumber] = NULL;
return Status; return Status;
} }
@ -193,29 +179,27 @@ PiMmCpuTpFwRootMmiHandler (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINTN CpuNumber;
ASSERT (Context == NULL); ASSERT (Context == NULL);
ASSERT (CommBuffer == NULL); ASSERT (CommBuffer == NULL);
ASSERT (CommBufferSize == NULL); ASSERT (CommBufferSize == NULL);
CpuNumber = mMmst->CurrentlyExecutingCpu; if (gGuidedEventContext == NULL) {
if (PerCpuGuidedEventContext[CpuNumber] == NULL) {
return EFI_NOT_FOUND; return EFI_NOT_FOUND;
} }
DEBUG (( DEBUG ((
DEBUG_INFO, DEBUG_INFO,
"CommBuffer - 0x%x, CommBufferSize - 0x%x\n", "CommBuffer - 0x%x, CommBufferSize - 0x%x\n",
PerCpuGuidedEventContext[CpuNumber], gGuidedEventContext,
PerCpuGuidedEventContext[CpuNumber]->MessageLength gGuidedEventContext->MessageLength
)); ));
Status = mMmst->MmiManage ( Status = mMmst->MmiManage (
&PerCpuGuidedEventContext[CpuNumber]->HeaderGuid, &gGuidedEventContext->HeaderGuid,
NULL, NULL,
PerCpuGuidedEventContext[CpuNumber]->Data, gGuidedEventContext->Data,
&PerCpuGuidedEventContext[CpuNumber]->MessageLength &gGuidedEventContext->MessageLength
); );
if (Status != EFI_SUCCESS) { if (Status != EFI_SUCCESS) {

View File

@ -22,10 +22,6 @@
#include <StandaloneMmCpu.h> #include <StandaloneMmCpu.h>
// GUID to identify HOB with whereabouts of communication buffer with Normal
// World
extern EFI_GUID gEfiStandaloneMmNonSecureBufferGuid;
// //
// mPiMmCpuDriverEpProtocol for Cpu driver entry point to handle // mPiMmCpuDriverEpProtocol for Cpu driver entry point to handle
// mm communication event. // mm communication event.
@ -42,42 +38,6 @@ EFI_MM_SYSTEM_TABLE *mMmst = NULL;
// //
STATIC EFI_HANDLE mMmCpuHandle = NULL; STATIC EFI_HANDLE mMmCpuHandle = NULL;
/** Returns the HOB data for the matching HOB GUID.
@param [in] HobList Pointer to the HOB list.
@param [in] HobGuid The GUID for the HOB.
@param [out] HobData Pointer to the HOB data.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
@retval EFI_NOT_FOUND Could not find HOB with matching GUID.
**/
EFI_STATUS
GetGuidedHobData (
IN VOID *HobList,
IN CONST EFI_GUID *HobGuid,
OUT VOID **HobData
)
{
EFI_HOB_GUID_TYPE *Hob;
if ((HobList == NULL) || (HobGuid == NULL) || (HobData == NULL)) {
return EFI_INVALID_PARAMETER;
}
Hob = GetNextGuidHob (HobGuid, HobList);
if (Hob == NULL) {
return EFI_NOT_FOUND;
}
*HobData = GET_GUID_HOB_DATA (Hob);
if (*HobData == NULL) {
return EFI_NOT_FOUND;
}
return EFI_SUCCESS;
}
/** Entry point for the Standalone MM CPU driver. /** Entry point for the Standalone MM CPU driver.
@param [in] ImageHandle Unused. Not actual image handle. @param [in] ImageHandle Unused. Not actual image handle.
@ -95,14 +55,8 @@ StandaloneMmCpuInitialize (
IN EFI_MM_SYSTEM_TABLE *SystemTable // not actual systemtable IN EFI_MM_SYSTEM_TABLE *SystemTable // not actual systemtable
) )
{ {
EFI_CONFIGURATION_TABLE *ConfigurationTable;
MP_INFORMATION_HOB_DATA *MpInformationHobData;
EFI_STATUS Status; EFI_STATUS Status;
EFI_HANDLE DispatchHandle; EFI_HANDLE DispatchHandle;
UINT32 MpInfoSize;
UINTN Index;
UINTN ArraySize;
VOID *HobStart;
ASSERT (SystemTable != NULL); ASSERT (SystemTable != NULL);
mMmst = SystemTable; mMmst = SystemTable;
@ -141,89 +95,5 @@ StandaloneMmCpuInitialize (
return Status; return Status;
} }
// Retrieve the Hoblist from the MMST to extract the details of the NS
// communication buffer that has been reserved for StandaloneMmPkg
ConfigurationTable = mMmst->MmConfigurationTable;
for (Index = 0; Index < mMmst->NumberOfTableEntries; Index++) {
if (CompareGuid (&gEfiHobListGuid, &(ConfigurationTable[Index].VendorGuid))) {
break;
}
}
// Bail out if the Hoblist could not be found
if (Index >= mMmst->NumberOfTableEntries) {
DEBUG ((DEBUG_ERROR, "Hoblist not found - 0x%x\n", Index));
return EFI_OUT_OF_RESOURCES;
}
HobStart = ConfigurationTable[Index].VendorTable;
//
// Extract the MP information from the Hoblist
//
Status = GetGuidedHobData (
HobStart,
&gMpInformationHobGuid,
(VOID **)&MpInformationHobData
);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "MpInformationHob extraction failed - 0x%x\n", Status));
return Status;
}
//
// Allocate memory for the MP information and copy over the MP information
// passed by Trusted Firmware. Use the number of processors passed in the HOB
// to copy the processor information
//
MpInfoSize = sizeof (MP_INFORMATION_HOB_DATA) +
(sizeof (EFI_PROCESSOR_INFORMATION) *
MpInformationHobData->NumberOfProcessors);
Status = mMmst->MmAllocatePool (
EfiRuntimeServicesData,
MpInfoSize,
(VOID **)&mMpInformationHobData
);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "mMpInformationHobData mem alloc failed - 0x%x\n", Status));
return Status;
}
CopyMem (mMpInformationHobData, MpInformationHobData, MpInfoSize);
// Print MP information
DEBUG ((
DEBUG_INFO,
"mMpInformationHobData: 0x%016lx - 0x%lx\n",
mMpInformationHobData->NumberOfProcessors,
mMpInformationHobData->NumberOfEnabledProcessors
));
for (Index = 0; Index < mMpInformationHobData->NumberOfProcessors; Index++) {
DEBUG ((
DEBUG_INFO,
"mMpInformationHobData[0x%lx]: %d, %d, %d\n",
mMpInformationHobData->ProcessorInfoBuffer[Index].ProcessorId,
mMpInformationHobData->ProcessorInfoBuffer[Index].Location.Package,
mMpInformationHobData->ProcessorInfoBuffer[Index].Location.Core,
mMpInformationHobData->ProcessorInfoBuffer[Index].Location.Thread
));
}
//
// Allocate memory for a table to hold pointers to a
// EFI_MM_COMMUNICATE_HEADER for each CPU
//
ArraySize = sizeof (EFI_MM_COMMUNICATE_HEADER *) *
mMpInformationHobData->NumberOfEnabledProcessors;
Status = mMmst->MmAllocatePool (
EfiRuntimeServicesData,
ArraySize,
(VOID **)&PerCpuGuidedEventContext
);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "PerCpuGuidedEventContext mem alloc failed - 0x%x\n", Status));
return Status;
}
return Status; return Status;
} }

View File

@ -19,7 +19,8 @@
/** /**
The PI Standalone MM entry point for handling mm communication request The PI Standalone MM entry point for handling mm communication request
Here is an example of how the PI_MM_CPU_DRIVER_EP_PROTOCOL is utilized in ARM: Here is an example of how the EDKII_PI_MM_CPU_DRIVER_EP_PROTOCOL
is utilized in ARM:
1. StandaloneMmCoreEntryPoint loads StandaloneMmCore. 1. StandaloneMmCoreEntryPoint loads StandaloneMmCore.
2. StandaloneMmCore dispatches all MM drivers, 2. StandaloneMmCore dispatches all MM drivers,
including the StandaloneMmCpu driver. including the StandaloneMmCpu driver.
@ -33,7 +34,6 @@
See StandaloneMmPkg/StandaloneMmCoreEntryPoint/Arm/StandaloneMmCoreEntryPoint.c See StandaloneMmPkg/StandaloneMmCoreEntryPoint/Arm/StandaloneMmCoreEntryPoint.c
@param [in] EventId The event Id based on firmware. @param [in] EventId The event Id based on firmware.
@param [in] CpuNumber The CPU number.
@param [in] CommBufferAddr Address of the communication buffer. @param [in] CommBufferAddr Address of the communication buffer.
@retval EFI_SUCCESS Success. @retval EFI_SUCCESS Success.
@ -46,7 +46,6 @@ typedef
EFI_STATUS EFI_STATUS
(EFIAPI *EDKII_PI_MM_CPU_DRIVER_ENTRYPOINT)( (EFIAPI *EDKII_PI_MM_CPU_DRIVER_ENTRYPOINT)(
IN UINTN EventId, IN UINTN EventId,
IN UINTN CpuNumber,
IN UINTN CommBufferAddr IN UINTN CommBufferAddr
); );

View File

@ -30,16 +30,14 @@ extern EFI_MM_CPU_PROTOCOL mMmCpuState;
// //
// MM event handling specific declarations // MM event handling specific declarations
// //
extern EFI_MM_COMMUNICATE_HEADER **PerCpuGuidedEventContext; extern EFI_MM_COMMUNICATE_HEADER *gGuidedEventContext;
extern MP_INFORMATION_HOB_DATA *mMpInformationHobData;
extern EFI_MM_CONFIGURATION_PROTOCOL mMmConfig; extern EFI_MM_CONFIGURATION_PROTOCOL mMmConfig;
/** /**
The PI Standalone MM entry point for the CPU driver. The PI Standalone MM entry point for the CPU driver.
@param [in] EventId The event Id. @param [in] EventId The event Id.
@param [in] CpuNumber The CPU number. @param [in] CommBufferAddr Address of the communication buffer.
@param [in] NsCommBufferAddr Address of the NS common buffer.
@retval EFI_SUCCESS Success. @retval EFI_SUCCESS Success.
@retval EFI_INVALID_PARAMETER A parameter was invalid. @retval EFI_INVALID_PARAMETER A parameter was invalid.
@ -50,8 +48,7 @@ extern EFI_MM_CONFIGURATION_PROTOCOL mMmConfig;
EFI_STATUS EFI_STATUS
PiMmStandaloneMmCpuDriverEntry ( PiMmStandaloneMmCpuDriverEntry (
IN UINTN EventId, IN UINTN EventId,
IN UINTN CpuNumber, IN UINTN CommBufferAddr
IN UINTN NsCommBufferAddr
); );
/** /**

View File

@ -26,7 +26,6 @@
#include <PiPei.h> #include <PiPei.h>
#include <Guid/MmramMemoryReserve.h> #include <Guid/MmramMemoryReserve.h>
#include <Guid/MpInformation.h>
#include <Library/ArmLib.h> #include <Library/ArmLib.h>
#include <Library/ArmSvcLib.h> #include <Library/ArmSvcLib.h>
@ -52,7 +51,6 @@ extern EFI_MM_SYSTEM_TABLE gMmCoreMmst;
VOID *gHobList = NULL; VOID *gHobList = NULL;
STATIC MP_INFORMATION_HOB_DATA *mMpInfo = NULL;
STATIC MISC_MM_COMMUNICATE_BUFFER *mMiscMmCommunicateBuffer = NULL; STATIC MISC_MM_COMMUNICATE_BUFFER *mMiscMmCommunicateBuffer = NULL;
STATIC EFI_MMRAM_DESCRIPTOR *mNsCommBuffer = NULL; STATIC EFI_MMRAM_DESCRIPTOR *mNsCommBuffer = NULL;
STATIC EFI_MMRAM_DESCRIPTOR *mSCommBuffer = NULL; STATIC EFI_MMRAM_DESCRIPTOR *mSCommBuffer = NULL;
@ -453,40 +451,6 @@ GetServiceType (
return ServiceTypeMisc; return ServiceTypeMisc;
} }
/**
Get logical Cpu Number based on MpInformation hob data.
@param [in] CommProtocol Abi Protocol.
@param [in] EventCompleteSvcArgs Pointer to the event completion arguments.
@retval CpuNumber Cpu Number
**/
STATIC
UINTN
EFIAPI
GetCpuNumber (
IN COMM_PROTOCOL CommProtocol,
IN ARM_SVC_ARGS *EventCompleteSvcArgs
)
{
UINTN Idx;
if (CommProtocol == CommProtocolSpmMm) {
Idx = EventCompleteSvcArgs->Arg3;
} else {
/*
* There's no way to find out CPU number in StandaloneMm via FF-A v1.2.
* Because StandaloneMm is S-EL0 partition, it couldn't read mpidr.
* Currently, StandaloneMm is UP migratable SP so, just return idx 0.
*/
Idx = 0;
}
ASSERT (Idx < mMpInfo->NumberOfProcessors);
return Idx;
}
/** /**
Perform bounds check for the Ns and Secure Communication buffer. Perform bounds check for the Ns and Secure Communication buffer.
@ -531,8 +495,9 @@ ValidateMmCommBufferAddr (
} }
// perform bounds check. // perform bounds check.
if ((CommBufferRange - sizeof (EFI_MM_COMMUNICATE_HEADER)) < if (((CommBufferAddr + sizeof (EFI_MM_COMMUNICATE_HEADER) +
((EFI_MM_COMMUNICATE_HEADER *)CommBufferAddr)->MessageLength) ((EFI_MM_COMMUNICATE_HEADER *)CommBufferAddr)->MessageLength)) >
CommBufferEnd)
{ {
return EFI_ACCESS_DENIED; return EFI_ACCESS_DENIED;
} }
@ -540,47 +505,6 @@ ValidateMmCommBufferAddr (
return EFI_SUCCESS; return EFI_SUCCESS;
} }
/**
Dump mp information descriptor.
@param[in] ProcessorInfo Mp information
@param[in] Idx Cpu index
**/
STATIC
VOID
EFIAPI
DumpMpInfoDescriptor (
EFI_PROCESSOR_INFORMATION *ProcessorInfo,
UINTN Idx
)
{
if (ProcessorInfo == NULL) {
return;
}
DEBUG ((
DEBUG_INFO,
"CPU[%d]: MpIdr - 0x%lx\n",
Idx,
ProcessorInfo->ProcessorId
));
DEBUG ((
DEBUG_INFO,
"CPU[%d]: StatusFlag - 0x%lx\n",
Idx,
ProcessorInfo->StatusFlag
));
DEBUG ((
DEBUG_INFO,
"CPU[%d]: Location[P:C:T] - :%d:%d:%d\n",
Idx,
ProcessorInfo->Location.Package,
ProcessorInfo->Location.Core,
ProcessorInfo->Location.Thread
));
}
/** /**
Dump mmram descriptor. Dump mmram descriptor.
@ -645,7 +569,6 @@ DumpPhitHob (
{ {
EFI_HOB_FIRMWARE_VOLUME *FvHob; EFI_HOB_FIRMWARE_VOLUME *FvHob;
EFI_HOB_GUID_TYPE *GuidHob; EFI_HOB_GUID_TYPE *GuidHob;
MP_INFORMATION_HOB_DATA *MpInfo;
EFI_MMRAM_HOB_DESCRIPTOR_BLOCK *MmramRangesHobData; EFI_MMRAM_HOB_DESCRIPTOR_BLOCK *MmramRangesHobData;
EFI_MMRAM_DESCRIPTOR *MmramDesc; EFI_MMRAM_DESCRIPTOR *MmramDesc;
UINTN Idx; UINTN Idx;
@ -659,23 +582,6 @@ DumpPhitHob (
DEBUG ((DEBUG_INFO, "FvHob: BaseAddress - 0x%lx\n", FvHob->BaseAddress)); DEBUG ((DEBUG_INFO, "FvHob: BaseAddress - 0x%lx\n", FvHob->BaseAddress));
DEBUG ((DEBUG_INFO, "FvHob: Length - %ld\n", FvHob->Length)); DEBUG ((DEBUG_INFO, "FvHob: Length - %ld\n", FvHob->Length));
GuidHob = GetNextGuidHob (&gMpInformationHobGuid, HobStart);
if (GuidHob == NULL) {
DEBUG ((DEBUG_ERROR, "Error: No MpInformation Guid Hob is present.\n"));
return;
}
MpInfo = GET_GUID_HOB_DATA (GuidHob);
DEBUG ((DEBUG_INFO, "Number of Cpus - %d\n", MpInfo->NumberOfProcessors));
DEBUG ((
DEBUG_INFO,
"Number of Enabled Cpus - %d\n",
MpInfo->NumberOfEnabledProcessors
));
for (Idx = 0; Idx < MpInfo->NumberOfProcessors; Idx++) {
DumpMpInfoDescriptor (&MpInfo->ProcessorInfoBuffer[Idx], Idx);
}
GuidHob = GetNextGuidHob (&gEfiStandaloneMmNonSecureBufferGuid, HobStart); GuidHob = GetNextGuidHob (&gEfiStandaloneMmNonSecureBufferGuid, HobStart);
if (GuidHob == NULL) { if (GuidHob == NULL) {
DEBUG ((DEBUG_ERROR, "Error: No Ns Buffer Guid Hob is present.\n")); DEBUG ((DEBUG_ERROR, "Error: No Ns Buffer Guid Hob is present.\n"));
@ -937,7 +843,6 @@ DelegatedEventLoop (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINTN CpuNumber;
UINT64 Uuid[2]; UINT64 Uuid[2];
VOID *CommData; VOID *CommData;
FFA_MSG_INFO FfaMsgInfo; FFA_MSG_INFO FfaMsgInfo;
@ -962,9 +867,6 @@ DelegatedEventLoop (
DEBUG ((DEBUG_INFO, "X6 : 0x%x\n", (UINT32)EventCompleteSvcArgs->Arg6)); DEBUG ((DEBUG_INFO, "X6 : 0x%x\n", (UINT32)EventCompleteSvcArgs->Arg6));
DEBUG ((DEBUG_INFO, "X7 : 0x%x\n", (UINT32)EventCompleteSvcArgs->Arg7)); DEBUG ((DEBUG_INFO, "X7 : 0x%x\n", (UINT32)EventCompleteSvcArgs->Arg7));
CpuNumber = GetCpuNumber (CommProtocol, EventCompleteSvcArgs);
DEBUG ((DEBUG_INFO, "CpuNumber: %d\n", CpuNumber));
if (CommProtocol == CommProtocolFfa) { if (CommProtocol == CommProtocolFfa) {
/* /*
* Register Convention for FF-A * Register Convention for FF-A
@ -1061,7 +963,7 @@ DelegatedEventLoop (
} }
} }
Status = CpuDriverEntryPoint ((UINTN)ServiceType, CpuNumber, CommBufferAddr); Status = CpuDriverEntryPoint ((UINTN)ServiceType, CommBufferAddr);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG (( DEBUG ((
DEBUG_ERROR, DEBUG_ERROR,
@ -1238,24 +1140,8 @@ CEntryPoint (
goto finish; goto finish;
} }
// Set the gHobList to point to the HOB list saved in ConfigurationTable[].
gHobList = ConfigurationTable[Idx].VendorTable; gHobList = ConfigurationTable[Idx].VendorTable;
//
// Find MpInformation Hob in HobList.
// It couldn't save address of mp information in gHobList
// because that memory area will be reused after StandaloneMm finishing
// initialization.
//
GuidHob = GetNextGuidHob (&gMpInformationHobGuid, gHobList);
if (GuidHob == NULL) {
Status = EFI_NOT_FOUND;
DEBUG ((DEBUG_ERROR, "Error: No MpInformation hob ...\n"));
goto finish;
}
mMpInfo = GET_GUID_HOB_DATA (GuidHob);
// Find the descriptor that contains the whereabouts of the buffer for // Find the descriptor that contains the whereabouts of the buffer for
// communication with the Normal world. // communication with the Normal world.
GuidHob = GetNextGuidHob (&gEfiStandaloneMmNonSecureBufferGuid, gHobList); GuidHob = GetNextGuidHob (&gEfiStandaloneMmNonSecureBufferGuid, gHobList);