[edk2] [PATCH] UefiCpuPkg/MpInitLib: fix AP init issue in 64-bit PEI

Jian J Wang posted 1 patch 6 years, 9 months ago
Failed in applying to current master (apply log)
There is a newer version of this series
UefiCpuPkg/Library/MpInitLib/MpLib.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
[edk2] [PATCH] UefiCpuPkg/MpInitLib: fix AP init issue in 64-bit PEI
Posted by Jian J Wang 6 years, 9 months ago
This issue is introduced by a patch at

   f32bfe6d061420a15bac6083063d227c567e6388

The above patch miss the case of 64-bit PEI, which will link
X64/MpFuncs.nasm instead of Ia32/MpFuncs.nasm. For X64/MpFuncs.nasm,
ExchangeInfo->ModeHighMemory should be always initialized no matter
if separate wakeup buffer is allocated or not. Ia32/MpFuncs.nasm will
not need ModeHighMemory during AP init. So the changes made in this
patch should not affect the functionality of it.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
---
 UefiCpuPkg/Library/MpInitLib/MpLib.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 42011d6231..7c4b9deaee 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -834,14 +834,15 @@ FillExchangeInfoData (
       );
 
     ExchangeInfo->ModeTransitionMemory = (UINT32)CpuMpData->WakeupBufferHigh;
-    ExchangeInfo->ModeHighMemory = (UINT32)CpuMpData->WakeupBufferHigh +
-                                   (UINT32)ExchangeInfo->ModeOffset -
-                                   (UINT32)CpuMpData->AddressMap.ModeTransitionOffset;
-    ExchangeInfo->ModeHighSegment = (UINT16)ExchangeInfo->CodeSegment;
   } else {
     ExchangeInfo->ModeTransitionMemory = (UINT32)
       (ExchangeInfo->BufferStart + CpuMpData->AddressMap.ModeTransitionOffset);
   }
+
+  ExchangeInfo->ModeHighMemory = ExchangeInfo->ModeTransitionMemory +
+                         (UINT32)ExchangeInfo->ModeOffset -
+                         (UINT32)CpuMpData->AddressMap.ModeTransitionOffset;
+  ExchangeInfo->ModeHighSegment = (UINT16)ExchangeInfo->CodeSegment;
 }
 
 /**
@@ -918,9 +919,9 @@ AllocateResetVector (
     CpuMpData->MpCpuExchangeInfo = (MP_CPU_EXCHANGE_INFO *) (UINTN)
                     (CpuMpData->WakeupBuffer + CpuMpData->AddressMap.RendezvousFunnelSize);
     CpuMpData->WakeupBufferHigh  = GetModeTransitionBuffer (
-                                    CpuMpData->AddressMap.RendezvousFunnelSize -
-                                    CpuMpData->AddressMap.ModeTransitionOffset
-                                    );
+                      CpuMpData->AddressMap.RendezvousFunnelSize -
+                      CpuMpData->AddressMap.ModeTransitionOffset
+                      );
   }
   BackupAndPrepareWakeupBuffer (CpuMpData);
 }
-- 
2.15.1.windows.2

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel