From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com []) by mx.groups.io with SMTP id smtpd.web11.2872.1587546075137554060 for ; Wed, 22 Apr 2020 02:01:16 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: eric.dong@intel.com) IronPort-SDR: jB2I55MNsQa0DfNmYPKApWtcGBJ6X9rMcGntZAsw3zu3HEjaxQ1c2PjrnU0dSvFITHcgaYAlQT idm1Tj65VUrQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Apr 2020 02:01:15 -0700 IronPort-SDR: uf5ArGCl3ceY0O8SrKGyfUjGcOmEIUYKLwuVFQ8HfdDhf82BffG0d+K0PD/v7BSd4lUc8k360K mYZeFJmk6XPg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,413,1580803200"; d="scan'208";a="402476182" Received: from ydong10-desktop.ccr.corp.intel.com ([10.239.158.133]) by orsmga004.jf.intel.com with ESMTP; 22 Apr 2020 02:01:14 -0700 From: "Dong, Eric" To: devel@edk2.groups.io Cc: "Dong, Eric" , Ray Ni , Laszlo Ersek , Chandana Kumar Subject: [PATCH v2 2/2] UefiCpuPkg/MpInitLib: Avoid ApInitReconfig in PEI. Date: Wed, 22 Apr 2020 17:01:11 +0800 Message-Id: <20200422090111.423-2-eric.dong@intel.com> X-Mailer: git-send-email 2.23.0.windows.1 In-Reply-To: <20200422090111.423-1-eric.dong@intel.com> References: <20200422090111.423-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 1. Enhance code to remove CpuMpData->ApLoopMode =3D=3D ApInHltLoop check.=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