From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web11.2038.1587718060043192900 for ; Fri, 24 Apr 2020 01:47:40 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: eric.dong@intel.com) IronPort-SDR: yKJ5bVIqnE+Gub8ZRGojNuWUfvc1rAY1G5C+EHRpuHCgJW6uAj0ODulstUJ5ObK0rdXtP4NMpN pkzyjOaaFlMw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2020 01:47:39 -0700 IronPort-SDR: latXfLx5wG8Px8EbrYOgAIqFtPm36B8LZojJvyFS5H/sj1mueeKRhIJQJUCcorKsjB6lWTkEbm ZOlWGMvugeyw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,311,1583222400"; d="scan'208";a="457837082" Received: from ydong10-desktop.ccr.corp.intel.com ([10.239.158.133]) by fmsmga006.fm.intel.com with ESMTP; 24 Apr 2020 01:47:21 -0700 From: "Dong, Eric" To: devel@edk2.groups.io Cc: "Dong, Eric" , Laszlo Ersek , Chandana Kumar , Ray Ni Subject: [PATCH v3 2/2] UefiCpuPkg/MpInitLib: Avoid ApInitReconfig in PEI. Date: Fri, 24 Apr 2020 16:47:16 +0800 Message-Id: <20200424084716.877-3-eric.dong@intel.com> X-Mailer: git-send-email 2.23.0.windows.1 In-Reply-To: <20200424084716.877-1-eric.dong@intel.com> References: <20200424084716.877-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: Laszlo Ersek Cc: Chandana Kumar Signed-off-by: Eric Dong Reviewed-by: Ray Ni --- 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 7fd757b428..64528fd1e7 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -1820,7 +1820,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 @@ -1828,7 +1835,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