[edk2-devel] [PATCH v1 2/2] MdeModulePkg: Modified VariableSmm driver to use new interface SmmWaitForAllProcessor().

Li, Zhihao zhihao.li at intel.com
Tue Feb 8 05:35:56 UTC 2022


From: Zhihao Li <zhihao.li at 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.wang at intel.com>
Cc: Liming Gao <gaoliming at byosoft.com.cn>

Signed-off-by: Zhihao Li <zhihao.li at 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/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