public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch V3 0/8] Resolve Quark build and boot issues
@ 2019-04-30 19:31 Michael D Kinney
  2019-04-30 19:31 ` [Patch V3 1/8] MdePkg: Add PcdSpeculationBarrierType Michael D Kinney
                   ` (9 more replies)
  0 siblings, 10 replies; 16+ messages in thread
From: Michael D Kinney @ 2019-04-30 19:31 UTC (permalink / raw)
  To: devel; +Cc: Kelly Steele, Liming Gao, Eric Dong, Ray Ni, Laszlo Ersek

New in V3
=========
* Remove change to MpInitLib to avoid use of MSR_IA32_APIC_BASE.  That change
  was not safe because an AP could call the PCD Protocol/PPI.
* Add new MpInitLibUp for uni-processor platforms.
* Update Quark DSC files to use MpInitLibUp for uni-processor platforms.
* Add missing CpuLub library class to the CpuMpPei INF file

New in V2
=========
* Add PcdSpeculationBarrierType to select between LFENCE, CPUID, and no
  operation in the x86 implementation of the BaseLib function
  SpeculationBarrier().
* Set PcdSpeculationBarrierType to CPUID on Quark platforms.

This series of patches resolves a few issues with building
and booting Quark platforms.

* Resolve name collision from API added to ResetSystemLib
* Set SMRAM region to UC when SMRAM region is closed
* Do no use LFENCE if CPU does not support SSE2
* Avoid MSR_IA32_APIC_BASE if there is only one CPU

Cc: Kelly Steele <kelly.steele@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>

Michael D Kinney (8):
  MdePkg: Add PcdSpeculationBarrierType
  MdePkg/BaseLib: Use PcdSpeculationBarrierType
  QuarkPlatformPkg: Set PcdSpeculationBarrierType to CPUID
  UefiCpuPkg/MpInitLibUp: Add uniprocessor MpInitLib
  UefiCPuPkg/CpuMpPei: Add missing CpuLib class
  QuarkPlatformPkg: Use uniprocessor MpInitLibUp
  QuarkSocPkg/SmmAccessDxe: Set region to UC on SMRAM close
  QuarkPlatformPkg/PlatformInit: Resolve ResetSystemLib name collision

 MdePkg/Library/BaseLib/BaseLib.inf            |   1 +
 .../Library/BaseLib/X86SpeculationBarrier.c   |   8 +-
 MdePkg/MdePkg.dec                             |   9 +
 MdePkg/MdePkg.uni                             |   8 +
 .../Pei/PlatformInit/MemoryCallback.c         |   6 +-
 .../Pei/PlatformInit/PlatformEarlyInit.h      |   4 +-
 QuarkPlatformPkg/Quark.dsc                    |  10 +-
 QuarkPlatformPkg/QuarkMin.dsc                 |   8 +-
 .../Smm/Dxe/SmmAccessDxe/SmmAccess.inf        |   3 +-
 .../Smm/Dxe/SmmAccessDxe/SmmAccessDriver.c    |  18 +-
 .../Smm/Dxe/SmmAccessDxe/SmmAccessDriver.h    |   3 +-
 UefiCpuPkg/CpuMpPei/CpuMpPei.inf              |   3 +-
 UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.c  | 407 ++++++++++++++++++
 .../Library/MpInitLibUp/MpInitLibUp.inf       |  37 ++
 .../Library/MpInitLibUp/MpInitLibUp.uni       |  14 +
 UefiCpuPkg/UefiCpuPkg.dsc                     |   3 +-
 16 files changed, 525 insertions(+), 17 deletions(-)
 create mode 100644 UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.c
 create mode 100644 UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf
 create mode 100644 UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.uni

-- 
2.21.0.windows.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Patch V3 1/8] MdePkg: Add PcdSpeculationBarrierType
  2019-04-30 19:31 [Patch V3 0/8] Resolve Quark build and boot issues Michael D Kinney
@ 2019-04-30 19:31 ` Michael D Kinney
  2019-04-30 19:31 ` [Patch V3 2/8] MdePkg/BaseLib: Use PcdSpeculationBarrierType Michael D Kinney
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Michael D Kinney @ 2019-04-30 19:31 UTC (permalink / raw)
  To: devel; +Cc: Liming Gao, Laszlo Ersek

Add gEfiMdePkgTokenSpaceGuid.PcdSpeculationBarrierType that
uses the PCD type FixedAtBuild.  This performs a build time
selection for the type of speculation barrier to use in the
BaseLib function SpeculationBarrier().  The recommended
speculation barrier for x86 is LFENCE and this is the default
value for this PCD.  x86 CPUs that do not support LFENCE must
select one of the other supported values which includes CPUID
and nothing.

Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
---
 MdePkg/MdePkg.dec | 9 +++++++++
 MdePkg/MdePkg.uni | 8 ++++++++
 2 files changed, 17 insertions(+)

diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index e2ea8fff66..28d4a966c2 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -2062,6 +2062,15 @@ [PcdsFixedAtBuild]
   # @Prompt Enable control flow enforcement.
   gEfiMdePkgTokenSpaceGuid.PcdControlFlowEnforcementPropertyMask|0x0|UINT32|0x30001017
 
+  ## Indicates the type of instruction sequence to use for a speculation
+  #  barrier.  The default instruction sequence is LFENCE.<BR><BR>
+  #   0x00 - No operation.<BR>
+  #   0x01 - LFENCE (IA32/X64).<BR>
+  #   0x02 - CPUID  (IA32/X64).<BR>
+  #   Other - reserved
+  # @Prompt Speculation Barrier Type.
+  gEfiMdePkgTokenSpaceGuid.PcdSpeculationBarrierType|0x01|UINT8|0x30001018
+
 [PcdsFixedAtBuild,PcdsPatchableInModule]
   ## Indicates the maximum length of unicode string used in the following
   #  BaseLib functions: StrLen(), StrSize(), StrCmp(), StrnCmp(), StrCpy(), StrnCpy()<BR><BR>
diff --git a/MdePkg/MdePkg.uni b/MdePkg/MdePkg.uni
index c359bb4b5b..5c1fa24065 100644
--- a/MdePkg/MdePkg.uni
+++ b/MdePkg/MdePkg.uni
@@ -149,6 +149,14 @@
                                                                                                   " BIT0 - SMM CET Shadow Stack is enabled.<BR>\n"
                                                                                                   " Other - reserved"
 
+#string STR_gEfiMdePkgTokenSpaceGuid_PcdSpeculationBarrierType_PROMPT  #language en-US "Speculation Barrier Type."
+
+#string STR_gEfiMdePkgTokenSpaceGuid_PcdSpeculationBarrierType_HELP  #language en-US  "Indicates the type of instruction sequence to use for a speculation.barrier.  The default instruction sequence is LFENCE.<BR><BR>\n"
+                                                                                      "0x00 - No operation.<BR>\n"
+                                                                                      "0x01 - LFENCE (IA32/X64).<BR>\n"
+                                                                                      "0x02 - CPUID  (IA32/X64).<BR>\n"
+                                                                                      "Other - reserved"
+
 #string STR_gEfiMdePkgTokenSpaceGuid_PcdMaximumAsciiStringLength_PROMPT  #language en-US "Maximum Length of Ascii String"
 
 #string STR_gEfiMdePkgTokenSpaceGuid_PcdMaximumAsciiStringLength_HELP  #language en-US "Sets the maximum number of ASCII characters used for string functions.  This affects the following BaseLib functions: AsciiStrLen(), AsciiStrSize(), AsciiStrCmp(), AsciiStrnCmp(), AsciiStrCpy(), AsciiStrnCpy(). <BR><BR>\n"
-- 
2.21.0.windows.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [Patch V3 2/8] MdePkg/BaseLib: Use PcdSpeculationBarrierType
  2019-04-30 19:31 [Patch V3 0/8] Resolve Quark build and boot issues Michael D Kinney
  2019-04-30 19:31 ` [Patch V3 1/8] MdePkg: Add PcdSpeculationBarrierType Michael D Kinney
@ 2019-04-30 19:31 ` Michael D Kinney
  2019-04-30 19:31 ` [Patch V3 3/8] QuarkPlatformPkg: Set PcdSpeculationBarrierType to CPUID Michael D Kinney
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Michael D Kinney @ 2019-04-30 19:31 UTC (permalink / raw)
  To: devel; +Cc: Liming Gao, Laszlo Ersek

Use PcdSpeculationBarrierType in the x86 implementation
of SpeculationBarrier() to select between AsmLfence(),
AsmCpuid(), and no operation.

Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
---
 MdePkg/Library/BaseLib/BaseLib.inf             | 1 +
 MdePkg/Library/BaseLib/X86SpeculationBarrier.c | 8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/MdePkg/Library/BaseLib/BaseLib.inf b/MdePkg/Library/BaseLib/BaseLib.inf
index 533e83e0b2..3586beb0ab 100644
--- a/MdePkg/Library/BaseLib/BaseLib.inf
+++ b/MdePkg/Library/BaseLib/BaseLib.inf
@@ -394,6 +394,7 @@ [Pcd]
   gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength     ## SOMETIMES_CONSUMES
   gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength   ## SOMETIMES_CONSUMES
   gEfiMdePkgTokenSpaceGuid.PcdControlFlowEnforcementPropertyMask   ## SOMETIMES_CONSUMES
+  gEfiMdePkgTokenSpaceGuid.PcdSpeculationBarrierType       ## SOMETIMES_CONSUMES
 
 [FeaturePcd]
   gEfiMdePkgTokenSpaceGuid.PcdVerifyNodeInList  ## CONSUMES
diff --git a/MdePkg/Library/BaseLib/X86SpeculationBarrier.c b/MdePkg/Library/BaseLib/X86SpeculationBarrier.c
index 8e5f983bb8..b28fd8de9b 100644
--- a/MdePkg/Library/BaseLib/X86SpeculationBarrier.c
+++ b/MdePkg/Library/BaseLib/X86SpeculationBarrier.c
@@ -1,7 +1,7 @@
 /** @file
   SpeculationBarrier() function for IA32 and x64.
 
-  Copyright (C) 2018, Intel Corporation. All rights reserved.<BR>
+  Copyright (C) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -22,5 +22,9 @@ SpeculationBarrier (
   VOID
   )
 {
-  AsmLfence ();
+  if (PcdGet8 (PcdSpeculationBarrierType) == 0x01) {
+    AsmLfence ();
+  } else if (PcdGet8 (PcdSpeculationBarrierType) == 0x02) {
+    AsmCpuid (0x01, NULL, NULL, NULL, NULL);
+  }
 }
-- 
2.21.0.windows.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [Patch V3 3/8] QuarkPlatformPkg: Set PcdSpeculationBarrierType to CPUID
  2019-04-30 19:31 [Patch V3 0/8] Resolve Quark build and boot issues Michael D Kinney
  2019-04-30 19:31 ` [Patch V3 1/8] MdePkg: Add PcdSpeculationBarrierType Michael D Kinney
  2019-04-30 19:31 ` [Patch V3 2/8] MdePkg/BaseLib: Use PcdSpeculationBarrierType Michael D Kinney
@ 2019-04-30 19:31 ` Michael D Kinney
  2019-04-30 21:25   ` [edk2-devel] " Kubacki, Michael A
  2019-04-30 19:31 ` [Patch V3 4/8] UefiCpuPkg/MpInitLibUp: Add uniprocessor MpInitLib Michael D Kinney
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 16+ messages in thread
From: Michael D Kinney @ 2019-04-30 19:31 UTC (permalink / raw)
  To: devel; +Cc: Kelly Steele, Liming Gao

Set PcdSpeculationBarrierType to use CPUID instead of the
default LFENCE in the BaseLib function SpeculationBarrier().
LFENCE requires SSE2, and Quark platforms do not support
SSE2.

Cc: Kelly Steele <kelly.steele@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 QuarkPlatformPkg/Quark.dsc    | 7 ++++++-
 QuarkPlatformPkg/QuarkMin.dsc | 5 +++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/QuarkPlatformPkg/Quark.dsc b/QuarkPlatformPkg/Quark.dsc
index 422fd9cf8d..96ddc1565a 100644
--- a/QuarkPlatformPkg/Quark.dsc
+++ b/QuarkPlatformPkg/Quark.dsc
@@ -2,7 +2,7 @@
 # Clanton Peak CRB platform with 32-bit DXE for 4MB/8MB flash devices.
 #
 # This package provides Clanton Peak CRB platform specific modules.
-# Copyright (c) 2013 - 2018 Intel Corporation.
+# Copyright (c) 2013 - 2019 Intel Corporation.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -448,6 +448,11 @@ [PcdsFixedAtBuild]
   gEfiMdeModulePkgTokenSpaceGuid.PcdRecoveryFileName|L"QUARKREC.Cap"
 !endif
 
+  #
+  # Quark does not support LFENCE.  Use CPUID as speculation barrier
+  #
+  gEfiMdePkgTokenSpaceGuid.PcdSpeculationBarrierType|0x02
+
 [PcdsPatchableInModule]
   gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x803000C7
   gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress|0x0
diff --git a/QuarkPlatformPkg/QuarkMin.dsc b/QuarkPlatformPkg/QuarkMin.dsc
index 00e2febb54..8ca75bc474 100644
--- a/QuarkPlatformPkg/QuarkMin.dsc
+++ b/QuarkPlatformPkg/QuarkMin.dsc
@@ -406,6 +406,11 @@ [PcdsFixedAtBuild]
 
   gEfiMdeModulePkgTokenSpaceGuid.PcdConInConnectOnDemand|FALSE
 
+  #
+  # Quark does not support LFENCE.  Use CPUID as speculation barrier
+  #
+  gEfiMdePkgTokenSpaceGuid.PcdSpeculationBarrierType|0x02
+
 [PcdsPatchableInModule]
   gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x803000C7
   gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress|0x0
-- 
2.21.0.windows.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [Patch V3 4/8] UefiCpuPkg/MpInitLibUp: Add uniprocessor MpInitLib
  2019-04-30 19:31 [Patch V3 0/8] Resolve Quark build and boot issues Michael D Kinney
                   ` (2 preceding siblings ...)
  2019-04-30 19:31 ` [Patch V3 3/8] QuarkPlatformPkg: Set PcdSpeculationBarrierType to CPUID Michael D Kinney
@ 2019-04-30 19:31 ` Michael D Kinney
  2019-04-30 20:25   ` [edk2-devel] " Laszlo Ersek
  2019-05-05  2:36   ` Ni, Ray
  2019-04-30 19:31 ` [Patch V3 5/8] UefiCPuPkg/CpuMpPei: Add missing CpuLib class Michael D Kinney
                   ` (5 subsequent siblings)
  9 siblings, 2 replies; 16+ messages in thread
From: Michael D Kinney @ 2019-04-30 19:31 UTC (permalink / raw)
  To: devel; +Cc: Eric Dong, Ray Ni, Laszlo Ersek

Add a new instance of the MpInitLib that is designed for
uniprocessor platforms that require the use of modules
that depend on the MP_SERVICES_PROTOCOL for dispatch
or to retrieve information about the boot processor.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.c  | 407 ++++++++++++++++++
 .../Library/MpInitLibUp/MpInitLibUp.inf       |  37 ++
 .../Library/MpInitLibUp/MpInitLibUp.uni       |  14 +
 UefiCpuPkg/UefiCpuPkg.dsc                     |   3 +-
 4 files changed, 460 insertions(+), 1 deletion(-)
 create mode 100644 UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.c
 create mode 100644 UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf
 create mode 100644 UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.uni

diff --git a/UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.c b/UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.c
new file mode 100644
index 0000000000..36c2bb5326
--- /dev/null
+++ b/UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.c
@@ -0,0 +1,407 @@
+/** @file
+  Multiple-Processor initialization Library for uniprocessor platforms.
+
+  Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <PiDxe.h>
+#include <Ppi/SecPlatformInformation.h>
+#include <Protocol/MpService.h>
+#include <Library/DebugLib.h>
+#include <Library/LocalApicLib.h>
+#include <Library/HobLib.h>
+
+/**
+  MP Initialize Library initialization.
+
+  This service will allocate AP reset vector and wakeup all APs to do APs
+  initialization.
+
+  This service must be invoked before all other MP Initialize Library
+  service are invoked.
+
+  @retval  EFI_SUCCESS           MP initialization succeeds.
+  @retval  Others                MP initialization fails.
+
+**/
+EFI_STATUS
+EFIAPI
+MpInitLibInitialize (
+  VOID
+  )
+{
+  //
+  // Enable the local APIC for Virtual Wire Mode.
+  //
+  ProgramVirtualWireMode ();
+
+  return EFI_SUCCESS;
+}
+
+/**
+  Retrieves the number of logical processor in the platform and the number of
+  those logical processors that are enabled on this boot. This service may only
+  be called from the BSP.
+
+  @param[out] NumberOfProcessors          Pointer to the total number of logical
+                                          processors in the system, including the BSP
+                                          and disabled APs.
+  @param[out] NumberOfEnabledProcessors   Pointer to the number of enabled logical
+                                          processors that exist in system, including
+                                          the BSP.
+
+  @retval EFI_SUCCESS             The number of logical processors and enabled
+                                  logical processors was retrieved.
+  @retval EFI_DEVICE_ERROR        The calling processor is an AP.
+  @retval EFI_INVALID_PARAMETER   NumberOfProcessors is NULL and NumberOfEnabledProcessors
+                                  is NULL.
+  @retval EFI_NOT_READY           MP Initialize Library is not initialized.
+
+**/
+EFI_STATUS
+EFIAPI
+MpInitLibGetNumberOfProcessors (
+  OUT UINTN                     *NumberOfProcessors,       OPTIONAL
+  OUT UINTN                     *NumberOfEnabledProcessors OPTIONAL
+  )
+{
+  *NumberOfProcessors        = 1;
+  *NumberOfEnabledProcessors = 1;
+  return EFI_SUCCESS;
+}
+
+/**
+  Gets detailed MP-related information on the requested processor at the
+  instant this call is made. This service may only be called from the BSP.
+
+  @param[in]  ProcessorNumber       The handle number of processor.
+  @param[out] ProcessorInfoBuffer   A pointer to the buffer where information for
+                                    the requested processor is deposited.
+  @param[out] HealthData            Return processor health data.
+
+  @retval EFI_SUCCESS             Processor information was returned.
+  @retval EFI_DEVICE_ERROR        The calling processor is an AP.
+  @retval EFI_INVALID_PARAMETER   ProcessorInfoBuffer is NULL.
+  @retval EFI_NOT_FOUND           The processor with the handle specified by
+                                  ProcessorNumber does not exist in the platform.
+  @retval EFI_NOT_READY           MP Initialize Library is not initialized.
+
+**/
+EFI_STATUS
+EFIAPI
+MpInitLibGetProcessorInfo (
+  IN  UINTN                      ProcessorNumber,
+  OUT EFI_PROCESSOR_INFORMATION  *ProcessorInfoBuffer,
+  OUT EFI_HEALTH_FLAGS           *HealthData  OPTIONAL
+  )
+{
+  EFI_HOB_GUID_TYPE                    *GuidHob;
+  EFI_SEC_PLATFORM_INFORMATION_RECORD  *SecPlatformInformation;
+
+  if (ProcessorInfoBuffer == NULL) {
+    return EFI_INVALID_PARAMETER;
+  }
+  if (ProcessorNumber != 0) {
+    return EFI_NOT_FOUND;
+  }
+  ProcessorInfoBuffer->ProcessorId      = 0;
+  ProcessorInfoBuffer->StatusFlag       = PROCESSOR_AS_BSP_BIT  |
+                                          PROCESSOR_ENABLED_BIT |
+                                          PROCESSOR_HEALTH_STATUS_BIT;
+  ProcessorInfoBuffer->Location.Package = 0;
+  ProcessorInfoBuffer->Location.Core    = 0;
+  ProcessorInfoBuffer->Location.Thread  = 0;
+  if (HealthData != NULL) {
+    GuidHob = GetFirstGuidHob (&gEfiSecPlatformInformationPpiGuid);
+    if (GuidHob != NULL) {
+      SecPlatformInformation = GET_GUID_HOB_DATA (GuidHob);
+      HealthData->Uint32 = SecPlatformInformation->IA32HealthFlags.Uint32;
+    } else {
+      DEBUG ((DEBUG_INFO, "Does not find any HOB stored CPU BIST information!\n"));
+      HealthData->Uint32 = 0;
+    }
+  }
+  return EFI_SUCCESS;
+}
+
+/**
+  This service executes a caller provided function on all enabled APs.
+
+  @param[in]  Procedure               A pointer to the function to be run on
+                                      enabled APs of the system. See type
+                                      EFI_AP_PROCEDURE.
+  @param[in]  SingleThread            If TRUE, then all the enabled APs execute
+                                      the function specified by Procedure one by
+                                      one, in ascending order of processor handle
+                                      number.  If FALSE, then all the enabled APs
+                                      execute the function specified by Procedure
+                                      simultaneously.
+  @param[in]  WaitEvent               The event created by the caller with CreateEvent()
+                                      service.  If it is NULL, then execute in
+                                      blocking mode. BSP waits until all APs finish
+                                      or TimeoutInMicroSeconds expires.  If it's
+                                      not NULL, then execute in non-blocking mode.
+                                      BSP requests the function specified by
+                                      Procedure to be started on all the enabled
+                                      APs, and go on executing immediately. If
+                                      all return from Procedure, or TimeoutInMicroSeconds
+                                      expires, this event is signaled. The BSP
+                                      can use the CheckEvent() or WaitForEvent()
+                                      services to check the state of event.  Type
+                                      EFI_EVENT is defined in CreateEvent() in
+                                      the Unified Extensible Firmware Interface
+                                      Specification.
+  @param[in]  TimeoutInMicroseconds   Indicates the time limit in microseconds for
+                                      APs to return from Procedure, either for
+                                      blocking or non-blocking mode. Zero means
+                                      infinity.  If the timeout expires before
+                                      all APs return from Procedure, then Procedure
+                                      on the failed APs is terminated. All enabled
+                                      APs are available for next function assigned
+                                      by MpInitLibStartupAllAPs() or
+                                      MPInitLibStartupThisAP().
+                                      If the timeout expires in blocking mode,
+                                      BSP returns EFI_TIMEOUT.  If the timeout
+                                      expires in non-blocking mode, WaitEvent
+                                      is signaled with SignalEvent().
+  @param[in]  ProcedureArgument       The parameter passed into Procedure for
+                                      all APs.
+  @param[out] FailedCpuList           If NULL, this parameter is ignored. Otherwise,
+                                      if all APs finish successfully, then its
+                                      content is set to NULL. If not all APs
+                                      finish before timeout expires, then its
+                                      content is set to address of the buffer
+                                      holding handle numbers of the failed APs.
+                                      The buffer is allocated by MP Initialization
+                                      library, and it's the caller's responsibility to
+                                      free the buffer with FreePool() service.
+                                      In blocking mode, it is ready for consumption
+                                      when the call returns. In non-blocking mode,
+                                      it is ready when WaitEvent is signaled.  The
+                                      list of failed CPU is terminated by
+                                      END_OF_CPU_LIST.
+
+  @retval EFI_SUCCESS             In blocking mode, all APs have finished before
+                                  the timeout expired.
+  @retval EFI_SUCCESS             In non-blocking mode, function has been dispatched
+                                  to all enabled APs.
+  @retval EFI_UNSUPPORTED         A non-blocking mode request was made after the
+                                  UEFI event EFI_EVENT_GROUP_READY_TO_BOOT was
+                                  signaled.
+  @retval EFI_UNSUPPORTED         WaitEvent is not NULL if non-blocking mode is not
+                                  supported.
+  @retval EFI_DEVICE_ERROR        Caller processor is AP.
+  @retval EFI_NOT_STARTED         No enabled APs exist in the system.
+  @retval EFI_NOT_READY           Any enabled APs are busy.
+  @retval EFI_NOT_READY           MP Initialize Library is not initialized.
+  @retval EFI_TIMEOUT             In blocking mode, the timeout expired before
+                                  all enabled APs have finished.
+  @retval EFI_INVALID_PARAMETER   Procedure is NULL.
+
+**/
+EFI_STATUS
+EFIAPI
+MpInitLibStartupAllAPs (
+  IN  EFI_AP_PROCEDURE          Procedure,
+  IN  BOOLEAN                   SingleThread,
+  IN  EFI_EVENT                 WaitEvent               OPTIONAL,
+  IN  UINTN                     TimeoutInMicroseconds,
+  IN  VOID                      *ProcedureArgument      OPTIONAL,
+  OUT UINTN                     **FailedCpuList         OPTIONAL
+  )
+{
+  return EFI_NOT_STARTED;
+}
+
+/**
+  This service lets the caller get one enabled AP to execute a caller-provided
+  function.
+
+  @param[in]  Procedure               A pointer to the function to be run on the
+                                      designated AP of the system. See type
+                                      EFI_AP_PROCEDURE.
+  @param[in]  ProcessorNumber         The handle number of the AP. The range is
+                                      from 0 to the total number of logical
+                                      processors minus 1. The total number of
+                                      logical processors can be retrieved by
+                                      MpInitLibGetNumberOfProcessors().
+  @param[in]  WaitEvent               The event created by the caller with CreateEvent()
+                                      service.  If it is NULL, then execute in
+                                      blocking mode. BSP waits until this AP finish
+                                      or TimeoutInMicroSeconds expires.  If it's
+                                      not NULL, then execute in non-blocking mode.
+                                      BSP requests the function specified by
+                                      Procedure to be started on this AP,
+                                      and go on executing immediately. If this AP
+                                      return from Procedure or TimeoutInMicroSeconds
+                                      expires, this event is signaled. The BSP
+                                      can use the CheckEvent() or WaitForEvent()
+                                      services to check the state of event.  Type
+                                      EFI_EVENT is defined in CreateEvent() in
+                                      the Unified Extensible Firmware Interface
+                                      Specification.
+  @param[in]  TimeoutInMicroseconds   Indicates the time limit in microseconds for
+                                      this AP to finish this Procedure, either for
+                                      blocking or non-blocking mode. Zero means
+                                      infinity.  If the timeout expires before
+                                      this AP returns from Procedure, then Procedure
+                                      on the AP is terminated. The
+                                      AP is available for next function assigned
+                                      by MpInitLibStartupAllAPs() or
+                                      MpInitLibStartupThisAP().
+                                      If the timeout expires in blocking mode,
+                                      BSP returns EFI_TIMEOUT.  If the timeout
+                                      expires in non-blocking mode, WaitEvent
+                                      is signaled with SignalEvent().
+  @param[in]  ProcedureArgument       The parameter passed into Procedure on the
+                                      specified AP.
+  @param[out] Finished                If NULL, this parameter is ignored.  In
+                                      blocking mode, this parameter is ignored.
+                                      In non-blocking mode, if AP returns from
+                                      Procedure before the timeout expires, its
+                                      content is set to TRUE. Otherwise, the
+                                      value is set to FALSE. The caller can
+                                      determine if the AP returned from Procedure
+                                      by evaluating this value.
+
+  @retval EFI_SUCCESS             In blocking mode, specified AP finished before
+                                  the timeout expires.
+  @retval EFI_SUCCESS             In non-blocking mode, the function has been
+                                  dispatched to specified AP.
+  @retval EFI_UNSUPPORTED         A non-blocking mode request was made after the
+                                  UEFI event EFI_EVENT_GROUP_READY_TO_BOOT was
+                                  signaled.
+  @retval EFI_UNSUPPORTED         WaitEvent is not NULL if non-blocking mode is not
+                                  supported.
+  @retval EFI_DEVICE_ERROR        The calling processor is an AP.
+  @retval EFI_TIMEOUT             In blocking mode, the timeout expired before
+                                  the specified AP has finished.
+  @retval EFI_NOT_READY           The specified AP is busy.
+  @retval EFI_NOT_READY           MP Initialize Library is not initialized.
+  @retval EFI_NOT_FOUND           The processor with the handle specified by
+                                  ProcessorNumber does not exist.
+  @retval EFI_INVALID_PARAMETER   ProcessorNumber specifies the BSP or disabled AP.
+  @retval EFI_INVALID_PARAMETER   Procedure is NULL.
+
+**/
+EFI_STATUS
+EFIAPI
+MpInitLibStartupThisAP (
+  IN  EFI_AP_PROCEDURE          Procedure,
+  IN  UINTN                     ProcessorNumber,
+  IN  EFI_EVENT                 WaitEvent               OPTIONAL,
+  IN  UINTN                     TimeoutInMicroseconds,
+  IN  VOID                      *ProcedureArgument      OPTIONAL,
+  OUT BOOLEAN                   *Finished               OPTIONAL
+  )
+{
+  return EFI_INVALID_PARAMETER;
+}
+
+/**
+  This service switches the requested AP to be the BSP from that point onward.
+  This service changes the BSP for all purposes. This call can only be performed
+  by the current BSP.
+
+  @param[in] ProcessorNumber   The handle number of AP that is to become the new
+                               BSP. The range is from 0 to the total number of
+                               logical processors minus 1. The total number of
+                               logical processors can be retrieved by
+                               MpInitLibGetNumberOfProcessors().
+  @param[in] EnableOldBSP      If TRUE, then the old BSP will be listed as an
+                               enabled AP. Otherwise, it will be disabled.
+
+  @retval EFI_SUCCESS             BSP successfully switched.
+  @retval EFI_UNSUPPORTED         Switching the BSP cannot be completed prior to
+                                  this service returning.
+  @retval EFI_UNSUPPORTED         Switching the BSP is not supported.
+  @retval EFI_DEVICE_ERROR        The calling processor is an AP.
+  @retval EFI_NOT_FOUND           The processor with the handle specified by
+                                  ProcessorNumber does not exist.
+  @retval EFI_INVALID_PARAMETER   ProcessorNumber specifies the current BSP or
+                                  a disabled AP.
+  @retval EFI_NOT_READY           The specified AP is busy.
+  @retval EFI_NOT_READY           MP Initialize Library is not initialized.
+
+**/
+EFI_STATUS
+EFIAPI
+MpInitLibSwitchBSP (
+  IN UINTN                     ProcessorNumber,
+  IN BOOLEAN                   EnableOldBSP
+  )
+{
+  return EFI_UNSUPPORTED;
+}
+
+/**
+  This service lets the caller enable or disable an AP from this point onward.
+  This service may only be called from the BSP.
+
+  @param[in] ProcessorNumber   The handle number of AP.
+                               The range is from 0 to the total number of
+                               logical processors minus 1. The total number of
+                               logical processors can be retrieved by
+                               MpInitLibGetNumberOfProcessors().
+  @param[in] EnableAP          Specifies the new state for the processor for
+                               enabled, FALSE for disabled.
+  @param[in] HealthFlag        If not NULL, a pointer to a value that specifies
+                               the new health status of the AP. This flag
+                               corresponds to StatusFlag defined in
+                               EFI_MP_SERVICES_PROTOCOL.GetProcessorInfo(). Only
+                               the PROCESSOR_HEALTH_STATUS_BIT is used. All other
+                               bits are ignored.  If it is NULL, this parameter
+                               is ignored.
+
+  @retval EFI_SUCCESS             The specified AP was enabled or disabled successfully.
+  @retval EFI_UNSUPPORTED         Enabling or disabling an AP cannot be completed
+                                  prior to this service returning.
+  @retval EFI_UNSUPPORTED         Enabling or disabling an AP is not supported.
+  @retval EFI_DEVICE_ERROR        The calling processor is an AP.
+  @retval EFI_NOT_FOUND           Processor with the handle specified by ProcessorNumber
+                                  does not exist.
+  @retval EFI_INVALID_PARAMETER   ProcessorNumber specifies the BSP.
+  @retval EFI_NOT_READY           MP Initialize Library is not initialized.
+
+**/
+EFI_STATUS
+EFIAPI
+MpInitLibEnableDisableAP (
+  IN  UINTN                     ProcessorNumber,
+  IN  BOOLEAN                   EnableAP,
+  IN  UINT32                    *HealthFlag OPTIONAL
+  )
+{
+  return EFI_UNSUPPORTED;
+}
+
+/**
+  This return the handle number for the calling processor.  This service may be
+  called from the BSP and APs.
+
+  @param[out] ProcessorNumber  Pointer to the handle number of AP.
+                               The range is from 0 to the total number of
+                               logical processors minus 1. The total number of
+                               logical processors can be retrieved by
+                               MpInitLibGetNumberOfProcessors().
+
+  @retval EFI_SUCCESS             The current processor handle number was returned
+                                  in ProcessorNumber.
+  @retval EFI_INVALID_PARAMETER   ProcessorNumber is NULL.
+  @retval EFI_NOT_READY           MP Initialize Library is not initialized.
+
+**/
+EFI_STATUS
+EFIAPI
+MpInitLibWhoAmI (
+  OUT UINTN                    *ProcessorNumber
+  )
+{
+  if (ProcessorNumber == NULL) {
+    return EFI_INVALID_PARAMETER;
+  }
+  *ProcessorNumber = 0;
+  return EFI_SUCCESS;
+}
diff --git a/UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf b/UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf
new file mode 100644
index 0000000000..24ad29c03c
--- /dev/null
+++ b/UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf
@@ -0,0 +1,37 @@
+## @file
+#  MP Initialize Library instance for uniprocessor platforms.
+#
+#  Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION                    = 0x00010005
+  BASE_NAME                      = MpInitLibUp
+  MODULE_UNI_FILE                = MpInitLibUp.uni
+  FILE_GUID                      = 70E9818C-A4F0-4061-9FA2-2DFFC7016D6E
+  MODULE_TYPE                    = BASE
+  VERSION_STRING                 = 1.1
+  LIBRARY_CLASS                  = MpInitLib
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+#  VALID_ARCHITECTURES           = IA32 X64
+#
+
+[Sources]
+  MpInitLibUp.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  UefiCpuPkg/UefiCpuPkg.dec
+
+[LibraryClasses]
+  DebugLib
+  LocalApicLib
+  HobLib
+
+[Ppis]
+  gEfiSecPlatformInformationPpiGuid  ## SOMETIMES_CONSUMES
diff --git a/UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.uni b/UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.uni
new file mode 100644
index 0000000000..ca1ab94379
--- /dev/null
+++ b/UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.uni
@@ -0,0 +1,14 @@
+// /** @file
+// MP Initialize Library instance for uniprocessor platforms.
+//
+// MP Initialize Library instance for uniprocessor platforms.
+//
+// Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// **/
+
+#string STR_MODULE_ABSTRACT             #language en-US "MP Initialize Library instance for uniprocessor platforms."
+
+#string STR_MODULE_DESCRIPTION          #language en-US "MP Initialize Library instance for uniprocessor platforms."
diff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc
index 9ed2f79648..bf690d3978 100644
--- a/UefiCpuPkg/UefiCpuPkg.dsc
+++ b/UefiCpuPkg/UefiCpuPkg.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  UefiCpuPkg Package
 #
-#  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -124,6 +124,7 @@ [Components.IA32, Components.X64]
   UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf
   UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
   UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
+  UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf
   UefiCpuPkg/Library/MtrrLib/MtrrLib.inf
   UefiCpuPkg/Library/PlatformSecLibNull/PlatformSecLibNull.inf
   UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.inf
-- 
2.21.0.windows.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [Patch V3 5/8] UefiCPuPkg/CpuMpPei: Add missing CpuLib class
  2019-04-30 19:31 [Patch V3 0/8] Resolve Quark build and boot issues Michael D Kinney
                   ` (3 preceding siblings ...)
  2019-04-30 19:31 ` [Patch V3 4/8] UefiCpuPkg/MpInitLibUp: Add uniprocessor MpInitLib Michael D Kinney
@ 2019-04-30 19:31 ` Michael D Kinney
  2019-04-30 20:31   ` [edk2-devel] " Laszlo Ersek
  2019-04-30 19:31 ` [Patch V3 6/8] QuarkPlatformPkg: Use uniprocessor MpInitLibUp Michael D Kinney
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 16+ messages in thread
From: Michael D Kinney @ 2019-04-30 19:31 UTC (permalink / raw)
  To: devel; +Cc: Eric Dong, Ray Ni, Laszlo Ersek

The CpuMpPei module uses a services from the CpuLib class,
but the CpuLib class is missing from the INF file.  This
update is required to use the new MpInitLibUp instance that
does not use the CpuLib class.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 UefiCpuPkg/CpuMpPei/CpuMpPei.inf | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/UefiCpuPkg/CpuMpPei/CpuMpPei.inf b/UefiCpuPkg/CpuMpPei/CpuMpPei.inf
index 14ec75f254..4fc4ea77ba 100644
--- a/UefiCpuPkg/CpuMpPei/CpuMpPei.inf
+++ b/UefiCpuPkg/CpuMpPei/CpuMpPei.inf
@@ -1,7 +1,7 @@
 ## @file
 #  CPU driver installs CPU PI Multi-processor PPI.
 #
-#  Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.<BR>
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
@@ -43,6 +43,7 @@ [LibraryClasses]
   CpuExceptionHandlerLib
   MpInitLib
   BaseMemoryLib
+  CpuLib
 
 [Ppis]
   gEfiPeiMpServicesPpiGuid                      ## PRODUCES
-- 
2.21.0.windows.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [Patch V3 6/8] QuarkPlatformPkg: Use uniprocessor MpInitLibUp
  2019-04-30 19:31 [Patch V3 0/8] Resolve Quark build and boot issues Michael D Kinney
                   ` (4 preceding siblings ...)
  2019-04-30 19:31 ` [Patch V3 5/8] UefiCPuPkg/CpuMpPei: Add missing CpuLib class Michael D Kinney
@ 2019-04-30 19:31 ` Michael D Kinney
  2019-04-30 21:31   ` [edk2-devel] " Kubacki, Michael A
  2019-04-30 19:31 ` [Patch V3 7/8] QuarkSocPkg/SmmAccessDxe: Set region to UC on SMRAM close Michael D Kinney
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 16+ messages in thread
From: Michael D Kinney @ 2019-04-30 19:31 UTC (permalink / raw)
  To: devel; +Cc: Kelly Steele, Liming Gao

Update Quark DSC files to use MpInitLibUp instead
of DxeMpInitLib and PeiMpInitLib.

Cc: Kelly Steele <kelly.steele@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 QuarkPlatformPkg/Quark.dsc    | 3 +--
 QuarkPlatformPkg/QuarkMin.dsc | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/QuarkPlatformPkg/Quark.dsc b/QuarkPlatformPkg/Quark.dsc
index 96ddc1565a..e5ebeb5e09 100644
--- a/QuarkPlatformPkg/Quark.dsc
+++ b/QuarkPlatformPkg/Quark.dsc
@@ -195,7 +195,7 @@ [LibraryClasses]
   #
   MtrrLib|QuarkSocPkg/QuarkNorthCluster/Library/MtrrLib/MtrrLib.inf
   LocalApicLib|UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf
-  MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
+  MpInitLib|UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf
 
   #
   # Quark North Cluster
@@ -261,7 +261,6 @@ [LibraryClasses.IA32.PEIM,LibraryClasses.IA32.PEI_CORE]
   TimerLib|PcAtChipsetPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf
   PlatformHelperLib|QuarkPlatformPkg/Library/PlatformHelperLib/PeiPlatformHelperLib.inf
   CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
-  MpInitLib|UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
 !if $(PERFORMANCE_ENABLE)
   PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf
diff --git a/QuarkPlatformPkg/QuarkMin.dsc b/QuarkPlatformPkg/QuarkMin.dsc
index 8ca75bc474..c95a5fcff9 100644
--- a/QuarkPlatformPkg/QuarkMin.dsc
+++ b/QuarkPlatformPkg/QuarkMin.dsc
@@ -167,7 +167,7 @@ [LibraryClasses]
   #
   MtrrLib|QuarkSocPkg/QuarkNorthCluster/Library/MtrrLib/MtrrLib.inf
   LocalApicLib|UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf
-  MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
+  MpInitLib|UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf
 
   #
   # Quark North Cluster
@@ -219,7 +219,6 @@ [LibraryClasses.IA32.PEIM,LibraryClasses.IA32.PEI_CORE]
   TimerLib|PcAtChipsetPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf
   PlatformHelperLib|QuarkPlatformPkg/Library/PlatformHelperLib/PeiPlatformHelperLib.inf
   CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
-  MpInitLib|UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
 !if $(SECURE_BOOT_ENABLE)
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
 !endif
-- 
2.21.0.windows.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [Patch V3 7/8] QuarkSocPkg/SmmAccessDxe: Set region to UC on SMRAM close
  2019-04-30 19:31 [Patch V3 0/8] Resolve Quark build and boot issues Michael D Kinney
                   ` (5 preceding siblings ...)
  2019-04-30 19:31 ` [Patch V3 6/8] QuarkPlatformPkg: Use uniprocessor MpInitLibUp Michael D Kinney
@ 2019-04-30 19:31 ` Michael D Kinney
  2019-04-30 19:31 ` [Patch V3 8/8] QuarkPlatformPkg/PlatformInit: Resolve ResetSystemLib name collision Michael D Kinney
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Michael D Kinney @ 2019-04-30 19:31 UTC (permalink / raw)
  To: devel; +Cc: Kelly Steele

The following commit removed the unconditional UC setting
just prior to closing the SMRAM region.  This is a correct
change for most platforms.

https://github.com/tianocore/edk2/commit/bfc87aa78e77ed15b09d1b4499c5eab63e8842bb

The Quark platforms still require this UC setting, so move
the UC setting into the Quark specific SMM Access Protocol
when the Close() service is called.

Cc: Kelly Steele <kelly.steele@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Kelly Steele <kelly.steele@intel.com>
---
 .../Smm/Dxe/SmmAccessDxe/SmmAccess.inf         |  3 ++-
 .../Smm/Dxe/SmmAccessDxe/SmmAccessDriver.c     | 18 +++++++++++++++++-
 .../Smm/Dxe/SmmAccessDxe/SmmAccessDriver.h     |  3 ++-
 3 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/QuarkSocPkg/QuarkNorthCluster/Smm/Dxe/SmmAccessDxe/SmmAccess.inf b/QuarkSocPkg/QuarkNorthCluster/Smm/Dxe/SmmAccessDxe/SmmAccess.inf
index db916f686a..405e9eb7fd 100644
--- a/QuarkSocPkg/QuarkNorthCluster/Smm/Dxe/SmmAccessDxe/SmmAccess.inf
+++ b/QuarkSocPkg/QuarkNorthCluster/Smm/Dxe/SmmAccessDxe/SmmAccess.inf
@@ -1,7 +1,7 @@
 ## @file
 # Component description file for SmmAccess module
 #
-# Copyright (c) 2013-2015 Intel Corporation.
+# Copyright (c) 2013-2019 Intel Corporation.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -34,6 +34,7 @@ [LibraryClasses]
   S3BootScriptLib
   UefiDriverEntryPoint
   UefiBootServicesTableLib
+  DxeServicesTableLib
   PcdLib
   SmmLib
 
diff --git a/QuarkSocPkg/QuarkNorthCluster/Smm/Dxe/SmmAccessDxe/SmmAccessDriver.c b/QuarkSocPkg/QuarkNorthCluster/Smm/Dxe/SmmAccessDxe/SmmAccessDriver.c
index 6148dea1b4..830f8b83c3 100644
--- a/QuarkSocPkg/QuarkNorthCluster/Smm/Dxe/SmmAccessDxe/SmmAccessDriver.c
+++ b/QuarkSocPkg/QuarkNorthCluster/Smm/Dxe/SmmAccessDxe/SmmAccessDriver.c
@@ -2,7 +2,7 @@
 This is the driver that publishes the SMM Access Protocol
 instance for the Tylersburg chipset.
 
-Copyright (c) 2013-2015 Intel Corporation.
+Copyright (c) 2013-2019 Intel Corporation.
 
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -221,6 +221,7 @@ Returns:
 
 --*/
 {
+  EFI_STATUS              Status;
   SMM_ACCESS_PRIVATE_DATA *SmmAccess;
   BOOLEAN                 OpenState;
   UINTN                   Index;
@@ -239,6 +240,21 @@ Returns:
     return EFI_DEVICE_ERROR;
   }
 
+  //
+  // Reset SMRAM cacheability to UC
+  //
+  for (Index = 0; Index < mSmmAccess.NumberRegions; Index++) {
+    DEBUG ((DEBUG_INFO, "SmmAccess->Close: Set to UC Base=%016lx  Size=%016lx\n", SmmAccess->SmramDesc[Index].CpuStart, SmmAccess->SmramDesc[Index].PhysicalSize));
+    Status = gDS->SetMemorySpaceAttributes(
+                    SmmAccess->SmramDesc[Index].CpuStart,
+                    SmmAccess->SmramDesc[Index].PhysicalSize,
+                    EFI_MEMORY_UC
+                    );
+    if (EFI_ERROR (Status)) {
+      DEBUG ((DEBUG_WARN, "SmmAccess: Failed to reset SMRAM window to EFI_MEMORY_UC\n"));
+    }
+  }
+
   //
   // Close TSEG
   //
diff --git a/QuarkSocPkg/QuarkNorthCluster/Smm/Dxe/SmmAccessDxe/SmmAccessDriver.h b/QuarkSocPkg/QuarkNorthCluster/Smm/Dxe/SmmAccessDxe/SmmAccessDriver.h
index 80f73ba0e3..aca169d3e2 100644
--- a/QuarkSocPkg/QuarkNorthCluster/Smm/Dxe/SmmAccessDxe/SmmAccessDriver.h
+++ b/QuarkSocPkg/QuarkNorthCluster/Smm/Dxe/SmmAccessDxe/SmmAccessDriver.h
@@ -3,7 +3,7 @@ Header file for SMM Access Driver.
 
 This file includes package header files, library classes and protocol, PPI & GUID definitions.
 
-Copyright (c) 2013-2015 Intel Corporation.
+Copyright (c) 2013-2019 Intel Corporation.
 
 SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
@@ -21,6 +21,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include <Library/BaseMemoryLib.h>
 #include <Library/UefiDriverEntryPoint.h>
 #include <Library/UefiBootServicesTableLib.h>
+#include <Library/DxeServicesTableLib.h>
 #include <Library/PcdLib.h>
 
 //
-- 
2.21.0.windows.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [Patch V3 8/8] QuarkPlatformPkg/PlatformInit: Resolve ResetSystemLib name collision
  2019-04-30 19:31 [Patch V3 0/8] Resolve Quark build and boot issues Michael D Kinney
                   ` (6 preceding siblings ...)
  2019-04-30 19:31 ` [Patch V3 7/8] QuarkSocPkg/SmmAccessDxe: Set region to UC on SMRAM close Michael D Kinney
@ 2019-04-30 19:31 ` Michael D Kinney
  2019-05-05  5:23 ` [Patch V3 0/8] Resolve Quark build and boot issues Liming Gao
  2019-05-08 14:49 ` Steele, Kelly
  9 siblings, 0 replies; 16+ messages in thread
From: Michael D Kinney @ 2019-04-30 19:31 UTC (permalink / raw)
  To: devel; +Cc: Kelly Steele

Change function name from ResetSystem() to PlatformResetSystem()
to resolve name collision with ResetSystemLib.

Cc: Kelly Steele <kelly.steele@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Kelly Steele <kelly.steele@intel.com>
---
 QuarkPlatformPkg/Platform/Pei/PlatformInit/MemoryCallback.c | 6 +++---
 .../Platform/Pei/PlatformInit/PlatformEarlyInit.h           | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/QuarkPlatformPkg/Platform/Pei/PlatformInit/MemoryCallback.c b/QuarkPlatformPkg/Platform/Pei/PlatformInit/MemoryCallback.c
index cc2a6674d0..cfdcba8e02 100644
--- a/QuarkPlatformPkg/Platform/Pei/PlatformInit/MemoryCallback.c
+++ b/QuarkPlatformPkg/Platform/Pei/PlatformInit/MemoryCallback.c
@@ -7,7 +7,7 @@ following action is performed in this file,
   4. Set MTRR for PEI
   5. Create FV HOB and Flash HOB
 
-Copyright (c) 2013 - 2016, Intel Corporation.
+Copyright (c) 2013 - 2019, Intel Corporation.
 
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -20,7 +20,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 
 extern EFI_PEI_PPI_DESCRIPTOR mPpiStall[];
 
-EFI_PEI_RESET_PPI mResetPpi = { ResetSystem };
+EFI_PEI_RESET_PPI mResetPpi = { PlatformResetSystem };
 
 EFI_PEI_PPI_DESCRIPTOR mPpiList[1] = {
   {
@@ -40,7 +40,7 @@ EFI_PEI_PPI_DESCRIPTOR mPpiList[1] = {
 **/
 EFI_STATUS
 EFIAPI
-ResetSystem (
+PlatformResetSystem (
   IN CONST EFI_PEI_SERVICES          **PeiServices
   )
 {
diff --git a/QuarkPlatformPkg/Platform/Pei/PlatformInit/PlatformEarlyInit.h b/QuarkPlatformPkg/Platform/Pei/PlatformInit/PlatformEarlyInit.h
index 6792538d42..84def44717 100644
--- a/QuarkPlatformPkg/Platform/Pei/PlatformInit/PlatformEarlyInit.h
+++ b/QuarkPlatformPkg/Platform/Pei/PlatformInit/PlatformEarlyInit.h
@@ -1,7 +1,7 @@
 /** @file
 The header file of Platform PEIM.
 
-Copyright (c) 2013 Intel Corporation.
+Copyright (c) 2013 - 2019 Intel Corporation.
 
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -59,7 +59,7 @@ UpdateBootMode (
 **/
 EFI_STATUS
 EFIAPI
-ResetSystem (
+PlatformResetSystem (
   IN CONST EFI_PEI_SERVICES          **PeiServices
   );
 
-- 
2.21.0.windows.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [edk2-devel] [Patch V3 4/8] UefiCpuPkg/MpInitLibUp: Add uniprocessor MpInitLib
  2019-04-30 19:31 ` [Patch V3 4/8] UefiCpuPkg/MpInitLibUp: Add uniprocessor MpInitLib Michael D Kinney
@ 2019-04-30 20:25   ` Laszlo Ersek
  2019-05-05  2:36   ` Ni, Ray
  1 sibling, 0 replies; 16+ messages in thread
From: Laszlo Ersek @ 2019-04-30 20:25 UTC (permalink / raw)
  To: devel, michael.d.kinney; +Cc: Eric Dong, Ray Ni

On 04/30/19 21:31, Michael D Kinney wrote:
> Add a new instance of the MpInitLib that is designed for
> uniprocessor platforms that require the use of modules
> that depend on the MP_SERVICES_PROTOCOL for dispatch
> or to retrieve information about the boot processor.
> 
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
> ---
>  UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.c  | 407 ++++++++++++++++++
>  .../Library/MpInitLibUp/MpInitLibUp.inf       |  37 ++
>  .../Library/MpInitLibUp/MpInitLibUp.uni       |  14 +
>  UefiCpuPkg/UefiCpuPkg.dsc                     |   3 +-
>  4 files changed, 460 insertions(+), 1 deletion(-)
>  create mode 100644 UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.c
>  create mode 100644 UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf
>  create mode 100644 UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.uni

I didn't try to validate MpInitLibInitialize() or
MpInitLibGetProcessorInfo() in depth, but the rest looks fine.

In particular, EFI_NOT_STARTED from MpInitLibStartupAllAPs() is a
condition that all clients of MP_SERVICES_PROTOCOL must expect already.

Reviewed-by: Laszlo Ersek <lersek@redhat.com>

Thanks,
Laszlo

> 
> diff --git a/UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.c b/UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.c
> new file mode 100644
> index 0000000000..36c2bb5326
> --- /dev/null
> +++ b/UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.c
> @@ -0,0 +1,407 @@
> +/** @file
> +  Multiple-Processor initialization Library for uniprocessor platforms.
> +
> +  Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include <PiDxe.h>
> +#include <Ppi/SecPlatformInformation.h>
> +#include <Protocol/MpService.h>
> +#include <Library/DebugLib.h>
> +#include <Library/LocalApicLib.h>
> +#include <Library/HobLib.h>
> +
> +/**
> +  MP Initialize Library initialization.
> +
> +  This service will allocate AP reset vector and wakeup all APs to do APs
> +  initialization.
> +
> +  This service must be invoked before all other MP Initialize Library
> +  service are invoked.
> +
> +  @retval  EFI_SUCCESS           MP initialization succeeds.
> +  @retval  Others                MP initialization fails.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +MpInitLibInitialize (
> +  VOID
> +  )
> +{
> +  //
> +  // Enable the local APIC for Virtual Wire Mode.
> +  //
> +  ProgramVirtualWireMode ();
> +
> +  return EFI_SUCCESS;
> +}
> +
> +/**
> +  Retrieves the number of logical processor in the platform and the number of
> +  those logical processors that are enabled on this boot. This service may only
> +  be called from the BSP.
> +
> +  @param[out] NumberOfProcessors          Pointer to the total number of logical
> +                                          processors in the system, including the BSP
> +                                          and disabled APs.
> +  @param[out] NumberOfEnabledProcessors   Pointer to the number of enabled logical
> +                                          processors that exist in system, including
> +                                          the BSP.
> +
> +  @retval EFI_SUCCESS             The number of logical processors and enabled
> +                                  logical processors was retrieved.
> +  @retval EFI_DEVICE_ERROR        The calling processor is an AP.
> +  @retval EFI_INVALID_PARAMETER   NumberOfProcessors is NULL and NumberOfEnabledProcessors
> +                                  is NULL.
> +  @retval EFI_NOT_READY           MP Initialize Library is not initialized.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +MpInitLibGetNumberOfProcessors (
> +  OUT UINTN                     *NumberOfProcessors,       OPTIONAL
> +  OUT UINTN                     *NumberOfEnabledProcessors OPTIONAL
> +  )
> +{
> +  *NumberOfProcessors        = 1;
> +  *NumberOfEnabledProcessors = 1;
> +  return EFI_SUCCESS;
> +}
> +
> +/**
> +  Gets detailed MP-related information on the requested processor at the
> +  instant this call is made. This service may only be called from the BSP.
> +
> +  @param[in]  ProcessorNumber       The handle number of processor.
> +  @param[out] ProcessorInfoBuffer   A pointer to the buffer where information for
> +                                    the requested processor is deposited.
> +  @param[out] HealthData            Return processor health data.
> +
> +  @retval EFI_SUCCESS             Processor information was returned.
> +  @retval EFI_DEVICE_ERROR        The calling processor is an AP.
> +  @retval EFI_INVALID_PARAMETER   ProcessorInfoBuffer is NULL.
> +  @retval EFI_NOT_FOUND           The processor with the handle specified by
> +                                  ProcessorNumber does not exist in the platform.
> +  @retval EFI_NOT_READY           MP Initialize Library is not initialized.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +MpInitLibGetProcessorInfo (
> +  IN  UINTN                      ProcessorNumber,
> +  OUT EFI_PROCESSOR_INFORMATION  *ProcessorInfoBuffer,
> +  OUT EFI_HEALTH_FLAGS           *HealthData  OPTIONAL
> +  )
> +{
> +  EFI_HOB_GUID_TYPE                    *GuidHob;
> +  EFI_SEC_PLATFORM_INFORMATION_RECORD  *SecPlatformInformation;
> +
> +  if (ProcessorInfoBuffer == NULL) {
> +    return EFI_INVALID_PARAMETER;
> +  }
> +  if (ProcessorNumber != 0) {
> +    return EFI_NOT_FOUND;
> +  }
> +  ProcessorInfoBuffer->ProcessorId      = 0;
> +  ProcessorInfoBuffer->StatusFlag       = PROCESSOR_AS_BSP_BIT  |
> +                                          PROCESSOR_ENABLED_BIT |
> +                                          PROCESSOR_HEALTH_STATUS_BIT;
> +  ProcessorInfoBuffer->Location.Package = 0;
> +  ProcessorInfoBuffer->Location.Core    = 0;
> +  ProcessorInfoBuffer->Location.Thread  = 0;
> +  if (HealthData != NULL) {
> +    GuidHob = GetFirstGuidHob (&gEfiSecPlatformInformationPpiGuid);
> +    if (GuidHob != NULL) {
> +      SecPlatformInformation = GET_GUID_HOB_DATA (GuidHob);
> +      HealthData->Uint32 = SecPlatformInformation->IA32HealthFlags.Uint32;
> +    } else {
> +      DEBUG ((DEBUG_INFO, "Does not find any HOB stored CPU BIST information!\n"));
> +      HealthData->Uint32 = 0;
> +    }
> +  }
> +  return EFI_SUCCESS;
> +}
> +
> +/**
> +  This service executes a caller provided function on all enabled APs.
> +
> +  @param[in]  Procedure               A pointer to the function to be run on
> +                                      enabled APs of the system. See type
> +                                      EFI_AP_PROCEDURE.
> +  @param[in]  SingleThread            If TRUE, then all the enabled APs execute
> +                                      the function specified by Procedure one by
> +                                      one, in ascending order of processor handle
> +                                      number.  If FALSE, then all the enabled APs
> +                                      execute the function specified by Procedure
> +                                      simultaneously.
> +  @param[in]  WaitEvent               The event created by the caller with CreateEvent()
> +                                      service.  If it is NULL, then execute in
> +                                      blocking mode. BSP waits until all APs finish
> +                                      or TimeoutInMicroSeconds expires.  If it's
> +                                      not NULL, then execute in non-blocking mode.
> +                                      BSP requests the function specified by
> +                                      Procedure to be started on all the enabled
> +                                      APs, and go on executing immediately. If
> +                                      all return from Procedure, or TimeoutInMicroSeconds
> +                                      expires, this event is signaled. The BSP
> +                                      can use the CheckEvent() or WaitForEvent()
> +                                      services to check the state of event.  Type
> +                                      EFI_EVENT is defined in CreateEvent() in
> +                                      the Unified Extensible Firmware Interface
> +                                      Specification.
> +  @param[in]  TimeoutInMicroseconds   Indicates the time limit in microseconds for
> +                                      APs to return from Procedure, either for
> +                                      blocking or non-blocking mode. Zero means
> +                                      infinity.  If the timeout expires before
> +                                      all APs return from Procedure, then Procedure
> +                                      on the failed APs is terminated. All enabled
> +                                      APs are available for next function assigned
> +                                      by MpInitLibStartupAllAPs() or
> +                                      MPInitLibStartupThisAP().
> +                                      If the timeout expires in blocking mode,
> +                                      BSP returns EFI_TIMEOUT.  If the timeout
> +                                      expires in non-blocking mode, WaitEvent
> +                                      is signaled with SignalEvent().
> +  @param[in]  ProcedureArgument       The parameter passed into Procedure for
> +                                      all APs.
> +  @param[out] FailedCpuList           If NULL, this parameter is ignored. Otherwise,
> +                                      if all APs finish successfully, then its
> +                                      content is set to NULL. If not all APs
> +                                      finish before timeout expires, then its
> +                                      content is set to address of the buffer
> +                                      holding handle numbers of the failed APs.
> +                                      The buffer is allocated by MP Initialization
> +                                      library, and it's the caller's responsibility to
> +                                      free the buffer with FreePool() service.
> +                                      In blocking mode, it is ready for consumption
> +                                      when the call returns. In non-blocking mode,
> +                                      it is ready when WaitEvent is signaled.  The
> +                                      list of failed CPU is terminated by
> +                                      END_OF_CPU_LIST.
> +
> +  @retval EFI_SUCCESS             In blocking mode, all APs have finished before
> +                                  the timeout expired.
> +  @retval EFI_SUCCESS             In non-blocking mode, function has been dispatched
> +                                  to all enabled APs.
> +  @retval EFI_UNSUPPORTED         A non-blocking mode request was made after the
> +                                  UEFI event EFI_EVENT_GROUP_READY_TO_BOOT was
> +                                  signaled.
> +  @retval EFI_UNSUPPORTED         WaitEvent is not NULL if non-blocking mode is not
> +                                  supported.
> +  @retval EFI_DEVICE_ERROR        Caller processor is AP.
> +  @retval EFI_NOT_STARTED         No enabled APs exist in the system.
> +  @retval EFI_NOT_READY           Any enabled APs are busy.
> +  @retval EFI_NOT_READY           MP Initialize Library is not initialized.
> +  @retval EFI_TIMEOUT             In blocking mode, the timeout expired before
> +                                  all enabled APs have finished.
> +  @retval EFI_INVALID_PARAMETER   Procedure is NULL.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +MpInitLibStartupAllAPs (
> +  IN  EFI_AP_PROCEDURE          Procedure,
> +  IN  BOOLEAN                   SingleThread,
> +  IN  EFI_EVENT                 WaitEvent               OPTIONAL,
> +  IN  UINTN                     TimeoutInMicroseconds,
> +  IN  VOID                      *ProcedureArgument      OPTIONAL,
> +  OUT UINTN                     **FailedCpuList         OPTIONAL
> +  )
> +{
> +  return EFI_NOT_STARTED;
> +}
> +
> +/**
> +  This service lets the caller get one enabled AP to execute a caller-provided
> +  function.
> +
> +  @param[in]  Procedure               A pointer to the function to be run on the
> +                                      designated AP of the system. See type
> +                                      EFI_AP_PROCEDURE.
> +  @param[in]  ProcessorNumber         The handle number of the AP. The range is
> +                                      from 0 to the total number of logical
> +                                      processors minus 1. The total number of
> +                                      logical processors can be retrieved by
> +                                      MpInitLibGetNumberOfProcessors().
> +  @param[in]  WaitEvent               The event created by the caller with CreateEvent()
> +                                      service.  If it is NULL, then execute in
> +                                      blocking mode. BSP waits until this AP finish
> +                                      or TimeoutInMicroSeconds expires.  If it's
> +                                      not NULL, then execute in non-blocking mode.
> +                                      BSP requests the function specified by
> +                                      Procedure to be started on this AP,
> +                                      and go on executing immediately. If this AP
> +                                      return from Procedure or TimeoutInMicroSeconds
> +                                      expires, this event is signaled. The BSP
> +                                      can use the CheckEvent() or WaitForEvent()
> +                                      services to check the state of event.  Type
> +                                      EFI_EVENT is defined in CreateEvent() in
> +                                      the Unified Extensible Firmware Interface
> +                                      Specification.
> +  @param[in]  TimeoutInMicroseconds   Indicates the time limit in microseconds for
> +                                      this AP to finish this Procedure, either for
> +                                      blocking or non-blocking mode. Zero means
> +                                      infinity.  If the timeout expires before
> +                                      this AP returns from Procedure, then Procedure
> +                                      on the AP is terminated. The
> +                                      AP is available for next function assigned
> +                                      by MpInitLibStartupAllAPs() or
> +                                      MpInitLibStartupThisAP().
> +                                      If the timeout expires in blocking mode,
> +                                      BSP returns EFI_TIMEOUT.  If the timeout
> +                                      expires in non-blocking mode, WaitEvent
> +                                      is signaled with SignalEvent().
> +  @param[in]  ProcedureArgument       The parameter passed into Procedure on the
> +                                      specified AP.
> +  @param[out] Finished                If NULL, this parameter is ignored.  In
> +                                      blocking mode, this parameter is ignored.
> +                                      In non-blocking mode, if AP returns from
> +                                      Procedure before the timeout expires, its
> +                                      content is set to TRUE. Otherwise, the
> +                                      value is set to FALSE. The caller can
> +                                      determine if the AP returned from Procedure
> +                                      by evaluating this value.
> +
> +  @retval EFI_SUCCESS             In blocking mode, specified AP finished before
> +                                  the timeout expires.
> +  @retval EFI_SUCCESS             In non-blocking mode, the function has been
> +                                  dispatched to specified AP.
> +  @retval EFI_UNSUPPORTED         A non-blocking mode request was made after the
> +                                  UEFI event EFI_EVENT_GROUP_READY_TO_BOOT was
> +                                  signaled.
> +  @retval EFI_UNSUPPORTED         WaitEvent is not NULL if non-blocking mode is not
> +                                  supported.
> +  @retval EFI_DEVICE_ERROR        The calling processor is an AP.
> +  @retval EFI_TIMEOUT             In blocking mode, the timeout expired before
> +                                  the specified AP has finished.
> +  @retval EFI_NOT_READY           The specified AP is busy.
> +  @retval EFI_NOT_READY           MP Initialize Library is not initialized.
> +  @retval EFI_NOT_FOUND           The processor with the handle specified by
> +                                  ProcessorNumber does not exist.
> +  @retval EFI_INVALID_PARAMETER   ProcessorNumber specifies the BSP or disabled AP.
> +  @retval EFI_INVALID_PARAMETER   Procedure is NULL.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +MpInitLibStartupThisAP (
> +  IN  EFI_AP_PROCEDURE          Procedure,
> +  IN  UINTN                     ProcessorNumber,
> +  IN  EFI_EVENT                 WaitEvent               OPTIONAL,
> +  IN  UINTN                     TimeoutInMicroseconds,
> +  IN  VOID                      *ProcedureArgument      OPTIONAL,
> +  OUT BOOLEAN                   *Finished               OPTIONAL
> +  )
> +{
> +  return EFI_INVALID_PARAMETER;
> +}
> +
> +/**
> +  This service switches the requested AP to be the BSP from that point onward.
> +  This service changes the BSP for all purposes. This call can only be performed
> +  by the current BSP.
> +
> +  @param[in] ProcessorNumber   The handle number of AP that is to become the new
> +                               BSP. The range is from 0 to the total number of
> +                               logical processors minus 1. The total number of
> +                               logical processors can be retrieved by
> +                               MpInitLibGetNumberOfProcessors().
> +  @param[in] EnableOldBSP      If TRUE, then the old BSP will be listed as an
> +                               enabled AP. Otherwise, it will be disabled.
> +
> +  @retval EFI_SUCCESS             BSP successfully switched.
> +  @retval EFI_UNSUPPORTED         Switching the BSP cannot be completed prior to
> +                                  this service returning.
> +  @retval EFI_UNSUPPORTED         Switching the BSP is not supported.
> +  @retval EFI_DEVICE_ERROR        The calling processor is an AP.
> +  @retval EFI_NOT_FOUND           The processor with the handle specified by
> +                                  ProcessorNumber does not exist.
> +  @retval EFI_INVALID_PARAMETER   ProcessorNumber specifies the current BSP or
> +                                  a disabled AP.
> +  @retval EFI_NOT_READY           The specified AP is busy.
> +  @retval EFI_NOT_READY           MP Initialize Library is not initialized.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +MpInitLibSwitchBSP (
> +  IN UINTN                     ProcessorNumber,
> +  IN BOOLEAN                   EnableOldBSP
> +  )
> +{
> +  return EFI_UNSUPPORTED;
> +}
> +
> +/**
> +  This service lets the caller enable or disable an AP from this point onward.
> +  This service may only be called from the BSP.
> +
> +  @param[in] ProcessorNumber   The handle number of AP.
> +                               The range is from 0 to the total number of
> +                               logical processors minus 1. The total number of
> +                               logical processors can be retrieved by
> +                               MpInitLibGetNumberOfProcessors().
> +  @param[in] EnableAP          Specifies the new state for the processor for
> +                               enabled, FALSE for disabled.
> +  @param[in] HealthFlag        If not NULL, a pointer to a value that specifies
> +                               the new health status of the AP. This flag
> +                               corresponds to StatusFlag defined in
> +                               EFI_MP_SERVICES_PROTOCOL.GetProcessorInfo(). Only
> +                               the PROCESSOR_HEALTH_STATUS_BIT is used. All other
> +                               bits are ignored.  If it is NULL, this parameter
> +                               is ignored.
> +
> +  @retval EFI_SUCCESS             The specified AP was enabled or disabled successfully.
> +  @retval EFI_UNSUPPORTED         Enabling or disabling an AP cannot be completed
> +                                  prior to this service returning.
> +  @retval EFI_UNSUPPORTED         Enabling or disabling an AP is not supported.
> +  @retval EFI_DEVICE_ERROR        The calling processor is an AP.
> +  @retval EFI_NOT_FOUND           Processor with the handle specified by ProcessorNumber
> +                                  does not exist.
> +  @retval EFI_INVALID_PARAMETER   ProcessorNumber specifies the BSP.
> +  @retval EFI_NOT_READY           MP Initialize Library is not initialized.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +MpInitLibEnableDisableAP (
> +  IN  UINTN                     ProcessorNumber,
> +  IN  BOOLEAN                   EnableAP,
> +  IN  UINT32                    *HealthFlag OPTIONAL
> +  )
> +{
> +  return EFI_UNSUPPORTED;
> +}
> +
> +/**
> +  This return the handle number for the calling processor.  This service may be
> +  called from the BSP and APs.
> +
> +  @param[out] ProcessorNumber  Pointer to the handle number of AP.
> +                               The range is from 0 to the total number of
> +                               logical processors minus 1. The total number of
> +                               logical processors can be retrieved by
> +                               MpInitLibGetNumberOfProcessors().
> +
> +  @retval EFI_SUCCESS             The current processor handle number was returned
> +                                  in ProcessorNumber.
> +  @retval EFI_INVALID_PARAMETER   ProcessorNumber is NULL.
> +  @retval EFI_NOT_READY           MP Initialize Library is not initialized.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +MpInitLibWhoAmI (
> +  OUT UINTN                    *ProcessorNumber
> +  )
> +{
> +  if (ProcessorNumber == NULL) {
> +    return EFI_INVALID_PARAMETER;
> +  }
> +  *ProcessorNumber = 0;
> +  return EFI_SUCCESS;
> +}
> diff --git a/UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf b/UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf
> new file mode 100644
> index 0000000000..24ad29c03c
> --- /dev/null
> +++ b/UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf
> @@ -0,0 +1,37 @@
> +## @file
> +#  MP Initialize Library instance for uniprocessor platforms.
> +#
> +#  Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +##
> +
> +[Defines]
> +  INF_VERSION                    = 0x00010005
> +  BASE_NAME                      = MpInitLibUp
> +  MODULE_UNI_FILE                = MpInitLibUp.uni
> +  FILE_GUID                      = 70E9818C-A4F0-4061-9FA2-2DFFC7016D6E
> +  MODULE_TYPE                    = BASE
> +  VERSION_STRING                 = 1.1
> +  LIBRARY_CLASS                  = MpInitLib
> +
> +#
> +# The following information is for reference only and not required by the build tools.
> +#
> +#  VALID_ARCHITECTURES           = IA32 X64
> +#
> +
> +[Sources]
> +  MpInitLibUp.c
> +
> +[Packages]
> +  MdePkg/MdePkg.dec
> +  UefiCpuPkg/UefiCpuPkg.dec
> +
> +[LibraryClasses]
> +  DebugLib
> +  LocalApicLib
> +  HobLib
> +
> +[Ppis]
> +  gEfiSecPlatformInformationPpiGuid  ## SOMETIMES_CONSUMES
> diff --git a/UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.uni b/UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.uni
> new file mode 100644
> index 0000000000..ca1ab94379
> --- /dev/null
> +++ b/UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.uni
> @@ -0,0 +1,14 @@
> +// /** @file
> +// MP Initialize Library instance for uniprocessor platforms.
> +//
> +// MP Initialize Library instance for uniprocessor platforms.
> +//
> +// Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
> +//
> +// SPDX-License-Identifier: BSD-2-Clause-Patent
> +//
> +// **/
> +
> +#string STR_MODULE_ABSTRACT             #language en-US "MP Initialize Library instance for uniprocessor platforms."
> +
> +#string STR_MODULE_DESCRIPTION          #language en-US "MP Initialize Library instance for uniprocessor platforms."
> diff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc
> index 9ed2f79648..bf690d3978 100644
> --- a/UefiCpuPkg/UefiCpuPkg.dsc
> +++ b/UefiCpuPkg/UefiCpuPkg.dsc
> @@ -1,7 +1,7 @@
>  ## @file
>  #  UefiCpuPkg Package
>  #
> -#  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
> +#  Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>
>  #
>  #  SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
> @@ -124,6 +124,7 @@ [Components.IA32, Components.X64]
>    UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf
>    UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
>    UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
> +  UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf
>    UefiCpuPkg/Library/MtrrLib/MtrrLib.inf
>    UefiCpuPkg/Library/PlatformSecLibNull/PlatformSecLibNull.inf
>    UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.inf
> 


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [edk2-devel] [Patch V3 5/8] UefiCPuPkg/CpuMpPei: Add missing CpuLib class
  2019-04-30 19:31 ` [Patch V3 5/8] UefiCPuPkg/CpuMpPei: Add missing CpuLib class Michael D Kinney
@ 2019-04-30 20:31   ` Laszlo Ersek
  0 siblings, 0 replies; 16+ messages in thread
From: Laszlo Ersek @ 2019-04-30 20:31 UTC (permalink / raw)
  To: devel, michael.d.kinney; +Cc: Eric Dong, Ray Ni

On 04/30/19 21:31, Michael D Kinney wrote:
> The CpuMpPei module uses a services from the CpuLib class,
> but the CpuLib class is missing from the INF file.  This
> update is required to use the new MpInitLibUp instance that
> does not use the CpuLib class.
> 
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
> ---
>  UefiCpuPkg/CpuMpPei/CpuMpPei.inf | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/UefiCpuPkg/CpuMpPei/CpuMpPei.inf b/UefiCpuPkg/CpuMpPei/CpuMpPei.inf
> index 14ec75f254..4fc4ea77ba 100644
> --- a/UefiCpuPkg/CpuMpPei/CpuMpPei.inf
> +++ b/UefiCpuPkg/CpuMpPei/CpuMpPei.inf
> @@ -1,7 +1,7 @@
>  ## @file
>  #  CPU driver installs CPU PI Multi-processor PPI.
>  #
> -#  Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
> +#  Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.<BR>
>  #  SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
>  ##
> @@ -43,6 +43,7 @@ [LibraryClasses]
>    CpuExceptionHandlerLib
>    MpInitLib
>    BaseMemoryLib
> +  CpuLib
>  
>  [Ppis]
>    gEfiPeiMpServicesPpiGuid                      ## PRODUCES
> 

Right, CpuMpPei calls CpuFlushTlb(), but its INF file doesn't require
CpuLib. And this issue has been masked thus far because both
DxeMpInitLib and PeiMpInitLib depend on CpuLib.

Reviewed-by: Laszlo Ersek <lersek@redhat.com>

Thanks,
Laszlo

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [edk2-devel] [Patch V3 3/8] QuarkPlatformPkg: Set PcdSpeculationBarrierType to CPUID
  2019-04-30 19:31 ` [Patch V3 3/8] QuarkPlatformPkg: Set PcdSpeculationBarrierType to CPUID Michael D Kinney
@ 2019-04-30 21:25   ` Kubacki, Michael A
  0 siblings, 0 replies; 16+ messages in thread
From: Kubacki, Michael A @ 2019-04-30 21:25 UTC (permalink / raw)
  To: devel@edk2.groups.io, Kinney, Michael D; +Cc: Steele, Kelly, Gao, Liming

Reviewed-by: Michael Kubacki <michael.a.kubacki@intel.com>

> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Michael D Kinney
> Sent: Tuesday, April 30, 2019 12:31 PM
> To: devel@edk2.groups.io
> Cc: Steele, Kelly <kelly.steele@intel.com>; Gao, Liming
> <liming.gao@intel.com>
> Subject: [edk2-devel] [Patch V3 3/8] QuarkPlatformPkg: Set
> PcdSpeculationBarrierType to CPUID
> 
> Set PcdSpeculationBarrierType to use CPUID instead of the default LFENCE in
> the BaseLib function SpeculationBarrier().
> LFENCE requires SSE2, and Quark platforms do not support SSE2.
> 
> Cc: Kelly Steele <kelly.steele@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
> ---
>  QuarkPlatformPkg/Quark.dsc    | 7 ++++++-
>  QuarkPlatformPkg/QuarkMin.dsc | 5 +++++
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/QuarkPlatformPkg/Quark.dsc b/QuarkPlatformPkg/Quark.dsc
> index 422fd9cf8d..96ddc1565a 100644
> --- a/QuarkPlatformPkg/Quark.dsc
> +++ b/QuarkPlatformPkg/Quark.dsc
> @@ -2,7 +2,7 @@
>  # Clanton Peak CRB platform with 32-bit DXE for 4MB/8MB flash devices.
>  #
>  # This package provides Clanton Peak CRB platform specific modules.
> -# Copyright (c) 2013 - 2018 Intel Corporation.
> +# Copyright (c) 2013 - 2019 Intel Corporation.
>  #
>  # SPDX-License-Identifier: BSD-2-Clause-Patent  # @@ -448,6 +448,11 @@
> [PcdsFixedAtBuild]
> 
> gEfiMdeModulePkgTokenSpaceGuid.PcdRecoveryFileName|L"QUARKREC.Ca
> p"
>  !endif
> 
> +  #
> +  # Quark does not support LFENCE.  Use CPUID as speculation barrier  #
> +  gEfiMdePkgTokenSpaceGuid.PcdSpeculationBarrierType|0x02
> +
>  [PcdsPatchableInModule]
>    gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x803000C7
>    gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress|0x0
> diff --git a/QuarkPlatformPkg/QuarkMin.dsc
> b/QuarkPlatformPkg/QuarkMin.dsc index 00e2febb54..8ca75bc474 100644
> --- a/QuarkPlatformPkg/QuarkMin.dsc
> +++ b/QuarkPlatformPkg/QuarkMin.dsc
> @@ -406,6 +406,11 @@ [PcdsFixedAtBuild]
> 
>    gEfiMdeModulePkgTokenSpaceGuid.PcdConInConnectOnDemand|FALSE
> 
> +  #
> +  # Quark does not support LFENCE.  Use CPUID as speculation barrier  #
> +  gEfiMdePkgTokenSpaceGuid.PcdSpeculationBarrierType|0x02
> +
>  [PcdsPatchableInModule]
>    gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x803000C7
>    gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress|0x0
> --
> 2.21.0.windows.1
> 
> 
> 


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [edk2-devel] [Patch V3 6/8] QuarkPlatformPkg: Use uniprocessor MpInitLibUp
  2019-04-30 19:31 ` [Patch V3 6/8] QuarkPlatformPkg: Use uniprocessor MpInitLibUp Michael D Kinney
@ 2019-04-30 21:31   ` Kubacki, Michael A
  0 siblings, 0 replies; 16+ messages in thread
From: Kubacki, Michael A @ 2019-04-30 21:31 UTC (permalink / raw)
  To: devel@edk2.groups.io, Kinney, Michael D; +Cc: Steele, Kelly, Gao, Liming

Reviewed-by: Michael Kubacki <michael.a.kubacki@intel.com>

> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Michael D Kinney
> Sent: Tuesday, April 30, 2019 12:31 PM
> To: devel@edk2.groups.io
> Cc: Steele, Kelly <kelly.steele@intel.com>; Gao, Liming
> <liming.gao@intel.com>
> Subject: [edk2-devel] [Patch V3 6/8] QuarkPlatformPkg: Use uniprocessor
> MpInitLibUp
> 
> Update Quark DSC files to use MpInitLibUp instead of DxeMpInitLib and
> PeiMpInitLib.
> 
> Cc: Kelly Steele <kelly.steele@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
> ---
>  QuarkPlatformPkg/Quark.dsc    | 3 +--
>  QuarkPlatformPkg/QuarkMin.dsc | 3 +--
>  2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/QuarkPlatformPkg/Quark.dsc b/QuarkPlatformPkg/Quark.dsc
> index 96ddc1565a..e5ebeb5e09 100644
> --- a/QuarkPlatformPkg/Quark.dsc
> +++ b/QuarkPlatformPkg/Quark.dsc
> @@ -195,7 +195,7 @@ [LibraryClasses]
>    #
>    MtrrLib|QuarkSocPkg/QuarkNorthCluster/Library/MtrrLib/MtrrLib.inf
>    LocalApicLib|UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf
> -  MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
> +  MpInitLib|UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf
> 
>    #
>    # Quark North Cluster
> @@ -261,7 +261,6 @@
> [LibraryClasses.IA32.PEIM,LibraryClasses.IA32.PEI_CORE]
>    TimerLib|PcAtChipsetPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf
> 
> PlatformHelperLib|QuarkPlatformPkg/Library/PlatformHelperLib/PeiPlatfor
> mHelperLib.inf
> 
> CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPe
> iCpuExceptionHandlerLib.inf
> -  MpInitLib|UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
>    BaseCryptLib|CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
>  !if $(PERFORMANCE_ENABLE)
> 
> PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanc
> eLib.inf
> diff --git a/QuarkPlatformPkg/QuarkMin.dsc
> b/QuarkPlatformPkg/QuarkMin.dsc index 8ca75bc474..c95a5fcff9 100644
> --- a/QuarkPlatformPkg/QuarkMin.dsc
> +++ b/QuarkPlatformPkg/QuarkMin.dsc
> @@ -167,7 +167,7 @@ [LibraryClasses]
>    #
>    MtrrLib|QuarkSocPkg/QuarkNorthCluster/Library/MtrrLib/MtrrLib.inf
>    LocalApicLib|UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf
> -  MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
> +  MpInitLib|UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf
> 
>    #
>    # Quark North Cluster
> @@ -219,7 +219,6 @@
> [LibraryClasses.IA32.PEIM,LibraryClasses.IA32.PEI_CORE]
>    TimerLib|PcAtChipsetPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf
> 
> PlatformHelperLib|QuarkPlatformPkg/Library/PlatformHelperLib/PeiPlatfor
> mHelperLib.inf
> 
> CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPe
> iCpuExceptionHandlerLib.inf
> -  MpInitLib|UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
>  !if $(SECURE_BOOT_ENABLE)
>    BaseCryptLib|CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
>  !endif
> --
> 2.21.0.windows.1
> 
> 
> 


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [edk2-devel] [Patch V3 4/8] UefiCpuPkg/MpInitLibUp: Add uniprocessor MpInitLib
  2019-04-30 19:31 ` [Patch V3 4/8] UefiCpuPkg/MpInitLibUp: Add uniprocessor MpInitLib Michael D Kinney
  2019-04-30 20:25   ` [edk2-devel] " Laszlo Ersek
@ 2019-05-05  2:36   ` Ni, Ray
  1 sibling, 0 replies; 16+ messages in thread
From: Ni, Ray @ 2019-05-05  2:36 UTC (permalink / raw)
  To: devel@edk2.groups.io, Kinney, Michael D; +Cc: Dong, Eric, Laszlo Ersek

Reviewed-by: Ray Ni <ray.ni@intel.com>

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Michael
> D Kinney
> Sent: Wednesday, May 1, 2019 3:31 AM
> To: devel@edk2.groups.io
> Cc: Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Laszlo
> Ersek <lersek@redhat.com>
> Subject: [edk2-devel] [Patch V3 4/8] UefiCpuPkg/MpInitLibUp: Add
> uniprocessor MpInitLib
> 
> Add a new instance of the MpInitLib that is designed for uniprocessor
> platforms that require the use of modules that depend on the
> MP_SERVICES_PROTOCOL for dispatch or to retrieve information about the
> boot processor.
> 
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
> ---
>  UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.c  | 407
> ++++++++++++++++++
>  .../Library/MpInitLibUp/MpInitLibUp.inf       |  37 ++
>  .../Library/MpInitLibUp/MpInitLibUp.uni       |  14 +
>  UefiCpuPkg/UefiCpuPkg.dsc                     |   3 +-
>  4 files changed, 460 insertions(+), 1 deletion(-)  create mode 100644
> UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.c
>  create mode 100644 UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf
>  create mode 100644 UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.uni
> 
> diff --git a/UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.c
> b/UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.c
> new file mode 100644
> index 0000000000..36c2bb5326
> --- /dev/null
> +++ b/UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.c
> @@ -0,0 +1,407 @@
> +/** @file
> +  Multiple-Processor initialization Library for uniprocessor platforms.
> +
> +  Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include <PiDxe.h>
> +#include <Ppi/SecPlatformInformation.h> #include <Protocol/MpService.h>
> +#include <Library/DebugLib.h> #include <Library/LocalApicLib.h>
> +#include <Library/HobLib.h>
> +
> +/**
> +  MP Initialize Library initialization.
> +
> +  This service will allocate AP reset vector and wakeup all APs to do
> + APs  initialization.
> +
> +  This service must be invoked before all other MP Initialize Library
> + service are invoked.
> +
> +  @retval  EFI_SUCCESS           MP initialization succeeds.
> +  @retval  Others                MP initialization fails.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +MpInitLibInitialize (
> +  VOID
> +  )
> +{
> +  //
> +  // Enable the local APIC for Virtual Wire Mode.
> +  //
> +  ProgramVirtualWireMode ();
> +
> +  return EFI_SUCCESS;
> +}
> +
> +/**
> +  Retrieves the number of logical processor in the platform and the
> +number of
> +  those logical processors that are enabled on this boot. This service
> +may only
> +  be called from the BSP.
> +
> +  @param[out] NumberOfProcessors          Pointer to the total number of
> logical
> +                                          processors in the system, including the BSP
> +                                          and disabled APs.
> +  @param[out] NumberOfEnabledProcessors   Pointer to the number of
> enabled logical
> +                                          processors that exist in system, including
> +                                          the BSP.
> +
> +  @retval EFI_SUCCESS             The number of logical processors and enabled
> +                                  logical processors was retrieved.
> +  @retval EFI_DEVICE_ERROR        The calling processor is an AP.
> +  @retval EFI_INVALID_PARAMETER   NumberOfProcessors is NULL and
> NumberOfEnabledProcessors
> +                                  is NULL.
> +  @retval EFI_NOT_READY           MP Initialize Library is not initialized.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +MpInitLibGetNumberOfProcessors (
> +  OUT UINTN                     *NumberOfProcessors,       OPTIONAL
> +  OUT UINTN                     *NumberOfEnabledProcessors OPTIONAL
> +  )
> +{
> +  *NumberOfProcessors        = 1;
> +  *NumberOfEnabledProcessors = 1;
> +  return EFI_SUCCESS;
> +}
> +
> +/**
> +  Gets detailed MP-related information on the requested processor at
> +the
> +  instant this call is made. This service may only be called from the BSP.
> +
> +  @param[in]  ProcessorNumber       The handle number of processor.
> +  @param[out] ProcessorInfoBuffer   A pointer to the buffer where
> information for
> +                                    the requested processor is deposited.
> +  @param[out] HealthData            Return processor health data.
> +
> +  @retval EFI_SUCCESS             Processor information was returned.
> +  @retval EFI_DEVICE_ERROR        The calling processor is an AP.
> +  @retval EFI_INVALID_PARAMETER   ProcessorInfoBuffer is NULL.
> +  @retval EFI_NOT_FOUND           The processor with the handle specified by
> +                                  ProcessorNumber does not exist in the platform.
> +  @retval EFI_NOT_READY           MP Initialize Library is not initialized.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +MpInitLibGetProcessorInfo (
> +  IN  UINTN                      ProcessorNumber,
> +  OUT EFI_PROCESSOR_INFORMATION  *ProcessorInfoBuffer,
> +  OUT EFI_HEALTH_FLAGS           *HealthData  OPTIONAL
> +  )
> +{
> +  EFI_HOB_GUID_TYPE                    *GuidHob;
> +  EFI_SEC_PLATFORM_INFORMATION_RECORD  *SecPlatformInformation;
> +
> +  if (ProcessorInfoBuffer == NULL) {
> +    return EFI_INVALID_PARAMETER;
> +  }
> +  if (ProcessorNumber != 0) {
> +    return EFI_NOT_FOUND;
> +  }
> +  ProcessorInfoBuffer->ProcessorId      = 0;
> +  ProcessorInfoBuffer->StatusFlag       = PROCESSOR_AS_BSP_BIT  |
> +                                          PROCESSOR_ENABLED_BIT |
> +                                          PROCESSOR_HEALTH_STATUS_BIT;
> +  ProcessorInfoBuffer->Location.Package = 0;
> +  ProcessorInfoBuffer->Location.Core    = 0;
> +  ProcessorInfoBuffer->Location.Thread  = 0;
> +  if (HealthData != NULL) {
> +    GuidHob = GetFirstGuidHob (&gEfiSecPlatformInformationPpiGuid);
> +    if (GuidHob != NULL) {
> +      SecPlatformInformation = GET_GUID_HOB_DATA (GuidHob);
> +      HealthData->Uint32 = SecPlatformInformation->IA32HealthFlags.Uint32;
> +    } else {
> +      DEBUG ((DEBUG_INFO, "Does not find any HOB stored CPU BIST
> information!\n"));
> +      HealthData->Uint32 = 0;
> +    }
> +  }
> +  return EFI_SUCCESS;
> +}
> +
> +/**
> +  This service executes a caller provided function on all enabled APs.
> +
> +  @param[in]  Procedure               A pointer to the function to be run on
> +                                      enabled APs of the system. See type
> +                                      EFI_AP_PROCEDURE.
> +  @param[in]  SingleThread            If TRUE, then all the enabled APs execute
> +                                      the function specified by Procedure one by
> +                                      one, in ascending order of processor handle
> +                                      number.  If FALSE, then all the enabled APs
> +                                      execute the function specified by Procedure
> +                                      simultaneously.
> +  @param[in]  WaitEvent               The event created by the caller with
> CreateEvent()
> +                                      service.  If it is NULL, then execute in
> +                                      blocking mode. BSP waits until all APs finish
> +                                      or TimeoutInMicroSeconds expires.  If it's
> +                                      not NULL, then execute in non-blocking mode.
> +                                      BSP requests the function specified by
> +                                      Procedure to be started on all the enabled
> +                                      APs, and go on executing immediately. If
> +                                      all return from Procedure, or TimeoutInMicroSeconds
> +                                      expires, this event is signaled. The BSP
> +                                      can use the CheckEvent() or WaitForEvent()
> +                                      services to check the state of event.  Type
> +                                      EFI_EVENT is defined in CreateEvent() in
> +                                      the Unified Extensible Firmware Interface
> +                                      Specification.
> +  @param[in]  TimeoutInMicroseconds   Indicates the time limit in
> microseconds for
> +                                      APs to return from Procedure, either for
> +                                      blocking or non-blocking mode. Zero means
> +                                      infinity.  If the timeout expires before
> +                                      all APs return from Procedure, then Procedure
> +                                      on the failed APs is terminated. All enabled
> +                                      APs are available for next function assigned
> +                                      by MpInitLibStartupAllAPs() or
> +                                      MPInitLibStartupThisAP().
> +                                      If the timeout expires in blocking mode,
> +                                      BSP returns EFI_TIMEOUT.  If the timeout
> +                                      expires in non-blocking mode, WaitEvent
> +                                      is signaled with SignalEvent().
> +  @param[in]  ProcedureArgument       The parameter passed into
> Procedure for
> +                                      all APs.
> +  @param[out] FailedCpuList           If NULL, this parameter is ignored.
> Otherwise,
> +                                      if all APs finish successfully, then its
> +                                      content is set to NULL. If not all APs
> +                                      finish before timeout expires, then its
> +                                      content is set to address of the buffer
> +                                      holding handle numbers of the failed APs.
> +                                      The buffer is allocated by MP Initialization
> +                                      library, and it's the caller's responsibility to
> +                                      free the buffer with FreePool() service.
> +                                      In blocking mode, it is ready for consumption
> +                                      when the call returns. In non-blocking mode,
> +                                      it is ready when WaitEvent is signaled.  The
> +                                      list of failed CPU is terminated by
> +                                      END_OF_CPU_LIST.
> +
> +  @retval EFI_SUCCESS             In blocking mode, all APs have finished before
> +                                  the timeout expired.
> +  @retval EFI_SUCCESS             In non-blocking mode, function has been
> dispatched
> +                                  to all enabled APs.
> +  @retval EFI_UNSUPPORTED         A non-blocking mode request was made
> after the
> +                                  UEFI event EFI_EVENT_GROUP_READY_TO_BOOT was
> +                                  signaled.
> +  @retval EFI_UNSUPPORTED         WaitEvent is not NULL if non-blocking
> mode is not
> +                                  supported.
> +  @retval EFI_DEVICE_ERROR        Caller processor is AP.
> +  @retval EFI_NOT_STARTED         No enabled APs exist in the system.
> +  @retval EFI_NOT_READY           Any enabled APs are busy.
> +  @retval EFI_NOT_READY           MP Initialize Library is not initialized.
> +  @retval EFI_TIMEOUT             In blocking mode, the timeout expired before
> +                                  all enabled APs have finished.
> +  @retval EFI_INVALID_PARAMETER   Procedure is NULL.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +MpInitLibStartupAllAPs (
> +  IN  EFI_AP_PROCEDURE          Procedure,
> +  IN  BOOLEAN                   SingleThread,
> +  IN  EFI_EVENT                 WaitEvent               OPTIONAL,
> +  IN  UINTN                     TimeoutInMicroseconds,
> +  IN  VOID                      *ProcedureArgument      OPTIONAL,
> +  OUT UINTN                     **FailedCpuList         OPTIONAL
> +  )
> +{
> +  return EFI_NOT_STARTED;
> +}
> +
> +/**
> +  This service lets the caller get one enabled AP to execute a
> +caller-provided
> +  function.
> +
> +  @param[in]  Procedure               A pointer to the function to be run on the
> +                                      designated AP of the system. See type
> +                                      EFI_AP_PROCEDURE.
> +  @param[in]  ProcessorNumber         The handle number of the AP. The
> range is
> +                                      from 0 to the total number of logical
> +                                      processors minus 1. The total number of
> +                                      logical processors can be retrieved by
> +                                      MpInitLibGetNumberOfProcessors().
> +  @param[in]  WaitEvent               The event created by the caller with
> CreateEvent()
> +                                      service.  If it is NULL, then execute in
> +                                      blocking mode. BSP waits until this AP finish
> +                                      or TimeoutInMicroSeconds expires.  If it's
> +                                      not NULL, then execute in non-blocking mode.
> +                                      BSP requests the function specified by
> +                                      Procedure to be started on this AP,
> +                                      and go on executing immediately. If this AP
> +                                      return from Procedure or TimeoutInMicroSeconds
> +                                      expires, this event is signaled. The BSP
> +                                      can use the CheckEvent() or WaitForEvent()
> +                                      services to check the state of event.  Type
> +                                      EFI_EVENT is defined in CreateEvent() in
> +                                      the Unified Extensible Firmware Interface
> +                                      Specification.
> +  @param[in]  TimeoutInMicroseconds   Indicates the time limit in
> microseconds for
> +                                      this AP to finish this Procedure, either for
> +                                      blocking or non-blocking mode. Zero means
> +                                      infinity.  If the timeout expires before
> +                                      this AP returns from Procedure, then Procedure
> +                                      on the AP is terminated. The
> +                                      AP is available for next function assigned
> +                                      by MpInitLibStartupAllAPs() or
> +                                      MpInitLibStartupThisAP().
> +                                      If the timeout expires in blocking mode,
> +                                      BSP returns EFI_TIMEOUT.  If the timeout
> +                                      expires in non-blocking mode, WaitEvent
> +                                      is signaled with SignalEvent().
> +  @param[in]  ProcedureArgument       The parameter passed into
> Procedure on the
> +                                      specified AP.
> +  @param[out] Finished                If NULL, this parameter is ignored.  In
> +                                      blocking mode, this parameter is ignored.
> +                                      In non-blocking mode, if AP returns from
> +                                      Procedure before the timeout expires, its
> +                                      content is set to TRUE. Otherwise, the
> +                                      value is set to FALSE. The caller can
> +                                      determine if the AP returned from Procedure
> +                                      by evaluating this value.
> +
> +  @retval EFI_SUCCESS             In blocking mode, specified AP finished before
> +                                  the timeout expires.
> +  @retval EFI_SUCCESS             In non-blocking mode, the function has been
> +                                  dispatched to specified AP.
> +  @retval EFI_UNSUPPORTED         A non-blocking mode request was made
> after the
> +                                  UEFI event EFI_EVENT_GROUP_READY_TO_BOOT was
> +                                  signaled.
> +  @retval EFI_UNSUPPORTED         WaitEvent is not NULL if non-blocking
> mode is not
> +                                  supported.
> +  @retval EFI_DEVICE_ERROR        The calling processor is an AP.
> +  @retval EFI_TIMEOUT             In blocking mode, the timeout expired before
> +                                  the specified AP has finished.
> +  @retval EFI_NOT_READY           The specified AP is busy.
> +  @retval EFI_NOT_READY           MP Initialize Library is not initialized.
> +  @retval EFI_NOT_FOUND           The processor with the handle specified by
> +                                  ProcessorNumber does not exist.
> +  @retval EFI_INVALID_PARAMETER   ProcessorNumber specifies the BSP or
> disabled AP.
> +  @retval EFI_INVALID_PARAMETER   Procedure is NULL.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +MpInitLibStartupThisAP (
> +  IN  EFI_AP_PROCEDURE          Procedure,
> +  IN  UINTN                     ProcessorNumber,
> +  IN  EFI_EVENT                 WaitEvent               OPTIONAL,
> +  IN  UINTN                     TimeoutInMicroseconds,
> +  IN  VOID                      *ProcedureArgument      OPTIONAL,
> +  OUT BOOLEAN                   *Finished               OPTIONAL
> +  )
> +{
> +  return EFI_INVALID_PARAMETER;
> +}
> +
> +/**
> +  This service switches the requested AP to be the BSP from that point
> onward.
> +  This service changes the BSP for all purposes. This call can only be
> +performed
> +  by the current BSP.
> +
> +  @param[in] ProcessorNumber   The handle number of AP that is to
> become the new
> +                               BSP. The range is from 0 to the total number of
> +                               logical processors minus 1. The total number of
> +                               logical processors can be retrieved by
> +                               MpInitLibGetNumberOfProcessors().
> +  @param[in] EnableOldBSP      If TRUE, then the old BSP will be listed as an
> +                               enabled AP. Otherwise, it will be disabled.
> +
> +  @retval EFI_SUCCESS             BSP successfully switched.
> +  @retval EFI_UNSUPPORTED         Switching the BSP cannot be completed
> prior to
> +                                  this service returning.
> +  @retval EFI_UNSUPPORTED         Switching the BSP is not supported.
> +  @retval EFI_DEVICE_ERROR        The calling processor is an AP.
> +  @retval EFI_NOT_FOUND           The processor with the handle specified by
> +                                  ProcessorNumber does not exist.
> +  @retval EFI_INVALID_PARAMETER   ProcessorNumber specifies the
> current BSP or
> +                                  a disabled AP.
> +  @retval EFI_NOT_READY           The specified AP is busy.
> +  @retval EFI_NOT_READY           MP Initialize Library is not initialized.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +MpInitLibSwitchBSP (
> +  IN UINTN                     ProcessorNumber,
> +  IN BOOLEAN                   EnableOldBSP
> +  )
> +{
> +  return EFI_UNSUPPORTED;
> +}
> +
> +/**
> +  This service lets the caller enable or disable an AP from this point onward.
> +  This service may only be called from the BSP.
> +
> +  @param[in] ProcessorNumber   The handle number of AP.
> +                               The range is from 0 to the total number of
> +                               logical processors minus 1. The total number of
> +                               logical processors can be retrieved by
> +                               MpInitLibGetNumberOfProcessors().
> +  @param[in] EnableAP          Specifies the new state for the processor for
> +                               enabled, FALSE for disabled.
> +  @param[in] HealthFlag        If not NULL, a pointer to a value that specifies
> +                               the new health status of the AP. This flag
> +                               corresponds to StatusFlag defined in
> +                               EFI_MP_SERVICES_PROTOCOL.GetProcessorInfo(). Only
> +                               the PROCESSOR_HEALTH_STATUS_BIT is used. All other
> +                               bits are ignored.  If it is NULL, this parameter
> +                               is ignored.
> +
> +  @retval EFI_SUCCESS             The specified AP was enabled or disabled
> successfully.
> +  @retval EFI_UNSUPPORTED         Enabling or disabling an AP cannot be
> completed
> +                                  prior to this service returning.
> +  @retval EFI_UNSUPPORTED         Enabling or disabling an AP is not
> supported.
> +  @retval EFI_DEVICE_ERROR        The calling processor is an AP.
> +  @retval EFI_NOT_FOUND           Processor with the handle specified by
> ProcessorNumber
> +                                  does not exist.
> +  @retval EFI_INVALID_PARAMETER   ProcessorNumber specifies the BSP.
> +  @retval EFI_NOT_READY           MP Initialize Library is not initialized.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +MpInitLibEnableDisableAP (
> +  IN  UINTN                     ProcessorNumber,
> +  IN  BOOLEAN                   EnableAP,
> +  IN  UINT32                    *HealthFlag OPTIONAL
> +  )
> +{
> +  return EFI_UNSUPPORTED;
> +}
> +
> +/**
> +  This return the handle number for the calling processor.  This
> +service may be
> +  called from the BSP and APs.
> +
> +  @param[out] ProcessorNumber  Pointer to the handle number of AP.
> +                               The range is from 0 to the total number of
> +                               logical processors minus 1. The total number of
> +                               logical processors can be retrieved by
> +                               MpInitLibGetNumberOfProcessors().
> +
> +  @retval EFI_SUCCESS             The current processor handle number was
> returned
> +                                  in ProcessorNumber.
> +  @retval EFI_INVALID_PARAMETER   ProcessorNumber is NULL.
> +  @retval EFI_NOT_READY           MP Initialize Library is not initialized.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +MpInitLibWhoAmI (
> +  OUT UINTN                    *ProcessorNumber
> +  )
> +{
> +  if (ProcessorNumber == NULL) {
> +    return EFI_INVALID_PARAMETER;
> +  }
> +  *ProcessorNumber = 0;
> +  return EFI_SUCCESS;
> +}
> diff --git a/UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf
> b/UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf
> new file mode 100644
> index 0000000000..24ad29c03c
> --- /dev/null
> +++ b/UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf
> @@ -0,0 +1,37 @@
> +## @file
> +#  MP Initialize Library instance for uniprocessor platforms.
> +#
> +#  Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> #
> +SPDX-License-Identifier: BSD-2-Clause-Patent # ##
> +
> +[Defines]
> +  INF_VERSION                    = 0x00010005
> +  BASE_NAME                      = MpInitLibUp
> +  MODULE_UNI_FILE                = MpInitLibUp.uni
> +  FILE_GUID                      = 70E9818C-A4F0-4061-9FA2-2DFFC7016D6E
> +  MODULE_TYPE                    = BASE
> +  VERSION_STRING                 = 1.1
> +  LIBRARY_CLASS                  = MpInitLib
> +
> +#
> +# The following information is for reference only and not required by the
> build tools.
> +#
> +#  VALID_ARCHITECTURES           = IA32 X64
> +#
> +
> +[Sources]
> +  MpInitLibUp.c
> +
> +[Packages]
> +  MdePkg/MdePkg.dec
> +  UefiCpuPkg/UefiCpuPkg.dec
> +
> +[LibraryClasses]
> +  DebugLib
> +  LocalApicLib
> +  HobLib
> +
> +[Ppis]
> +  gEfiSecPlatformInformationPpiGuid  ## SOMETIMES_CONSUMES
> diff --git a/UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.uni
> b/UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.uni
> new file mode 100644
> index 0000000000..ca1ab94379
> --- /dev/null
> +++ b/UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.uni
> @@ -0,0 +1,14 @@
> +// /** @file
> +// MP Initialize Library instance for uniprocessor platforms.
> +//
> +// MP Initialize Library instance for uniprocessor platforms.
> +//
> +// Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> //
> +// SPDX-License-Identifier: BSD-2-Clause-Patent // // **/
> +
> +#string STR_MODULE_ABSTRACT             #language en-US "MP Initialize
> Library instance for uniprocessor platforms."
> +
> +#string STR_MODULE_DESCRIPTION          #language en-US "MP Initialize
> Library instance for uniprocessor platforms."
> diff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc index
> 9ed2f79648..bf690d3978 100644
> --- a/UefiCpuPkg/UefiCpuPkg.dsc
> +++ b/UefiCpuPkg/UefiCpuPkg.dsc
> @@ -1,7 +1,7 @@
>  ## @file
>  #  UefiCpuPkg Package
>  #
> -#  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
> +#  Copyright (c) 2007 - 2019, Intel Corporation. All rights
> +reserved.<BR>
>  #
>  #  SPDX-License-Identifier: BSD-2-Clause-Patent  # @@ -124,6 +124,7 @@
> [Components.IA32, Components.X64]
> 
> UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf
>    UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
>    UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
> +  UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf
>    UefiCpuPkg/Library/MtrrLib/MtrrLib.inf
>    UefiCpuPkg/Library/PlatformSecLibNull/PlatformSecLibNull.inf
>    UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.inf
> --
> 2.21.0.windows.1
> 
> 
> 


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Patch V3 0/8] Resolve Quark build and boot issues
  2019-04-30 19:31 [Patch V3 0/8] Resolve Quark build and boot issues Michael D Kinney
                   ` (7 preceding siblings ...)
  2019-04-30 19:31 ` [Patch V3 8/8] QuarkPlatformPkg/PlatformInit: Resolve ResetSystemLib name collision Michael D Kinney
@ 2019-05-05  5:23 ` Liming Gao
  2019-05-08 14:49 ` Steele, Kelly
  9 siblings, 0 replies; 16+ messages in thread
From: Liming Gao @ 2019-05-05  5:23 UTC (permalink / raw)
  To: Kinney, Michael D, devel@edk2.groups.io
  Cc: Steele, Kelly, Dong, Eric, Ni, Ray, Laszlo Ersek

The change in MdePkg is good. Reviewed-by: Liming Gao <liming.gao@intel.com>

>-----Original Message-----
>From: Kinney, Michael D
>Sent: Wednesday, May 01, 2019 3:31 AM
>To: devel@edk2.groups.io
>Cc: Steele, Kelly <kelly.steele@intel.com>; Gao, Liming
><liming.gao@intel.com>; Dong, Eric <eric.dong@intel.com>; Ni, Ray
><ray.ni@intel.com>; Laszlo Ersek <lersek@redhat.com>
>Subject: [Patch V3 0/8] Resolve Quark build and boot issues
>
>New in V3
>=========
>* Remove change to MpInitLib to avoid use of MSR_IA32_APIC_BASE.  That
>change
>  was not safe because an AP could call the PCD Protocol/PPI.
>* Add new MpInitLibUp for uni-processor platforms.
>* Update Quark DSC files to use MpInitLibUp for uni-processor platforms.
>* Add missing CpuLub library class to the CpuMpPei INF file
>
>New in V2
>=========
>* Add PcdSpeculationBarrierType to select between LFENCE, CPUID, and no
>  operation in the x86 implementation of the BaseLib function
>  SpeculationBarrier().
>* Set PcdSpeculationBarrierType to CPUID on Quark platforms.
>
>This series of patches resolves a few issues with building
>and booting Quark platforms.
>
>* Resolve name collision from API added to ResetSystemLib
>* Set SMRAM region to UC when SMRAM region is closed
>* Do no use LFENCE if CPU does not support SSE2
>* Avoid MSR_IA32_APIC_BASE if there is only one CPU
>
>Cc: Kelly Steele <kelly.steele@intel.com>
>Cc: Liming Gao <liming.gao@intel.com>
>Cc: Eric Dong <eric.dong@intel.com>
>Cc: Ray Ni <ray.ni@intel.com>
>Cc: Laszlo Ersek <lersek@redhat.com>
>Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
>
>Michael D Kinney (8):
>  MdePkg: Add PcdSpeculationBarrierType
>  MdePkg/BaseLib: Use PcdSpeculationBarrierType
>  QuarkPlatformPkg: Set PcdSpeculationBarrierType to CPUID
>  UefiCpuPkg/MpInitLibUp: Add uniprocessor MpInitLib
>  UefiCPuPkg/CpuMpPei: Add missing CpuLib class
>  QuarkPlatformPkg: Use uniprocessor MpInitLibUp
>  QuarkSocPkg/SmmAccessDxe: Set region to UC on SMRAM close
>  QuarkPlatformPkg/PlatformInit: Resolve ResetSystemLib name collision
>
> MdePkg/Library/BaseLib/BaseLib.inf            |   1 +
> .../Library/BaseLib/X86SpeculationBarrier.c   |   8 +-
> MdePkg/MdePkg.dec                             |   9 +
> MdePkg/MdePkg.uni                             |   8 +
> .../Pei/PlatformInit/MemoryCallback.c         |   6 +-
> .../Pei/PlatformInit/PlatformEarlyInit.h      |   4 +-
> QuarkPlatformPkg/Quark.dsc                    |  10 +-
> QuarkPlatformPkg/QuarkMin.dsc                 |   8 +-
> .../Smm/Dxe/SmmAccessDxe/SmmAccess.inf        |   3 +-
> .../Smm/Dxe/SmmAccessDxe/SmmAccessDriver.c    |  18 +-
> .../Smm/Dxe/SmmAccessDxe/SmmAccessDriver.h    |   3 +-
> UefiCpuPkg/CpuMpPei/CpuMpPei.inf              |   3 +-
> UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.c  | 407
>++++++++++++++++++
> .../Library/MpInitLibUp/MpInitLibUp.inf       |  37 ++
> .../Library/MpInitLibUp/MpInitLibUp.uni       |  14 +
> UefiCpuPkg/UefiCpuPkg.dsc                     |   3 +-
> 16 files changed, 525 insertions(+), 17 deletions(-)
> create mode 100644 UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.c
> create mode 100644 UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf
> create mode 100644 UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.uni
>
>--
>2.21.0.windows.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [Patch V3 0/8] Resolve Quark build and boot issues
  2019-04-30 19:31 [Patch V3 0/8] Resolve Quark build and boot issues Michael D Kinney
                   ` (8 preceding siblings ...)
  2019-05-05  5:23 ` [Patch V3 0/8] Resolve Quark build and boot issues Liming Gao
@ 2019-05-08 14:49 ` Steele, Kelly
  9 siblings, 0 replies; 16+ messages in thread
From: Steele, Kelly @ 2019-05-08 14:49 UTC (permalink / raw)
  To: Kinney, Michael D, devel@edk2.groups.io
  Cc: Gao, Liming, Dong, Eric, Ni, Ray, Laszlo Ersek



Reviewed-by: Kelly Steele <kelly.steele@intel.com>



> -----Original Message-----
> From: Kinney, Michael D
> Sent: April 30, 2019 12:31
> To: devel@edk2.groups.io
> Cc: Steele, Kelly <kelly.steele@intel.com>; Gao, Liming
> <liming.gao@intel.com>; Dong, Eric <eric.dong@intel.com>; Ni, Ray
> <ray.ni@intel.com>; Laszlo Ersek <lersek@redhat.com>
> Subject: [Patch V3 0/8] Resolve Quark build and boot issues
> 
> New in V3
> =========
> * Remove change to MpInitLib to avoid use of MSR_IA32_APIC_BASE.  That
> change
>   was not safe because an AP could call the PCD Protocol/PPI.
> * Add new MpInitLibUp for uni-processor platforms.
> * Update Quark DSC files to use MpInitLibUp for uni-processor platforms.
> * Add missing CpuLub library class to the CpuMpPei INF file
> 
> New in V2
> =========
> * Add PcdSpeculationBarrierType to select between LFENCE, CPUID, and no
>   operation in the x86 implementation of the BaseLib function
>   SpeculationBarrier().
> * Set PcdSpeculationBarrierType to CPUID on Quark platforms.
> 
> This series of patches resolves a few issues with building
> and booting Quark platforms.
> 
> * Resolve name collision from API added to ResetSystemLib
> * Set SMRAM region to UC when SMRAM region is closed
> * Do no use LFENCE if CPU does not support SSE2
> * Avoid MSR_IA32_APIC_BASE if there is only one CPU
> 
> Cc: Kelly Steele <kelly.steele@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
> 
> Michael D Kinney (8):
>   MdePkg: Add PcdSpeculationBarrierType
>   MdePkg/BaseLib: Use PcdSpeculationBarrierType
>   QuarkPlatformPkg: Set PcdSpeculationBarrierType to CPUID
>   UefiCpuPkg/MpInitLibUp: Add uniprocessor MpInitLib
>   UefiCPuPkg/CpuMpPei: Add missing CpuLib class
>   QuarkPlatformPkg: Use uniprocessor MpInitLibUp
>   QuarkSocPkg/SmmAccessDxe: Set region to UC on SMRAM close
>   QuarkPlatformPkg/PlatformInit: Resolve ResetSystemLib name collision
> 
>  MdePkg/Library/BaseLib/BaseLib.inf            |   1 +
>  .../Library/BaseLib/X86SpeculationBarrier.c   |   8 +-
>  MdePkg/MdePkg.dec                             |   9 +
>  MdePkg/MdePkg.uni                             |   8 +
>  .../Pei/PlatformInit/MemoryCallback.c         |   6 +-
>  .../Pei/PlatformInit/PlatformEarlyInit.h      |   4 +-
>  QuarkPlatformPkg/Quark.dsc                    |  10 +-
>  QuarkPlatformPkg/QuarkMin.dsc                 |   8 +-
>  .../Smm/Dxe/SmmAccessDxe/SmmAccess.inf        |   3 +-
>  .../Smm/Dxe/SmmAccessDxe/SmmAccessDriver.c    |  18 +-
>  .../Smm/Dxe/SmmAccessDxe/SmmAccessDriver.h    |   3 +-
>  UefiCpuPkg/CpuMpPei/CpuMpPei.inf              |   3 +-
>  UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.c  | 407
> ++++++++++++++++++
>  .../Library/MpInitLibUp/MpInitLibUp.inf       |  37 ++
>  .../Library/MpInitLibUp/MpInitLibUp.uni       |  14 +
>  UefiCpuPkg/UefiCpuPkg.dsc                     |   3 +-
>  16 files changed, 525 insertions(+), 17 deletions(-)
>  create mode 100644 UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.c
>  create mode 100644 UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf
>  create mode 100644 UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.uni
> 
> --
> 2.21.0.windows.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2019-05-08 14:49 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-30 19:31 [Patch V3 0/8] Resolve Quark build and boot issues Michael D Kinney
2019-04-30 19:31 ` [Patch V3 1/8] MdePkg: Add PcdSpeculationBarrierType Michael D Kinney
2019-04-30 19:31 ` [Patch V3 2/8] MdePkg/BaseLib: Use PcdSpeculationBarrierType Michael D Kinney
2019-04-30 19:31 ` [Patch V3 3/8] QuarkPlatformPkg: Set PcdSpeculationBarrierType to CPUID Michael D Kinney
2019-04-30 21:25   ` [edk2-devel] " Kubacki, Michael A
2019-04-30 19:31 ` [Patch V3 4/8] UefiCpuPkg/MpInitLibUp: Add uniprocessor MpInitLib Michael D Kinney
2019-04-30 20:25   ` [edk2-devel] " Laszlo Ersek
2019-05-05  2:36   ` Ni, Ray
2019-04-30 19:31 ` [Patch V3 5/8] UefiCPuPkg/CpuMpPei: Add missing CpuLib class Michael D Kinney
2019-04-30 20:31   ` [edk2-devel] " Laszlo Ersek
2019-04-30 19:31 ` [Patch V3 6/8] QuarkPlatformPkg: Use uniprocessor MpInitLibUp Michael D Kinney
2019-04-30 21:31   ` [edk2-devel] " Kubacki, Michael A
2019-04-30 19:31 ` [Patch V3 7/8] QuarkSocPkg/SmmAccessDxe: Set region to UC on SMRAM close Michael D Kinney
2019-04-30 19:31 ` [Patch V3 8/8] QuarkPlatformPkg/PlatformInit: Resolve ResetSystemLib name collision Michael D Kinney
2019-05-05  5:23 ` [Patch V3 0/8] Resolve Quark build and boot issues Liming Gao
2019-05-08 14:49 ` Steele, Kelly

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox