[edk2-devel] [PATCH 3/4] UefiCpuPkg/MpInitLib: Skip X2APIC enabling when BSP in X2APIC already

Ni, Ray posted 4 patches 2 years, 5 months ago
[edk2-devel] [PATCH 3/4] UefiCpuPkg/MpInitLib: Skip X2APIC enabling when BSP in X2APIC already
Posted by Ni, Ray 2 years, 5 months ago
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>
---
 UefiCpuPkg/Library/MpInitLib/MpLib.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 2372475a04..5a8ed027be 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -1998,7 +1998,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
-- 
2.39.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#106717): https://edk2.groups.io/g/devel/message/106717
Mute This Topic: https://groups.io/mt/100000877/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076/xyzzy [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-