summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRay Ni <ray.ni@intel.com>2023-04-18 17:41:21 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-08-28 17:46:17 +0000
commit319835abb8517fde84bff31740fb1e61b33a3ae8 (patch)
treef0c0c76bad8a4ad631f758cfad5852d253de680e
parent7ed398916605be3e9fd3b1bfc8f49cc36e86fd3f (diff)
downloadedk2-319835abb8517fde84bff31740fb1e61b33a3ae8.tar.gz
edk2-319835abb8517fde84bff31740fb1e61b33a3ae8.tar.bz2
edk2-319835abb8517fde84bff31740fb1e61b33a3ae8.zip
UefiCpuPkg/MpInitLib: Skip X2APIC enabling when BSP in X2APIC already
The BSP's APIC mode is synced to all APs in CollectProcessorCount(). So, it's safe to skip the X2 APIC enabling in AutoEnableX2Apic() which runs later when BSP's APIC mode is X2 APIC already. Signed-off-by: Ray Ni <ray.ni@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Rahul Kumar <rahul1.kumar@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r--UefiCpuPkg/Library/MpInitLib/MpLib.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 4e28ff3fe4..67e8556a4a 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -2248,7 +2248,9 @@ MpInitLibInitialize (
//
// Enable X2APIC if needed.
//
- AutoEnableX2Apic (CpuMpData);
+ if (CpuMpData->InitialBspApicMode == LOCAL_APIC_MODE_XAPIC) {
+ AutoEnableX2Apic (CpuMpData);
+ }
//
// Sort BSP/Aps by CPU APIC ID in ascending order