From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lucky1.263xmail.com (lucky1.263xmail.com [211.157.147.132]) by mx.groups.io with SMTP id smtpd.web09.2035.1654136221525359926 for ; Wed, 01 Jun 2022 19:17:03 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: byosoft.net, ip: 211.157.147.132, mailfrom: byomail@byosoft.net) Received: from localhost (unknown [192.168.167.16]) by lucky1.263xmail.com (Postfix) with ESMTP id C957F109DD9 for ; Thu, 2 Jun 2022 10:16:57 +0800 (CST) X-MAIL-GRAY: 1 X-MAIL-DELIVERY: 0 X-ADDR-CHECKED4: 1 X-SKE-CHECKED: 1 X-ABS-CHECKED: 1 X-ANTISPAM-LEVEL: 2 Received: from mail.byosoft.com.cn (unknown [58.240.74.242]) by smtp.263.net (postfix) whith ESMTP id P13320T140235340596992S1654136217793692_; Thu, 02 Jun 2022 10:16:58 +0800 (CST) X-IP-DOMAINF: 1 X-RL-SENDER: byomail@byosoft.net X-SENDER: byomail@byosoft.net X-LOGIN-NAME: byomail@byosoft.net X-FST-TO: devel@edk2.groups.io X-RCPT-COUNT: 1 X-LOCAL-RCPT-COUNT: 0 X-MUTI-DOMAIN-COUNT: 0 X-SENDER-IP: 58.240.74.242 X-ATTACHMENT-NUM: 0 X-UNIQUE-TAG: X-System-Flag: 0 Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Thu, 02 Jun 2022 10:15:59 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-Originating-IP: 58.246.60.130 X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: "'zhihaoli'" , Cc: "'Jian J Wang'" , "'Ni Ray'" References: <20220531162704.2202-1-zhihao.li@intel.com> In-Reply-To: <20220531162704.2202-1-zhihao.li@intel.com> Subject: =?UTF-8?B?5Zue5aSNOiBbUEFUQ0ggdjMgMS8xXSBNZGVNb2R1bGVQa2c6IFVzZSBTbW1XYWl0Rm9yQWxsUHJvY2Vzc29yKCkgaW4gVmFyaWFibGVTbW0gZHJpdmVyLg==?= Date: Thu, 2 Jun 2022 10:16:00 +0800 Message-ID: <00dc01d87626$b428b0b0$1c7a1210$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQJ53n2C8EN7i9ULaPD/h3su7aQu8qv4j6sg Sender: "gaoliming" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Reviewed-by: Liming Gao One minor comment: the change in MdeModulePkg is not required, because = this library instance has been specified in MdeLibs.dsc.inc Thanks Liming > -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > =E5=8F=91=E4=BB=B6=E4=BA=BA: zhihaoli > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: = 2022=E5=B9=B46=E6=9C=881=E6=97=A5 0:27 > =E6=94=B6=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io > =E6=8A=84=E9=80=81: Jian J Wang ; Liming Gao > ; Ni Ray > =E4=B8=BB=E9=A2=98: [PATCH v3 1/1] MdeModulePkg: Use = SmmWaitForAllProcessor() in > VariableSmm driver. >=20 > From: Zhihao Li >=20 > REF=EF=BC=9A https://bugzilla.tianocore.org/show_bug.cgi?id=3D3854 >=20 > In UefiCpuPkg, there are a new Protocol with the new service > SmmWaitForAllProcessor(), which can be used by SMI handler > to optionally wait for other APs to complete SMM rendezvous in > relaxed AP mode. >=20 > This patch use the new service to let VariableSmm driver work > normally in relaxed AP mode. >=20 > Due to MdeModulePkg can not depend on UefiCpuPkg, use null version > implementation in MdePkg. >=20 > Cc: Jian J Wang > Cc: Liming Gao > Cc: Ni Ray >=20 > Signed-off-by: Zhihao Li > --- > MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c > | 10 +++++++++- > MdeModulePkg/MdeModulePkg.dsc > | 4 +++- > MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf > | 3 ++- > MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf > | 3 ++- > 4 files changed, 16 insertions(+), 4 deletions(-) >=20 > diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c > b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c > index 517cae7b00f8..52a9b0e6b202 100644 > --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c > +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c > @@ -14,7 +14,7 @@ > VariableServiceSetVariable(), VariableServiceQueryVariableInfo(), > ReclaimForOS(), >=20 > SmmVariableGetStatistics() should also do validation based on its = own > knowledge. >=20 >=20 >=20 > -Copyright (c) 2010 - 2019, Intel Corporation. All rights = reserved.
>=20 > +Copyright (c) 2010 - 2022, Intel Corporation. All rights = reserved.
>=20 > Copyright (c) 2018, Linaro, Ltd. All rights reserved.
>=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 >=20 >=20 > @@ -28,6 +28,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent >=20 >=20 > #include >=20 > #include >=20 > +#include >=20 >=20 >=20 > #include >=20 > #include "Variable.h" >=20 > @@ -656,6 +657,13 @@ SmmVariableHandler ( > goto EXIT; >=20 > } >=20 >=20 >=20 > + if ((SmmVariableHeader->Attributes & > EFI_VARIABLE_NON_VOLATILE) !=3D 0) { >=20 > + if (EFI_ERROR (SmmWaitForAllProcessor (TRUE))) { >=20 > + DEBUG ((DEBUG_ERROR, "SetVariable: fail to wait for all AP > check in SMM!\n")); >=20 > + goto EXIT; >=20 > + } >=20 > + } >=20 > + >=20 > Status =3D VariableServiceSetVariable ( >=20 > SmmVariableHeader->Name, >=20 > &SmmVariableHeader->Guid, >=20 > diff --git a/MdeModulePkg/MdeModulePkg.dsc > b/MdeModulePkg/MdeModulePkg.dsc > index b1d83461865e..1a3cf191bb5c 100644 > --- a/MdeModulePkg/MdeModulePkg.dsc > +++ b/MdeModulePkg/MdeModulePkg.dsc > @@ -2,7 +2,7 @@ > # EFI/PI Reference Module Package for All Architectures >=20 > # >=20 > # (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
>=20 > -# Copyright (c) 2007 - 2021, Intel Corporation. All rights = reserved.
>=20 > +# Copyright (c) 2007 - 2022, Intel Corporation. All rights = reserved.
>=20 > # Copyright (c) Microsoft Corporation. >=20 > # >=20 > # SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > @@ -152,6 +152,7 @@ [LibraryClasses.common.DXE_SMM_DRIVER] >=20 > SmmServicesTableLib|MdePkg/Library/SmmServicesTableLib/SmmServicesTa > bleLib.inf >=20 >=20 > LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxSmmLib.i > nf >=20 > SmmMemLib|MdePkg/Library/SmmMemLib/SmmMemLib.inf >=20 > + > SmmCpuRendezvousLib|MdePkg/Library/SmmCpuRendezvousLibNull/SmmC > puRendezvousLibNull.inf >=20 >=20 >=20 > [LibraryClasses.common.UEFI_DRIVER] >=20 > HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf >=20 > @@ -172,6 +173,7 @@ [LibraryClasses.common.MM_STANDALONE] >=20 > MmServicesTableLib|MdePkg/Library/StandaloneMmServicesTableLib/Stand > aloneMmServicesTableLib.inf >=20 >=20 > LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxStandalon > eMmLib.inf >=20 >=20 > MemLib|StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMm > MemLib.inf >=20 > + > SmmCpuRendezvousLib|MdePkg/Library/SmmCpuRendezvousLibNull/SmmC > puRendezvousLibNull.inf >=20 >=20 >=20 > [LibraryClasses.ARM, LibraryClasses.AARCH64] >=20 > ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf >=20 > diff --git = a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf > b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf > index eaa97a01c6e5..0bebd92b1626 100644 > --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf > +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf > @@ -18,7 +18,7 @@ > # may not be modified without authorization. If platform fails to = protect > these resources, >=20 > # the authentication service provided in this driver will be broken, = and the > behavior is undefined. >=20 > # >=20 > -# Copyright (c) 2010 - 2019, Intel Corporation. All rights = reserved.
>=20 > +# Copyright (c) 2010 - 2022, Intel Corporation. All rights = reserved.
>=20 > # Copyright (c) Microsoft Corporation. >=20 > # SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > # >=20 > @@ -82,6 +82,7 @@ [LibraryClasses] > UefiBootServicesTableLib >=20 > VariablePolicyLib >=20 > VariablePolicyHelperLib >=20 > + SmmCpuRendezvousLib >=20 >=20 >=20 > [Protocols] >=20 > gEfiSmmFirmwareVolumeBlockProtocolGuid ## CONSUMES >=20 > diff --git > a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.in > f > b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.in > f > index d8c4f77e7f1f..595baaf70164 100644 > --- > a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.in > f > +++ > b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.in > f > @@ -18,7 +18,7 @@ > # may not be modified without authorization. If platform fails to = protect > these resources, >=20 > # the authentication service provided in this driver will be broken, = and the > behavior is undefined. >=20 > # >=20 > -# Copyright (c) 2010 - 2019, Intel Corporation. All rights = reserved.
>=20 > +# Copyright (c) 2010 - 2022, Intel Corporation. All rights = reserved.
>=20 > # Copyright (c) 2018, Linaro, Ltd. All rights reserved.
>=20 > # Copyright (c) Microsoft Corporation. >=20 > # SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > @@ -78,6 +78,7 @@ [LibraryClasses] > VarCheckLib >=20 > VariablePolicyLib >=20 > VariablePolicyHelperLib >=20 > + SmmCpuRendezvousLib >=20 >=20 >=20 > [Protocols] >=20 > gEfiSmmFirmwareVolumeBlockProtocolGuid ## CONSUMES >=20 > -- > 2.26.2.windows.1