UefiCpuPkg/MpInitLib: Avoid ApInitReconfig in PEI.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2683

In PEI phase, AP already been waked up through ApInitConfig,
so it can directly wake up it through change wakup buffer
instead of use ApInitReconfig flag. It can save some time.

Change code to only use ApInitReconfig flag in DXE phase
which must need to update the wake up buffer.

Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
Cc: Chandana Kumar <chandana.c.kumar@intel.com>
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
This commit is contained in:
Dong, Eric 2020-04-24 16:47:16 +08:00 committed by mergify[bot]
parent 052aa07da4
commit f07fb43b2d
1 changed files with 11 additions and 2 deletions

View File

@ -1820,7 +1820,14 @@ MpInitLibInitialize (
// Wakeup APs to do some AP initialize sync (Microcode & MTRR)
//
if (CpuMpData->CpuCount > 1) {
CpuMpData->InitFlag = ApInitReconfig;
if (OldCpuMpData != NULL) {
//
// Only needs to use this flag for DXE phase to update the wake up
// buffer. Wakeup buffer allocated in PEI phase is no longer valid
// in DXE.
//
CpuMpData->InitFlag = ApInitReconfig;
}
WakeUpAP (CpuMpData, TRUE, 0, ApInitializeSync, CpuMpData, TRUE);
//
// Wait for all APs finished initialization
@ -1828,7 +1835,9 @@ MpInitLibInitialize (
while (CpuMpData->FinishedCount < (CpuMpData->CpuCount - 1)) {
CpuPause ();
}
CpuMpData->InitFlag = ApInitDone;
if (OldCpuMpData != NULL) {
CpuMpData->InitFlag = ApInitDone;
}
for (Index = 0; Index < CpuMpData->CpuCount; Index++) {
SetApState (&CpuMpData->CpuData[Index], CpuStateIdle);
}