From cb33bde4ac7536f5a5621c7a56aecd981585e087 Mon Sep 17 00:00:00 2001 From: Jeff Fan Date: Mon, 14 Nov 2016 10:30:03 +0800 Subject: [PATCH] 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 --- UefiCpuPkg/Library/MpInitLib/MpLib.c | 5 +++++ 1 file changed, 5 insertions(+) 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); } -- 2.39.2