From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com []) by mx.groups.io with SMTP id smtpd.web10.3030.1587519300506659025 for ; Tue, 21 Apr 2020 18:35:03 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: eric.dong@intel.com) IronPort-SDR: nfnyK2ZTkgxuwQH3wIZ4VnHYV6L5rtDbfY/10CldLeTU3SGsrbypVecvhJxuNvwVhxFHhXuqiL qe/JajfU4Gqw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Apr 2020 18:35:02 -0700 IronPort-SDR: RjDd0MhRwLMOkRUhkp5MFaQwvDefjTaWntPpFRNStcuWR7dWqXQ/Vn+HcOUCxN0DJBzWKyXEVr yL7DrKDFNxQg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,412,1580803200"; d="scan'208";a="429730969" Received: from ydong10-desktop.ccr.corp.intel.com ([10.239.158.133]) by orsmga005.jf.intel.com with ESMTP; 21 Apr 2020 18:35:01 -0700 From: "Dong, Eric" To: devel@edk2.groups.io Cc: Ray Ni , Laszlo Ersek , Chandana Kumar Subject: [PATCH 2/2] UefiCpuPkg/MpInitLib: Avoid ApInitReconfig in PEI. Date: Wed, 22 Apr 2020 09:34:56 +0800 Message-Id: <20200422013456.1053-3-eric.dong@intel.com> X-Mailer: git-send-email 2.23.0.windows.1 In-Reply-To: <20200422013456.1053-1-eric.dong@intel.com> References: <20200422013456.1053-1-eric.dong@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2683=0D 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 --- 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 ac7f92fd48..644971b68f 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -1819,7 +1819,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. Current been used wake up buffer is allocated in PEI phas= e=0D + // and no long valid at this time.=0D + //=0D + CpuMpData->InitFlag =3D ApInitReconfig;=0D + }=0D WakeUpAP (CpuMpData, TRUE, 0, ApInitializeSync, CpuMpData, TRUE);=0D //=0D // Wait for all APs finished initialization=0D @@ -1827,7 +1834,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