From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web11.13356.1683716223195345643 for ; Wed, 10 May 2023 03:57:03 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=ZhplBB4U; spf=pass (domain: intel.com, ip: 134.134.136.24, mailfrom: zhihao.li@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1683716223; x=1715252223; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=NoFQ4Dh3YNikSrZtfrMEwJGT2vTTaQ3D2oqUk8QEcTA=; b=ZhplBB4UQmq1BOyItuzF47/Z4FJ4lfWll11VfHr7PJftK/q9OVSMebWy F1N8eqcMlIhRj6o1VWgWMDGxUgb+Y1ThvSKN1N7RDRJfTj8+WJOp2iYZk 1Y4JIScpIMjh+woq8oEJtN7neBrtyXhGpw4SSPmmr8FiSuGE8GdYhuNmn P+Abjc/+xZX+nQw+2C0LNXSsRyBvGQEq6C1siSGU7PBrkTIYAHAoeuDwV MeDlFZVNK4MerfRfpH9kA/EpFLXY9AhFr21Ty1mAyShN8qhd1RDHsZiKa yzVoeVcexUXqaf4dpPBgnydnSj80AjxdpFVg0AvaPI6nbnjpgA3OzE9CH g==; X-IronPort-AV: E=McAfee;i="6600,9927,10705"; a="352374340" X-IronPort-AV: E=Sophos;i="5.99,264,1677571200"; d="scan'208";a="352374340" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2023 03:56:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10705"; a="693358655" X-IronPort-AV: E=Sophos;i="5.99,264,1677571200"; d="scan'208";a="693358655" Received: from win_li.ccr.corp.intel.com ([10.239.157.27]) by orsmga007.jf.intel.com with ESMTP; 10 May 2023 03:56:54 -0700 From: "Li, Zhihao" To: devel@edk2.groups.io Cc: Jian J Wang , Liming Gao Subject: [PATCH v1 1/1] MdeModulePkg/VariableSmm.c: add Ap rendezvous check before SmmSetVariable. Date: Wed, 10 May 2023 18:56:53 +0800 Message-Id: <20230510105653.635-1-zhihao.li@intel.com> X-Mailer: git-send-email 2.26.2.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4429 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_ACCES= S_DENIED. Cc: Jian J Wang Cc: Liming Gao 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(-) diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c b/Mde= ModulePkg/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(), Reclai= mForOS(),=0D SmmVariableGetStatistics() should also do validation based on its own kn= owledge.=0D =0D -Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
=0D +Copyright (c) 2010 - 2023, Intel Corporation. All rights reserved.
=0D Copyright (c) 2018, Linaro, Ltd. All rights reserved.
=0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D =0D @@ -28,6 +28,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent =0D #include =0D #include =0D +#include =0D =0D #include =0D #include "Variable.h"=0D @@ -87,6 +88,13 @@ SmmVariableSetVariable ( {=0D EFI_STATUS Status;=0D =0D + //=0D + // Need to wait for all Aps to arrive in Relaxed-AP Sync Mode=0D + //=0D + if (EFI_ERROR (SmmWaitForAllProcessor (TRUE))) {=0D + DEBUG ((DEBUG_ERROR, "SetVariable: fail to wait for all AP check in SM= M!\n"));=0D + }=0D +=0D //=0D // Disable write protection when the calling SetVariable() through EFI_S= MM_VARIABLE_PROTOCOL.=0D //=0D diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf b/M= deModulePkg/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,=0D # the authentication service provided in this driver will be broken, and = the behavior is undefined.=0D #=0D -# Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
=0D +# Copyright (c) 2010 - 2023, Intel Corporation. All rights reserved.
=0D # Copyright (c) Microsoft Corporation.=0D # SPDX-License-Identifier: BSD-2-Clause-Patent=0D #=0D @@ -84,6 +84,7 @@ VariablePolicyLib=0D VariablePolicyHelperLib=0D SafeIntLib=0D + SmmCpuRendezvousLib=0D =0D [Protocols]=0D gEfiSmmFirmwareVolumeBlockProtocolGuid ## CONSUMES=0D diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneM= m.inf b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf index f09bed40cf51..89187456ca25 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf @@ -18,7 +18,7 @@ # may not be modified without authorization. If platform fails to protect= these resources,=0D # the authentication service provided in this driver will be broken, and = the behavior is undefined.=0D #=0D -# Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
=0D +# Copyright (c) 2010 - 2023, Intel Corporation. All rights reserved.
=0D # Copyright (c) 2018, Linaro, Ltd. All rights reserved.
=0D # Copyright (c) Microsoft Corporation.=0D # SPDX-License-Identifier: BSD-2-Clause-Patent=0D @@ -80,6 +80,7 @@ VariableFlashInfoLib=0D VariablePolicyLib=0D VariablePolicyHelperLib=0D + SmmCpuRendezvousLib=0D =0D [Protocols]=0D gEfiSmmFirmwareVolumeBlockProtocolGuid ## CONSUMES=0D --=20 2.26.2.windows.1