[edk2-devel] [Patch 4/5] UefiCpuPkg/CpuMpPei: Produce EDKII_PEI_MP_SERVICES2_PPI.

Ni, Ray ray.ni at intel.com
Fri Jul 19 08:03:16 UTC 2019


If FailedCpuList isn't cared by the new PPI service, can we remove the FailedCpuList parameter from the MpInitLib library API?

> -----Original Message-----
> From: devel at edk2.groups.io <devel at edk2.groups.io> On Behalf Of Dong,
> Eric
> Sent: Friday, July 19, 2019 3:28 PM
> To: devel at edk2.groups.io
> Cc: Ni, Ray <ray.ni at intel.com>; Laszlo Ersek <lersek at redhat.com>; Kumar,
> Chandana C <chandana.c.kumar at intel.com>; Zeng, Star
> <star.zeng at intel.com>
> Subject: [edk2-devel] [Patch 4/5] UefiCpuPkg/CpuMpPei: Produce
> EDKII_PEI_MP_SERVICES2_PPI.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1973
> 
> Produce new EDKII_PEI_MP_SERVICES2_PPI service.
> 
> It includes all APIs existed in EFI_PEI_MP_SERVICES_PPI and add new API
> EDKII_PEI_MP_SERVICES_STARTUP_ALL_CPUS.
> 
> Cc: Ray Ni <ray.ni at intel.com>
> Cc: Laszlo Ersek <lersek at redhat.com>
> Cc: Chandana Kumar <chandana.c.kumar at intel.com>
> Cc: Star Zeng <star.zeng at intel.com>
> Signed-off-by: Eric Dong <eric.dong at intel.com>
> ---
>  UefiCpuPkg/CpuMpPei/CpuMpPei.c   | 73
> +++++++++++++++++++++++++++++---
>  UefiCpuPkg/CpuMpPei/CpuMpPei.h   | 35 ++++++++++++++-
>  UefiCpuPkg/CpuMpPei/CpuMpPei.inf |  1 +
>  3 files changed, 102 insertions(+), 7 deletions(-)
> 
> diff --git a/UefiCpuPkg/CpuMpPei/CpuMpPei.c
> b/UefiCpuPkg/CpuMpPei/CpuMpPei.c index 926541c937..5ed2297770 100644
> --- a/UefiCpuPkg/CpuMpPei/CpuMpPei.c
> +++ b/UefiCpuPkg/CpuMpPei/CpuMpPei.c
> @@ -1,7 +1,7 @@
>  /** @file
>    CPU PEI Module installs CPU Multiple 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
> 
>  **/
> @@ -21,10 +21,31 @@ EFI_PEI_MP_SERVICES_PPI                mMpServicesPpi =
> {
>    PeiWhoAmI,
>  };
> 
> -EFI_PEI_PPI_DESCRIPTOR           mPeiCpuMpPpiDesc = {
> -  (EFI_PEI_PPI_DESCRIPTOR_PPI |
> EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
> -  &gEfiPeiMpServicesPpiGuid,
> -  &mMpServicesPpi
> +//
> +// CPU MP2 PPI to be installed
> +//
> +EDKII_PEI_MP_SERVICES2_PPI            mMpServices2Ppi = {
> +  PeiGetNumberOfProcessors,
> +  PeiGetProcessorInfo,
> +  PeiStartupAllAPs,
> +  PeiStartupThisAP,
> +  PeiSwitchBSP,
> +  PeiEnableDisableAP,
> +  PeiWhoAmI,
> +  PeiStartupAllCPUs
> +};
> +
> +EFI_PEI_PPI_DESCRIPTOR           mPeiCpuMpPpiList[] = {
> +  {
> +    EFI_PEI_PPI_DESCRIPTOR_PPI,
> +    &gEdkiiPeiMpServices2PpiGuid,
> +    &mMpServices2Ppi
> +  },
> +  {
> +    (EFI_PEI_PPI_DESCRIPTOR_PPI |
> EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
> +    &gEfiPeiMpServicesPpiGuid,
> +    &mMpServicesPpi
> +  }
>  };
> 
>  /**
> @@ -402,6 +423,46 @@ PeiWhoAmI (
>    return MpInitLibWhoAmI (ProcessorNumber);  }
> 
> +/**
> +  This service executes a caller provided function on all enabled CPUs.
> +CPUs can
> +  run either simultaneously or one at a time in sequence. This service
> +may only
> +  be called from the BSP.
> +
> +  @param[in] This                 A pointer to the EDKII_PEI_MP_SERVICES2_PPI
> instance.
> +  @param[in] Procedure            A pointer to the function to be run on
> enabled APs of
> +                                  the system.
> +  @param[in] TimeoutInMicroSeconds
> +                                  Indicates the time limit in microseconds for APs to
> +                                  return from Procedure, for blocking mode only. Zero
> +                                  means infinity.  If the timeout expires in blocking
> +                                  mode, BSP returns EFI_TIMEOUT.
> +  @param[in] ProcedureArgument    The parameter passed into Procedure
> for all CPUs.
> +
> +  @retval EFI_SUCCESS             In blocking mode, all APs have finished before
> the
> +                                  timeout expired.
> +  @retval EFI_DEVICE_ERROR        Caller processor is AP.
> +  @retval EFI_NOT_READY           Any enabled APs are busy.
> +  @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
> +PeiStartupAllCPUs (
> +  IN  EDKII_PEI_MP_SERVICES2_PPI   *This,
> +  IN  EFI_AP_PROCEDURE             Procedure,
> +  IN  UINTN                        TimeoutInMicroSeconds,
> +  IN  VOID                         *ProcedureArgument      OPTIONAL
> +  )
> +{
> +  return MpInitLibStartupAllCPUs (
> +           Procedure,
> +           TimeoutInMicroSeconds,
> +           ProcedureArgument,
> +           NULL
> +           );
> +}
> +
>  /**
>    Get GDT register value.
> 
> @@ -667,7 +728,7 @@ InitializeCpuMpWorker (
>    //
>    // Install CPU MP PPI
>    //
> -  Status = PeiServicesInstallPpi(&mPeiCpuMpPpiDesc);
> +  Status = PeiServicesInstallPpi(mPeiCpuMpPpiList);
>    ASSERT_EFI_ERROR (Status);
> 
>    return Status;
> diff --git a/UefiCpuPkg/CpuMpPei/CpuMpPei.h
> b/UefiCpuPkg/CpuMpPei/CpuMpPei.h index a5d8a755b2..b385c5088b
> 100644
> --- a/UefiCpuPkg/CpuMpPei/CpuMpPei.h
> +++ b/UefiCpuPkg/CpuMpPei/CpuMpPei.h
> @@ -1,7 +1,7 @@
>  /** @file
>    Definitions to install Multiple 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
> 
>  **/
> @@ -15,6 +15,7 @@
>  #include <Ppi/SecPlatformInformation.h>  #include
> <Ppi/SecPlatformInformation2.h>  #include <Ppi/EndOfPeiPhase.h>
> +#include <Ppi/EdkiiMpServices2.h>
> 
>  #include <Library/BaseLib.h>
>  #include <Library/DebugLib.h>
> @@ -431,6 +432,38 @@ MemoryDiscoveredPpiNotifyCallback (
>    IN VOID                       *Ppi
>    );
> 
> +/**
> +  This service executes a caller provided function on all enabled CPUs.
> +CPUs can
> +  run either simultaneously or one at a time in sequence. This service
> +may only
> +  be called from the BSP.
> +
> +  @param[in] This                 A pointer to the EDKII_PEI_MP_SERVICES2_PPI
> instance.
> +  @param[in] Procedure            A pointer to the function to be run on
> enabled APs of
> +                                  the system.
> +  @param[in] TimeoutInMicroSeconds
> +                                  Indicates the time limit in microseconds for APs to
> +                                  return from Procedure, for blocking mode only. Zero
> +                                  means infinity.  If the timeout expires in blocking
> +                                  mode, BSP returns EFI_TIMEOUT.
> +  @param[in] ProcedureArgument    The parameter passed into Procedure
> for all CPUs.
> +
> +  @retval EFI_SUCCESS             In blocking mode, all APs have finished before
> the
> +                                  timeout expired.
> +  @retval EFI_DEVICE_ERROR        Caller processor is AP.
> +  @retval EFI_NOT_READY           Any enabled APs are busy.
> +  @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
> +PeiStartupAllCPUs (
> +  IN  EDKII_PEI_MP_SERVICES2_PPI   *This,
> +  IN  EFI_AP_PROCEDURE             Procedure,
> +  IN  UINTN                        TimeoutInMicroSeconds,
> +  IN  VOID                         *ProcedureArgument      OPTIONAL
> +  );
> +
>  extern EFI_PEI_NOTIFY_DESCRIPTOR  mPostMemNotifyList[];
> 
>  #endif
> diff --git a/UefiCpuPkg/CpuMpPei/CpuMpPei.inf
> b/UefiCpuPkg/CpuMpPei/CpuMpPei.inf
> index 4fc4ea77ba..e42ba824e4 100644
> --- a/UefiCpuPkg/CpuMpPei/CpuMpPei.inf
> +++ b/UefiCpuPkg/CpuMpPei/CpuMpPei.inf
> @@ -54,6 +54,7 @@
>    gEfiSecPlatformInformation2PpiGuid
>    gEfiVectorHandoffInfoPpiGuid                  ## SOMETIMES_CONSUMES
>    gEfiPeiMemoryDiscoveredPpiGuid                ## CONSUMES
> +  gEdkiiPeiMpServices2PpiGuid                   ## PRODUCES
> 
>  [Pcd]
> 
> gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrM
> ask    ## CONSUMES
> --
> 2.21.0.windows.1
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#44026): https://edk2.groups.io/g/devel/message/44026
Mute This Topic: https://groups.io/mt/32524460/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list