public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Eric Dong <eric.dong@intel.com>
To: edk2-devel@lists.01.org
Cc: Laszlo Ersek <lersek@redhat.com>, Ruiyu Ni <ruiyu.ni@intel.com>
Subject: [Patch v3 3/3] UefiCpuPkg/MpInitLib: Load uCode once for each core.
Date: Mon, 16 Jul 2018 11:08:51 +0800	[thread overview]
Message-ID: <20180716030851.13752-4-eric.dong@intel.com> (raw)
In-Reply-To: <20180716030851.13752-1-eric.dong@intel.com>

The SDM requires only one thread per core to load the
microcode.

This change enables this solution.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
---
 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



  parent reply	other threads:[~2018-07-16  3:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-16  3:08 [Patch v3 0/3] Optimize load uCode performance Eric Dong
2018-07-16  3:08 ` [Patch v3 1/3] UefiCpuPkg/MpInitLib: Relocate uCode to memory to save time Eric Dong
2018-07-17 10:02   ` Ni, Ruiyu
2018-07-16  3:08 ` [Patch v3 2/3] UefiCpuPkg/MpInitLib: Use BSP uCode for APs if possible Eric Dong
2018-07-17 10:00   ` Ni, Ruiyu
2018-07-16  3:08 ` Eric Dong [this message]
2018-07-17 10:02   ` [Patch v3 3/3] UefiCpuPkg/MpInitLib: Load uCode once for each core Ni, Ruiyu
2018-07-17 14:07     ` Laszlo Ersek
2018-07-18  0:11       ` Dong, Eric
2018-07-19  4:42         ` Ni, Ruiyu
2018-07-17 16:38 ` [Patch v3 0/3] Optimize load uCode performance Laszlo Ersek
2018-07-17 19:08   ` Laszlo Ersek
2018-07-18  0:18   ` Dong, Eric
  -- strict thread matches above, loose matches on Subject: below --
2018-07-13  0:47 Eric Dong
2018-07-13  0:47 ` [Patch v3 3/3] UefiCpuPkg/MpInitLib: Load uCode once for each core Eric Dong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180716030851.13752-4-eric.dong@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox