From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web08.1459.1665208669836692295 for ; Fri, 07 Oct 2022 22:57:50 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=kfw+t6pN; spf=pass (domain: intel.com, ip: 192.55.52.43, 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=1665208669; x=1696744669; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Jym33F43h2+1d1FtDfo1Nz9AzA7JvgMuqLrtIiPsx1w=; b=kfw+t6pNaS1OJlh9TqN1Na6MtTcWnVMFE1KVSDPfitcmfAPKnQlcJkWK tQKgkiCAxyTttxFvx7bCbZCFbsMVA20Wspqvb+Akqr8+11Lrb+asVZvh0 gOtUAlsXMmdksy5+jt/HR4Sw1hMB5aU9pKSXZWXGlhymol/38iL9Acc0y RRxwklG3K0OZD4MVI52pHnvhcoWBKvsk4got7yDuTYpG8DNbYyVXHF+X8 fM9ezOZs74Te+vL9akCuvN1Q3jjuP+a0pRWkiflNRC5u+kpVFRcXMjxpf fmxlXVWOmgr7S+tjBrlcbN7AHdW+4B8g/FWTUk1R/rX5+9XDBo95RPgNb w==; X-IronPort-AV: E=McAfee;i="6500,9779,10493"; a="390199508" X-IronPort-AV: E=Sophos;i="5.95,168,1661842800"; d="scan'208";a="390199508" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Oct 2022 22:57:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10493"; a="658580368" X-IronPort-AV: E=Sophos;i="5.95,168,1661842800"; d="scan'208";a="658580368" Received: from win_li.ccr.corp.intel.com ([10.239.157.44]) by orsmga001.jf.intel.com with ESMTP; 07 Oct 2022 22:57:47 -0700 From: "Li, Zhihao" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni Subject: [PATCH v2 1/1] UefiCpuPkg: Reset a parameter when BSP Exit in CPU relaxed mode. Date: Sat, 8 Oct 2022 13:57:46 +0800 Message-Id: <20221008055746.1599-1-zhihao.li@intel.com> X-Mailer: git-send-email 2.26.2.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Zhihao Li REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4083 In CPU relaxed mode, it doesn't reset the value of mSmmMpSyncData->AllApArrivedWithException when BSP exit smm mode. So this patch will reset this variable. Modified the flow of SmmCpuRendezvous to avoid enter SmmWaitForApArrival repeatedly. Cc: Eric Dong Cc: Ray Ni Signed-off-by: Zhihao Li --- UefiCpuPkg/PiSmmCpuDxeSmm/CpuService.c | 17 ++++++++++++----- UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 5 +++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuService.c b/UefiCpuPkg/PiSmmCpuDx= eSmm/CpuService.c index 2ebf4543c3ed..368bacd29ea1 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuService.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuService.c @@ -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 diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c b/UefiCpuPkg/PiSmmCpuDxe= Smm/MpService.c index 13c2cb8da4c3..c79da418e37c 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c @@ -696,8 +696,9 @@ BSPHandler ( //=0D // Allow APs to check in from this point on=0D //=0D - *mSmmMpSyncData->Counter =3D 0;=0D - *mSmmMpSyncData->AllCpusInSync =3D FALSE;=0D + *mSmmMpSyncData->Counter =3D 0;=0D + *mSmmMpSyncData->AllCpusInSync =3D FALSE;=0D + mSmmMpSyncData->AllApArrivedWithException =3D FALSE;=0D }=0D =0D /**=0D --=20 2.26.2.windows.1