From f63a3e286765f47b79a73d56f8d687c4f3733979 Mon Sep 17 00:00:00 2001 From: Eric Dong Date: Thu, 12 Jul 2018 18:21:01 +0800 Subject: [PATCH] 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 --- UefiCpuPkg/Library/MpInitLib/Microcode.c | 9 +++++++++ 1 file changed, 9 insertions(+) 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 -- 2.39.2