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.web10.44141.1683184024086720747 for ; Thu, 04 May 2023 00:07:04 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=FbjLmvit; 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=1683184024; x=1714720024; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=OEeKYfCUd8i605iOKPqMj4DQzsFjkzs79TATgu0RhjI=; b=FbjLmvitc0/PvhNpYTx6WDopIpUjs5k0kkDBCOJLGKi5G4ohhzKcd/NB aKo0k8+pATylnuWBunRmoV2R1Xj6dgmTUcZHT80psNe1v+2DN4bO+MCEI fjK7K//oS+OGsi/B1gyWtzcVyC3w4HUR0bUyI0VLJ7es1UjHY+XhbKWJr 5w9QM5KOWu4UH10CHSe/ea4/iW8NOA3/kkUvVh/QRu2rLnBEhM3RdOt5D X8xkCTtvJqeT3TzVQzMpI5FWznFm1nPkwSkSKkRsse2wtbZVK2qsHKtu+ pGQOE73yvYO45BUDklpmJIldUhU54efVAJesqJnmX75f5BX+rePl5k917 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10699"; a="348895413" X-IronPort-AV: E=Sophos;i="5.99,249,1677571200"; d="scan'208";a="348895413" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 May 2023 00:06:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10699"; a="729683000" X-IronPort-AV: E=Sophos;i="5.99,249,1677571200"; d="scan'208";a="729683000" Received: from win_li.ccr.corp.intel.com ([10.239.157.27]) by orsmga001.jf.intel.com with ESMTP; 04 May 2023 00:06:53 -0700 From: "Li, Zhihao" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni Subject: [PATCH v2 1/1] UefiCpuPkg/PiSmmCpuDxeSmm:add Ap Rendezvous check in PerformRemainingTasks. Date: Thu, 4 May 2023 15:06:53 +0800 Message-Id: <20230504070653.458-1-zhihao.li@intel.com> X-Mailer: git-send-email 2.26.2.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4424 In Relaxed-AP Sync Mode, BSP will not wait for all Aps arrive. However, PerformRemainingTasks() needs to wait all Aps arrive before calling SetMemMapAttributes and ConfigSmmCodeAccessCheck() when mSmmReadyToLock is true. In SetMemMapAttributes(), SmmSetMemoryAttributesEx() will call FlushTlbForAll() that need to start up the aps. So it need to let all aps arrive. Same as SetMemMapAttributes(), ConfigSmmCodeAccessCheck() also will start up the aps. Cc: Eric Dong Cc: Ray Ni Signed-off-by: Zhihao Li --- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c b/UefiCpuPkg/PiSmmC= puDxeSmm/PiSmmCpuDxeSmm.c index 655175a2c6db..1e210beb0e06 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c @@ -1,7 +1,7 @@ /** @file=0D Agent Module to load other modules to deploy SMM Entry Vector for X86 CPU.= =0D =0D -Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.
=0D +Copyright (c) 2009 - 2023, Intel Corporation. All rights reserved.
=0D Copyright (c) 2017, AMD Incorporated. All rights reserved.
=0D =0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D @@ -1441,6 +1441,19 @@ PerformRemainingTasks ( )=0D {=0D if (mSmmReadyToLock) {=0D + //=0D + // Check if all Aps enter SMM. In Relaxed-AP Sync Mode, BSP will not w= ait for=0D + // all Aps arrive. However,PerformRemainingTasks() needs to wait all A= ps arrive before calling=0D + // SetMemMapAttributes() and ConfigSmmCodeAccessCheck() when mSmmReady= ToLock=0D + // is true. In SetMemMapAttributes(), SmmSetMemoryAttributesEx() will = call=0D + // FlushTlbForAll() that need to start up the aps. So it need to let a= ll=0D + // aps arrive. Same as SetMemMapAttributes(), ConfigSmmCodeAccessCheck= ()=0D + // also will start up the aps.=0D + //=0D + if (EFI_ERROR (SmmCpuRendezvous (NULL, TRUE))) {=0D + DEBUG ((DEBUG_ERROR, "PerformRemainingTasks: fail to wait for all AP= check in SMM!\n"));=0D + }=0D +=0D //=0D // Start SMM Profile feature=0D //=0D --=20 2.26.2.windows.1