From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web09.6630.1650622020444630192 for ; Fri, 22 Apr 2022 03:07:01 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=MjICdtzi; spf=pass (domain: intel.com, ip: 134.134.136.65, 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=1650622020; x=1682158020; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=yHDl2CGmToYRFET1HmYOsyHaPXjfTn91AJIhq2TeeL8=; b=MjICdtzipPxboL5B8wu7GrHBHS+a55v7BDDK4t8ILPOVgXCfJUvU0CLT 4OWjUDtPJ2gumAHcqRu5QNrrBLCXYTAohjsfHfPnkNA8WdWnxjHc3H/KH uNEm0tTdJco4t1r1k14a/I1LNDJa5ktJ1+hdFz4oQOTUxDjScpZrruHB2 O+tq01JV9fJAG9rlQE3uZDvsfBNvSaxPb4FBVtBXkJeAyWpiph5eUVW3E EzY9Kr/l9jy8sGgTKyl3yTQBCBSkqu1FYO9E2MNeaJ5z9rw1uZ//jHwip ohfTwJyr31VpidHeR3ocncdkLPG/Gb/b0LypG+I8xQ0gkADkNpTq0Q5Gx A==; X-IronPort-AV: E=McAfee;i="6400,9594,10324"; a="264413384" X-IronPort-AV: E=Sophos;i="5.90,281,1643702400"; d="scan'208";a="264413384" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Apr 2022 03:06:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,281,1643702400"; d="scan'208";a="511507649" Received: from win_li.ccr.corp.intel.com ([10.239.157.34]) by orsmga003.jf.intel.com with ESMTP; 22 Apr 2022 03:06:57 -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 v1 1/1] MdePkg: add SmmCpuRendezvousLib.h and SmmCpuRendezvousLibNull implement. Date: Fri, 22 Apr 2022 18:06:56 +0800 Message-Id: <20220422100656.1184-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/MdePkg.dec | 3 ++ MdePkg/MdePkg.dsc | 1 + UefiCpuPkg/UefiCpuPkg.dec | 3 -- 6 files changed, 59 insertions(+), 3 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/MdePkg.dec b/MdePkg/MdePkg.dec index faeb28c80cbd..85a4398e8f65 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -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..5e2ea32088fa 100644 --- a/MdePkg/MdePkg.dsc +++ b/MdePkg/MdePkg.dsc @@ -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