From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web08.2783.1655100558949846950 for ; Sun, 12 Jun 2022 23:09:19 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=mz6kEAVL; spf=pass (domain: intel.com, ip: 192.55.52.115, 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=1655100559; x=1686636559; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=JKg3jkM9KmM2gPTUhLp9iHv4Gpyw8eNfZ/Bv8ZvZ1EY=; b=mz6kEAVLxZbYJCFTHjuAV2nyvMqiVe5DwTYt7Jcnh/4Lpm69CDak4CjO CViNxb1rqajGxld1vLJNfQNkFOktH+jG8ESbCfhanz9dWHQj4utcuf7i/ cOqIzifUDDieiqLvhXHGreUGLxM0CHcAR4gZ3FrvZ2ejpoYKmpfQ6GzB6 3rSqIByysYJ3WjloFlPT7S6gUrEH+vQ7jt6aAPwka3XokpW42wNRQw4JQ kZZ73IytQ5Z6AdHlAXPYUNQGTTIlTq2pE6ewcsDI5tGf5R8GItR5gY0E3 8y6bdk+0VO5KyqZKskarlProMvfLYOwGIgT4hoSvi3KtL4TwAGDvLgQH6 Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10376"; a="278212812" X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="278212812" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2022 23:09:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,296,1647327600"; d="scan'208";a="685852429" Received: from win_li.ccr.corp.intel.com ([10.239.157.34]) by fmsmga002.fm.intel.com with ESMTP; 12 Jun 2022 23:09:15 -0700 From: "Li, Zhihao" To: devel@edk2.groups.io Cc: Jian J Wang , Liming Gao , Ni Ray Subject: [PATCH v4 1/1] MdeModulePkg: Use SmmWaitForAllProcessor() in VariableSmm driver. Date: Mon, 13 Jun 2022 14:09:14 +0800 Message-Id: <20220613060914.2095-1-zhihao.li@intel.com> X-Mailer: git-send-email 2.26.2.windows.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable From: Zhihao Li REF=EF=BC=9A https://bugzilla.tianocore.org/show_bug.cgi?id=3D3854 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. This patch use the new service to let VariableSmm driver work normally in relaxed AP mode. Due to MdeModulePkg can not depend on UefiCpuPkg, use null version implementation in MdePkg. Cc: Jian J Wang Cc: Liming Gao Cc: Ni Ray 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..265934c56a11 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 - 2022, 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 @@ -656,6 +657,13 @@ SmmVariableHandler ( goto EXIT;=0D }=0D =0D + if ((SmmVariableHeader->Attributes & EFI_VARIABLE_NON_VOLATILE) !=3D= 0) {=0D + if (EFI_ERROR (SmmWaitForAllProcessor (TRUE))) {=0D + DEBUG ((DEBUG_ERROR, "SetVariable: fail to wait for all AP check= in SMM!\n"));=0D + goto EXIT;=0D + }=0D + }=0D +=0D Status =3D VariableServiceSetVariable (=0D SmmVariableHeader->Name,=0D &SmmVariableHeader->Guid,=0D diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf b/M= deModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf index 8c552b87e080..e2a59d90586b 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 - 2022, Intel Corporation. All rights reserved.
=0D # Copyright (c) Microsoft Corporation.=0D # SPDX-License-Identifier: BSD-2-Clause-Patent=0D #=0D @@ -84,6 +84,7 @@ [LibraryClasses] 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..e473a12cd80e 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 - 2022, 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 @@ [LibraryClasses] VariableFlashInfoLib=0D VariablePolicyLib=0D VariablePolicyHelperLib=0D + SmmCpuRendezvousLib=0D =0D [Protocols]=0D gEfiSmmFirmwareVolumeBlockProtocolGuid ## CONSUMES=0D --=20 2.26.2.windows.1