mirror of https://github.com/acidanthera/audk.git
UefiCpuPkg/MpInitLib: Restore IDT context for APs.
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2683 This patch fixes an assertion because AP can't find the CpuMpData. When AP is waken up through Init-Sipi-Sipi, AP's IDT should be restored to pre-allocated buffer so AP can get the CpuMpData through the IDT base address. Current code already has logic to handle this when CpuMpData-> InitFlag is ApInitConfig but misses the logic when CpuMpData->InitFlag is ApInitReconfig. This patch fixes this gap. Reviewed-by: Ray Ni <ray.ni@intel.com> 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>
This commit is contained in:
parent
b2034179e8
commit
052aa07da4
|
@ -686,9 +686,21 @@ ApWakeupFunction (
|
||||||
WAKEUP_AP_SIGNAL,
|
WAKEUP_AP_SIGNAL,
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (CpuMpData->InitFlag == ApInitReconfig) {
|
||||||
|
//
|
||||||
|
// ApInitReconfig happens when:
|
||||||
|
// 1. AP is re-enabled after it's disabled, in either PEI or DXE phase.
|
||||||
|
// 2. AP is initialized in DXE phase.
|
||||||
|
// In either case, use the volatile registers value derived from BSP.
|
||||||
|
// NOTE: IDTR.BASE stored in CpuMpData->CpuData[0].VolatileRegisters points to a
|
||||||
|
// different IDT shared by all APs.
|
||||||
|
//
|
||||||
|
RestoreVolatileRegisters (&CpuMpData->CpuData[0].VolatileRegisters, FALSE);
|
||||||
|
} else {
|
||||||
if (CpuMpData->ApLoopMode == ApInHltLoop) {
|
if (CpuMpData->ApLoopMode == ApInHltLoop) {
|
||||||
//
|
//
|
||||||
// Restore AP's volatile registers saved
|
// Restore AP's volatile registers saved before AP is halted
|
||||||
//
|
//
|
||||||
RestoreVolatileRegisters (&CpuMpData->CpuData[ProcessorNumber].VolatileRegisters, TRUE);
|
RestoreVolatileRegisters (&CpuMpData->CpuData[ProcessorNumber].VolatileRegisters, TRUE);
|
||||||
} else {
|
} else {
|
||||||
|
@ -699,6 +711,7 @@ ApWakeupFunction (
|
||||||
//
|
//
|
||||||
CpuFlushTlb ();
|
CpuFlushTlb ();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (GetApState (&CpuMpData->CpuData[ProcessorNumber]) == CpuStateReady) {
|
if (GetApState (&CpuMpData->CpuData[ProcessorNumber]) == CpuStateReady) {
|
||||||
Procedure = (EFI_AP_PROCEDURE)CpuMpData->CpuData[ProcessorNumber].ApFunction;
|
Procedure = (EFI_AP_PROCEDURE)CpuMpData->CpuData[ProcessorNumber].ApFunction;
|
||||||
|
@ -1780,7 +1793,6 @@ MpInitLibInitialize (
|
||||||
InitializeSpinLock(&CpuMpData->CpuData[Index].ApLock);
|
InitializeSpinLock(&CpuMpData->CpuData[Index].ApLock);
|
||||||
CpuMpData->CpuData[Index].CpuHealthy = (CpuInfoInHob[Index].Health == 0)? TRUE:FALSE;
|
CpuMpData->CpuData[Index].CpuHealthy = (CpuInfoInHob[Index].Health == 0)? TRUE:FALSE;
|
||||||
CpuMpData->CpuData[Index].ApFunction = 0;
|
CpuMpData->CpuData[Index].ApFunction = 0;
|
||||||
CopyMem (&CpuMpData->CpuData[Index].VolatileRegisters, &VolatileRegisters, sizeof (CPU_VOLATILE_REGISTERS));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue