From: Eric Dong Date: Thu, 12 Jul 2018 10:21:01 +0000 (+0800) Subject: UefiCpuPkg/MpInitLib: Load uCode once for each core. X-Git-Tag: edk2-stable201903~1393 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=f63a3e286765f47b79a73d56f8d687c4f3733979 UefiCpuPkg/MpInitLib: Load uCode once for each core. The SDM requires only one thread per core to load the microcode. This change enables this solution. Cc: Laszlo Ersek Cc: Ruiyu Ni Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Eric Dong Acked-by: Laszlo Ersek Regression-tested-by: Laszlo Ersek Reviewed-by: Ruiyu Ni --- diff --git a/UefiCpuPkg/Library/MpInitLib/Microcode.c b/UefiCpuPkg/Library/MpInitLib/Microcode.c index 30ceaa46ad..efda143e67 100644 --- a/UefiCpuPkg/Library/MpInitLib/Microcode.c +++ b/UefiCpuPkg/Library/MpInitLib/Microcode.c @@ -61,6 +61,7 @@ MicrocodeDetect ( VOID *MicrocodeData; MSR_IA32_PLATFORM_ID_REGISTER PlatformIdMsr; UINT32 ProcessorFlags; + UINT32 ThreadId; if (CpuMpData->MicrocodePatchRegionSize == 0) { // @@ -77,6 +78,14 @@ MicrocodeDetect ( return; } + GetProcessorLocationByApicId (GetInitialApicId (), NULL, NULL, &ThreadId); + if (ThreadId != 0) { + // + // Skip loading microcode if it is not the first thread in one core. + // + return; + } + ExtendedTableLength = 0; // // Here data of CPUID leafs have not been collected into context buffer, so