From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by mx.groups.io with SMTP id smtpd.web10.5383.1649725202863193897 for ; Mon, 11 Apr 2022 18:00:04 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: byosoft.com.cn, ip: 58.240.74.242, mailfrom: gaoliming@byosoft.com.cn) Received: from DESKTOPS6D0PVI ([101.224.116.119]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Tue, 12 Apr 2022 08:59:51 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-Originating-IP: 101.224.116.119 X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: , Cc: "'Jian J Wang'" , "'Siyuan Fu'" , "'Ni Ray'" , "'Michael D Kinney'" References: <20220411070631.1266-1-zhihao.li@intel.com> In-Reply-To: <20220411070631.1266-1-zhihao.li@intel.com> Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0gW1BBVENIIHYxIDEvMV0gTWRlTW9kdWxlUGtnOiBVc2UgU21tV2FpdEZvckFsbFByb2Nlc3NvcigpIGluIFZhcmlhYmxlU21tIGRyaXZlci4=?= Date: Tue, 12 Apr 2022 08:59:42 +0800 Message-ID: <011201d84e08$9e123d50$da36b7f0$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQFtCTG1UWK9uDQ6I7Bl2eh6XmYNfa3B/j3Q Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Zhihao: This patch breaks two things. One is to let MdeModulePkg depend on UefiCp= uPkg, another is to let VariableStandaloneMm depend on UefiCpuPkg SmmCpuRen= dezvousLib. Please provide your proposal to resolve these two dependency fi= rst.=20 Thanks Liming > -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > =E5=8F=91=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io = =E4=BB=A3=E8=A1=A8 Li, Zhihao > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2022=E5=B9=B44=E6=9C=8811=E6=97=A5 = 15:07 > =E6=94=B6=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io > =E6=8A=84=E9=80=81: Jian J Wang ; Liming Gao > ; Siyuan Fu ; Ni Ray > ; Michael D Kinney > =E4=B8=BB=E9=A2=98: [edk2-devel] [PATCH v1 1/1] MdeModulePkg: Use > SmmWaitForAllProcessor() in VariableSmm driver. >=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 > Cc: Jian J Wang > Cc: Liming Gao > Cc: Siyuan Fu > Cc: Ni Ray > Cc: Michael D Kinney >=20 > Signed-off-by: Zhihao Li > --- > MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c > | 10 +++++++- > MdeModulePkg/Include/Library/SmmCpuRendezvousLib.h > | 27 ++++++++++++++++++++ > MdeModulePkg/MdeModulePkg.dec > | 5 +++- > MdeModulePkg/MdeModulePkg.dsc > | 4 ++- > MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf > | 3 ++- > MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf > | 3 ++- > 6 files changed, 47 insertions(+), 5 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/Include/Library/SmmCpuRendezvousLib.h > b/MdeModulePkg/Include/Library/SmmCpuRendezvousLib.h > new file mode 100644 > index 000000000000..82e459e9106e > --- /dev/null > +++ b/MdeModulePkg/Include/Library/SmmCpuRendezvousLib.h > @@ -0,0 +1,27 @@ > +/** @file >=20 > + SMM CPU Rendezvous library header file. >=20 > + >=20 > + Copyright (c) 2022, Intel Corporation. All rights reserved.
>=20 > + SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > + >=20 > +**/ >=20 > + >=20 > +#ifndef SMM_CPU_RENDEZVOUS_H_ >=20 > +#define SMM_CPU_RENDEZVOUS_H_ >=20 > + >=20 > +/** >=20 > + This routine wait for all AP processors to arrive in SMM. >=20 > + >=20 > + @param[in] BlockingMode Blocking mode or non-blocking mode. >=20 > + >=20 > + @retval EFI_SUCCESS All processors checked in to SMM. >=20 > + @retval EFI_TIMEOUT Wait for all APs until timeout. >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +EFIAPI >=20 > +SmmWaitForAllProcessor ( >=20 > + IN BOOLEAN BlockingMode >=20 > + ); >=20 > + >=20 > +#endif >=20 > diff --git a/MdeModulePkg/MdeModulePkg.dec > b/MdeModulePkg/MdeModulePkg.dec > index 463e889e9a68..06ada41b7344 100644 > --- a/MdeModulePkg/MdeModulePkg.dec > +++ b/MdeModulePkg/MdeModulePkg.dec > @@ -4,7 +4,7 @@ > # and libraries instances, which are used for those modules. >=20 > # >=20 > # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. >=20 > -# Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.
>=20 > +# Copyright (c) 2007 - 2022, Intel Corporation. All rights reserved.
>=20 > # Copyright (c) 2016, Linaro Ltd. All rights reserved.
>=20 > # (C) Copyright 2016 - 2019 Hewlett Packard Enterprise Development > LP
>=20 > # Copyright (c) 2017, AMD Incorporated. All rights reserved.
>=20 > @@ -154,6 +154,9 @@ > # >=20 > VariablePolicyHelperLib|Include/Library/VariablePolicyHelperLib.h >=20 >=20 >=20 > + ## @libraryclass Provides function for SMM CPU Rendezvous Library. >=20 > + SmmCpuRendezvousLib|Include/Library/SmmCpuRendezvousLib.h >=20 > + >=20 > [Guids] >=20 > ## MdeModule package token space guid >=20 > # Include/Guid/MdeModulePkgTokenSpace.h >=20 > diff --git a/MdeModulePkg/MdeModulePkg.dsc > b/MdeModulePkg/MdeModulePkg.dsc > index b1d83461865e..a15dd5d7b23d 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 @@ >=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|UefiCpuPkg/Library/SmmCpuRendezvousLib/SmmCp > uRendezvousLib.inf >=20 >=20 >=20 > [LibraryClasses.common.UEFI_DRIVER] >=20 > HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf >=20 > @@ -172,6 +173,7 @@ >=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|UefiCpuPkg/Library/SmmCpuRendezvousLib/SmmCp > uRendezvousLib.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 prote= ct > these resources, >=20 > # the authentication service provided in this driver will be broken, an= d 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 @@ > 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 prote= ct > these resources, >=20 > # the authentication service provided in this driver will be broken, an= d 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 @@ > VarCheckLib >=20 > VariablePolicyLib >=20 > VariablePolicyHelperLib >=20 > + SmmCpuRendezvousLib >=20 >=20 >=20 > [Protocols] >=20 > gEfiSmmFirmwareVolumeBlockProtocolGuid ## CONSUMES >=20 > -- > 2.26.2.windows.1 >=20 >=20 >=20 >=20 >=20