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.web12.27061.1650876451337106574 for ; Mon, 25 Apr 2022 01:47:32 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=KlR/euT2; 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=1650876451; x=1682412451; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=KJrnr6nTaMcFOV7mlCMUzN7FCU0Tl5XYx12e/IEFxMo=; b=KlR/euT2BLAKZKZRrzWmDV3fn05IWJNCfsFVt+v4+cdZOYGn7WPfcQaS dEu2O1ho7EnJdJzRRlu/t58evhZ1TqKk6303xVhxNBQ571hYiuG8fwZSZ 1xY2fOT86Yak5cSsMXr71ZTV2N+PnibQ8SAbaARlJ6Cx+huIdWTM8OgqA h2818sBsPC+Cu6Hxauok5++z3Twj6Eq6YHceWERTnDXnOsaEEbCG5s+vu nN1KEkX3PoqnOFdpbvAVsGYNr+zdzfHyb5A948T2gxwYbTj5vFfsWEOxV HOO+pyh+SsD0dCbCWl3Kor6cH55Fhjyn6/u9iOh4eeIezie3xiXOqFLfE w==; X-IronPort-AV: E=McAfee;i="6400,9594,10327"; a="264704442" X-IronPort-AV: E=Sophos;i="5.90,287,1643702400"; d="scan'208";a="264704442" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Apr 2022 01:47:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,287,1643702400"; d="scan'208";a="512551085" Received: from win_li.ccr.corp.intel.com ([10.239.157.34]) by orsmga003.jf.intel.com with ESMTP; 25 Apr 2022 01:47:28 -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 v2 1/1] MdePkg: add SmmCpuRendezvousLib.h and SmmCpuRendezvousLibNull implement. Date: Mon, 25 Apr 2022 16:47:27 +0800 Message-Id: <20220425084727.1351-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 REF=EF=BC=9A 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 --- MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.c | 29 ++= ++++++++++++++++++ {UefiCpuPkg =3D> MdePkg}/Include/Library/SmmCpuRendezvousLib.h | 0 MdePkg/Library/SmmCpuRendezvousLibNull/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(-) 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 3c70daf87a0c..9d7b234b8565 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 @@ -13,3 +13,4 @@ =0D [LibraryClasses]=0D RegisterFilterLib|MdePkg/Library/RegisterFilterLibNull/RegisterFilterLib= Null.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 @@ #=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 @@ =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 @@ ## @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