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>
This commit is contained in:
Ray Ni 2023-04-18 17:41:21 +08:00 committed by mergify[bot]
parent 7ed3989166
commit 319835abb8

View File

@ -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