From nobody Tue May 21 16:15:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+90614+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+90614+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1655717792; cv=none; d=zohomail.com; s=zohoarc; b=Jang79jNjeCRCNVs62fxV8Ur7d5zH24Xy6Ea0h0+ZVwSaV7B+IuDMzCJO8TQCbdjiiMgiDdEDFU0UCgjSD1x9JSAZWIemd7UOmIYMwrWLgVdJ1oCdiEJqFDoBzIDA1auMiSUjBmpq0TWNh0Y2uRCb6nXOK3SDm60tGjgcQhcqV8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655717792; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=u0ITr8x/P7SN71A4JD3Wc1z3F/fJA0PCNcU3sdppTHY=; b=FFaJX2Di7GZ+FwNlLe6QZcXvQ2y6QhMNr87LMwOMrjaa7O3La4N9DXH08VOZvWgauKFPthbDP33tNGqxmOYhYiflhOQAak2cBCwOO/BKZ39+Gs87Zwn32gjej7tnZOK1VkCq7RyJRkRo/gXhNP8D/7y9SemsODJLRJt+sLXSDWs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+90614+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1655717792980574.9775576652756; Mon, 20 Jun 2022 02:36:32 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id giIYYY1788612xR7Ka1RZUGB; Mon, 20 Jun 2022 02:36:32 -0700 X-Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web09.28337.1655717789581811779 for ; Mon, 20 Jun 2022 02:36:31 -0700 X-IronPort-AV: E=McAfee;i="6400,9594,10380"; a="277399474" X-IronPort-AV: E=Sophos;i="5.92,306,1650956400"; d="scan'208";a="277399474" X-Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2022 02:36:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,306,1650956400"; d="scan'208";a="654595305" X-Received: from sep081ff3625096.sh.intel.com (HELO win_li.ccr.corp.intel.com) ([10.239.157.34]) by fmsmga004.fm.intel.com with ESMTP; 20 Jun 2022 02:36:26 -0700 From: "Li, Zhihao" To: devel@edk2.groups.io Cc: Jiewen Yao , Jian J Wang , Rahul Kumar , Qi Zhang Subject: [edk2-devel] [PATCH v1 1/1] SecurityPkg: use SmmWaitForAllProcessor in TcgSmm and Tcg2Smm driver. Date: Mon, 20 Jun 2022 17:36:15 +0800 Message-Id: <20220620093615.1535-7-zhihao.li@intel.com> In-Reply-To: <20220620093615.1535-1-zhihao.li@intel.com> References: <20220620093615.1535-1-zhihao.li@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhihao.li@intel.com X-Gm-Message-State: obBSWl9mFXO5rT8vHUgJHYOVx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1655717792; bh=AdAGZpZGhuQQXeGRhCQAgoszdIhJbqhI9iMhRfcgzUA=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=SxGc6525Ca0sHVfFNqDqgB7eEJW8uKnuaH6LGuj/fN/9O/2EwXEhIEn6D2UXF74omee 6td9ZUpHaX0wIRy9v5akUD+U1ujCWzIoWPOhPlCx9A4dlPHRiQ327Q9tmRQhY0I6yF3L+ QOetuCG2+BITNseyW4Wzbh2J2PL80B6HPVU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1655717794282100015 Content-Type: text/plain; charset="utf-8" From: Zhihao Li REF=EF=BC=9A https://bugzilla.tianocore.org/show_bug.cgi?id=3D3855 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 TcgSmm and Tcg2Smm driver work normally in relaxed AP mode. Cc: Jiewen Yao Cc: Jian J Wang Cc: Rahul Kumar Cc: Qi Zhang Signed-off-by: Zhihao Li --- SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c | 21 ++++++++++++++++++-- SecurityPkg/Tcg/TcgSmm/TcgSmm.c | 15 ++++++++++++-- SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h | 3 ++- SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.inf | 3 ++- SecurityPkg/Tcg/Tcg2Smm/Tcg2StandaloneMm.inf | 1 + SecurityPkg/Tcg/TcgSmm/TcgSmm.h | 3 ++- SecurityPkg/Tcg/TcgSmm/TcgSmm.inf | 3 ++- 7 files changed, 41 insertions(+), 8 deletions(-) diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c b/SecurityPkg/Tcg/Tcg2Smm/Tc= g2Smm.c index 498fb626bd9c..4367102fbd49 100644 --- a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c +++ b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c @@ -9,7 +9,7 @@ =20 PhysicalPresenceCallback() and MemoryClearCallback() will receive untrus= ted input and do some check. =20 -Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2022, Intel Corporation. All rights reserved.
Copyright (c) Microsoft Corporation. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -42,6 +42,7 @@ EFI_HANDLE mReadyToLockHandle; should still be called. @retval EFI_UNSUPPORTED An unknown test function was requested. @retval EFI_ACCESS_DENIED Part of the communication buffer lies = in an invalid region. + @retval EFI_ABORTED Fail to wait for all AP check in SMM. =20 **/ EFI_STATUS @@ -78,6 +79,11 @@ TpmNvsCommunciate ( return EFI_ACCESS_DENIED; } =20 + if (EFI_ERROR (SmmWaitForAllProcessor (TRUE))) { + DEBUG ((DEBUG_ERROR, "TpmNvsCommunciate: fail to wait for all AP check= in SMM!\n")); + return EFI_ABORTED; + } + // // Farm out the job to individual functions based on what was requested. // @@ -116,7 +122,7 @@ TpmNvsCommunciate ( @param[in, out] CommBufferSize The size of the CommBuffer. =20 @retval EFI_SUCCESS The interrupt was handled successfully. - + @retval EFI_ABORTED Fail to wait for all AP check in SMM. **/ EFI_STATUS EFIAPI @@ -132,6 +138,11 @@ PhysicalPresenceCallback ( UINT32 OperationRequest; UINT32 RequestParameter; =20 + if (EFI_ERROR (SmmWaitForAllProcessor (TRUE))) { + DEBUG ((DEBUG_ERROR, "TpmPhysicalPresent: fail to wait for all AP chec= k in SMM!\n")); + return EFI_ABORTED; + } + if (mTcgNvs->PhysicalPresence.Parameter =3D=3D TCG_ACPI_FUNCTION_RETURN_= REQUEST_RESPONSE_TO_OS) { mTcgNvs->PhysicalPresence.ReturnCode =3D Tcg2PhysicalPresenceLibReturn= OperationResponseToOsFunction ( &MostRecentRequest, @@ -173,6 +184,7 @@ PhysicalPresenceCallback ( @param[in, out] CommBufferSize The size of the CommBuffer. =20 @retval EFI_SUCCESS The interrupt was handled successfully. + @retval EFI_ABORTED Fail to wait for all AP check in SMM. =20 **/ EFI_STATUS @@ -217,6 +229,11 @@ MemoryClearCallback ( return EFI_SUCCESS; } =20 + if (EFI_ERROR (SmmWaitForAllProcessor (TRUE))) { + DEBUG ((DEBUG_ERROR, "TpmMemoryClear: fail to wait for all AP check in= SMM!\n")); + return EFI_ABORTED; + } + DataSize =3D sizeof (UINT8); Status =3D mSmmVariable->SmmSetVariable ( MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME, diff --git a/SecurityPkg/Tcg/TcgSmm/TcgSmm.c b/SecurityPkg/Tcg/TcgSmm/TcgSm= m.c index 96327a483ba9..e91567ca3169 100644 --- a/SecurityPkg/Tcg/TcgSmm/TcgSmm.c +++ b/SecurityPkg/Tcg/TcgSmm/TcgSmm.c @@ -8,7 +8,7 @@ =20 PhysicalPresenceCallback() and MemoryClearCallback() will receive untrus= ted input and do some check. =20 -Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2011 - 2022, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -33,7 +33,7 @@ TCG_NVS *mTcgNvs; @param[in, out] CommBufferSize The size of the CommBuffer. =20 @retval EFI_SUCCESS The interrupt was handled successfully. - + @retval EFI_ABORTED Fail to wait for all AP check in SMM. **/ EFI_STATUS EFIAPI @@ -92,6 +92,11 @@ PhysicalPresenceCallback ( return EFI_SUCCESS; } =20 + if (EFI_ERROR (SmmWaitForAllProcessor (TRUE))) { + DEBUG ((DEBUG_ERROR, "TPMPhysicalPresent: fail to wait for all AP ch= eck in SMM!\n")); + return EFI_ABORTED; + } + if (PpData.PPRequest !=3D mTcgNvs->PhysicalPresence.Request) { PpData.PPRequest =3D (UINT8)mTcgNvs->PhysicalPresence.Request; DataSize =3D sizeof (EFI_PHYSICAL_PRESENCE); @@ -238,6 +243,7 @@ PhysicalPresenceCallback ( @param[in, out] CommBufferSize The size of the CommBuffer. =20 @retval EFI_SUCCESS The interrupt was handled successfully. + @retval EFI_ABORTED Fail to wait for all AP check in SMM. =20 **/ EFI_STATUS @@ -282,6 +288,11 @@ MemoryClearCallback ( return EFI_SUCCESS; } =20 + if (EFI_ERROR (SmmWaitForAllProcessor (TRUE))) { + DEBUG ((DEBUG_ERROR, " TpmMemoryClear: fail to wait for all AP check i= n SMM!\n")); + return EFI_ABORTED; + } + DataSize =3D sizeof (UINT8); Status =3D mSmmVariable->SmmSetVariable ( MEMORY_OVERWRITE_REQUEST_VARIABLE_NAME, diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h b/SecurityPkg/Tcg/Tcg2Smm/Tc= g2Smm.h index 84b65eb0897c..c0c0e9d91aeb 100644 --- a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h +++ b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h @@ -1,7 +1,7 @@ /** @file The header file for Tcg2 SMM driver. =20 -Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2022, Intel Corporation. All rights reserved.
Copyright (c) Microsoft Corporation. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -31,6 +31,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include =20 #include =20 diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.inf b/SecurityPkg/Tcg/Tcg2Smm/= Tcg2Smm.inf index 096338d0ef47..10b0629d506b 100644 --- a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.inf +++ b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.inf @@ -20,7 +20,7 @@ # This driver will have external input - variable and ACPINvs data in SMM= mode. # This external input must be validated carefully to avoid security issue. # -# Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2015 - 2022, Intel Corporation. All rights reserved.
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -59,6 +59,7 @@ [LibraryClasses] Tcg2PhysicalPresenceLib PcdLib SmmMemLib + SmmCpuRendezvousLib =20 [Guids] ## SOMETIMES_PRODUCES ## Variable:L"MemoryOverwriteRequestControl" diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tcg2StandaloneMm.inf b/SecurityPkg/Tcg= /Tcg2Smm/Tcg2StandaloneMm.inf index 746eda3e9fed..6cf74803a12d 100644 --- a/SecurityPkg/Tcg/Tcg2Smm/Tcg2StandaloneMm.inf +++ b/SecurityPkg/Tcg/Tcg2Smm/Tcg2StandaloneMm.inf @@ -55,6 +55,7 @@ [LibraryClasses] Tcg2PhysicalPresenceLib PcdLib MemLib + SmmCpuRendezvousLib =20 [Guids] ## SOMETIMES_PRODUCES ## Variable:L"MemoryOverwriteRequestControl" diff --git a/SecurityPkg/Tcg/TcgSmm/TcgSmm.h b/SecurityPkg/Tcg/TcgSmm/TcgSm= m.h index e348ad105499..dcc85ee3efbc 100644 --- a/SecurityPkg/Tcg/TcgSmm/TcgSmm.h +++ b/SecurityPkg/Tcg/TcgSmm/TcgSmm.h @@ -1,7 +1,7 @@ /** @file The header file for TCG SMM driver. =20 -Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2012 - 2022, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -31,6 +31,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include =20 #pragma pack(1) typedef struct { diff --git a/SecurityPkg/Tcg/TcgSmm/TcgSmm.inf b/SecurityPkg/Tcg/TcgSmm/Tcg= Smm.inf index 9fac896dde8b..1d0f1c9170d4 100644 --- a/SecurityPkg/Tcg/TcgSmm/TcgSmm.inf +++ b/SecurityPkg/Tcg/TcgSmm/TcgSmm.inf @@ -9,7 +9,7 @@ # This driver will have external input - variable and ACPINvs data in SMM= mode. # This external input must be validated carefully to avoid security issue. # -# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2011 - 2022, Intel Corporation. All rights reserved.
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -46,6 +46,7 @@ [LibraryClasses] TpmMeasurementLib PcdLib TcgPpVendorLib + SmmCpuRendezvousLib =20 [Guids] ## SOMETIMES_PRODUCES ## Variable:L"PhysicalPresence" --=20 2.26.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#90614): https://edk2.groups.io/g/devel/message/90614 Mute This Topic: https://groups.io/mt/91873299/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Tue May 21 16:15:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+90611+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+90611+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1655717791; cv=none; d=zohomail.com; s=zohoarc; b=MuxWerKl7Fe18i0LCjfNSYjzisvYiqVOUjx5n9ZvNoVoZgSeNIMQ2if1fujVUI2yHYciJykfjFwo8Uqv+G5eQ9bHwuwojHFt8Ul+IF5ORAZ63/TzrdM2kUGv9pxzWTY/WaLCoq13/ca7t/JPvOV+F3+H9JHxKZkVc+JEf+154/0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655717791; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=/lhBN6HVnzIfhZlcoFHJ8ZLqBP2MY0bFeJvEo4W3O9w=; b=egMbw//wSxEnsGAPOgVp7jypSBQYTkjhHlnLhDY/3n8ZVXjd7zulbrgpODB1aVG3qSxqDMHs6iQjofOzaZ8/GRwytmNWTjRNL5NN/hFiNqInSHxa6vSmisLCFCFADhtlHa8bXX+FnN5zE8MRmrgeRBFtnoGYGvw+eoCYDFbYqzs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+90611+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1655717791719537.2124244153588; Mon, 20 Jun 2022 02:36:31 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id lY0QYY1788612xghqKW9Ruc7; Mon, 20 Jun 2022 02:36:31 -0700 X-Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web10.28023.1655717790205046709 for ; Mon, 20 Jun 2022 02:36:30 -0700 X-IronPort-AV: E=McAfee;i="6400,9594,10380"; a="277399457" X-IronPort-AV: E=Sophos;i="5.92,306,1650956400"; d="scan'208";a="277399457" X-Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2022 02:36:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,306,1650956400"; d="scan'208";a="654595277" X-Received: from sep081ff3625096.sh.intel.com (HELO win_li.ccr.corp.intel.com) ([10.239.157.34]) by fmsmga004.fm.intel.com with ESMTP; 20 Jun 2022 02:36:17 -0700 From: "Li, Zhihao" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Rahul Kumar , Siyuan Fu , Zhihao Li Subject: [edk2-devel] [PATCH 1/1] UefiCpuPkg: Extend SMM CPU Service with rendezvous support. Date: Mon, 20 Jun 2022 17:36:10 +0800 Message-Id: <20220620093615.1535-2-zhihao.li@intel.com> In-Reply-To: <20220620093615.1535-1-zhihao.li@intel.com> References: <20220620093615.1535-1-zhihao.li@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhihao.li@intel.com X-Gm-Message-State: ZiboqDBUdC8abx5Mliebwknjx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1655717791; bh=ojBr9xLRzAcfy8eY3i7EcIwhqqjmtbvavqSJd2LORdU=; h=Cc:Date:From:Reply-To:Subject:To; b=fO5fIZ4Yo5YEqtsvKAgIebj0/NPKUyAHlM6HWT5tHTMZDAXvkBiOnv0SvEFJpbPjoIy xb05k3Ar7H/K8Nd7duXdywY+1GH09M94qAdAY3cSqvnttUA01gGnq5ML9ky3YqSe886w1 6eApeOrsXmRlGzUrcWZiJlreiKMpVSHVErE= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1655717792464100003 Content-Type: text/plain; charset="utf-8" From: "Li, Zhihao" REF? https://bugzilla.tianocore.org/show_bug.cgi?id=3D3815 This patch define a new Protocol with the new services SmmWaitForAllProcessor(), which can be used by SMI handler to optionally wait for other APs to complete SMM rendezvous in relaxed AP mode. A new library SmmCpuRendezvousLib is provided to abstract the service into library API to simple SMI handler code. Cc: Eric Dong Reviewed-by: Ray Ni Cc: Rahul Kumar Cc: Siyuan Fu Cc: Zhihao Li Signed-off-by: Zhihao Li --- .../SmmCpuRendezvousLib/SmmCpuRendezvousLib.c | 103 ++++++++++++++++++ UefiCpuPkg/PiSmmCpuDxeSmm/CpuService.c | 69 +++++++++++- UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 20 +++- .../Include/Library/SmmCpuRendezvousLib.h | 27 +++++ UefiCpuPkg/Include/Protocol/SmmCpuService.h | 36 +++++- .../SmmCpuRendezvousLib.inf | 35 ++++++ UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 29 ++++- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf | 5 +- UefiCpuPkg/UefiCpuPkg.dec | 8 +- UefiCpuPkg/UefiCpuPkg.dsc | 2 + 10 files changed, 322 insertions(+), 12 deletions(-) create mode 100644 UefiCpuPkg/Library/SmmCpuRendezvousLib/SmmCpuRendezvous= Lib.c create mode 100644 UefiCpuPkg/Include/Library/SmmCpuRendezvousLib.h create mode 100644 UefiCpuPkg/Library/SmmCpuRendezvousLib/SmmCpuRendezvous= Lib.inf diff --git a/UefiCpuPkg/Library/SmmCpuRendezvousLib/SmmCpuRendezvousLib.c b= /UefiCpuPkg/Library/SmmCpuRendezvousLib/SmmCpuRendezvousLib.c new file mode 100644 index 000000000000..e573c2ecfb51 --- /dev/null +++ b/UefiCpuPkg/Library/SmmCpuRendezvousLib/SmmCpuRendezvousLib.c @@ -0,0 +1,103 @@ +/** @file + SMM CPU Rendezvous sevice implement. + + Copyright (c) 2022, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include +#include + +STATIC EDKII_SMM_CPU_RENDEZVOUS_PROTOCOL *mSmmCpuRendezvous =3D NULL; +STATIC VOID *mRegistration =3D NULL; + +/** + Callback function to wait Smm cpu rendezvous service located. + + SmmCpuRendezvousLib need to support MM_STANDALONE and DXE_SMM_DRIVER dri= ver. + So do not use library constructor to locate the protocol. + + @param[in] Protocol Points to the protocol's unique identifier. + @param[in] Interface Points to the interface instance. + @param[in] Handle The handle on which the interface was installed. + + @retval EFI_SUCCESS Notification runs successfully. + +**/ +EFI_STATUS +EFIAPI +SmmCpuRendezvousProtocolNotify ( + IN CONST EFI_GUID *Protocol, + IN VOID *Interface, + IN EFI_HANDLE Handle + ) +{ + EFI_STATUS Status; + + Status =3D gMmst->MmLocateProtocol ( + &gEdkiiSmmCpuRendezvousProtocolGuid, + NULL, + (VOID **)&mSmmCpuRendezvous + ); + ASSERT_EFI_ERROR (Status); + + return EFI_SUCCESS; +} + +/** + This routine wait for all AP processors to arrive in SMM. + + @param[in] BlockingMode Blocking mode or non-blocking mode. + + @retval EFI_SUCCESS All avaiable APs arrived. + @retval EFI_TIMEOUT Wait for all APs until timeout. + @retval OTHER Fail to register SMM CPU Rendezvous service Protoco= l. +**/ +EFI_STATUS +EFIAPI +SmmWaitForAllProcessor ( + IN BOOLEAN BlockingMode + ) +{ + EFI_STATUS Status; + + if ((mRegistration =3D=3D NULL) && (mSmmCpuRendezvous =3D=3D NULL)) { + // + // Locate SMM cpu rendezvous protocol for the first time execute the f= unction. + // + Status =3D gMmst->MmLocateProtocol ( + &gEdkiiSmmCpuRendezvousProtocolGuid, + NULL, + (VOID **)&mSmmCpuRendezvous + ); + if (EFI_ERROR (Status)) { + Status =3D gMmst->MmRegisterProtocolNotify ( + &gEdkiiSmmCpuRendezvousProtocolGuid, + SmmCpuRendezvousProtocolNotify, + &mRegistration + ); + if (EFI_ERROR (Status)) { + return Status; + } + } + } + + // + // The platform have not set up. It doesn't need smm cpu rendezvous. + // + if (mSmmCpuRendezvous =3D=3D NULL) { + return EFI_SUCCESS; + } + + Status =3D mSmmCpuRendezvous->WaitForAllProcessor ( + mSmmCpuRendezvous, + BlockingMode + ); + return Status; +} diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuService.c b/UefiCpuPkg/PiSmmCpuDx= eSmm/CpuService.c index 5d624f8e9ed6..2ebf4543c3ed 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuService.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuService.c @@ -1,7 +1,7 @@ /** @file Implementation of SMM CPU Services Protocol. =20 -Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2011 - 2022, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -20,6 +20,13 @@ EFI_SMM_CPU_SERVICE_PROTOCOL mSmmCpuService =3D { SmmRegisterExceptionHandler }; =20 +// +// EDKII SMM CPU Rendezvous Service Protocol instance +// +EDKII_SMM_CPU_RENDEZVOUS_PROTOCOL mSmmCpuRendezvousService =3D { + SmmCpuRendezvous +}; + /** Gets processor information on the requested processor at the instant thi= s call is made. =20 @@ -350,6 +357,7 @@ SmmRegisterExceptionHandler ( @param ImageHandle The firmware allocated handle for the EFI image. =20 @retval EFI_SUCCESS EFI SMM CPU Services Protocol was installed succe= ssfully. + @retval OTHER Fail to install Protocol. **/ EFI_STATUS InitializeSmmCpuServices ( @@ -365,5 +373,64 @@ InitializeSmmCpuServices ( &mSmmCpuService ); ASSERT_EFI_ERROR (Status); + if (EFI_ERROR (Status)) { + return Status; + } + + Status =3D gSmst->SmmInstallProtocolInterface ( + &Handle, + &gEdkiiSmmCpuRendezvousProtocolGuid, + EFI_NATIVE_INTERFACE, + &mSmmCpuRendezvousService + ); + ASSERT_EFI_ERROR (Status); + return Status; +} + +/** + Wait for all processors enterring SMM until all CPUs are already synchro= nized or not. + + If BlockingMode is False, timeout value is zero. + + @param This A pointer to the EDKII_SMM_CPU_RENDEZVOUS_PROTOCOL = instance. + @param BlockingMode Blocking mode or non-blocking mode. + + @retval EFI_SUCCESS All avaiable APs arrived. + @retval EFI_TIMEOUT Wait for all APs until timeout. + +**/ +EFI_STATUS +EFIAPI +SmmCpuRendezvous ( + IN EDKII_SMM_CPU_RENDEZVOUS_PROTOCOL *This, + IN BOOLEAN BlockingMode + ) +{ + EFI_STATUS Status; + + // + // Return success immediately if all CPUs are already synchronized. + // + if (mSmmMpSyncData->AllApArrivedWithException) { + Status =3D EFI_SUCCESS; + goto ON_EXIT; + } + + if (!BlockingMode) { + Status =3D EFI_TIMEOUT; + goto ON_EXIT; + } + + // + // There are some APs outside SMM, Wait for all avaiable APs to arrive. + // + SmmWaitForApArrival (); + Status =3D mSmmMpSyncData->AllApArrivedWithException ? EFI_SUCCESS : EFI= _TIMEOUT; + +ON_EXIT: + if (!mSmmMpSyncData->AllApArrivedWithException) { + DEBUG ((DEBUG_INFO, "EdkiiSmmWaitForAllApArrival: Timeout to wait all = APs arrival\n")); + } + return Status; } diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c b/UefiCpuPkg/PiSmmCpuDxe= Smm/MpService.c index 882dee4fe246..13c2cb8da4c3 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c @@ -1,7 +1,7 @@ /** @file SMM MP service implementation =20 -Copyright (c) 2009 - 2021, Intel Corporation. All rights reserved.
+Copyright (c) 2009 - 2022, Intel Corporation. All rights reserved.
Copyright (c) 2017, AMD Incorporated. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent @@ -293,10 +293,14 @@ SmmWaitForApArrival ( // Sync with APs 1st timeout // for (Timer =3D StartSyncTimer (); - !IsSyncTimerTimeout (Timer) && !(LmceEn && LmceSignal) && - !AllCpusInSmmWithExceptions (ARRIVAL_EXCEPTION_BLOCKED | ARRIVAL_EX= CEPTION_SMI_DISABLED); + !IsSyncTimerTimeout (Timer) && !(LmceEn && LmceSignal); ) { + mSmmMpSyncData->AllApArrivedWithException =3D AllCpusInSmmWithExceptio= ns (ARRIVAL_EXCEPTION_BLOCKED | ARRIVAL_EXCEPTION_SMI_DISABLED); + if (mSmmMpSyncData->AllApArrivedWithException) { + break; + } + CpuPause (); } =20 @@ -330,10 +334,14 @@ SmmWaitForApArrival ( // Sync with APs 2nd timeout. // for (Timer =3D StartSyncTimer (); - !IsSyncTimerTimeout (Timer) && - !AllCpusInSmmWithExceptions (ARRIVAL_EXCEPTION_BLOCKED | ARRIVAL_= EXCEPTION_SMI_DISABLED); + !IsSyncTimerTimeout (Timer); ) { + mSmmMpSyncData->AllApArrivedWithException =3D AllCpusInSmmWithExcept= ions (ARRIVAL_EXCEPTION_BLOCKED | ARRIVAL_EXCEPTION_SMI_DISABLED); + if (mSmmMpSyncData->AllApArrivedWithException) { + break; + } + CpuPause (); } } @@ -1887,6 +1895,8 @@ InitializeMpSyncData ( *mSmmMpSyncData->InsideSmm =3D FALSE; *mSmmMpSyncData->AllCpusInSync =3D FALSE; =20 + mSmmMpSyncData->AllApArrivedWithException =3D FALSE; + for (CpuIndex =3D 0; CpuIndex < gSmmCpuPrivate->SmmCoreEntryContext.Nu= mberOfCpus; CpuIndex++) { mSmmMpSyncData->CpuData[CpuIndex].Busy =3D (SPIN_LOCK *)((UINTN)mSmmCpuSemaphores.SemaphoreCpu.Busy + mSemaph= oreSize * CpuIndex); diff --git a/UefiCpuPkg/Include/Library/SmmCpuRendezvousLib.h b/UefiCpuPkg/= Include/Library/SmmCpuRendezvousLib.h new file mode 100644 index 000000000000..82e459e9106e --- /dev/null +++ b/UefiCpuPkg/Include/Library/SmmCpuRendezvousLib.h @@ -0,0 +1,27 @@ +/** @file + SMM CPU Rendezvous library header file. + + Copyright (c) 2022, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef SMM_CPU_RENDEZVOUS_H_ +#define SMM_CPU_RENDEZVOUS_H_ + +/** + This routine wait for all AP processors to arrive in SMM. + + @param[in] BlockingMode Blocking mode or non-blocking mode. + + @retval EFI_SUCCESS All processors checked in to SMM. + @retval EFI_TIMEOUT Wait for all APs until timeout. + +**/ +EFI_STATUS +EFIAPI +SmmWaitForAllProcessor ( + IN BOOLEAN BlockingMode + ); + +#endif diff --git a/UefiCpuPkg/Include/Protocol/SmmCpuService.h b/UefiCpuPkg/Inclu= de/Protocol/SmmCpuService.h index 952767afce75..3d93d243409c 100644 --- a/UefiCpuPkg/Include/Protocol/SmmCpuService.h +++ b/UefiCpuPkg/Include/Protocol/SmmCpuService.h @@ -1,7 +1,7 @@ /** @file SMM CPU Service protocol definition. =20 -Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2013 - 2022, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -200,4 +200,38 @@ struct _EFI_SMM_CPU_SERVICE_PROTOCOL { =20 extern EFI_GUID gEfiSmmCpuServiceProtocolGuid; =20 +// +// EDKII_SMM_CPU_RENDEZVOUS_PROTOCOL provide SMM CPU +// rendezvous service support. +// +#define EDKII_SMM_CPU_RENDEZVOUS_PROTOCOL_GUID \ + { \ + 0xaa00d50b, 0x4911, 0x428f, { 0xb9, 0x1a, 0xa5, 0x9d, 0xdb, 0x13, 0xe2= , 0x4c } \ + } + +typedef struct _EDKII_SMM_CPU_RENDEZVOUS_PROTOCOL EDKII_SMM_CPU_RENDEZVOUS= _PROTOCOL; + +/** + Wait for all APs to arrive SMM mode in given timeout constraint. + + @param[in] This A pointer to the EDKII_SMM_CPU_RENDEZV= OUS_PROTOCOL instance. + @param[in] BlockingMode Block or non-block mode. + + @retval EFI_SUCCESS All APs have arrived SMM mode except S= MI disabled APs. + @retval EFI_TIMEOUT There are APs not in SMM mode in given= timeout constraint. + +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_WAIT_FOR_ALL_PROCESSOR)( + IN EDKII_SMM_CPU_RENDEZVOUS_PROTOCOL *This, + IN BOOLEAN BlockingMode + ); + +struct _EDKII_SMM_CPU_RENDEZVOUS_PROTOCOL { + EDKII_WAIT_FOR_ALL_PROCESSOR WaitForAllProcessor; +}; + +extern EFI_GUID gEdkiiSmmCpuRendezvousProtocolGuid; + #endif diff --git a/UefiCpuPkg/Library/SmmCpuRendezvousLib/SmmCpuRendezvousLib.inf= b/UefiCpuPkg/Library/SmmCpuRendezvousLib/SmmCpuRendezvousLib.inf new file mode 100644 index 000000000000..52374bf6e9b4 --- /dev/null +++ b/UefiCpuPkg/Library/SmmCpuRendezvousLib/SmmCpuRendezvousLib.inf @@ -0,0 +1,35 @@ +## @file +# SMM CPU Rendezvous service lib. +# +# This is SMM CPU rendezvous service lib that wait for all +# APs to enter SMM mode. +# +# Copyright (c) 2022, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D SmmCpuRendezvousLib + FILE_GUID =3D 1509Bb36-9Ba4-438B-B195-Ac5914Db14E2 + MODULE_TYPE =3D DXE_SMM_DRIVER + LIBRARY_CLASS =3D SmmCpuRendezvousLib|MM_STANDALONE DXE= _SMM_DRIVER + +[Sources] + SmmCpuRendezvousLib.c + +[Packages] + MdePkg/MdePkg.dec + UefiCpuPkg/UefiCpuPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + MmServicesTableLib + +[Pcd] + gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmApSyncTimeout ## CONS= UMES + +[Protocols] + gEdkiiSmmCpuRendezvousProtocolGuid diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h b/UefiCpuPkg/PiSmmC= puDxeSmm/PiSmmCpuDxeSmm.h index 26d07c5b5ea0..aed872836c99 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h @@ -1,7 +1,7 @@ /** @file Agent Module to load other modules to deploy SMM Entry Vector for X86 CPU. =20 -Copyright (c) 2009 - 2020, Intel Corporation. All rights reserved.
+Copyright (c) 2009 - 2022, Intel Corporation. All rights reserved.
Copyright (c) 2017, AMD Incorporated. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent @@ -428,6 +428,7 @@ typedef struct { volatile SMM_CPU_SYNC_MODE EffectiveSyncMode; volatile BOOLEAN SwitchBsp; volatile BOOLEAN *CandidateBsp; + volatile BOOLEAN AllApArrivedWithException; EFI_AP_PROCEDURE StartupProcedure; VOID *StartupProcArgs; } SMM_DISPATCHER_MP_SYNC_DATA; @@ -1488,4 +1489,30 @@ IsRestrictedMemoryAccess ( VOID ); =20 +/** + Choose blocking or non-blocking mode to Wait for all APs. + + @param[in] This A pointer to the EDKII_SMM_CPU_RENDEZV= OUS_PROTOCOL instance. + @param[in] BlockingMode Blocking or non-blocking mode. + + @retval EFI_SUCCESS All APs have arrived SMM mode except S= MI disabled APs. + @retval EFI_TIMEOUT There are APs not in SMM mode in given= timeout constraint. + +**/ +EFI_STATUS +EFIAPI +SmmCpuRendezvous ( + IN EDKII_SMM_CPU_RENDEZVOUS_PROTOCOL *This, + IN BOOLEAN BlockingMode + ); + +/** + Insure when this function returns, no AP will execute normal mode code b= efore entering SMM, except SMI disabled APs. + +**/ +VOID +SmmWaitForApArrival ( + VOID + ); + #endif diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf b/UefiCpuPkg/PiSm= mCpuDxeSmm/PiSmmCpuDxeSmm.inf index 0e88071c7079..deef00f9c6e9 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf @@ -4,7 +4,7 @@ # This SMM driver performs SMM initialization, deploy SMM Entry Vector, # provides CPU specific services in SMM. # -# Copyright (c) 2009 - 2021, Intel Corporation. All rights reserved.
+# Copyright (c) 2009 - 2022, Intel Corporation. All rights reserved.
# Copyright (c) 2017, AMD Incorporated. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent @@ -107,7 +107,8 @@ [Protocols] gEfiSmmReadyToLockProtocolGuid ## NOTIFY gEfiSmmCpuServiceProtocolGuid ## PRODUCES gEdkiiSmmMemoryAttributeProtocolGuid ## PRODUCES - gEfiMmMpProtocolGuid ## PRODUCES + gEfiMmMpProtocolGuid ## PRODUCES + gEdkiiSmmCpuRendezvousProtocolGuid ## PRODUCES =20 [Guids] gEfiAcpiVariableGuid ## SOMETIMES_CONSUMES ## HOB # = it is used for S3 boot. diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec index 7de66fde674c..525cde463435 100644 --- a/UefiCpuPkg/UefiCpuPkg.dec +++ b/UefiCpuPkg/UefiCpuPkg.dec @@ -1,7 +1,7 @@ ## @file UefiCpuPkg.dec # This Package provides UEFI compatible CPU modules and libraries. # -# Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2022, Intel Corporation. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -62,6 +62,9 @@ [LibraryClasses.IA32, LibraryClasses.X64] ## @libraryclass Provides function for loading microcode. MicrocodeLib|Include/Library/MicrocodeLib.h =20 + ## @libraryclass Provides function for SMM CPU Rendezvous Library. + SmmCpuRendezvousLib|Include/Library/SmmCpuRendezvousLib.h + [Guids] gUefiCpuPkgTokenSpaceGuid =3D { 0xac05bf33, 0x995a, 0x4ed4, { 0xaa,= 0xb8, 0xef, 0x7a, 0xe8, 0xf, 0x5c, 0xb0 }} gMsegSmramGuid =3D { 0x5802bce4, 0xeeee, 0x4e33, { 0xa1,= 0x30, 0xeb, 0xad, 0x27, 0xf0, 0xe4, 0x39 }} @@ -77,7 +80,8 @@ [Guids] =20 [Protocols] ## Include/Protocol/SmmCpuService.h - gEfiSmmCpuServiceProtocolGuid =3D { 0x1d202cab, 0xc8ab, 0x4d5c, { 0x94,= 0xf7, 0x3c, 0xfc, 0xc0, 0xd3, 0xd3, 0x35 }} + gEfiSmmCpuServiceProtocolGuid =3D { 0x1d202cab, 0xc8ab, 0x4d5c, { 0x94= , 0xf7, 0x3c, 0xfc, 0xc0, 0xd3, 0xd3, 0x35 }} + gEdkiiSmmCpuRendezvousProtocolGuid =3D { 0xaa00d50b, 0x4911, 0x428f, { 0= xb9, 0x1a, 0xa5, 0x9d, 0xdb, 0x13, 0xe2, 0x4c }} =20 ## Include/Protocol/SmMonitorInit.h gEfiSmMonitorInitProtocolGuid =3D { 0x228f344d, 0xb3de, 0x43bb, { 0xa4,= 0xd7, 0xea, 0x20, 0xb, 0x1b, 0x14, 0x82 }} diff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc index d1d61dd6a03b..a0bbde9985d3 100644 --- a/UefiCpuPkg/UefiCpuPkg.dsc +++ b/UefiCpuPkg/UefiCpuPkg.dsc @@ -61,6 +61,7 @@ [LibraryClasses] TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurem= entLibNull.inf VmgExitLib|UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf MicrocodeLib|UefiCpuPkg/Library/MicrocodeLib/MicrocodeLib.inf + SmmCpuRendezvousLib|UefiCpuPkg/Library/SmmCpuRendezvousLib/SmmCpuRendezv= ousLib.inf =20 [LibraryClasses.common.SEC] PlatformSecLib|UefiCpuPkg/Library/PlatformSecLibNull/PlatformSecLibNull.= inf @@ -173,6 +174,7 @@ [Components.IA32, Components.X64] } UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf UefiCpuPkg/ResetVector/Vtf0/Bin/ResetVector.inf + UefiCpuPkg/Library/SmmCpuRendezvousLib/SmmCpuRendezvousLib.inf =20 [BuildOptions] *_*_*_CC_FLAGS =3D -D DISABLE_NEW_DEPRECATED_INTERFACES --=20 2.26.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#90611): https://edk2.groups.io/g/devel/message/90611 Mute This Topic: https://groups.io/mt/91873296/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Tue May 21 16:15:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+90613+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+90613+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1655717793; cv=none; d=zohomail.com; s=zohoarc; b=GRSQ6AEsyTLP6G3lu3hcuH0Uen8G6jbx9M5zCh+LCoz56FkjTF2o7rqoqlUu5bvXh2UxnXXKb1xgHHqrqAppz15ovFgPH5zTfBjYM4ZmBABTf3mjIU1pdQhpy0ZDJu64nRiYmdH1vRlaI9ojq7WyeHN9Q+8c+lJz7L0O1KbAy1s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655717793; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=SknhSxPChfDjU7xp8zWjaWkDinvwrB4Shbbe/y+syOI=; b=Ry/5TqXfih40WSUiZ1mMkkrpLxdHlDMUq1kXIFROnfAsP54pD+5GPiCQ21d5+B+CTffEBPZlgqk/tf7p8nMMAhcvtnk8ub+/ByiGv7J28KxWSP0fBEwodwenqfcOCkN4NOWQhycjP6nUm3IzYUQbga+w8PTZLrIzUB7o5YOOvuU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+90613+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1655717793485822.6884098295734; Mon, 20 Jun 2022 02:36:33 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 1v1mYY1788612xrFY492WVsF; Mon, 20 Jun 2022 02:36:33 -0700 X-Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web10.28023.1655717790205046709 for ; Mon, 20 Jun 2022 02:36:31 -0700 X-IronPort-AV: E=McAfee;i="6400,9594,10380"; a="277399462" X-IronPort-AV: E=Sophos;i="5.92,306,1650956400"; d="scan'208";a="277399462" X-Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2022 02:36:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,306,1650956400"; d="scan'208";a="654595291" X-Received: from sep081ff3625096.sh.intel.com (HELO win_li.ccr.corp.intel.com) ([10.239.157.34]) by fmsmga004.fm.intel.com with ESMTP; 20 Jun 2022 02:36:21 -0700 From: "Li, Zhihao" To: devel@edk2.groups.io Cc: Guo Dong , Ray Ni , Benjamin You , Sean Rhodes , Siyuan Fu Subject: [edk2-devel] [PATCH 1/1] UefiPayloadPkg: Add dependency of VariableSmm driver. Date: Mon, 20 Jun 2022 17:36:12 +0800 Message-Id: <20220620093615.1535-4-zhihao.li@intel.com> In-Reply-To: <20220620093615.1535-1-zhihao.li@intel.com> References: <20220620093615.1535-1-zhihao.li@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhihao.li@intel.com X-Gm-Message-State: vJ8fa4xQlFZy93o8xCkrq0Scx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1655717793; bh=WGm6r3APP0frzpUXT8PpvwEETQaUlEQ6fIc8I9nV8tM=; h=Cc:Date:From:Reply-To:Subject:To; b=ggyeCSJVHA2oUQ4/Vjc0AHJzLf8WO2ZUNKFjeJEXmMM6Hi3P0R+TWb6FHpbg8imByxn jnvgFCqZcjpLmHS/5aGKu8q9A5Fiqi/4w54yS5HQJq3cmBbcwb194U/TJFsFO5oHx0pxh Tl39i1yddKK2+DDrrAvisH9IbFdQ8e49OJw= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1655717794259100013 Content-Type: text/plain; charset="utf-8" From: "Li, Zhihao" REF? https://bugzilla.tianocore.org/show_bug.cgi?id=3D3882 UefiCpuPkg define a new Protocol with the new services SmmWaitForAllProcessor(), which can be used by SMI handler to optionally wait for other APs to complete SMM rendezvous in relaxed AP mode. VariableSmm driver need use SmmCpuRendezvousLib, So add SmmCpuRendezvousLib dependency in UefiPayloadPkg which use VariableSmm driver. Cc: Guo Dong Cc: Ray Ni Cc: Benjamin You Cc: Sean Rhodes Cc: Siyuan Fu Signed-off-by: Zhihao Li Reviewed-by: Guo Dong --- UefiPayloadPkg/UefiPayloadPkg.dsc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayload= Pkg.dsc index e2ea48348257..17b30589e77c 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.dsc +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc @@ -3,7 +3,7 @@ # # Provides drivers and definitions to create uefi payload for bootloaders. # -# Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.
+# Copyright (c) 2014 - 2022, Intel Corporation. All rights reserved.
# Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -354,6 +354,7 @@ [LibraryClasses.common.DXE_SMM_DRIVER] SmmCpuFeaturesLib|UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib= .inf CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuE= xceptionHandlerLib.inf ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseRepor= tStatusCodeLibNull.inf + SmmCpuRendezvousLib|UefiCpuPkg/Library/SmmCpuRendezvousLib/SmmCpuRendezv= ousLib.inf !if $(PERFORMANCE_MEASUREMENT_ENABLE) PerformanceLib|MdeModulePkg/Library/SmmPerformanceLib/SmmPerformanceLib.= inf !endif --=20 2.26.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#90613): https://edk2.groups.io/g/devel/message/90613 Mute This Topic: https://groups.io/mt/91873298/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Tue May 21 16:15:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+90616+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+90616+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1655717793; cv=none; d=zohomail.com; s=zohoarc; b=dlCpMkgmozUC6isah7qN243Z0vSfkbdN9YuKr8sSiyOF6WtA1TlAhqSxLwv2PG3IVyjmtarGG51iyqjRB+LXspUnY/wlgv/O5Ajut62JVZKVRqID+rKVwq7FHO6b4s5LRTEFfZ2JZ7nRNrH2fCra8WlorDAwLLvIYq1AXPFDJXI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655717793; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=5OReCodOcrz7nzmqiOZWuqW2AQpVbwdOUfx1w4gcyl0=; b=GGQ21Hw7C99MrGBRDGVha7zvwE7cwBxtxeDjomaSyqPHBRd2smwZjwM3kK/8ZC3LSIlVORc4ur1U4TEheVQ7N8ixUtnjkSQcXVjVpe1YyZGfLz3/JqTuhYwTExbA44SPwRwuB+3yFoeJnifD5cQ5jdSFvR0s6vN3/VxmnQIFqxs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+90616+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1655717793862715.5658125391317; Mon, 20 Jun 2022 02:36:33 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id dDNdYY1788612xbnDAebroAT; Mon, 20 Jun 2022 02:36:33 -0700 X-Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web08.28377.1655717791517777367 for ; Mon, 20 Jun 2022 02:36:32 -0700 X-IronPort-AV: E=McAfee;i="6400,9594,10380"; a="277399470" X-IronPort-AV: E=Sophos;i="5.92,306,1650956400"; d="scan'208";a="277399470" X-Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2022 02:36:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,306,1650956400"; d="scan'208";a="654595302" X-Received: from sep081ff3625096.sh.intel.com (HELO win_li.ccr.corp.intel.com) ([10.239.157.34]) by fmsmga004.fm.intel.com with ESMTP; 20 Jun 2022 02:36:25 -0700 From: "Li, Zhihao" To: devel@edk2.groups.io Cc: Michael D Kinney , Liming Gao Subject: [edk2-devel] [PATCH 1/1] MdePkg: Remove "assert" from SmmCpuRendevousLibNull.c Date: Mon, 20 Jun 2022 17:36:14 +0800 Message-Id: <20220620093615.1535-6-zhihao.li@intel.com> In-Reply-To: <20220620093615.1535-1-zhihao.li@intel.com> References: <20220620093615.1535-1-zhihao.li@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhihao.li@intel.com X-Gm-Message-State: CwOIV7DVAbzNnVckOlLN8UiAx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1655717793; bh=NZPjaBz+qSpxAoLx6ifGrqnhZbnQT4jskczkWMZzazA=; h=Cc:Date:From:Reply-To:Subject:To; b=qAf8tLBXnC+O2gyMqDELdJ9EcYc0NYIizHLQHDE+mf4Ml4X9IBEFs1GDar0VyaIc352 E+P4U/Bq9wHHGX3YCH7QtmwjuiRTm23QcYPoA9CdveKhXck3efVBQMvOw6PpcopaZkp/H x1zRj7Z0cwsXZXGVooiVEu+GADgHxcFJXlQ= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1655717794239100011 Content-Type: text/plain; charset="utf-8" From: Zhihao Li REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3931 Some drivers will break down when they use SmmWaitForAllProcessor() which from SmmCpuRendezvousLibNull.c. Removing the code "ASSERT(False)" will make consumer work normally if they keep default setting for sync mode. Cc: Michael D Kinney Cc: Liming Gao Signed-off-by: Zhihao Li Reviewed-by: Liming Gao --- MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.c | 1 - 1 file changed, 1 deletion(-) diff --git a/MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull= .c b/MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.c index 474195bbb374..769f4c673802 100644 --- a/MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.c +++ b/MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.c @@ -24,6 +24,5 @@ SmmWaitForAllProcessor ( IN BOOLEAN BlockingMode ) { - ASSERT (FALSE); return EFI_SUCCESS; } --=20 2.26.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#90616): https://edk2.groups.io/g/devel/message/90616 Mute This Topic: https://groups.io/mt/91873301/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Tue May 21 16:15:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+90612+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+90612+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1655717792; cv=none; d=zohomail.com; s=zohoarc; b=FgLgm03dDve9r7cA42jDhLQk8sEdC6ZPLBBduYGSTSXeaOqplqMtpYzsH4EkG0fTum4EHUfrzFoqSK38xZOiGpeS/iCJ1NAd6H+/tZ7ZkrbpI8UI7HDpALO51PhbBs9tRPT3rRsKkDATs7eYDR+Bb+eRigp7/7aIWNZNjpsAmxk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655717792; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=omDJq14t4xluLtVE+fsxTpr2FASm/esMK0+PxDbNtlg=; b=VpwMoTHk+4P/U2FNpf5KTxHPkU/tnYT/OU2hv8Ux+3P1gmiZeRAhTzmp26g/ljS90/RjlC4LIAVwGMlacsjmpVYPt9Ukp2wjYDA+sQgA/0HVqZTpSIxnoFeRSHa1/M9BqnFOQyqqJUuNseSXmSmcwuly7GBO5VJqp1R7BNOsmtw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+90612+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1655717792572746.3355429115635; Mon, 20 Jun 2022 02:36:32 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id oGm5YY1788612xGg0ftiOaGL; Mon, 20 Jun 2022 02:36:32 -0700 X-Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web09.28337.1655717789581811779 for ; Mon, 20 Jun 2022 02:36:31 -0700 X-IronPort-AV: E=McAfee;i="6400,9594,10380"; a="277399458" X-IronPort-AV: E=Sophos;i="5.92,306,1650956400"; d="scan'208";a="277399458" X-Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2022 02:36:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,306,1650956400"; d="scan'208";a="654595283" X-Received: from sep081ff3625096.sh.intel.com (HELO win_li.ccr.corp.intel.com) ([10.239.157.34]) by fmsmga004.fm.intel.com with ESMTP; 20 Jun 2022 02:36:19 -0700 From: "Li, Zhihao" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Jiewen Yao , Jordan Justen , Gerd Hoffmann , Sebastien Boeuf Subject: [edk2-devel] [PATCH 1/1] OvmfPkg: Add dependency of VariableSmm driver to make it work normally. Date: Mon, 20 Jun 2022 17:36:11 +0800 Message-Id: <20220620093615.1535-3-zhihao.li@intel.com> In-Reply-To: <20220620093615.1535-1-zhihao.li@intel.com> References: <20220620093615.1535-1-zhihao.li@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhihao.li@intel.com X-Gm-Message-State: wzNUXBwSkCDzVgWhUGDE8UVRx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1655717792; bh=QCN87fdT50ESqI1jOFDY/ibq81JPJcXXSbithZEvEQ4=; h=Cc:Date:From:Reply-To:Subject:To; b=assuAWj2UPDwPabI37D7CwqngIHTo6v2WuiS4EqEW3Q9gxVRrBdy1YKe31/EqkVvZrt yR3ackRPJgTTjVWcsTAp7M2AErhqfG0t7/L+/uTMOJwIkX3DW2OZAvHfQ5FbDcgkU/tW/ 3yPQwfBTMpg+QVUMo3cYt78pwfROVfFfYpI= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1655717794271100014 Content-Type: text/plain; charset="utf-8" From: Zhihao Li REF? https://bugzilla.tianocore.org/show_bug.cgi?id=3D3861 UefiCpuPkg define a new Protocol with the new services SmmWaitForAllProcessor(), which can be used by SMI handler to optionally wait for other APs to complete SMM rendezvous in relaxed AP mode. VariableSmm driver need use SmmCpuRendezvousLib, So add SmmCpuRendezvousLib in OvmfPkg. Cc: Ard Biesheuvel Cc: Jiewen Yao Cc: Jordan Justen Cc: Gerd Hoffmann Cc: Sebastien Boeuf Signed-off-by: Zhihao Li Acked-by: Gerd Hoffmann Reviewed-by: Jiewen Yao --- OvmfPkg/CloudHv/CloudHvX64.dsc | 1 + OvmfPkg/OvmfPkgIa32.dsc | 3 ++- OvmfPkg/OvmfPkgIa32X64.dsc | 3 ++- OvmfPkg/OvmfPkgX64.dsc | 3 ++- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/OvmfPkg/CloudHv/CloudHvX64.dsc b/OvmfPkg/CloudHv/CloudHvX64.dsc index 380438e0dc0e..20f3bc340807 100644 --- a/OvmfPkg/CloudHv/CloudHvX64.dsc +++ b/OvmfPkg/CloudHv/CloudHvX64.dsc @@ -432,6 +432,7 @@ [LibraryClasses.common.DXE_SMM_DRIVER] !endif BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf + SmmCpuRendezvousLib|UefiCpuPkg/Library/SmmCpuRendezvousLib/SmmCpuRendezv= ousLib.inf =20 [LibraryClasses.common.SMM_CORE] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc index 2495d7786420..e4218b01f0fc 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc +++ b/OvmfPkg/OvmfPkgIa32.dsc @@ -1,7 +1,7 @@ ## @file # EFI/Framework Open Virtual Machine Firmware (OVMF) platform # -# Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.
+# Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
# Copyright (c) Microsoft Corporation. # @@ -429,6 +429,7 @@ [LibraryClasses.common.DXE_SMM_DRIVER] !endif BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf + SmmCpuRendezvousLib|UefiCpuPkg/Library/SmmCpuRendezvousLib/SmmCpuRendezv= ousLib.inf =20 [LibraryClasses.common.SMM_CORE] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc index 4e3104833871..a80cdaacb8bc 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -1,7 +1,7 @@ ## @file # EFI/Framework Open Virtual Machine Firmware (OVMF) platform # -# Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.
+# Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
# Copyright (c) Microsoft Corporation. # @@ -435,6 +435,7 @@ [LibraryClasses.common.DXE_SMM_DRIVER] !endif BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf + SmmCpuRendezvousLib|UefiCpuPkg/Library/SmmCpuRendezvousLib/SmmCpuRendezv= ousLib.inf =20 [LibraryClasses.common.SMM_CORE] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index f72f8c2e48fe..fb2899f8a1be 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -1,7 +1,7 @@ ## @file # EFI/Framework Open Virtual Machine Firmware (OVMF) platform # -# Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.
+# Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
# Copyright (c) Microsoft Corporation. # @@ -444,6 +444,7 @@ [LibraryClasses.common.DXE_SMM_DRIVER] !endif BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf + SmmCpuRendezvousLib|UefiCpuPkg/Library/SmmCpuRendezvousLib/SmmCpuRendezv= ousLib.inf =20 [LibraryClasses.common.SMM_CORE] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf --=20 2.26.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#90612): https://edk2.groups.io/g/devel/message/90612 Mute This Topic: https://groups.io/mt/91873297/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Tue May 21 16:15:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+90615+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+90615+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1655717794; cv=none; d=zohomail.com; s=zohoarc; b=aVwnqPaamk7W5LweNE+AoN202ZKFNt3EhKQzZLKHXitrOyuP8o9+xlXCYdfSYumosXjhPF0FP/DpygsGMbazmE2hf2ZtxJcVDj4XTgDkFQ3pdawoD+bMZGilDm1y/iZtY2ZLK5J33p/oLI29v+R0rPHuYhFxP+TELzmKsX6//FI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655717794; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=wdGZHo3OSfg+WwlSqg+XmojumU2+SwkGy85KMvXVTEw=; b=KOIa3mMS44S4Fj2psMM+ETStn7NoUif6byzau+B6tIo2a00LneIwAaTbYzMBKJWc4pXA0VnZ1GyciHiv/VbJ3ljsvTcUR3bjVq3zNxPfARvlMjDTJoakhGMAoYo+4YK+4QvAgWXiPgVtfIr5zHgOYEguANtglXQK7MPUFi1wHFM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+90615+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1655717794230679.1665021510921; Mon, 20 Jun 2022 02:36:34 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id kDtNYY1788612xXLETDqzNI6; Mon, 20 Jun 2022 02:36:33 -0700 X-Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web10.28023.1655717790205046709 for ; Mon, 20 Jun 2022 02:36:32 -0700 X-IronPort-AV: E=McAfee;i="6400,9594,10380"; a="277399468" X-IronPort-AV: E=Sophos;i="5.92,306,1650956400"; d="scan'208";a="277399468" X-Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jun 2022 02:36:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,306,1650956400"; d="scan'208";a="654595298" X-Received: from sep081ff3625096.sh.intel.com (HELO win_li.ccr.corp.intel.com) ([10.239.157.34]) by fmsmga004.fm.intel.com with ESMTP; 20 Jun 2022 02:36:22 -0700 From: "Li, Zhihao" To: devel@edk2.groups.io Cc: Michael D Kinney , Liming Gao , Eric Dong , Ray Ni , Michael Kubacki , Siyuan Fu Subject: [edk2-devel] [PATCH 1/1] MdePkg: add SmmCpuRendezvousLib.h and SmmCpuRendezvousLibNull implement. Date: Mon, 20 Jun 2022 17:36:13 +0800 Message-Id: <20220620093615.1535-5-zhihao.li@intel.com> In-Reply-To: <20220620093615.1535-1-zhihao.li@intel.com> References: <20220620093615.1535-1-zhihao.li@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhihao.li@intel.com X-Gm-Message-State: ZsRifTmdLswn2JYbgJrAcGY1x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1655717793; bh=cKCAB/GULdzOl5uYCld0AN9VsfUAVDOostJNGp3a5H4=; h=Cc:Date:From:Reply-To:Subject:To; b=FFEHty3dLvMuexKRVLlUKuW6iKq4b+b/X5RBArooxaO2YSc85QwGp+qIDTcXdqwvjXs Pjr+4TbJPhidLHSCa2lbv7MQdzDqXlfMYc5/L1sotoH2jvVqXzl8ay8DrgGVJNGrfyk9e S+SL971Fdjf9cIlzCp6m9PFsJzQN5f4JJkA= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1655717796278100026 Content-Type: text/plain; charset="utf-8" From: "Li, Zhihao" REF? https://bugzilla.tianocore.org/show_bug.cgi?id=3D3912 UefiCpuPkg define a new Protocol with the new services SmmWaitForAllProcessor(), which can be used by SMI handler to optionally wait for other APs to complete SMM rendezvous in relaxed AP mode. VariableSmm and VariableStandaloneMM driver in MdeModulePkg need to use this services but MdeModulePkg can't depend on UefiCpuPkg. Thus, the solution is moving SmmCpuRendezvouslib.h from UefiCpuPkg to MdePkg and creating SmmCpuRendezvousLib NullLib version implementation in MdePkg as dependency for the pkg that can't depend on UefiCpuPkg. Cc: Michael D Kinney Cc: Liming Gao Cc: Eric Dong Cc: Ray Ni Cc: Michael Kubacki Cc: Siyuan Fu Signed-off-by: Zhihao Li Acked-by: Liming Gao --- .../SmmCpuRendezvousLibNull.c | 29 +++++++++++++++++++ .../Include/Library/SmmCpuRendezvousLib.h | 0 .../SmmCpuRendezvousLibNull.inf | 26 +++++++++++++++++ MdePkg/MdeLibs.dsc.inc | 3 +- MdePkg/MdePkg.dec | 5 +++- MdePkg/MdePkg.dsc | 3 +- UefiCpuPkg/UefiCpuPkg.dec | 3 -- 7 files changed, 63 insertions(+), 6 deletions(-) create mode 100644 MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvous= LibNull.c rename {UefiCpuPkg =3D> MdePkg}/Include/Library/SmmCpuRendezvousLib.h (100= %) create mode 100644 MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvous= LibNull.inf diff --git a/MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull= .c b/MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.c new file mode 100644 index 000000000000..474195bbb374 --- /dev/null +++ b/MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.c @@ -0,0 +1,29 @@ +/** @file + SMM CPU Rendezvous sevice implement. + + Copyright (c) 2022, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include + +/** + This routine wait for all AP processors to arrive in SMM. + + @param[in] BlockingMode Blocking mode or non-blocking mode. + + @retval EFI_SUCCESS All avaiable APs arrived. + @retval EFI_TIMEOUT Wait for all APs until timeout. + @retval OTHER Fail to register SMM CPU Rendezvous service Protoco= l. +**/ +EFI_STATUS +EFIAPI +SmmWaitForAllProcessor ( + IN BOOLEAN BlockingMode + ) +{ + ASSERT (FALSE); + return EFI_SUCCESS; +} diff --git a/UefiCpuPkg/Include/Library/SmmCpuRendezvousLib.h b/MdePkg/Incl= ude/Library/SmmCpuRendezvousLib.h similarity index 100% rename from UefiCpuPkg/Include/Library/SmmCpuRendezvousLib.h rename to MdePkg/Include/Library/SmmCpuRendezvousLib.h diff --git a/MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull= .inf b/MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.inf new file mode 100644 index 000000000000..7c9bac9af2ff --- /dev/null +++ b/MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.inf @@ -0,0 +1,26 @@ +## @file +# SMM CPU Rendezvous service lib. +# +# This is SMM CPU rendezvous service lib that wait for all +# APs to enter SMM mode. +# +# Copyright (c) 2022, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D SmmCpuRendezvousLibNull + FILE_GUID =3D 1e5790ea-d013-4d7b-9047-b4342a762027 + MODULE_TYPE =3D DXE_SMM_DRIVER + LIBRARY_CLASS =3D SmmCpuRendezvousLib|MM_STANDALONE DXE= _SMM_DRIVER + +[Sources] + SmmCpuRendezvousLibNull.c + +[Packages] + MdePkg/MdePkg.dec + +[LibraryClasses] + DebugLib diff --git a/MdePkg/MdeLibs.dsc.inc b/MdePkg/MdeLibs.dsc.inc index 015ce46f7d3b..fc6f385b304d 100644 --- a/MdePkg/MdeLibs.dsc.inc +++ b/MdePkg/MdeLibs.dsc.inc @@ -5,7 +5,7 @@ # by using "!include MdePkg/MdeLibs.dsc.inc" to specify the library instan= ces # of some EDKII basic/common library classes. # -# Copyright (c) 2021, Intel Corporation. All rights reserved.
+# Copyright (c) 2021 - 2022, Intel Corporation. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -14,3 +14,4 @@ [LibraryClasses] RegisterFilterLib|MdePkg/Library/RegisterFilterLibNull/RegisterFilterLib= Null.inf CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf + SmmCpuRendezvousLib|MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezv= ousLibNull.inf diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index faeb28c80cbd..f1ebf9e251c1 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -4,7 +4,7 @@ # It also provides the definitions(including PPIs/PROTOCOLs/GUIDs) of # EFI1.10/UEFI2.7/PI1.7 and some Industry Standards. # -# Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2022, Intel Corporation. All rights reserved.
# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
# (C) Copyright 2016 - 2021 Hewlett Packard Enterprise Development LP
# @@ -272,6 +272,9 @@ [LibraryClasses] # CcProbeLib|Include/Library/CcProbeLib.h =20 + ## @libraryclass Provides function for SMM CPU Rendezvous Library. + SmmCpuRendezvousLib|Include/Library/SmmCpuRendezvousLib.h + [LibraryClasses.IA32, LibraryClasses.X64, LibraryClasses.AARCH64] ## @libraryclass Provides services to generate random number. # diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc index c8d282882ec1..3d8874e64782 100644 --- a/MdePkg/MdePkg.dsc +++ b/MdePkg/MdePkg.dsc @@ -1,7 +1,7 @@ ## @file # EFI/PI MdePkg Package # -# Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2022, Intel Corporation. All rights reserved.
# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
# (C) Copyright 2020 Hewlett Packard Enterprise Development LP
# @@ -131,6 +131,7 @@ [Components] =20 MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf + MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.inf =20 [Components.IA32, Components.X64, Components.ARM, Components.AARCH64] # diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec index 525cde463435..1951eb294c6c 100644 --- a/UefiCpuPkg/UefiCpuPkg.dec +++ b/UefiCpuPkg/UefiCpuPkg.dec @@ -62,9 +62,6 @@ [LibraryClasses.IA32, LibraryClasses.X64] ## @libraryclass Provides function for loading microcode. MicrocodeLib|Include/Library/MicrocodeLib.h =20 - ## @libraryclass Provides function for SMM CPU Rendezvous Library. - SmmCpuRendezvousLib|Include/Library/SmmCpuRendezvousLib.h - [Guids] gUefiCpuPkgTokenSpaceGuid =3D { 0xac05bf33, 0x995a, 0x4ed4, { 0xaa,= 0xb8, 0xef, 0x7a, 0xe8, 0xf, 0x5c, 0xb0 }} gMsegSmramGuid =3D { 0x5802bce4, 0xeeee, 0x4e33, { 0xa1,= 0x30, 0xeb, 0xad, 0x27, 0xf0, 0xe4, 0x39 }} --=20 2.26.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#90615): https://edk2.groups.io/g/devel/message/90615 Mute This Topic: https://groups.io/mt/91873300/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-