* [Patch 1/5] UefiCpuPkg/Include/MpInitLib.h: Add MpInitLibStartupAllCPUs API.
2019-07-19 7:28 [Patch 0/5] UefiCpuPkg: Enable Edkii Mp Services2 Ppi Dong, Eric
@ 2019-07-19 7:28 ` Dong, Eric
2019-07-19 7:52 ` [edk2-devel] " Ni, Ray
2019-07-19 7:28 ` [Patch 2/5] UefiCpuPkg/MpInitLib: " Dong, Eric
` (4 subsequent siblings)
5 siblings, 1 reply; 13+ messages in thread
From: Dong, Eric @ 2019-07-19 7:28 UTC (permalink / raw)
To: devel; +Cc: Ray Ni, Laszlo Ersek, Chandana Kumar, Star Zeng
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1973
Add new MpInitLibStartupAllCPUs API uses to start all processors
at the same time.
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Chandana Kumar <chandana.c.kumar@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Eric Dong <eric.dong@intel.com>
---
UefiCpuPkg/Include/Library/MpInitLib.h | 48 ++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/UefiCpuPkg/Include/Library/MpInitLib.h b/UefiCpuPkg/Include/Library/MpInitLib.h
index fa82529373..3f06dcf558 100644
--- a/UefiCpuPkg/Include/Library/MpInitLib.h
+++ b/UefiCpuPkg/Include/Library/MpInitLib.h
@@ -344,4 +344,52 @@ MpInitLibWhoAmI (
OUT UINTN *ProcessorNumber
);
+/**
+ This service executes a caller provided function on all enabled CPUs.
+
+ @param[in] Procedure A pointer to the function to be run on
+ enabled APs of the system. See type
+ EFI_AP_PROCEDURE.
+ @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.
+ @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 CPUs have finished before
+ the timeout expired.
+ @retval EFI_SUCCESS In non-blocking mode, function has been dispatched
+ to all enabled CPUs.
+ @retval EFI_DEVICE_ERROR Caller processor is AP.
+ @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
+MpInitLibStartupAllCPUs (
+ IN EFI_AP_PROCEDURE Procedure,
+ IN UINTN TimeoutInMicroseconds,
+ IN VOID *ProcedureArgument OPTIONAL,
+ OUT UINTN **FailedCpuList OPTIONAL
+ );
+
#endif
--
2.21.0.windows.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [edk2-devel] [Patch 1/5] UefiCpuPkg/Include/MpInitLib.h: Add MpInitLibStartupAllCPUs API.
2019-07-19 7:28 ` [Patch 1/5] UefiCpuPkg/Include/MpInitLib.h: Add MpInitLibStartupAllCPUs API Dong, Eric
@ 2019-07-19 7:52 ` Ni, Ray
0 siblings, 0 replies; 13+ messages in thread
From: Ni, Ray @ 2019-07-19 7:52 UTC (permalink / raw)
To: devel@edk2.groups.io, Dong, Eric
Cc: Laszlo Ersek, Kumar, Chandana C, Zeng, Star
My understanding to the difference (No WaitEvent, No SingleThread) between prototype of *StartupAllCPUs and *StartupAllAPs() is:
This library API supports the new PPI service *StartupAllCPUs() and isn't consumed by CpuMpDxe to produce similar *StartupAllCPUs() protocol service.
With the commit message updated to include the reason above, Reviewed-by: Ray Ni <ray.ni@intel.com>
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Dong,
> Eric
> Sent: Friday, July 19, 2019 3:28 PM
> To: devel@edk2.groups.io
> Cc: Ni, Ray <ray.ni@intel.com>; Laszlo Ersek <lersek@redhat.com>; Kumar,
> Chandana C <chandana.c.kumar@intel.com>; Zeng, Star
> <star.zeng@intel.com>
> Subject: [edk2-devel] [Patch 1/5] UefiCpuPkg/Include/MpInitLib.h: Add
> MpInitLibStartupAllCPUs API.
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1973
>
> Add new MpInitLibStartupAllCPUs API uses to start all processors at the same
> time.
>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Chandana Kumar <chandana.c.kumar@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Signed-off-by: Eric Dong <eric.dong@intel.com>
> ---
> UefiCpuPkg/Include/Library/MpInitLib.h | 48
> ++++++++++++++++++++++++++
> 1 file changed, 48 insertions(+)
>
> diff --git a/UefiCpuPkg/Include/Library/MpInitLib.h
> b/UefiCpuPkg/Include/Library/MpInitLib.h
> index fa82529373..3f06dcf558 100644
> --- a/UefiCpuPkg/Include/Library/MpInitLib.h
> +++ b/UefiCpuPkg/Include/Library/MpInitLib.h
> @@ -344,4 +344,52 @@ MpInitLibWhoAmI (
> OUT UINTN *ProcessorNumber
> );
>
> +/**
> + This service executes a caller provided function on all enabled CPUs.
> +
> + @param[in] Procedure A pointer to the function to be run on
> + enabled APs of the system. See type
> + EFI_AP_PROCEDURE.
> + @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.
> + @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 CPUs have finished
> before
> + the timeout expired.
> + @retval EFI_SUCCESS In non-blocking mode, function has been
> dispatched
> + to all enabled CPUs.
> + @retval EFI_DEVICE_ERROR Caller processor is AP.
> + @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
> +MpInitLibStartupAllCPUs (
> + IN EFI_AP_PROCEDURE Procedure,
> + IN UINTN TimeoutInMicroseconds,
> + IN VOID *ProcedureArgument OPTIONAL,
> + OUT UINTN **FailedCpuList OPTIONAL
> + );
> +
> #endif
> --
> 2.21.0.windows.1
>
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Patch 2/5] UefiCpuPkg/MpInitLib: Add MpInitLibStartupAllCPUs API.
2019-07-19 7:28 [Patch 0/5] UefiCpuPkg: Enable Edkii Mp Services2 Ppi Dong, Eric
2019-07-19 7:28 ` [Patch 1/5] UefiCpuPkg/Include/MpInitLib.h: Add MpInitLibStartupAllCPUs API Dong, Eric
@ 2019-07-19 7:28 ` Dong, Eric
2019-07-19 7:56 ` [edk2-devel] " Ni, Ray
2019-07-19 7:28 ` [Patch 3/5] UefiCpuPkg: Add new EDKII_PEI_MP_SERVICES2_PPI Dong, Eric
` (3 subsequent siblings)
5 siblings, 1 reply; 13+ messages in thread
From: Dong, Eric @ 2019-07-19 7:28 UTC (permalink / raw)
To: devel; +Cc: Ray Ni, Laszlo Ersek, Chandana Kumar, Star Zeng
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1973
Add new MpInitLibStartupAllCPUs API uses to start all processors
at the same time.
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Chandana Kumar <chandana.c.kumar@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Eric Dong <eric.dong@intel.com>
---
UefiCpuPkg/Library/MpInitLib/DxeMpLib.c | 1 +
UefiCpuPkg/Library/MpInitLib/MpLib.c | 74 ++++++++++++++++++++++++-
UefiCpuPkg/Library/MpInitLib/MpLib.h | 2 +
UefiCpuPkg/Library/MpInitLib/PeiMpLib.c | 1 +
4 files changed, 75 insertions(+), 3 deletions(-)
diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
index 6be1bae464..69c34afdf1 100644
--- a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
@@ -571,6 +571,7 @@ MpInitLibStartupAllAPs (
Status = StartupAllAPsWorker (
Procedure,
SingleThread,
+ FALSE,
WaitEvent,
TimeoutInMicroseconds,
ProcedureArgument,
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 6f51bc4ebf..791f5e85ab 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -2130,6 +2130,7 @@ MpInitLibGetNumberOfProcessors (
number. If FALSE, then all the enabled APs
execute the function specified by Procedure
simultaneously.
+ @param[in] IncludeBsp Whether let BSP also trig this task.
@param[in] WaitEvent The event created by the caller with CreateEvent()
service.
@param[in] TimeoutInMicroseconds Indicates the time limit in microseconds for
@@ -2154,6 +2155,7 @@ EFI_STATUS
StartupAllAPsWorker (
IN EFI_AP_PROCEDURE Procedure,
IN BOOLEAN SingleThread,
+ IN BOOLEAN IncludeBsp,
IN EFI_EVENT WaitEvent OPTIONAL,
IN UINTN TimeoutInMicroseconds,
IN VOID *ProcedureArgument OPTIONAL,
@@ -2175,7 +2177,7 @@ StartupAllAPsWorker (
*FailedCpuList = NULL;
}
- if (CpuMpData->CpuCount == 1) {
+ if (CpuMpData->CpuCount == 1 && !IncludeBsp) {
return EFI_NOT_STARTED;
}
@@ -2218,9 +2220,9 @@ StartupAllAPsWorker (
}
}
- if (!HasEnabledAp) {
+ if (!HasEnabledAp && !IncludeBsp) {
//
- // If no enabled AP exists, return EFI_NOT_STARTED.
+ // If no enabled AP exists and not include Bsp to do the procedure, return EFI_NOT_STARTED.
//
return EFI_NOT_STARTED;
}
@@ -2266,6 +2268,13 @@ StartupAllAPsWorker (
}
}
+ if (IncludeBsp) {
+ //
+ // Start BSP.
+ //
+ Procedure (ProcedureArgument);
+ }
+
Status = EFI_SUCCESS;
if (WaitEvent == NULL) {
do {
@@ -2411,3 +2420,62 @@ GetCpuMpDataFromGuidedHob (
return CpuMpData;
}
+/**
+ This service executes a caller provided function on all enabled CPUs.
+
+ @param[in] Procedure A pointer to the function to be run on
+ enabled APs of the system. See type
+ EFI_AP_PROCEDURE.
+ @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.
+ @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 CPUs have finished before
+ the timeout expired.
+ @retval EFI_SUCCESS In non-blocking mode, function has been dispatched
+ to all enabled CPUs.
+ @retval EFI_DEVICE_ERROR Caller processor is AP.
+ @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
+MpInitLibStartupAllCPUs (
+ IN EFI_AP_PROCEDURE Procedure,
+ IN UINTN TimeoutInMicroseconds,
+ IN VOID *ProcedureArgument OPTIONAL,
+ OUT UINTN **FailedCpuList OPTIONAL
+ )
+{
+ return StartupAllAPsWorker (
+ Procedure,
+ FALSE,
+ TRUE,
+ NULL,
+ TimeoutInMicroseconds,
+ ProcedureArgument,
+ FailedCpuList
+ );
+}
+
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h b/UefiCpuPkg/Library/MpInitLib/MpLib.h
index f89037c59e..fce7961a98 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.h
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h
@@ -405,6 +405,7 @@ InitMpGlobalData (
number. If FALSE, then all the enabled APs
execute the function specified by Procedure
simultaneously.
+ @param[in] IncludeBsp Whether let BSP also trig this task.
@param[in] WaitEvent The event created by the caller with CreateEvent()
service.
@param[in] TimeoutInMicroseconds Indicates the time limit in microseconds for
@@ -429,6 +430,7 @@ EFI_STATUS
StartupAllAPsWorker (
IN EFI_AP_PROCEDURE Procedure,
IN BOOLEAN SingleThread,
+ IN BOOLEAN IncludeBsp,
IN EFI_EVENT WaitEvent OPTIONAL,
IN UINTN TimeoutInMicroseconds,
IN VOID *ProcedureArgument OPTIONAL,
diff --git a/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c b/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c
index 35dff91fd2..a3e568b056 100644
--- a/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c
@@ -404,6 +404,7 @@ MpInitLibStartupAllAPs (
return StartupAllAPsWorker (
Procedure,
SingleThread,
+ FALSE,
NULL,
TimeoutInMicroseconds,
ProcedureArgument,
--
2.21.0.windows.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [edk2-devel] [Patch 2/5] UefiCpuPkg/MpInitLib: Add MpInitLibStartupAllCPUs API.
2019-07-19 7:28 ` [Patch 2/5] UefiCpuPkg/MpInitLib: " Dong, Eric
@ 2019-07-19 7:56 ` Ni, Ray
0 siblings, 0 replies; 13+ messages in thread
From: Ni, Ray @ 2019-07-19 7:56 UTC (permalink / raw)
To: devel@edk2.groups.io, Dong, Eric
Cc: Laszlo Ersek, Kumar, Chandana C, Zeng, Star
I feel having additional parameter "IncludeBsp" in StartupAllAps() is a bit confusing.
How abut let StartupAllAPs() call StartupAllCPUs()?
StartupAllCPUs() contains a parameter indicating whether BSP is excluded.
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Dong,
> Eric
> Sent: Friday, July 19, 2019 3:28 PM
> To: devel@edk2.groups.io
> Cc: Ni, Ray <ray.ni@intel.com>; Laszlo Ersek <lersek@redhat.com>; Kumar,
> Chandana C <chandana.c.kumar@intel.com>; Zeng, Star
> <star.zeng@intel.com>
> Subject: [edk2-devel] [Patch 2/5] UefiCpuPkg/MpInitLib: Add
> MpInitLibStartupAllCPUs API.
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1973
>
> Add new MpInitLibStartupAllCPUs API uses to start all processors at the same
> time.
>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Chandana Kumar <chandana.c.kumar@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Signed-off-by: Eric Dong <eric.dong@intel.com>
> ---
> UefiCpuPkg/Library/MpInitLib/DxeMpLib.c | 1 +
> UefiCpuPkg/Library/MpInitLib/MpLib.c | 74
> ++++++++++++++++++++++++-
> UefiCpuPkg/Library/MpInitLib/MpLib.h | 2 +
> UefiCpuPkg/Library/MpInitLib/PeiMpLib.c | 1 +
> 4 files changed, 75 insertions(+), 3 deletions(-)
>
> diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
> b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
> index 6be1bae464..69c34afdf1 100644
> --- a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
> +++ b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
> @@ -571,6 +571,7 @@ MpInitLibStartupAllAPs (
> Status = StartupAllAPsWorker (
> Procedure,
> SingleThread,
> + FALSE,
> WaitEvent,
> TimeoutInMicroseconds,
> ProcedureArgument,
> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> index 6f51bc4ebf..791f5e85ab 100644
> --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> @@ -2130,6 +2130,7 @@ MpInitLibGetNumberOfProcessors (
> number. If FALSE, then all the enabled APs
> execute the function specified by Procedure
> simultaneously.
> + @param[in] IncludeBsp Whether let BSP also trig this task.
> @param[in] WaitEvent The event created by the caller with
> CreateEvent()
> service.
> @param[in] TimeoutInMicroseconds Indicates the time limit in
> microseconds for
> @@ -2154,6 +2155,7 @@ EFI_STATUS
> StartupAllAPsWorker (
> IN EFI_AP_PROCEDURE Procedure,
> IN BOOLEAN SingleThread,
> + IN BOOLEAN IncludeBsp,
> IN EFI_EVENT WaitEvent OPTIONAL,
> IN UINTN TimeoutInMicroseconds,
> IN VOID *ProcedureArgument OPTIONAL,
> @@ -2175,7 +2177,7 @@ StartupAllAPsWorker (
> *FailedCpuList = NULL;
> }
>
> - if (CpuMpData->CpuCount == 1) {
> + if (CpuMpData->CpuCount == 1 && !IncludeBsp) {
> return EFI_NOT_STARTED;
> }
>
> @@ -2218,9 +2220,9 @@ StartupAllAPsWorker (
> }
> }
>
> - if (!HasEnabledAp) {
> + if (!HasEnabledAp && !IncludeBsp) {
> //
> - // If no enabled AP exists, return EFI_NOT_STARTED.
> + // If no enabled AP exists and not include Bsp to do the procedure, return
> EFI_NOT_STARTED.
> //
> return EFI_NOT_STARTED;
> }
> @@ -2266,6 +2268,13 @@ StartupAllAPsWorker (
> }
> }
>
> + if (IncludeBsp) {
> + //
> + // Start BSP.
> + //
> + Procedure (ProcedureArgument);
> + }
> +
> Status = EFI_SUCCESS;
> if (WaitEvent == NULL) {
> do {
> @@ -2411,3 +2420,62 @@ GetCpuMpDataFromGuidedHob (
> return CpuMpData;
> }
>
> +/**
> + This service executes a caller provided function on all enabled CPUs.
> +
> + @param[in] Procedure A pointer to the function to be run on
> + enabled APs of the system. See type
> + EFI_AP_PROCEDURE.
> + @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.
> + @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 CPUs have finished
> before
> + the timeout expired.
> + @retval EFI_SUCCESS In non-blocking mode, function has been
> dispatched
> + to all enabled CPUs.
> + @retval EFI_DEVICE_ERROR Caller processor is AP.
> + @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
> +MpInitLibStartupAllCPUs (
> + IN EFI_AP_PROCEDURE Procedure,
> + IN UINTN TimeoutInMicroseconds,
> + IN VOID *ProcedureArgument OPTIONAL,
> + OUT UINTN **FailedCpuList OPTIONAL
> + )
> +{
> + return StartupAllAPsWorker (
> + Procedure,
> + FALSE,
> + TRUE,
> + NULL,
> + TimeoutInMicroseconds,
> + ProcedureArgument,
> + FailedCpuList
> + );
> +}
> +
> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h
> b/UefiCpuPkg/Library/MpInitLib/MpLib.h
> index f89037c59e..fce7961a98 100644
> --- a/UefiCpuPkg/Library/MpInitLib/MpLib.h
> +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h
> @@ -405,6 +405,7 @@ InitMpGlobalData (
> number. If FALSE, then all the enabled APs
> execute the function specified by Procedure
> simultaneously.
> + @param[in] IncludeBsp Whether let BSP also trig this task.
> @param[in] WaitEvent The event created by the caller with
> CreateEvent()
> service.
> @param[in] TimeoutInMicroseconds Indicates the time limit in
> microseconds for
> @@ -429,6 +430,7 @@ EFI_STATUS
> StartupAllAPsWorker (
> IN EFI_AP_PROCEDURE Procedure,
> IN BOOLEAN SingleThread,
> + IN BOOLEAN IncludeBsp,
> IN EFI_EVENT WaitEvent OPTIONAL,
> IN UINTN TimeoutInMicroseconds,
> IN VOID *ProcedureArgument OPTIONAL,
> diff --git a/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c
> b/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c
> index 35dff91fd2..a3e568b056 100644
> --- a/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c
> +++ b/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c
> @@ -404,6 +404,7 @@ MpInitLibStartupAllAPs (
> return StartupAllAPsWorker (
> Procedure,
> SingleThread,
> + FALSE,
> NULL,
> TimeoutInMicroseconds,
> ProcedureArgument,
> --
> 2.21.0.windows.1
>
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Patch 3/5] UefiCpuPkg: Add new EDKII_PEI_MP_SERVICES2_PPI
2019-07-19 7:28 [Patch 0/5] UefiCpuPkg: Enable Edkii Mp Services2 Ppi Dong, Eric
2019-07-19 7:28 ` [Patch 1/5] UefiCpuPkg/Include/MpInitLib.h: Add MpInitLibStartupAllCPUs API Dong, Eric
2019-07-19 7:28 ` [Patch 2/5] UefiCpuPkg/MpInitLib: " Dong, Eric
@ 2019-07-19 7:28 ` Dong, Eric
2019-07-19 7:57 ` [edk2-devel] " Ni, Ray
2019-07-19 7:28 ` [Patch 4/5] UefiCpuPkg/CpuMpPei: Produce EDKII_PEI_MP_SERVICES2_PPI Dong, Eric
` (2 subsequent siblings)
5 siblings, 1 reply; 13+ messages in thread
From: Dong, Eric @ 2019-07-19 7:28 UTC (permalink / raw)
To: devel; +Cc: Ray Ni, Laszlo Ersek, Chandana Kumar, Star Zeng
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1973
Add definition for new EDKII_PEI_MP_SERVICES2_PPI.
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@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Chandana Kumar <chandana.c.kumar@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Eric Dong <eric.dong@intel.com>
---
UefiCpuPkg/Include/Ppi/EdkiiMpServices2.h | 72 +++++++++++++++++++++++
UefiCpuPkg/UefiCpuPkg.dec | 3 +
2 files changed, 75 insertions(+)
create mode 100644 UefiCpuPkg/Include/Ppi/EdkiiMpServices2.h
diff --git a/UefiCpuPkg/Include/Ppi/EdkiiMpServices2.h b/UefiCpuPkg/Include/Ppi/EdkiiMpServices2.h
new file mode 100644
index 0000000000..c6b9712cc0
--- /dev/null
+++ b/UefiCpuPkg/Include/Ppi/EdkiiMpServices2.h
@@ -0,0 +1,72 @@
+/** @file
+ This file declares edkii Multi-processor service PPI.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __EDKII_PEI_MP_SERVICES2_PPI_H__
+#define __EDKII_PEI_MP_SERVICES2_PPI_H__
+
+#include <Ppi/MpServices.h>
+
+#define EDKII_PEI_MP_SERVICES2_PPI_GUID \
+ { \
+ 0x5cb9cb3d, 0x31a4, 0x480c, { 0x94, 0x98, 0x29, 0xd2, 0x69, 0xba, 0xcf, 0xba} \
+ }
+
+typedef struct _EDKII_PEI_MP_SERVICES2_PPI EDKII_PEI_MP_SERVICES2_PPI;
+
+typedef EFI_PEI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS EDKII_PEI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS;
+typedef EFI_PEI_MP_SERVICES_GET_PROCESSOR_INFO EDKII_PEI_MP_SERVICES_GET_PROCESSOR_INFO;
+typedef EFI_PEI_MP_SERVICES_STARTUP_ALL_APS EDKII_PEI_MP_SERVICES_STARTUP_ALL_APS;
+typedef EFI_PEI_MP_SERVICES_STARTUP_THIS_AP EDKII_PEI_MP_SERVICES_STARTUP_THIS_AP;
+typedef EFI_PEI_MP_SERVICES_SWITCH_BSP EDKII_PEI_MP_SERVICES_SWITCH_BSP;
+typedef EFI_PEI_MP_SERVICES_ENABLEDISABLEAP EDKII_PEI_MP_SERVICES_ENABLEDISABLEAP;
+typedef EFI_PEI_MP_SERVICES_WHOAMI EDKII_PEI_MP_SERVICES_WHOAMI;
+
+/**
+ Activate all of the application proessors.
+
+ @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.
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EDKII_PEI_MP_SERVICES_STARTUP_ALL_CPUS) (
+ IN EDKII_PEI_MP_SERVICES2_PPI *This,
+ IN EFI_AP_PROCEDURE Procedure,
+ IN UINTN TimeoutInMicroSeconds,
+ IN VOID *ProcedureArgument OPTIONAL
+ );
+
+struct _EDKII_PEI_MP_SERVICES2_PPI {
+ EDKII_PEI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS GetNumberOfProcessors;
+ EDKII_PEI_MP_SERVICES_GET_PROCESSOR_INFO GetProcessorInfo;
+ EDKII_PEI_MP_SERVICES_STARTUP_ALL_APS StartupAllAPs;
+ EDKII_PEI_MP_SERVICES_STARTUP_THIS_AP StartupThisAP;
+ EDKII_PEI_MP_SERVICES_SWITCH_BSP SwitchBSP;
+ EDKII_PEI_MP_SERVICES_ENABLEDISABLEAP EnableDisableAP;
+ EDKII_PEI_MP_SERVICES_WHOAMI WhoAmI;
+ EDKII_PEI_MP_SERVICES_STARTUP_ALL_CPUS StartupAllCPUs;
+};
+
+extern EFI_GUID gEdkiiPeiMpServices2PpiGuid;
+
+#endif
diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec
index 6ddf0cd224..5a555644b7 100644
--- a/UefiCpuPkg/UefiCpuPkg.dec
+++ b/UefiCpuPkg/UefiCpuPkg.dec
@@ -75,6 +75,9 @@
# 0x80000001 | Invalid value provided.
#
+[Ppis]
+ gEdkiiPeiMpServices2PpiGuid = { 0x5cb9cb3d, 0x31a4, 0x480c, { 0x94, 0x98, 0x29, 0xd2, 0x69, 0xba, 0xcf, 0xba}}
+
[PcdsFeatureFlag]
## Indicates if SMM Profile will be enabled.
# If enabled, instruction executions in and data accesses to memory outside of SMRAM will be logged.
--
2.21.0.windows.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [edk2-devel] [Patch 3/5] UefiCpuPkg: Add new EDKII_PEI_MP_SERVICES2_PPI
2019-07-19 7:28 ` [Patch 3/5] UefiCpuPkg: Add new EDKII_PEI_MP_SERVICES2_PPI Dong, Eric
@ 2019-07-19 7:57 ` Ni, Ray
0 siblings, 0 replies; 13+ messages in thread
From: Ni, Ray @ 2019-07-19 7:57 UTC (permalink / raw)
To: devel@edk2.groups.io, Dong, Eric
Cc: Laszlo Ersek, Kumar, Chandana C, Zeng, Star
Reviewed-by: Ray Ni <ray.ni@intel.com>
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Dong,
> Eric
> Sent: Friday, July 19, 2019 3:28 PM
> To: devel@edk2.groups.io
> Cc: Ni, Ray <ray.ni@intel.com>; Laszlo Ersek <lersek@redhat.com>; Kumar,
> Chandana C <chandana.c.kumar@intel.com>; Zeng, Star
> <star.zeng@intel.com>
> Subject: [edk2-devel] [Patch 3/5] UefiCpuPkg: Add new
> EDKII_PEI_MP_SERVICES2_PPI
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1973
>
> Add definition for new EDKII_PEI_MP_SERVICES2_PPI.
>
> 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@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Chandana Kumar <chandana.c.kumar@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Signed-off-by: Eric Dong <eric.dong@intel.com>
> ---
> UefiCpuPkg/Include/Ppi/EdkiiMpServices2.h | 72
> +++++++++++++++++++++++
> UefiCpuPkg/UefiCpuPkg.dec | 3 +
> 2 files changed, 75 insertions(+)
> create mode 100644 UefiCpuPkg/Include/Ppi/EdkiiMpServices2.h
>
> diff --git a/UefiCpuPkg/Include/Ppi/EdkiiMpServices2.h
> b/UefiCpuPkg/Include/Ppi/EdkiiMpServices2.h
> new file mode 100644
> index 0000000000..c6b9712cc0
> --- /dev/null
> +++ b/UefiCpuPkg/Include/Ppi/EdkiiMpServices2.h
> @@ -0,0 +1,72 @@
> +/** @file
> + This file declares edkii Multi-processor service PPI.
> +
> + Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef __EDKII_PEI_MP_SERVICES2_PPI_H__
> +#define __EDKII_PEI_MP_SERVICES2_PPI_H__
> +
> +#include <Ppi/MpServices.h>
> +
> +#define EDKII_PEI_MP_SERVICES2_PPI_GUID \
> + { \
> + 0x5cb9cb3d, 0x31a4, 0x480c, { 0x94, 0x98, 0x29, 0xd2, 0x69, 0xba, 0xcf,
> 0xba} \
> + }
> +
> +typedef struct _EDKII_PEI_MP_SERVICES2_PPI
> EDKII_PEI_MP_SERVICES2_PPI;
> +
> +typedef EFI_PEI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS
> EDKII_PEI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS;
> +typedef EFI_PEI_MP_SERVICES_GET_PROCESSOR_INFO
> EDKII_PEI_MP_SERVICES_GET_PROCESSOR_INFO;
> +typedef EFI_PEI_MP_SERVICES_STARTUP_ALL_APS
> EDKII_PEI_MP_SERVICES_STARTUP_ALL_APS;
> +typedef EFI_PEI_MP_SERVICES_STARTUP_THIS_AP
> EDKII_PEI_MP_SERVICES_STARTUP_THIS_AP;
> +typedef EFI_PEI_MP_SERVICES_SWITCH_BSP
> EDKII_PEI_MP_SERVICES_SWITCH_BSP;
> +typedef EFI_PEI_MP_SERVICES_ENABLEDISABLEAP
> EDKII_PEI_MP_SERVICES_ENABLEDISABLEAP;
> +typedef EFI_PEI_MP_SERVICES_WHOAMI
> EDKII_PEI_MP_SERVICES_WHOAMI;
> +
> +/**
> + Activate all of the application proessors.
> +
> + @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.
> +**/
> +typedef
> +EFI_STATUS
> +(EFIAPI *EDKII_PEI_MP_SERVICES_STARTUP_ALL_CPUS) (
> + IN EDKII_PEI_MP_SERVICES2_PPI *This,
> + IN EFI_AP_PROCEDURE Procedure,
> + IN UINTN TimeoutInMicroSeconds,
> + IN VOID *ProcedureArgument OPTIONAL
> + );
> +
> +struct _EDKII_PEI_MP_SERVICES2_PPI {
> + EDKII_PEI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS
> GetNumberOfProcessors;
> + EDKII_PEI_MP_SERVICES_GET_PROCESSOR_INFO GetProcessorInfo;
> + EDKII_PEI_MP_SERVICES_STARTUP_ALL_APS StartupAllAPs;
> + EDKII_PEI_MP_SERVICES_STARTUP_THIS_AP StartupThisAP;
> + EDKII_PEI_MP_SERVICES_SWITCH_BSP SwitchBSP;
> + EDKII_PEI_MP_SERVICES_ENABLEDISABLEAP EnableDisableAP;
> + EDKII_PEI_MP_SERVICES_WHOAMI WhoAmI;
> + EDKII_PEI_MP_SERVICES_STARTUP_ALL_CPUS StartupAllCPUs;
> +};
> +
> +extern EFI_GUID gEdkiiPeiMpServices2PpiGuid;
> +
> +#endif
> diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec
> index 6ddf0cd224..5a555644b7 100644
> --- a/UefiCpuPkg/UefiCpuPkg.dec
> +++ b/UefiCpuPkg/UefiCpuPkg.dec
> @@ -75,6 +75,9 @@
> # 0x80000001 | Invalid value provided.
> #
>
> +[Ppis]
> + gEdkiiPeiMpServices2PpiGuid = { 0x5cb9cb3d, 0x31a4, 0x480c, { 0x94,
> 0x98, 0x29, 0xd2, 0x69, 0xba, 0xcf, 0xba}}
> +
> [PcdsFeatureFlag]
> ## Indicates if SMM Profile will be enabled.
> # If enabled, instruction executions in and data accesses to memory
> outside of SMRAM will be logged.
> --
> 2.21.0.windows.1
>
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Patch 4/5] UefiCpuPkg/CpuMpPei: Produce EDKII_PEI_MP_SERVICES2_PPI.
2019-07-19 7:28 [Patch 0/5] UefiCpuPkg: Enable Edkii Mp Services2 Ppi Dong, Eric
` (2 preceding siblings ...)
2019-07-19 7:28 ` [Patch 3/5] UefiCpuPkg: Add new EDKII_PEI_MP_SERVICES2_PPI Dong, Eric
@ 2019-07-19 7:28 ` Dong, Eric
2019-07-19 8:03 ` [edk2-devel] " Ni, Ray
2019-07-19 7:28 ` [Patch 5/5] UefiCpuPkg/RegisterCpuFeaturesLib: Start all processors simultaneously Dong, Eric
2019-07-19 12:45 ` [Patch 0/5] UefiCpuPkg: Enable Edkii Mp Services2 Ppi Laszlo Ersek
5 siblings, 1 reply; 13+ messages in thread
From: Dong, Eric @ 2019-07-19 7:28 UTC (permalink / raw)
To: devel; +Cc: Ray Ni, Laszlo Ersek, Chandana Kumar, Star Zeng
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@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Chandana Kumar <chandana.c.kumar@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Eric Dong <eric.dong@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.PcdPteMemoryEncryptionAddressOrMask ## CONSUMES
--
2.21.0.windows.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [edk2-devel] [Patch 4/5] UefiCpuPkg/CpuMpPei: Produce EDKII_PEI_MP_SERVICES2_PPI.
2019-07-19 7:28 ` [Patch 4/5] UefiCpuPkg/CpuMpPei: Produce EDKII_PEI_MP_SERVICES2_PPI Dong, Eric
@ 2019-07-19 8:03 ` Ni, Ray
2019-07-21 10:43 ` Dong, Eric
0 siblings, 1 reply; 13+ messages in thread
From: Ni, Ray @ 2019-07-19 8:03 UTC (permalink / raw)
To: devel@edk2.groups.io, Dong, Eric
Cc: Laszlo Ersek, Kumar, Chandana C, Zeng, Star
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@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Dong,
> Eric
> Sent: Friday, July 19, 2019 3:28 PM
> To: devel@edk2.groups.io
> Cc: Ni, Ray <ray.ni@intel.com>; Laszlo Ersek <lersek@redhat.com>; Kumar,
> Chandana C <chandana.c.kumar@intel.com>; Zeng, Star
> <star.zeng@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@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Chandana Kumar <chandana.c.kumar@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Signed-off-by: Eric Dong <eric.dong@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
>
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [edk2-devel] [Patch 4/5] UefiCpuPkg/CpuMpPei: Produce EDKII_PEI_MP_SERVICES2_PPI.
2019-07-19 8:03 ` [edk2-devel] " Ni, Ray
@ 2019-07-21 10:43 ` Dong, Eric
0 siblings, 0 replies; 13+ messages in thread
From: Dong, Eric @ 2019-07-21 10:43 UTC (permalink / raw)
To: Ni, Ray, devel@edk2.groups.io; +Cc: Laszlo Ersek, Kumar, Chandana C, Zeng, Star
Ray,
Agree, will remove this parameter in next version change.
Thanks,
Eric
> -----Original Message-----
> From: Ni, Ray
> Sent: Friday, July 19, 2019 4:03 PM
> To: devel@edk2.groups.io; Dong, Eric <eric.dong@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>; Kumar, Chandana C
> <chandana.c.kumar@intel.com>; Zeng, Star <star.zeng@intel.com>
> Subject: RE: [edk2-devel] [Patch 4/5] UefiCpuPkg/CpuMpPei: Produce
> EDKII_PEI_MP_SERVICES2_PPI.
>
> 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@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Dong,
> > Eric
> > Sent: Friday, July 19, 2019 3:28 PM
> > To: devel@edk2.groups.io
> > Cc: Ni, Ray <ray.ni@intel.com>; Laszlo Ersek <lersek@redhat.com>;
> > Kumar, Chandana C <chandana.c.kumar@intel.com>; Zeng, Star
> > <star.zeng@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@intel.com>
> > Cc: Laszlo Ersek <lersek@redhat.com>
> > Cc: Chandana Kumar <chandana.c.kumar@intel.com>
> > Cc: Star Zeng <star.zeng@intel.com>
> > Signed-off-by: Eric Dong <eric.dong@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
> >
> >
> >
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Patch 5/5] UefiCpuPkg/RegisterCpuFeaturesLib: Start all processors simultaneously.
2019-07-19 7:28 [Patch 0/5] UefiCpuPkg: Enable Edkii Mp Services2 Ppi Dong, Eric
` (3 preceding siblings ...)
2019-07-19 7:28 ` [Patch 4/5] UefiCpuPkg/CpuMpPei: Produce EDKII_PEI_MP_SERVICES2_PPI Dong, Eric
@ 2019-07-19 7:28 ` Dong, Eric
2019-07-19 8:06 ` [edk2-devel] " Ni, Ray
2019-07-19 12:45 ` [Patch 0/5] UefiCpuPkg: Enable Edkii Mp Services2 Ppi Laszlo Ersek
5 siblings, 1 reply; 13+ messages in thread
From: Dong, Eric @ 2019-07-19 7:28 UTC (permalink / raw)
To: devel; +Cc: Ray Ni, Laszlo Ersek, Chandana Kumar, Star Zeng
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1973
For semaphore type register, it required all processors to do the
task at the same time.
Current logic begins BSP's task after all APs have finished their tasks.
This will caused set semaphore task hang if semaphore has package
level type.
This patch use new EDKII_PEI_MP_SERVICES2_PPI to start all processors at
the same time to fix the potential hang issue.
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Chandana Kumar <chandana.c.kumar@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Eric Dong <eric.dong@intel.com>
---
.../PeiRegisterCpuFeaturesLib.c | 62 ++++++++++++++-----
.../PeiRegisterCpuFeaturesLib.inf | 1 +
2 files changed, 47 insertions(+), 16 deletions(-)
diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.c
index 8ad5a40e5a..9ed0fbf381 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.c
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.c
@@ -12,6 +12,8 @@
#include <Library/PeiServicesLib.h>
#include <Library/PeiServicesTablePointerLib.h>
#include <Ppi/MpServices.h>
+#include <Ppi/EdkiiMpServices2.h>
+
#include "RegisterCpuFeatures.h"
#define REGISTER_CPU_FEATURES_GUID \
@@ -180,6 +182,48 @@ StartupAPsWorker (
ASSERT_EFI_ERROR (Status);
}
+/**
+ Worker function to execute 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.
+ @param[in] MpEvent The Event used to sync the result.
+
+**/
+VOID
+StartupCPUsWorker (
+ IN EFI_AP_PROCEDURE Procedure
+ )
+{
+ EFI_STATUS Status;
+ EDKII_PEI_MP_SERVICES2_PPI *CpuMp2Ppi;
+ CPU_FEATURES_DATA *CpuFeaturesData;
+
+ CpuFeaturesData = GetCpuFeaturesData ();
+
+ //
+ // Get MP Services2 Ppi
+ //
+ Status = PeiServicesLocatePpi (
+ &gEdkiiPeiMpServices2PpiGuid,
+ 0,
+ NULL,
+ (VOID **)&CpuMp2Ppi
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Wakeup all APs for data collection.
+ //
+ Status = CpuMp2Ppi->StartupAllCPUs (
+ CpuMp2Ppi,
+ Procedure,
+ 0,
+ CpuFeaturesData
+ );
+ ASSERT_EFI_ERROR (Status);
+}
+
/**
Worker function to switch the requested AP to be the BSP from that point onward.
@@ -267,23 +311,9 @@ CpuFeaturesInitialize (
CpuFeaturesData->BspNumber = OldBspNumber;
//
- // Known limitation: In PEI phase, CpuFeatures driver not
- // support async mode execute tasks. So semaphore type
- // register can't been used for this instance, must use
- // DXE type instance.
- //
-
- if (CpuFeaturesData->NumberOfCpus > 1) {
- //
- // Wakeup all APs for programming.
- //
- StartupAPsWorker (SetProcessorRegister, NULL);
- }
-
- //
- // Programming BSP
+ // Start to program register for all CPUs.
//
- SetProcessorRegister (CpuFeaturesData);
+ StartupCPUsWorker (SetProcessorRegister);
//
// Switch to new BSP if required
diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.inf b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.inf
index 63091dfeb8..61f922bf63 100644
--- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.inf
+++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.inf
@@ -46,6 +46,7 @@
[Ppis]
gEfiPeiMpServicesPpiGuid ## CONSUMES
+ gEdkiiPeiMpServices2PpiGuid ## CONSUMES
[Pcd]
gUefiCpuPkgTokenSpaceGuid.PcdCpuS3DataAddress ## CONSUMES
--
2.21.0.windows.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [edk2-devel] [Patch 5/5] UefiCpuPkg/RegisterCpuFeaturesLib: Start all processors simultaneously.
2019-07-19 7:28 ` [Patch 5/5] UefiCpuPkg/RegisterCpuFeaturesLib: Start all processors simultaneously Dong, Eric
@ 2019-07-19 8:06 ` Ni, Ray
0 siblings, 0 replies; 13+ messages in thread
From: Ni, Ray @ 2019-07-19 8:06 UTC (permalink / raw)
To: devel@edk2.groups.io, Dong, Eric
Cc: Laszlo Ersek, Kumar, Chandana C, Zeng, Star
1. does this module still consume MpPpi? If no, please update the INF.
2. This reminds me that there is another lib instance MpInitLibUp, you need to update that as well.
For *StartupAllCPUs(), implementation in that Up instance can just call the procedure. This abstracts
the behavior so your C code change in this patch can work even MpInitLibUp links to CpuMpPei.
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Dong,
> Eric
> Sent: Friday, July 19, 2019 3:28 PM
> To: devel@edk2.groups.io
> Cc: Ni, Ray <ray.ni@intel.com>; Laszlo Ersek <lersek@redhat.com>; Kumar,
> Chandana C <chandana.c.kumar@intel.com>; Zeng, Star
> <star.zeng@intel.com>
> Subject: [edk2-devel] [Patch 5/5] UefiCpuPkg/RegisterCpuFeaturesLib: Start
> all processors simultaneously.
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1973
>
> For semaphore type register, it required all processors to do the task at the
> same time.
> Current logic begins BSP's task after all APs have finished their tasks.
> This will caused set semaphore task hang if semaphore has package level
> type.
> This patch use new EDKII_PEI_MP_SERVICES2_PPI to start all processors at
> the same time to fix the potential hang issue.
>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Chandana Kumar <chandana.c.kumar@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Signed-off-by: Eric Dong <eric.dong@intel.com>
> ---
> .../PeiRegisterCpuFeaturesLib.c | 62 ++++++++++++++-----
> .../PeiRegisterCpuFeaturesLib.inf | 1 +
> 2 files changed, 47 insertions(+), 16 deletions(-)
>
> diff --git
> a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.c
> b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.c
> index 8ad5a40e5a..9ed0fbf381 100644
> ---
> a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.c
> +++
> b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLi
> +++ b.c
> @@ -12,6 +12,8 @@
> #include <Library/PeiServicesLib.h>
> #include <Library/PeiServicesTablePointerLib.h>
> #include <Ppi/MpServices.h>
> +#include <Ppi/EdkiiMpServices2.h>
> +
> #include "RegisterCpuFeatures.h"
>
> #define REGISTER_CPU_FEATURES_GUID \
> @@ -180,6 +182,48 @@ StartupAPsWorker (
> ASSERT_EFI_ERROR (Status);
> }
>
> +/**
> + Worker function to execute 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.
> + @param[in] MpEvent The Event used to sync the result.
> +
> +**/
> +VOID
> +StartupCPUsWorker (
> + IN EFI_AP_PROCEDURE Procedure
> + )
> +{
> + EFI_STATUS Status;
> + EDKII_PEI_MP_SERVICES2_PPI *CpuMp2Ppi;
> + CPU_FEATURES_DATA *CpuFeaturesData;
> +
> + CpuFeaturesData = GetCpuFeaturesData ();
> +
> + //
> + // Get MP Services2 Ppi
> + //
> + Status = PeiServicesLocatePpi (
> + &gEdkiiPeiMpServices2PpiGuid,
> + 0,
> + NULL,
> + (VOID **)&CpuMp2Ppi
> + );
> + ASSERT_EFI_ERROR (Status);
> +
> + //
> + // Wakeup all APs for data collection.
> + //
> + Status = CpuMp2Ppi->StartupAllCPUs (
> + CpuMp2Ppi,
> + Procedure,
> + 0,
> + CpuFeaturesData
> + );
> + ASSERT_EFI_ERROR (Status);
> +}
> +
> /**
> Worker function to switch the requested AP to be the BSP from that point
> onward.
>
> @@ -267,23 +311,9 @@ CpuFeaturesInitialize (
> CpuFeaturesData->BspNumber = OldBspNumber;
>
> //
> - // Known limitation: In PEI phase, CpuFeatures driver not
> - // support async mode execute tasks. So semaphore type
> - // register can't been used for this instance, must use
> - // DXE type instance.
> - //
> -
> - if (CpuFeaturesData->NumberOfCpus > 1) {
> - //
> - // Wakeup all APs for programming.
> - //
> - StartupAPsWorker (SetProcessorRegister, NULL);
> - }
> -
> - //
> - // Programming BSP
> + // Start to program register for all CPUs.
> //
> - SetProcessorRegister (CpuFeaturesData);
> + StartupCPUsWorker (SetProcessorRegister);
>
> //
> // Switch to new BSP if required
> diff --git
> a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.in
> f
> b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.in
> f
> index 63091dfeb8..61f922bf63 100644
> ---
> a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.in
> f
> +++
> b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLi
> +++ b.inf
> @@ -46,6 +46,7 @@
>
> [Ppis]
> gEfiPeiMpServicesPpiGuid ## CONSUMES
> + gEdkiiPeiMpServices2PpiGuid ## CONSUMES
>
> [Pcd]
> gUefiCpuPkgTokenSpaceGuid.PcdCpuS3DataAddress ##
> CONSUMES
> --
> 2.21.0.windows.1
>
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Patch 0/5] UefiCpuPkg: Enable Edkii Mp Services2 Ppi.
2019-07-19 7:28 [Patch 0/5] UefiCpuPkg: Enable Edkii Mp Services2 Ppi Dong, Eric
` (4 preceding siblings ...)
2019-07-19 7:28 ` [Patch 5/5] UefiCpuPkg/RegisterCpuFeaturesLib: Start all processors simultaneously Dong, Eric
@ 2019-07-19 12:45 ` Laszlo Ersek
5 siblings, 0 replies; 13+ messages in thread
From: Laszlo Ersek @ 2019-07-19 12:45 UTC (permalink / raw)
To: Eric Dong, devel; +Cc: Ray Ni, Chandana Kumar, Star Zeng
On 07/19/19 09:28, Eric Dong wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1973
>
> CpuFeatures solution introduces a policy which write msr bases
> on scope info. With this policy enabled, for the msr which is
> package scope, CpuFeature PEIM driver boots hang.
> The reason for this failure is current CPU MP Ppi not supports
> start bsp and AP at the same time.
>
> This patch serial introduce new API named StartupAllCPUs. And
> it add new ppi namded Edkii Mp Services2 Ppi, include EFI MP
> Serivces PPI and this new API.
>
> With this new PPi, CPU features PEI solution can start all CPUs
> at the same time.
>
> Because this patch only add one new API, i did belew tests:
> 1. Test StartupAllCpus with timeout == 0 pass.
> 2. Test StartupAllCpus with timeout != 0 pass.
I'd like to regression test patches 1 through 4.
It seems like Ray requested code updates for patch #2 and #4. Thus I
prefer to regression test v2, with those requests addressed.
Thanks
Laszlo
^ permalink raw reply [flat|nested] 13+ messages in thread