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.web10.11601.1683707889733929352 for ; Wed, 10 May 2023 01:38:10 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=VRkEMsJd; 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=1683707889; x=1715243889; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=iqwAeV0v4yo8A1DcpqnJ4tbS2NL7ZE5uPTmKRBVs+GI=; b=VRkEMsJdg1toREYWAerw+U2AqQ+H/33InqzT0fL++jHT3ssPJOCxEKvY vjmyeulWatvomlNDooT+PS+ndBTj3feG09RAKzAUMED0eOAGmABSKD/16 Oxm+WKOI//ORUaJJfqHUjsuIUx5dDtDtRBHwf4WRG/s7LqoelD806Swi4 9v1kkIOyFfnNELrPcPNJQs7S2Hfc+7HAku29O8rq5Inb9M7s1+iaYrxTN ERxgi+Dpufsgy8fTpx9JLrp+sGnBzsMaR1PNvB8zc/glDJvEMBTco3d77 Ia8x39+cibwIVXzcRjmxhvK5JD4uKdJAi1vbdGGf0CiJlY2zKCJeoOIpq w==; X-IronPort-AV: E=McAfee;i="6600,9927,10705"; a="352350064" X-IronPort-AV: E=Sophos;i="5.99,264,1677571200"; d="scan'208";a="352350064" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2023 01:38:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10705"; a="729862731" X-IronPort-AV: E=Sophos;i="5.99,264,1677571200"; d="scan'208";a="729862731" Received: from win_li.ccr.corp.intel.com ([10.239.157.27]) by orsmga008.jf.intel.com with ESMTP; 10 May 2023 01:38:04 -0700 From: "Li, Zhihao" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni Subject: [PATCH v1 1/1] UefiCpuPkg/CpuService.c:check cpu sync mode in SmmCpuRendezvous() Date: Wed, 10 May 2023 16:38:03 +0800 Message-Id: <20230510083803.564-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=3D4431 In Ap relaxed mode, some SMI handlers should call SmmWaitForApArrival() to = let all ap arrive in SmmCpuRendezvous(). But in traditional mode, these SMI= handlers don't need to call SmmWaitForApArrival() again. So it need to be = check cpu sync mode before calling SmmWaitForApArrival(). Cc: Eric Dong Cc: Ray Ni Signed-off-by: Zhihao Li --- UefiCpuPkg/PiSmmCpuDxeSmm/CpuService.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuService.c b/UefiCpuPkg/PiSmmCpuDx= eSmm/CpuService.c index 2ebf4543c3ed..391b64e9f222 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuService.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuService.c @@ -1,7 +1,7 @@ /** @file=0D Implementation of SMM CPU Services Protocol.=0D =0D -Copyright (c) 2011 - 2022, Intel Corporation. All rights reserved.
=0D +Copyright (c) 2011 - 2023, Intel Corporation. All rights reserved.
=0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D =0D **/=0D @@ -421,11 +421,18 @@ SmmCpuRendezvous ( goto ON_EXIT;=0D }=0D =0D - //=0D - // There are some APs outside SMM, Wait for all avaiable APs to arrive.= =0D - //=0D - SmmWaitForApArrival ();=0D - Status =3D mSmmMpSyncData->AllApArrivedWithException ? EFI_SUCCESS : EFI= _TIMEOUT;=0D + if ((mSmmMpSyncData->EffectiveSyncMode !=3D SmmCpuSyncModeTradition) && = !SmmCpuFeaturesNeedConfigureMtrrs ()) {=0D + //=0D + // There are some APs outside SMM, Wait for all avaiable APs to arrive= .=0D + //=0D + SmmWaitForApArrival ();=0D + Status =3D mSmmMpSyncData->AllApArrivedWithException ? EFI_SUCCESS : E= FI_TIMEOUT;=0D + } else {=0D + //=0D + // BSP has already waitted for APs to arrive SMM if SmmCpuSyncMode sel= ected or need config MTRR.=0D + //=0D + Status =3D EFI_TIMEOUT;=0D + }=0D =0D ON_EXIT:=0D if (!mSmmMpSyncData->AllApArrivedWithException) {=0D --=20 2.26.2.windows.1