From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=RZBfBJUV; spf=pass (domain: intel.com, ip: 192.55.52.93, 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=1655717791; x=1687253791; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=r6oG8XQwi5qpnXqoUP3toPSnp8Lxf9htdU0Hz7eV4tc=; b=RZBfBJUVG+yDdo0L4LCbpY0LQaR/AWu1CM0s7QiMx7eWwofCjazvHd+A fj+nDwsE+N6ymk6O2DENfKMV786p1SXbtauvc1i5GZYRIyjCIVEBZKa2j 7KyYHgl8Zoy1POtMTvK5cPGllaF5TRi/uut5kLFg9LYETM28cbStBdLCC 428EObXkgZKltFegLkJez0M+b2z40KDIbfYJvLo9sHKSlX0YYOk7rANnY ANHB0gTGCMDzEyghqSCS+qf3eppn8uUXjKtYWcdr6X7Y/LLWrpFuhVVIe Qnvo+0dcVJ3gL1IakzkfyCGV6vfjqewYE3wwxo4X3A5s8ZnWdyqgr93Rg Q==; 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" 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" 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: [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> X-Mailer: git-send-email 2.26.2.windows.1 In-Reply-To: <20220620093615.1535-1-zhihao.li@intel.com> References: <20220620093615.1535-1-zhihao.li@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=0D + SMM CPU Rendezvous sevice implement.=0D +=0D + Copyright (c) 2022, Intel Corporation. All rights reserved.
=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#include =0D +#include =0D +=0D +/**=0D + This routine wait for all AP processors to arrive in SMM.=0D +=0D + @param[in] BlockingMode Blocking mode or non-blocking mode.=0D +=0D + @retval EFI_SUCCESS All avaiable APs arrived.=0D + @retval EFI_TIMEOUT Wait for all APs until timeout.=0D + @retval OTHER Fail to register SMM CPU Rendezvous service Protoco= l.=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +SmmWaitForAllProcessor (=0D + IN BOOLEAN BlockingMode=0D + )=0D +{=0D + ASSERT (FALSE);=0D + return EFI_SUCCESS;=0D +}=0D 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=0D +# SMM CPU Rendezvous service lib.=0D +#=0D +# This is SMM CPU rendezvous service lib that wait for all=0D +# APs to enter SMM mode.=0D +#=0D +# Copyright (c) 2022, Intel Corporation. All rights reserved.
=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +##=0D +=0D +[Defines]=0D + INF_VERSION =3D 0x00010005=0D + BASE_NAME =3D SmmCpuRendezvousLibNull=0D + FILE_GUID =3D 1e5790ea-d013-4d7b-9047-b4342a762027= =0D + MODULE_TYPE =3D DXE_SMM_DRIVER=0D + LIBRARY_CLASS =3D SmmCpuRendezvousLib|MM_STANDALONE DXE= _SMM_DRIVER=0D +=0D +[Sources]=0D + SmmCpuRendezvousLibNull.c=0D +=0D +[Packages]=0D + MdePkg/MdePkg.dec=0D +=0D +[LibraryClasses]=0D + DebugLib=0D 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=0D # of some EDKII basic/common library classes.=0D #=0D -# Copyright (c) 2021, Intel Corporation. All rights reserved.
=0D +# Copyright (c) 2021 - 2022, Intel Corporation. All rights reserved.
=0D #=0D # SPDX-License-Identifier: BSD-2-Clause-Patent=0D #=0D @@ -14,3 +14,4 @@ [LibraryClasses]=0D RegisterFilterLib|MdePkg/Library/RegisterFilterLibNull/RegisterFilterLib= Null.inf=0D CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf=0D + SmmCpuRendezvousLib|MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezv= ousLibNull.inf=0D 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=0D # EFI1.10/UEFI2.7/PI1.7 and some Industry Standards.=0D #=0D -# Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.
=0D +# Copyright (c) 2007 - 2022, Intel Corporation. All rights reserved.
=0D # Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
= =0D # (C) Copyright 2016 - 2021 Hewlett Packard Enterprise Development LP
= =0D #=0D @@ -272,6 +272,9 @@ [LibraryClasses] #=0D CcProbeLib|Include/Library/CcProbeLib.h=0D =0D + ## @libraryclass Provides function for SMM CPU Rendezvous Library.=0D + SmmCpuRendezvousLib|Include/Library/SmmCpuRendezvousLib.h=0D +=0D [LibraryClasses.IA32, LibraryClasses.X64, LibraryClasses.AARCH64]=0D ## @libraryclass Provides services to generate random number.=0D #=0D 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=0D # EFI/PI MdePkg Package=0D #=0D -# Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.
=0D +# Copyright (c) 2007 - 2022, Intel Corporation. All rights reserved.
=0D # Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
= =0D # (C) Copyright 2020 Hewlett Packard Enterprise Development LP
=0D #=0D @@ -131,6 +131,7 @@ [Components] =0D MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf=0D MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf=0D + MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.inf=0D =0D [Components.IA32, Components.X64, Components.ARM, Components.AARCH64]=0D #=0D 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.=0D MicrocodeLib|Include/Library/MicrocodeLib.h=0D =0D - ## @libraryclass Provides function for SMM CPU Rendezvous Library.=0D - SmmCpuRendezvousLib|Include/Library/SmmCpuRendezvousLib.h=0D -=0D [Guids]=0D gUefiCpuPkgTokenSpaceGuid =3D { 0xac05bf33, 0x995a, 0x4ed4, { 0xaa,= 0xb8, 0xef, 0x7a, 0xe8, 0xf, 0x5c, 0xb0 }}=0D gMsegSmramGuid =3D { 0x5802bce4, 0xeeee, 0x4e33, { 0xa1,= 0x30, 0xeb, 0xad, 0x27, 0xf0, 0xe4, 0x39 }}=0D --=20 2.26.2.windows.1