diff options
author | Zhiguang Liu <zhiguang.liu@intel.com> | 2024-05-28 11:22:10 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-07-24 02:47:34 +0000 |
commit | 7033f359a99121fd2c3fefe03d9f0c64e8bfaa10 (patch) | |
tree | efe84fecfca3c8a1933171befe901add7a98355d | |
parent | 76f441c57c6653d689fbe936ba494ebfdbc7cb4f (diff) | |
download | edk2-7033f359a99121fd2c3fefe03d9f0c64e8bfaa10.tar.gz edk2-7033f359a99121fd2c3fefe03d9f0c64e8bfaa10.tar.bz2 edk2-7033f359a99121fd2c3fefe03d9f0c64e8bfaa10.zip |
UefiCpuPkg: Preserve Local APIC Timer Settings During BSP Switch
This update ensures the consistency of Local APIC timer settings across
all processors when a BSP switch occurs.
The Local APIC timer is utilized in two distinct scenarios:
1. As a delay mechanism within the timer library.
2. To generate periodic timer interrupts during the DXE phase.
For scenario 1, APs can simply inherit the initial settings from the
BSP. Even the local APIC timer setting is changed by BSP later, AP
can still use the old setting. Therefore, the code to save the Local
APIC timer can be moved to MpInitLibInitialize().
For scenario 2, because normal AP doesn't enable timer interrupt, we
only need to care SwitchBsp case. It is crucial that the periodic
timer interrupts remain operational after BSP is switched. To achieve
this, the Local APIC timer settings on old BSP are now preserved and
synced to new BSP.
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
-rw-r--r-- | UefiCpuPkg/Library/MpInitLib/MpLib.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c index 78eeaa6de2..69c53c6228 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -1258,7 +1258,6 @@ WakeUpAP ( AllocateResetVectorBelow1Mb (CpuMpData);
AllocateSevEsAPMemory (CpuMpData);
FillExchangeInfoData (CpuMpData);
- SaveLocalApicTimerSetting (CpuMpData);
}
if (CpuMpData->ApLoopMode == ApInMwaitLoop) {
@@ -2236,6 +2235,7 @@ MpInitLibInitialize ( // Enable the local APIC for Virtual Wire Mode.
//
ProgramVirtualWireMode ();
+ SaveLocalApicTimerSetting (CpuMpData);
if (FirstMpHandOff == NULL) {
if (MaxLogicalProcessorNumber > 1) {
@@ -2612,6 +2612,11 @@ SwitchBSPWorker ( AsmWriteMsr64 (MSR_IA32_APIC_BASE, ApicBaseMsr.Uint64);
//
+ // Save BSP's local APIC timer setting.
+ //
+ SaveLocalApicTimerSetting (CpuMpData);
+
+ //
// Need to wakeUp AP (future BSP).
//
WakeUpAP (CpuMpData, FALSE, ProcessorNumber, FutureBSPProc, CpuMpData, TRUE);
|