From: Jeff Fan Date: Mon, 14 Nov 2016 02:30:03 +0000 (+0800) Subject: UefiCpuPkg/MpInitLib: Force sending INIT-SIPI-SIPI to reset APs X-Git-Tag: edk2-stable201903~5185 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;ds=inline;h=cb33bde4ac7536f5a5621c7a56aecd981585e087;p=mirror_edk2.git UefiCpuPkg/MpInitLib: Force sending INIT-SIPI-SIPI to reset APs If BSP found APs timeout happened when AP executing AP task, BSP will reset APs by WakeUpAP(). However, if ApLoopMode is ApMwaitLoop or ApRunLoop, WakeUpAp() will try to write semaphore in memory to wake up AP. It cannot wake up APs actually if APs still executing AP task. This fix is to set ApInitReconfig flag to force BSP to send INIT-SIPI-SIPI to wake up APs. Cc: Feng Tian Cc: Michael D Kinney Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan Reviewed-by: Feng Tian --- diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c index a0edc55f52..9641e5e82c 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -899,7 +899,12 @@ ResetProcessorToIdleState ( CpuMpData = GetCpuMpData (); + CpuMpData->InitFlag = ApInitReconfig; WakeUpAP (CpuMpData, FALSE, ProcessorNumber, NULL, NULL); + while (CpuMpData->FinishedCount < 1) { + CpuPause (); + } + CpuMpData->InitFlag = ApInitDone; SetApState (&CpuMpData->CpuData[ProcessorNumber], CpuStateIdle); }