From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 387251A1E3A for ; Wed, 24 Aug 2016 07:45:29 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP; 24 Aug 2016 07:45:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,570,1464678000"; d="scan'208";a="160352184" Received: from jfan12-desk.ccr.corp.intel.com ([10.239.9.5]) by fmsmga004.fm.intel.com with ESMTP; 24 Aug 2016 07:45:28 -0700 From: Jeff Fan To: edk2-devel@lists.01.org Cc: Michael Kinney , Feng Tian Date: Wed, 24 Aug 2016 22:45:19 +0800 Message-Id: <1472049924-8228-2-git-send-email-jeff.fan@intel.com> X-Mailer: git-send-email 2.7.4.windows.1 In-Reply-To: <1472049924-8228-1-git-send-email-jeff.fan@intel.com> References: <1472049924-8228-1-git-send-email-jeff.fan@intel.com> Subject: [Patch 1/6] UefiCpuPkg/MpInitLib: Move timeout delay to WakupAp() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Aug 2016 14:45:29 -0000 After sending the 1st broadcast INIT-SIPI-SIPI, BSP will collect APs count after one specified timeout delay. However, WakupAp() will restore reset vector immediately after sending 1st broadcast INIT-SIPI-SIPI. Some processors may not complete executing reset vector code. This fix is to move MicroSecondDelay() from CollectProcessorCount() to the place that is after sending 1st broadcast INIT-SIPI-SIPI and before FreeResetVector() in WakupAp(). Cc: Michael Kinney Cc: Feng Tian Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan --- UefiCpuPkg/Library/MpInitLib/MpLib.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c index fbe2e8b..47a971b 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -513,10 +513,6 @@ CollectProcessorCount ( CpuMpData->InitFlag = ApInitConfig; CpuMpData->X2ApicEnable = FALSE; WakeUpAP (CpuMpData, TRUE, 0, NULL, NULL); - // - // Wait for AP task to complete and then exit. - // - MicroSecondDelay (PcdGet32(PcdCpuApInitTimeOutInMicroSeconds)); CpuMpData->InitFlag = ApInitDone; ASSERT (CpuMpData->CpuCount <= PcdGet32 (PcdCpuMaxLogicalProcessorNumber)); // @@ -863,7 +859,12 @@ WakeUpAP ( // SendInitSipiSipiAllExcludingSelf ((UINT32) ExchangeInfo->BufferStart); } - if (CpuMpData->InitFlag != ApInitConfig) { + if (CpuMpData->InitFlag == ApInitConfig) { + // + // Wait for all potential APs waken up in one specified period + // + MicroSecondDelay (PcdGet32(PcdCpuApInitTimeOutInMicroSeconds)); + } else { // // Wait all APs waken up if this is not the 1st broadcast of SIPI // -- 2.7.4.windows.1