audk/UefiCpuPkg
Hao A Wu a9e3458ba7 UefiCpuPkg/MpInitLib: Always get CPUID & PlatformID in MicrocodeDetect()
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2498

Commit fd30b00707 updated the logic in function MicrocodeDetect() that
will directly use the CPUID and PlatformID information from the 'CpuData'
field in the CPU_MP_DATA structure, instead of collecting these
information for each processor via AsmCpuid() and AsmReadMsr64() calls
respectively.

At that moment, this approach worked fine for APs. Since:
a) When the APs are waken up for the 1st time (1st MpInitLibInitialize()
   entry at PEI phase), the function InitializeApData() will be called for
   each AP and the CPUID and PlatformID information will be collected.

b) During the 2nd entry of MpInitLibInitialize() at DXE phase, when the
   APs are waken up again, the function InitializeApData() will not be
   called, which means the CPUID and PlatformID information will not be
   collected. However, the below logics in MicrocodeDetect() function:

  CurrentRevision = GetCurrentMicrocodeSignature ();
  IsBspCallIn     = (ProcessorNumber == (UINTN)CpuMpData->BspNumber) ? TRUE : FALSE;
  if (CurrentRevision != 0 && !IsBspCallIn) {
    //
    // Skip loading microcode if it has been loaded successfully
    //
    return;
  }

   will ensure that the microcode detection and application will be
   skipped due to the fact that such process has already been done in the
   PEI phase.

But after commit 396e791059, which removes the above skip loading logic,
the CPUID and PlatformID information on APs will be used upon the 2nd
entry of the MpInitLibInitialize(). But since the CPUID and PlatformID
information has not been collected, it will bring issue to the microcode
detection process.

This commit will update the logic in MicrocodeDetect() back to always
collecting the CPUID and PlatformID information explicitly.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
2020-02-06 00:31:28 +00:00
..
Application/Cpuid UefiCpuPkg: strip trailing whitespace 2019-10-04 11:18:32 +01:00
CpuDxe UefiCpuPkg/CpuDxe: clean up PAGE_TABLE_LIB_PAGING_CONTEXT usage. 2019-09-25 14:29:24 +08:00
CpuFeatures UefiCpuPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:28 -07:00
CpuIo2Dxe UefiCpuPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:28 -07:00
CpuIo2Smm UefiCpuPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:28 -07:00
CpuIoPei UefiCpuPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:28 -07:00
CpuMpPei UefiCpuPkg: Update code to include register definitions from MdePkg 2019-08-09 08:52:09 +08:00
CpuS3DataDxe UefiCpuPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:28 -07:00
Include UefiCpuPkg: Add definitions for EDKII microcode patch HOB 2020-01-02 03:10:36 +00:00
Library UefiCpuPkg/MpInitLib: Always get CPUID & PlatformID in MicrocodeDetect() 2020-02-06 00:31:28 +00:00
PiSmmCommunication UefiCpuPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:28 -07:00
PiSmmCpuDxeSmm UefiCpuPkg/PiSmmCpuDxeSmm: fix 2M->4K page splitting regression for PDEs 2020-01-17 09:41:05 +00:00
ResetVector UefiCpuPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:28 -07:00
SecCore UefiCpuPkg: support single EFI_PEI_CORE_FV_LOCATION_PPI in PpiList 2019-09-05 20:42:20 +08:00
Universal/Acpi/S3Resume2Pei UefiCpuPkg: Remove PcdFrameworkCompatibilitySupport usage 2019-05-09 09:42:55 +08:00
UefiCpuPkg.ci.yaml UefiCpuPkg: Add YAML file for CI builds 2019-11-11 13:02:38 -08:00
UefiCpuPkg.dec UefiCpuPkg: Shadow microcode patch according to FIT microcode entry. 2020-01-10 06:20:42 +00:00
UefiCpuPkg.dsc UefiCpuPkg: Add missing components to UefiCpuPkg.dsc 2019-10-23 17:47:29 -07:00
UefiCpuPkg.uni UefiCpuPkg: Shadow microcode patch according to FIT microcode entry. 2020-01-10 06:20:42 +00:00
UefiCpuPkgExtra.uni UefiCpuPkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:28 -07:00