From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from cxsh.intel-email.com (cxsh.intel-email.com [121.46.250.151]) by mx.groups.io with SMTP id smtpd.web11.12962.1684402655643372303 for ; Thu, 18 May 2023 02:37:36 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@byosoft.com.cn header.s=cloud-union header.b=KAYalrxQ; spf=pass (domain: byosoft.com.cn, ip: 121.46.250.151, mailfrom: gaoliming@byosoft.com.cn) Received: from cxsh.intel-email.com (localhost [127.0.0.1]) by cxsh.intel-email.com (Postfix) with ESMTP id 7AE31DDA814 for ; Thu, 18 May 2023 17:37:33 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=byosoft.com.cn; s=cloud-union; t=1684402653; bh=JkskvHG2YJwbV1gX3q27Jjb2RQ45Pbwc9EFd3oZhrQM=; h=From:To:Cc:References:In-Reply-To:Subject:Date; b=KAYalrxQo8Ybu1pGXsMGO5J0Ue/4gz0uUXpTcGEu80pSXPy2hky104Cl+n/qYhpzt KPBR5vZ+VK5uoItC9Mke2Fybeuft/DW4jtc2OBS5jkud0N7CoTVssDO9f7auoYVhXv dpOGf4io6eGt039ec19YWNBGtmSpSnMdHMyzoy3k= Received: from localhost (localhost [127.0.0.1]) by cxsh.intel-email.com (Postfix) with ESMTP id 6EBA2DDA813 for ; Thu, 18 May 2023 17:37:33 +0800 (CST) Received: from cxsh.intel-email.com (localhost [127.0.0.1]) by cxsh.intel-email.com (Postfix) with ESMTP id 33199DDA806 for ; Thu, 18 May 2023 17:37:33 +0800 (CST) Authentication-Results: cxsh.intel-email.com; none Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by cxsh.intel-email.com (Postfix) with SMTP id BEB20DDA814 for ; Thu, 18 May 2023 17:37:30 +0800 (CST) Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Thu, 18 May 2023 17:37:25 +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: "'Zhihao Li'" , , "'Ni, Ray'" , Cc: "'Jian J Wang'" References: <20230510105653.635-1-zhihao.li@intel.com> In-Reply-To: <20230510105653.635-1-zhihao.li@intel.com> Subject: =?UTF-8?B?5Zue5aSNOiBbUEFUQ0ggdjEgMS8xXSBNZGVNb2R1bGVQa2cvVmFyaWFibGVTbW0uYzogYWRkIEFwIHJlbmRlenZvdXMgY2hlY2sgYmVmb3JlIFNtbVNldFZhcmlhYmxlLg==?= Date: Thu, 18 May 2023 17:37:30 +0800 Message-ID: <05b701d9896c$5df57160$19e05420$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQKukQTCmi9SQ+IV648arAIwUCTP+K21tR7w Sender: "gaoliming" Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Zhihao: Have you root cause this issue that SmmVariableSetVariable may return EFI_ACCESS_DENIED? I am not sure whether this fix is proper. I also add UefiCpuPkg maintainers Ray and Gerd in the mail loop for this discussion.=20 Thanks Liming > -----=D3=CA=BC=FE=D4=AD=BC=FE----- > =B7=A2=BC=FE=C8=CB: Zhihao Li > =B7=A2=CB=CD=CA=B1=BC=E4: 2023=C4=EA5=D4=C210=C8=D5 18:57 > =CA=D5=BC=FE=C8=CB: devel@edk2.groups.io > =B3=AD=CB=CD: Jian J Wang ; Liming Gao > > =D6=F7=CC=E2: [PATCH v1 1/1] MdeModulePkg/VariableSmm.c: add Ap = rendezvous > check before SmmSetVariable. >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4429 >=20 > For Ap-Relaxed sync mode, SmmVariableSetVariable() need to let all Aps > arrive to smm before it set the variable. If not, it would return > EFI_ACCESS_DENIED. >=20 > Cc: Jian J Wang > Cc: Liming Gao >=20 > Signed-off-by: Zhihao Li > --- > MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c > | 10 +++++++++- > MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf > | 3 ++- > MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf > | 3 ++- > 3 files changed, 13 insertions(+), 3 deletions(-) >=20 > diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c > b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c > index 5253c328dcd9..4944903e64d4 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 - 2023, 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 > @@ -87,6 +88,13 @@ SmmVariableSetVariable ( > { >=20 > EFI_STATUS Status; >=20 >=20 >=20 > + // >=20 > + // Need to wait for all Aps to arrive in Relaxed-AP Sync Mode >=20 > + // >=20 > + if (EFI_ERROR (SmmWaitForAllProcessor (TRUE))) { >=20 > + DEBUG ((DEBUG_ERROR, "SetVariable: fail to wait for all AP check = in > SMM!\n")); >=20 > + } >=20 > + >=20 > // >=20 > // Disable write protection when the calling SetVariable() through > EFI_SMM_VARIABLE_PROTOCOL. >=20 > // >=20 > diff --git = a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf > b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf > index 8c552b87e080..1cf0d051e6c9 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 - 2023, Intel Corporation. All rights = reserved.
>=20 > # Copyright (c) Microsoft Corporation. >=20 > # SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > # >=20 > @@ -84,6 +84,7 @@ > VariablePolicyLib >=20 > VariablePolicyHelperLib >=20 > SafeIntLib >=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 f09bed40cf51..89187456ca25 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 - 2023, 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 > @@ -80,6 +80,7 @@ > VariableFlashInfoLib >=20 > VariablePolicyLib >=20 > VariablePolicyHelperLib >=20 > + SmmCpuRendezvousLib >=20 >=20 >=20 > [Protocols] >=20 > gEfiSmmFirmwareVolumeBlockProtocolGuid ## CONSUMES >=20 > -- > 2.26.2.windows.1