From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com []) by mx.groups.io with SMTP id smtpd.web11.2717.1587545162325592913 for ; Wed, 22 Apr 2020 01:46:05 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: eric.dong@intel.com) IronPort-SDR: rSkBL8AcnRtFU4e7mOt71wGZuEo6SgbySYWUPBjL2zBfJIXlMYivlZEykXy3XK9ij35lZ0C1Wg uPvFUseO0dNA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Apr 2020 01:46:04 -0700 IronPort-SDR: NjTHqFp5TFG+Nfs3JlWz+DLyFemfDyZIc/ERuwcV4c0qryb9AWTW47bnM9Zi+4ED9bdxNWG+cV J1APX/tY3lHw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,413,1580803200"; d="scan'208";a="334553960" Received: from ydong10-desktop.ccr.corp.intel.com ([10.239.158.133]) by orsmga001.jf.intel.com with ESMTP; 22 Apr 2020 01:46:03 -0700 From: "Dong, Eric" To: devel@edk2.groups.io Cc: "Dong, Eric" , Ray Ni , Laszlo Ersek , Chandana Kumar Subject: [PATCH 2/2] UefiCpuPkg/MpInitLib: Avoid ApInitReconfig in PEI. Date: Wed, 22 Apr 2020 16:45:58 +0800 Message-Id: <20200422084558.623-3-eric.dong@intel.com> X-Mailer: git-send-email 2.23.0.windows.1 In-Reply-To: <20200422084558.623-1-eric.dong@intel.com> References: <20200422084558.623-1-eric.dong@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: "Dong, Eric" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2683 In PEI phase, AP already been waked up through ApInitConfig, so it can directly wake up it through change wakup buffer instead of use ApInitReconfig flag. It can save some time. Change code to only use ApInitReconfig flag in DXE phase which must need to update the wake up buffer. Cc: Ray Ni Cc: Laszlo Ersek Cc: Chandana Kumar Signed-off-by: Eric Dong ---=0D V2:=0D Enhance the code comments.=0D UefiCpuPkg/Library/MpInitLib/MpLib.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpIn= itLib/MpLib.c index 2e87aa1f06..6d3a0ccc72 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -1818,7 +1818,14 @@ MpInitLibInitialize ( // Wakeup APs to do some AP initialize sync (Microcode & MTRR)=0D //=0D if (CpuMpData->CpuCount > 1) {=0D - CpuMpData->InitFlag =3D ApInitReconfig;=0D + if (OldCpuMpData !=3D NULL) {=0D + //=0D + // Only needs to use this flag for DXE phase to update the wake up=0D + // buffer. Wakeup buffer allocated in PEI phase is no longer valid=0D + // in DXE.=0D + //=0D + CpuMpData->InitFlag =3D ApInitReconfig;=0D + }=0D WakeUpAP (CpuMpData, TRUE, 0, ApInitializeSync, CpuMpData, TRUE);=0D //=0D // Wait for all APs finished initialization=0D @@ -1826,7 +1833,9 @@ MpInitLibInitialize ( while (CpuMpData->FinishedCount < (CpuMpData->CpuCount - 1)) {=0D CpuPause ();=0D }=0D - CpuMpData->InitFlag =3D ApInitDone;=0D + if (OldCpuMpData !=3D NULL) {=0D + CpuMpData->InitFlag =3D ApInitDone;=0D + }=0D for (Index =3D 0; Index < CpuMpData->CpuCount; Index++) {=0D SetApState (&CpuMpData->CpuData[Index], CpuStateIdle);=0D }=0D --=20 2.23.0.windows.1