From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.100; helo=mga07.intel.com; envelope-from=eric.dong@intel.com; receiver=edk2-devel@lists.01.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id B5C412097E25B for ; Thu, 12 Jul 2018 03:49:32 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jul 2018 03:49:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,342,1526367600"; d="scan'208";a="72147241" Received: from ydong10-win10.ccr.corp.intel.com ([10.239.9.24]) by orsmga001.jf.intel.com with ESMTP; 12 Jul 2018 03:49:31 -0700 From: Eric Dong To: edk2-devel@lists.01.org Cc: Laszlo Ersek , Ruiyu Ni Date: Thu, 12 Jul 2018 18:49:27 +0800 Message-Id: <20180712104927.12220-4-eric.dong@intel.com> X-Mailer: git-send-email 2.15.0.windows.1 In-Reply-To: <20180712104927.12220-1-eric.dong@intel.com> References: <20180712104927.12220-1-eric.dong@intel.com> Subject: [Patch v2 3/3] UefiCpuPkg/MpInitLib: Load uCode once for each core. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jul 2018 10:49:32 -0000 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 --- 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 351975e2a2..122c23469d 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.15.0.windows.1