From: Zhihao Li <zhihao...@intel.com> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3815
Last patch extends the SMM CPU Service protocol with new interface SmmWaitForAllProcessor(), which can be used by SMI handler to optionally wait for other APs to complete SMM rendezvous in relaxed AP mode. A new library SmmCpuRendezvousLib is provided to abstract the service into library API to simple SMI handler code. This patch modified VariableSmm driver in MdeModulePkg to let the SMI handler wait for all APs complete SMM rendezvous when policy is AP relaxed mode. Cc: Jian J Wang <jian.j.w...@intel.com> Cc: Liming Gao <gaolim...@byosoft.com.cn> Signed-off-by: Zhihao Li <zhihao...@intel.com> --- MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c | 8 ++++++++ MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf | 2 ++ 2 files changed, 10 insertions(+) diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c index 517cae7b00..1109f06833 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c @@ -28,6 +28,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include <Library/MmServicesTableLib.h> #include <Library/VariablePolicyLib.h> +#include <Library/SmmCpuRendezvousLib.h> #include <Guid/SmmVariableCommon.h> #include "Variable.h" @@ -656,6 +657,13 @@ SmmVariableHandler ( goto EXIT; } + if ((SmmVariableHeader->Attributes & EFI_VARIABLE_NON_VOLATILE) != 0) { + if (!SmmWaitForAllProcessor (TRUE)) { + DEBUG ((EFI_D_ERROR, "SetVariable: fail to wait for all AP check in SMM!\n")); + goto EXIT; + } + } + Status = VariableServiceSetVariable ( SmmVariableHeader->Name, &SmmVariableHeader->Guid, diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf index eaa97a01c6..206a5a7e2d 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf @@ -63,6 +63,7 @@ [Packages] MdePkg/MdePkg.dec MdeModulePkg/MdeModulePkg.dec + UefiCpuPkg/UefiCpuPkg.dec [LibraryClasses] UefiDriverEntryPoint @@ -82,6 +83,7 @@ UefiBootServicesTableLib VariablePolicyLib VariablePolicyHelperLib + SmmCpuRendezvousLib [Protocols] gEfiSmmFirmwareVolumeBlockProtocolGuid ## CONSUMES -- 2.26.2.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#86441): https://edk2.groups.io/g/devel/message/86441 Mute This Topic: https://groups.io/mt/88991120/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-