* [PATCH v1 1/1] MdePkg: add SmmCpuRendezvousLib.h and SmmCpuRendezvousLibNull implement.
@ 2022-04-22 10:06 Li, Zhihao
2022-04-25 1:04 ` 回复: " gaoliming
0 siblings, 1 reply; 2+ messages in thread
From: Li, Zhihao @ 2022-04-22 10:06 UTC (permalink / raw)
To: devel
Cc: Michael D Kinney, Liming Gao, Eric Dong, Ray Ni, Michael Kubacki,
Siyuan Fu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3912
UefiCpuPkg define a new Protocol with the new services
SmmWaitForAllProcessor(), which can be used by SMI handler
to optionally wait for other APs to complete SMM rendezvous in
relaxed AP mode.
VariableSmm and VariableStandaloneMM driver in MdeModulePkg need
to use this services but MdeModulePkg can't depend on UefiCpuPkg.
Thus, the solution is moving SmmCpuRendezvouslib.h from UefiCpuPkg
to MdePkg and creating SmmCpuRendezvousLib NullLib version
implementation in MdePkg as dependency for the pkg that can't
depend on UefiCpuPkg.
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Michael Kubacki <mikuback@linux.microsoft.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Signed-off-by: Zhihao Li <zhihao.li@intel.com>
---
MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.c | 29 ++++++++++++++++++++
{UefiCpuPkg => MdePkg}/Include/Library/SmmCpuRendezvousLib.h | 0
MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.inf | 26 ++++++++++++++++++
MdePkg/MdePkg.dec | 3 ++
MdePkg/MdePkg.dsc | 1 +
UefiCpuPkg/UefiCpuPkg.dec | 3 --
6 files changed, 59 insertions(+), 3 deletions(-)
diff --git a/MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.c b/MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.c
new file mode 100644
index 000000000000..474195bbb374
--- /dev/null
+++ b/MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.c
@@ -0,0 +1,29 @@
+/** @file
+ SMM CPU Rendezvous sevice implement.
+
+ Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Library/DebugLib.h>
+#include <Library/SmmCpuRendezvousLib.h>
+
+/**
+ This routine wait for all AP processors to arrive in SMM.
+
+ @param[in] BlockingMode Blocking mode or non-blocking mode.
+
+ @retval EFI_SUCCESS All avaiable APs arrived.
+ @retval EFI_TIMEOUT Wait for all APs until timeout.
+ @retval OTHER Fail to register SMM CPU Rendezvous service Protocol.
+**/
+EFI_STATUS
+EFIAPI
+SmmWaitForAllProcessor (
+ IN BOOLEAN BlockingMode
+ )
+{
+ ASSERT (FALSE);
+ return EFI_SUCCESS;
+}
diff --git a/UefiCpuPkg/Include/Library/SmmCpuRendezvousLib.h b/MdePkg/Include/Library/SmmCpuRendezvousLib.h
similarity index 100%
rename from UefiCpuPkg/Include/Library/SmmCpuRendezvousLib.h
rename to MdePkg/Include/Library/SmmCpuRendezvousLib.h
diff --git a/MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.inf b/MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.inf
new file mode 100644
index 000000000000..7c9bac9af2ff
--- /dev/null
+++ b/MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.inf
@@ -0,0 +1,26 @@
+## @file
+# SMM CPU Rendezvous service lib.
+#
+# This is SMM CPU rendezvous service lib that wait for all
+# APs to enter SMM mode.
+#
+# Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = SmmCpuRendezvousLibNull
+ FILE_GUID = 1e5790ea-d013-4d7b-9047-b4342a762027
+ MODULE_TYPE = DXE_SMM_DRIVER
+ LIBRARY_CLASS = SmmCpuRendezvousLib|MM_STANDALONE DXE_SMM_DRIVER
+
+[Sources]
+ SmmCpuRendezvousLibNull.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+
+[LibraryClasses]
+ DebugLib
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index faeb28c80cbd..85a4398e8f65 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -272,6 +272,9 @@
#
CcProbeLib|Include/Library/CcProbeLib.h
+ ## @libraryclass Provides function for SMM CPU Rendezvous Library.
+ SmmCpuRendezvousLib|Include/Library/SmmCpuRendezvousLib.h
+
[LibraryClasses.IA32, LibraryClasses.X64, LibraryClasses.AARCH64]
## @libraryclass Provides services to generate random number.
#
diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc
index c8d282882ec1..5e2ea32088fa 100644
--- a/MdePkg/MdePkg.dsc
+++ b/MdePkg/MdePkg.dsc
@@ -131,6 +131,7 @@
MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf
MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf
+ MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.inf
[Components.IA32, Components.X64, Components.ARM, Components.AARCH64]
#
diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec
index 525cde463435..1951eb294c6c 100644
--- a/UefiCpuPkg/UefiCpuPkg.dec
+++ b/UefiCpuPkg/UefiCpuPkg.dec
@@ -62,9 +62,6 @@
## @libraryclass Provides function for loading microcode.
MicrocodeLib|Include/Library/MicrocodeLib.h
- ## @libraryclass Provides function for SMM CPU Rendezvous Library.
- SmmCpuRendezvousLib|Include/Library/SmmCpuRendezvousLib.h
-
[Guids]
gUefiCpuPkgTokenSpaceGuid = { 0xac05bf33, 0x995a, 0x4ed4, { 0xaa, 0xb8, 0xef, 0x7a, 0xe8, 0xf, 0x5c, 0xb0 }}
gMsegSmramGuid = { 0x5802bce4, 0xeeee, 0x4e33, { 0xa1, 0x30, 0xeb, 0xad, 0x27, 0xf0, 0xe4, 0x39 }}
--
2.26.2.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* 回复: [PATCH v1 1/1] MdePkg: add SmmCpuRendezvousLib.h and SmmCpuRendezvousLibNull implement.
2022-04-22 10:06 [PATCH v1 1/1] MdePkg: add SmmCpuRendezvousLib.h and SmmCpuRendezvousLibNull implement Li, Zhihao
@ 2022-04-25 1:04 ` gaoliming
0 siblings, 0 replies; 2+ messages in thread
From: gaoliming @ 2022-04-25 1:04 UTC (permalink / raw)
To: 'Zhihao Li', devel
Cc: 'Michael D Kinney', 'Eric Dong', 'Ray Ni',
'Michael Kubacki', 'Siyuan Fu'
Zhihao:
To be compatible, you can also add the default SmmCpuRendezvousLib library instance (SmmCpuRendezvousLibNull) into MdeLibs.dsc.inc. Then, this change is compatible.
Thanks
Liming
> -----邮件原件-----
> 发件人: Zhihao Li <zhihao.li@intel.com>
> 发送时间: 2022年4月22日 18:07
> 收件人: devel@edk2.groups.io
> 抄送: Michael D Kinney <michael.d.kinney@intel.com>; Liming Gao
> <gaoliming@byosoft.com.cn>; Eric Dong <eric.dong@intel.com>; Ray Ni
> <ray.ni@intel.com>; Michael Kubacki <mikuback@linux.microsoft.com>;
> Siyuan Fu <siyuan.fu@intel.com>
> 主题: [PATCH v1 1/1] MdePkg: add SmmCpuRendezvousLib.h and
> SmmCpuRendezvousLibNull implement.
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3912
>
> UefiCpuPkg define a new Protocol with the new services
> SmmWaitForAllProcessor(), which can be used by SMI handler
> to optionally wait for other APs to complete SMM rendezvous in
> relaxed AP mode.
>
> VariableSmm and VariableStandaloneMM driver in MdeModulePkg need
> to use this services but MdeModulePkg can't depend on UefiCpuPkg.
>
> Thus, the solution is moving SmmCpuRendezvouslib.h from UefiCpuPkg
> to MdePkg and creating SmmCpuRendezvousLib NullLib version
> implementation in MdePkg as dependency for the pkg that can't
> depend on UefiCpuPkg.
>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Michael Kubacki <mikuback@linux.microsoft.com>
> Cc: Siyuan Fu <siyuan.fu@intel.com>
>
> Signed-off-by: Zhihao Li <zhihao.li@intel.com>
> ---
> MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.c
> | 29 ++++++++++++++++++++
> {UefiCpuPkg => MdePkg}/Include/Library/SmmCpuRendezvousLib.h
> | 0
> MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.inf
> | 26 ++++++++++++++++++
> MdePkg/MdePkg.dec
> | 3 ++
> MdePkg/MdePkg.dsc
> | 1 +
> UefiCpuPkg/UefiCpuPkg.dec
> | 3 --
> 6 files changed, 59 insertions(+), 3 deletions(-)
>
> diff --git
> a/MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.c
> b/MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.c
> new file mode 100644
> index 000000000000..474195bbb374
> --- /dev/null
> +++
> b/MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.c
> @@ -0,0 +1,29 @@
> +/** @file
>
> + SMM CPU Rendezvous sevice implement.
>
> +
>
> + Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
>
> + SPDX-License-Identifier: BSD-2-Clause-Patent
>
> +
>
> +**/
>
> +
>
> +#include <Library/DebugLib.h>
>
> +#include <Library/SmmCpuRendezvousLib.h>
>
> +
>
> +/**
>
> + This routine wait for all AP processors to arrive in SMM.
>
> +
>
> + @param[in] BlockingMode Blocking mode or non-blocking mode.
>
> +
>
> + @retval EFI_SUCCESS All avaiable APs arrived.
>
> + @retval EFI_TIMEOUT Wait for all APs until timeout.
>
> + @retval OTHER Fail to register SMM CPU Rendezvous service
> Protocol.
>
> +**/
>
> +EFI_STATUS
>
> +EFIAPI
>
> +SmmWaitForAllProcessor (
>
> + IN BOOLEAN BlockingMode
>
> + )
>
> +{
>
> + ASSERT (FALSE);
>
> + return EFI_SUCCESS;
>
> +}
>
> diff --git a/UefiCpuPkg/Include/Library/SmmCpuRendezvousLib.h
> b/MdePkg/Include/Library/SmmCpuRendezvousLib.h
> similarity index 100%
> rename from UefiCpuPkg/Include/Library/SmmCpuRendezvousLib.h
> rename to MdePkg/Include/Library/SmmCpuRendezvousLib.h
> diff --git
> a/MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.i
> nf
> b/MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.i
> nf
> new file mode 100644
> index 000000000000..7c9bac9af2ff
> --- /dev/null
> +++
> b/MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.i
> nf
> @@ -0,0 +1,26 @@
> +## @file
>
> +# SMM CPU Rendezvous service lib.
>
> +#
>
> +# This is SMM CPU rendezvous service lib that wait for all
>
> +# APs to enter SMM mode.
>
> +#
>
> +# Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
>
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
>
> +#
>
> +##
>
> +
>
> +[Defines]
>
> + INF_VERSION = 0x00010005
>
> + BASE_NAME = SmmCpuRendezvousLibNull
>
> + FILE_GUID =
> 1e5790ea-d013-4d7b-9047-b4342a762027
>
> + MODULE_TYPE = DXE_SMM_DRIVER
>
> + LIBRARY_CLASS =
> SmmCpuRendezvousLib|MM_STANDALONE DXE_SMM_DRIVER
>
> +
>
> +[Sources]
>
> + SmmCpuRendezvousLibNull.c
>
> +
>
> +[Packages]
>
> + MdePkg/MdePkg.dec
>
> +
>
> +[LibraryClasses]
>
> + DebugLib
>
> diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
> index faeb28c80cbd..85a4398e8f65 100644
> --- a/MdePkg/MdePkg.dec
> +++ b/MdePkg/MdePkg.dec
> @@ -272,6 +272,9 @@
> #
>
> CcProbeLib|Include/Library/CcProbeLib.h
>
>
>
> + ## @libraryclass Provides function for SMM CPU Rendezvous Library.
>
> + SmmCpuRendezvousLib|Include/Library/SmmCpuRendezvousLib.h
>
> +
>
> [LibraryClasses.IA32, LibraryClasses.X64, LibraryClasses.AARCH64]
>
> ## @libraryclass Provides services to generate random number.
>
> #
>
> diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc
> index c8d282882ec1..5e2ea32088fa 100644
> --- a/MdePkg/MdePkg.dsc
> +++ b/MdePkg/MdePkg.dsc
> @@ -131,6 +131,7 @@
>
>
> MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf
>
> MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf
>
> +
> MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.inf
>
>
>
> [Components.IA32, Components.X64, Components.ARM,
> Components.AARCH64]
>
> #
>
> diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec
> index 525cde463435..1951eb294c6c 100644
> --- a/UefiCpuPkg/UefiCpuPkg.dec
> +++ b/UefiCpuPkg/UefiCpuPkg.dec
> @@ -62,9 +62,6 @@
> ## @libraryclass Provides function for loading microcode.
>
> MicrocodeLib|Include/Library/MicrocodeLib.h
>
>
>
> - ## @libraryclass Provides function for SMM CPU Rendezvous Library.
>
> - SmmCpuRendezvousLib|Include/Library/SmmCpuRendezvousLib.h
>
> -
>
> [Guids]
>
> gUefiCpuPkgTokenSpaceGuid = { 0xac05bf33, 0x995a, 0x4ed4,
> { 0xaa, 0xb8, 0xef, 0x7a, 0xe8, 0xf, 0x5c, 0xb0 }}
>
> gMsegSmramGuid = { 0x5802bce4, 0xeeee, 0x4e33,
> { 0xa1, 0x30, 0xeb, 0xad, 0x27, 0xf0, 0xe4, 0x39 }}
>
> --
> 2.26.2.windows.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-04-25 1:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-22 10:06 [PATCH v1 1/1] MdePkg: add SmmCpuRendezvousLib.h and SmmCpuRendezvousLibNull implement Li, Zhihao
2022-04-25 1:04 ` 回复: " gaoliming
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox