summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXie, Yuanhao <yuanhao.xie@intel.com>2023-06-28 16:47:20 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-07-11 02:47:27 +0000
commit88f436883b45b090adaec2099728d224e47ff51f (patch)
treef87cbfb1da5c20414f7b692877315a8e347d609c
parent63923a5642e86f386a5c719a90cfc6a929ea9cb0 (diff)
downloadedk2-88f436883b45b090adaec2099728d224e47ff51f.tar.gz
edk2-88f436883b45b090adaec2099728d224e47ff51f.tar.bz2
edk2-88f436883b45b090adaec2099728d224e47ff51f.zip
UefiCpuPkg: Refactor the logic for placing APs in HltLoop.
Refactor the logic for placing APs in HltLoop into a separate function. Tested-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Rahul Kumar <rahul1.kumar@intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
-rw-r--r--UefiCpuPkg/Library/MpInitLib/MpLib.c35
1 files changed, 24 insertions, 11 deletions
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index f1f2840714..9560b39220 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -637,6 +637,28 @@ InitializeApData (
}
/**
+ This function place APs in Halt loop.
+
+ @param[in] CpuMpData Pointer to CPU MP Data
+**/
+VOID
+PlaceAPInHltLoop (
+ IN CPU_MP_DATA *CpuMpData
+ )
+{
+ while (TRUE) {
+ DisableInterrupts ();
+ if (CpuMpData->UseSevEsAPMethod) {
+ SevEsPlaceApHlt (CpuMpData);
+ } else {
+ CpuSleep ();
+ }
+
+ CpuPause ();
+ }
+}
+
+/**
This function will be called from AP reset code if BSP uses WakeUpAP.
@param[in] ExchangeInfo Pointer to the MP exchange info buffer
@@ -812,19 +834,10 @@ ApWakeupFunction (
// Place AP is specified loop mode
//
if (CpuMpData->ApLoopMode == ApInHltLoop) {
+ PlaceAPInHltLoop (CpuMpData);
//
- // Place AP in HLT-loop
+ // Never run here
//
- while (TRUE) {
- DisableInterrupts ();
- if (CpuMpData->UseSevEsAPMethod) {
- SevEsPlaceApHlt (CpuMpData);
- } else {
- CpuSleep ();
- }
-
- CpuPause ();
- }
}
while (TRUE) {