From nobody Thu May 2 22:08:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+44017+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+44017+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1563521297; cv=none; d=zoho.com; s=zohoarc; b=eK2DgW5Km86wzbsilFojoClLc4gShsdU6rsfV9vpGxmY+5Ssc7z2+iq0zMmZdprBf2Xby/eTqYGJ8ymWketoxhAnuiE8UfoeV6GLwrRIjeSw3Bf0uKwpOJTw/UKLfvhwsvwV44CBy7kmpq+hVYlRusfX4TXo5Rb+sL6UcgNes8c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563521297; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=ORZgUvN4uCkahA+ut8XmivCEfHwvZHYU0fAhbQDwO9A=; b=S9jexkTp8u+pSM6EwrSUw9DyC7tRAbRUIbaLsXBHADEpYl0kUloJ19DIw5/+vpKop9MMAM4rWDH6SUGDuvJNwaSJfU2nDXewKXRs/8zAyAuEtE+oysOFqeB86VNPtY7ZaQCdUjOueHZLpELb/HA75dBgPME5RLPwD0WM89hOqXY= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+44017+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1563521297269514.3281152241191; Fri, 19 Jul 2019 00:28:17 -0700 (PDT) Return-Path: X-Received: from mga09.intel.com (mga09.intel.com []) by groups.io with SMTP; Fri, 19 Jul 2019 00:28:15 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jul 2019 00:28:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,281,1559545200"; d="scan'208";a="170828847" X-Received: from ydong10-win10.ccr.corp.intel.com ([10.239.158.133]) by orsmga003.jf.intel.com with ESMTP; 19 Jul 2019 00:28:14 -0700 From: "Dong, Eric" To: devel@edk2.groups.io Cc: Ray Ni , Laszlo Ersek , Chandana Kumar , Star Zeng Subject: [edk2-devel] [Patch 1/5] UefiCpuPkg/Include/MpInitLib.h: Add MpInitLibStartupAllCPUs API. Date: Fri, 19 Jul 2019 15:28:06 +0800 Message-Id: <20190719072811.6352-2-eric.dong@intel.com> In-Reply-To: <20190719072811.6352-1-eric.dong@intel.com> References: <20190719072811.6352-1-eric.dong@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,eric.dong@intel.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1563521296; bh=Pl69m6xdDplE5emBMwphtqdsQEWfYUtJb720YTTby7k=; h=Cc:Date:From:Reply-To:Subject:To; b=k4naZzux92eg1w697TkTkNT+XnkF161WnPTSiq4ayDVTzfHYygeWZq3U3cLH7nyhyGH a6r3LGRI0psQckLkJccnWzA0ycB4JUQ5QeUsnN/PHKArapChVTfe9DWDEajTq4KbOT054 Hg5Wu0AClmE7abKWMy5wU/lScGq2lEWHoAA= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1973 Add new MpInitLibStartupAllCPUs API uses to start all processors at the same time. Cc: Ray Ni Cc: Laszlo Ersek Cc: Chandana Kumar Cc: Star Zeng Signed-off-by: Eric Dong --- UefiCpuPkg/Include/Library/MpInitLib.h | 48 ++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/UefiCpuPkg/Include/Library/MpInitLib.h b/UefiCpuPkg/Include/Li= brary/MpInitLib.h index fa82529373..3f06dcf558 100644 --- a/UefiCpuPkg/Include/Library/MpInitLib.h +++ b/UefiCpuPkg/Include/Library/MpInitLib.h @@ -344,4 +344,52 @@ MpInitLibWhoAmI ( OUT UINTN *ProcessorNumber ); =20 +/** + This service executes a caller provided function on all enabled CPUs. + + @param[in] Procedure A pointer to the function to be run = on + enabled APs of the system. See type + EFI_AP_PROCEDURE. + @param[in] TimeoutInMicroseconds Indicates the time limit in microsec= onds for + APs to return from Procedure, either= for + blocking or non-blocking mode. Zero = means + infinity. + @param[in] ProcedureArgument The parameter passed into Procedure = for + all APs. + @param[out] FailedCpuList If NULL, this parameter is ignored. = Otherwise, + if all APs finish successfully, then= its + content is set to NULL. If not all A= Ps + finish before timeout expires, then = its + content is set to address of the buf= fer + holding handle numbers of the failed= APs. + The buffer is allocated by MP Initia= lization + library, and it's the caller's respo= nsibility to + free the buffer with FreePool() serv= ice. + In blocking mode, it is ready for co= nsumption + when the call returns. In non-blocki= ng mode, + it is ready when WaitEvent is signal= ed. The + list of failed CPU is terminated by + END_OF_CPU_LIST. + + @retval EFI_SUCCESS In blocking mode, all CPUs have finished= before + the timeout expired. + @retval EFI_SUCCESS In non-blocking mode, function has been = dispatched + to all enabled CPUs. + @retval EFI_DEVICE_ERROR Caller processor is AP. + @retval EFI_NOT_READY Any enabled APs are busy. + @retval EFI_NOT_READY MP Initialize Library is not initialized. + @retval EFI_TIMEOUT In blocking mode, the timeout expired be= fore + all enabled APs have finished. + @retval EFI_INVALID_PARAMETER Procedure is NULL. + +**/ +EFI_STATUS +EFIAPI +MpInitLibStartupAllCPUs ( + IN EFI_AP_PROCEDURE Procedure, + IN UINTN TimeoutInMicroseconds, + IN VOID *ProcedureArgument OPTIONAL, + OUT UINTN **FailedCpuList OPTIONAL + ); + #endif --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#44017): https://edk2.groups.io/g/devel/message/44017 Mute This Topic: https://groups.io/mt/32524457/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 2 22:08:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+44018+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+44018+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1563521297; cv=none; d=zoho.com; s=zohoarc; b=ONqZYzHueJUS+FDNBPFPwGEAazq75U5+kgHALqJOOld12FS2ICG8Jn1t5TshYMtypSdAqD56Y4f/5aVIN5rWOX4kwDL8sSCBDLiXKfTybR9EEWe0nKjajPuO+zSTfxNMDJoLctCGCzWyxV2yZDS5kNy//LAPret5FtOWTZl3Kjg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563521297; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=SQemUqUb1dL8FUfQi6bG0oCwuvHsuSYcsuQwDNHV/6M=; b=DmgAeQj2LapxE2N1BYbSb6H1rYOSeLQfGQl9V43p2bjrkyxec5Ag6FgXGSzbLNocHb7H7sCyD10IPk77/xwqJF3AjC06OdUtH0JVBpp22oFnIQ75Y65Wpy041OEzpXrVyrB/gimLB3x78qdLWdWfqaswKDJcKecokQhPS1/YW8o= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+44018+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1563521297879561.4178288453674; Fri, 19 Jul 2019 00:28:17 -0700 (PDT) Return-Path: X-Received: from mga09.intel.com (mga09.intel.com []) by groups.io with SMTP; Fri, 19 Jul 2019 00:28:17 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jul 2019 00:28:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,281,1559545200"; d="scan'208";a="170828856" X-Received: from ydong10-win10.ccr.corp.intel.com ([10.239.158.133]) by orsmga003.jf.intel.com with ESMTP; 19 Jul 2019 00:28:15 -0700 From: "Dong, Eric" To: devel@edk2.groups.io Cc: Ray Ni , Laszlo Ersek , Chandana Kumar , Star Zeng Subject: [edk2-devel] [Patch 2/5] UefiCpuPkg/MpInitLib: Add MpInitLibStartupAllCPUs API. Date: Fri, 19 Jul 2019 15:28:07 +0800 Message-Id: <20190719072811.6352-3-eric.dong@intel.com> In-Reply-To: <20190719072811.6352-1-eric.dong@intel.com> References: <20190719072811.6352-1-eric.dong@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,eric.dong@intel.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1563521297; bh=Det5vLbKFU8H0krJRgh7gRHD1VHP55i2xHk8x3AecxI=; h=Cc:Date:From:Reply-To:Subject:To; b=LUhjILrbGz/KjIMQptUBs9QUqTRbGCgVYGJjcP/hdDsftGiehM0akR//aNmoiAXDm1+ rZwaxbirw6ZxrsBiHiNSjSuQa0O4qEObHCGk5GIc1D2uChlVvHXIJvvQLaUfMbDXqZPhz qe+v/HEJ+l08F18Jz1X6ZCVXX7RjlaIvrGM= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1973 Add new MpInitLibStartupAllCPUs API uses to start all processors at the same time. Cc: Ray Ni Cc: Laszlo Ersek Cc: Chandana Kumar Cc: Star Zeng Signed-off-by: Eric Dong --- UefiCpuPkg/Library/MpInitLib/DxeMpLib.c | 1 + UefiCpuPkg/Library/MpInitLib/MpLib.c | 74 ++++++++++++++++++++++++- UefiCpuPkg/Library/MpInitLib/MpLib.h | 2 + UefiCpuPkg/Library/MpInitLib/PeiMpLib.c | 1 + 4 files changed, 75 insertions(+), 3 deletions(-) diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c b/UefiCpuPkg/Library/M= pInitLib/DxeMpLib.c index 6be1bae464..69c34afdf1 100644 --- a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c @@ -571,6 +571,7 @@ MpInitLibStartupAllAPs ( Status =3D StartupAllAPsWorker ( Procedure, SingleThread, + FALSE, WaitEvent, TimeoutInMicroseconds, ProcedureArgument, diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpIn= itLib/MpLib.c index 6f51bc4ebf..791f5e85ab 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -2130,6 +2130,7 @@ MpInitLibGetNumberOfProcessors ( number. If FALSE, then all the enab= led APs execute the function specified by Pr= ocedure simultaneously. + @param[in] IncludeBsp Whether let BSP also trig this task. @param[in] WaitEvent The event created by the caller with= CreateEvent() service. @param[in] TimeoutInMicroseconds Indicates the time limit in microsec= onds for @@ -2154,6 +2155,7 @@ EFI_STATUS StartupAllAPsWorker ( IN EFI_AP_PROCEDURE Procedure, IN BOOLEAN SingleThread, + IN BOOLEAN IncludeBsp, IN EFI_EVENT WaitEvent OPTIONAL, IN UINTN TimeoutInMicroseconds, IN VOID *ProcedureArgument OPTIONAL, @@ -2175,7 +2177,7 @@ StartupAllAPsWorker ( *FailedCpuList =3D NULL; } =20 - if (CpuMpData->CpuCount =3D=3D 1) { + if (CpuMpData->CpuCount =3D=3D 1 && !IncludeBsp) { return EFI_NOT_STARTED; } =20 @@ -2218,9 +2220,9 @@ StartupAllAPsWorker ( } } =20 - if (!HasEnabledAp) { + if (!HasEnabledAp && !IncludeBsp) { // - // If no enabled AP exists, return EFI_NOT_STARTED. + // If no enabled AP exists and not include Bsp to do the procedure, re= turn EFI_NOT_STARTED. // return EFI_NOT_STARTED; } @@ -2266,6 +2268,13 @@ StartupAllAPsWorker ( } } =20 + if (IncludeBsp) { + // + // Start BSP. + // + Procedure (ProcedureArgument); + } + Status =3D EFI_SUCCESS; if (WaitEvent =3D=3D NULL) { do { @@ -2411,3 +2420,62 @@ GetCpuMpDataFromGuidedHob ( return CpuMpData; } =20 +/** + This service executes a caller provided function on all enabled CPUs. + + @param[in] Procedure A pointer to the function to be run = on + enabled APs of the system. See type + EFI_AP_PROCEDURE. + @param[in] TimeoutInMicroseconds Indicates the time limit in microsec= onds for + APs to return from Procedure, either= for + blocking or non-blocking mode. Zero = means + infinity. + @param[in] ProcedureArgument The parameter passed into Procedure = for + all APs. + @param[out] FailedCpuList If NULL, this parameter is ignored. = Otherwise, + if all APs finish successfully, then= its + content is set to NULL. If not all A= Ps + finish before timeout expires, then = its + content is set to address of the buf= fer + holding handle numbers of the failed= APs. + The buffer is allocated by MP Initia= lization + library, and it's the caller's respo= nsibility to + free the buffer with FreePool() serv= ice. + In blocking mode, it is ready for co= nsumption + when the call returns. In non-blocki= ng mode, + it is ready when WaitEvent is signal= ed. The + list of failed CPU is terminated by + END_OF_CPU_LIST. + + @retval EFI_SUCCESS In blocking mode, all CPUs have finished= before + the timeout expired. + @retval EFI_SUCCESS In non-blocking mode, function has been = dispatched + to all enabled CPUs. + @retval EFI_DEVICE_ERROR Caller processor is AP. + @retval EFI_NOT_READY Any enabled APs are busy. + @retval EFI_NOT_READY MP Initialize Library is not initialized. + @retval EFI_TIMEOUT In blocking mode, the timeout expired be= fore + all enabled APs have finished. + @retval EFI_INVALID_PARAMETER Procedure is NULL. + +**/ +EFI_STATUS +EFIAPI +MpInitLibStartupAllCPUs ( + IN EFI_AP_PROCEDURE Procedure, + IN UINTN TimeoutInMicroseconds, + IN VOID *ProcedureArgument OPTIONAL, + OUT UINTN **FailedCpuList OPTIONAL + ) +{ + return StartupAllAPsWorker ( + Procedure, + FALSE, + TRUE, + NULL, + TimeoutInMicroseconds, + ProcedureArgument, + FailedCpuList + ); +} + diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h b/UefiCpuPkg/Library/MpIn= itLib/MpLib.h index f89037c59e..fce7961a98 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.h +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h @@ -405,6 +405,7 @@ InitMpGlobalData ( number. If FALSE, then all the enab= led APs execute the function specified by Pr= ocedure simultaneously. + @param[in] IncludeBsp Whether let BSP also trig this task. @param[in] WaitEvent The event created by the caller with= CreateEvent() service. @param[in] TimeoutInMicroseconds Indicates the time limit in microsec= onds for @@ -429,6 +430,7 @@ EFI_STATUS StartupAllAPsWorker ( IN EFI_AP_PROCEDURE Procedure, IN BOOLEAN SingleThread, + IN BOOLEAN IncludeBsp, IN EFI_EVENT WaitEvent OPTIONAL, IN UINTN TimeoutInMicroseconds, IN VOID *ProcedureArgument OPTIONAL, diff --git a/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c b/UefiCpuPkg/Library/M= pInitLib/PeiMpLib.c index 35dff91fd2..a3e568b056 100644 --- a/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c @@ -404,6 +404,7 @@ MpInitLibStartupAllAPs ( return StartupAllAPsWorker ( Procedure, SingleThread, + FALSE, NULL, TimeoutInMicroseconds, ProcedureArgument, --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#44018): https://edk2.groups.io/g/devel/message/44018 Mute This Topic: https://groups.io/mt/32524458/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 2 22:08:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+44019+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+44019+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1563521299; cv=none; d=zoho.com; s=zohoarc; b=RiHgcZ/qiCIjnRNNhOQXgKrQMyMq8NQH2HIf4N6eYaARgGqU5QORGK5i63zNvDG64A9W4nVeuTnlAxfH1dfSh7+KYjAzGwgIq0zLcS/MdXZan85pxJcFi6uKSxswwssDcoXl51Pm7rIrMvjk1Lnxby4j6upXIE51CtB4gimZOvU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563521299; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=cICdPoRrqi04ObbA7erwZ4GNMSBlVpB21xyuh/C47I0=; b=IofnMb+vxK6TZToETRGm63N8BRkRv+LNIiMtal6+049pnV/nCvOF6/Bszq+wpYGCCjod/Hs+FVdyYaNHlm1BAP2phXG8rLvOTDbHEXunbvl66h6I7CBvK7bmTM5zc/cCz6KxVkQEwfhz3FOb1rcZDFkevQCHLcEkvsY/8EbLBxs= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+44019+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1563521299455996.3543765353351; Fri, 19 Jul 2019 00:28:19 -0700 (PDT) Return-Path: X-Received: from mga09.intel.com (mga09.intel.com []) by groups.io with SMTP; Fri, 19 Jul 2019 00:28:18 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jul 2019 00:28:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,281,1559545200"; d="scan'208";a="170828869" X-Received: from ydong10-win10.ccr.corp.intel.com ([10.239.158.133]) by orsmga003.jf.intel.com with ESMTP; 19 Jul 2019 00:28:17 -0700 From: "Dong, Eric" To: devel@edk2.groups.io Cc: Ray Ni , Laszlo Ersek , Chandana Kumar , Star Zeng Subject: [edk2-devel] [Patch 3/5] UefiCpuPkg: Add new EDKII_PEI_MP_SERVICES2_PPI Date: Fri, 19 Jul 2019 15:28:08 +0800 Message-Id: <20190719072811.6352-4-eric.dong@intel.com> In-Reply-To: <20190719072811.6352-1-eric.dong@intel.com> References: <20190719072811.6352-1-eric.dong@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,eric.dong@intel.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1563521298; bh=5+ooIbptC/SK3S9A020q4A93zIYbi1PMBzGypgDG2gE=; h=Cc:Date:From:Reply-To:Subject:To; b=XZRzrw4AagfV3ckXbk7OTptB7Fo9r17q+dzyRzEmKSUV0ikrwjCIzXvOKrXwXqy4Hb5 hqfO7wkO56Y4pzQYY0h+HPx4BLqlZLzlHT8bFOub7RyEoCu0X8lNhiql502tmtzJiH+3i zY8G/tU/hRUNE9xZNabyv0kRwWW6Br3RWBE= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1973 Add definition for new EDKII_PEI_MP_SERVICES2_PPI. It includes all APIs existed in EFI_PEI_MP_SERVICES_PPI and add new API EDKII_PEI_MP_SERVICES_STARTUP_ALL_CPUS. Cc: Ray Ni Cc: Laszlo Ersek Cc: Chandana Kumar Cc: Star Zeng Signed-off-by: Eric Dong Reviewed-by: Ray Ni --- UefiCpuPkg/Include/Ppi/EdkiiMpServices2.h | 72 +++++++++++++++++++++++ UefiCpuPkg/UefiCpuPkg.dec | 3 + 2 files changed, 75 insertions(+) create mode 100644 UefiCpuPkg/Include/Ppi/EdkiiMpServices2.h diff --git a/UefiCpuPkg/Include/Ppi/EdkiiMpServices2.h b/UefiCpuPkg/Include= /Ppi/EdkiiMpServices2.h new file mode 100644 index 0000000000..c6b9712cc0 --- /dev/null +++ b/UefiCpuPkg/Include/Ppi/EdkiiMpServices2.h @@ -0,0 +1,72 @@ +/** @file + This file declares edkii Multi-processor service PPI. + + Copyright (c) 2019, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __EDKII_PEI_MP_SERVICES2_PPI_H__ +#define __EDKII_PEI_MP_SERVICES2_PPI_H__ + +#include + +#define EDKII_PEI_MP_SERVICES2_PPI_GUID \ + { \ + 0x5cb9cb3d, 0x31a4, 0x480c, { 0x94, 0x98, 0x29, 0xd2, 0x69, 0xba, 0xcf= , 0xba} \ + } + +typedef struct _EDKII_PEI_MP_SERVICES2_PPI EDKII_PEI_MP_SERVICES2_PPI; + +typedef EFI_PEI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS EDKII_PEI_MP_SERVICE= S_GET_NUMBER_OF_PROCESSORS; +typedef EFI_PEI_MP_SERVICES_GET_PROCESSOR_INFO EDKII_PEI_MP_SERVICE= S_GET_PROCESSOR_INFO; +typedef EFI_PEI_MP_SERVICES_STARTUP_ALL_APS EDKII_PEI_MP_SERVICE= S_STARTUP_ALL_APS; +typedef EFI_PEI_MP_SERVICES_STARTUP_THIS_AP EDKII_PEI_MP_SERVICE= S_STARTUP_THIS_AP; +typedef EFI_PEI_MP_SERVICES_SWITCH_BSP EDKII_PEI_MP_SERVICE= S_SWITCH_BSP; +typedef EFI_PEI_MP_SERVICES_ENABLEDISABLEAP EDKII_PEI_MP_SERVICE= S_ENABLEDISABLEAP; +typedef EFI_PEI_MP_SERVICES_WHOAMI EDKII_PEI_MP_SERVICE= S_WHOAMI; + +/** + Activate all of the application proessors. + + @param[in] This A pointer to the EDKII_PEI_MP_SERVICES2_= PPI instance. + @param[in] Procedure A pointer to the function to be run on e= nabled APs of + the system. + @param[in] TimeoutInMicroSeconds + Indicates the time limit in microseconds= for APs to + return from Procedure, for blocking mode= only. Zero + means infinity. If the timeout expires = in blocking + mode, BSP returns EFI_TIMEOUT. + @param[in] ProcedureArgument The parameter passed into Procedure for = all CPUs. + + @retval EFI_SUCCESS In blocking mode, all APs have finished = before the + timeout expired. + @retval EFI_DEVICE_ERROR Caller processor is AP. + @retval EFI_NOT_READY Any enabled APs are busy. + @retval EFI_TIMEOUT In blocking mode, the timeout expired be= fore all + enabled APs have finished. + @retval EFI_INVALID_PARAMETER Procedure is NULL. +**/ +typedef +EFI_STATUS +(EFIAPI *EDKII_PEI_MP_SERVICES_STARTUP_ALL_CPUS) ( + IN EDKII_PEI_MP_SERVICES2_PPI *This, + IN EFI_AP_PROCEDURE Procedure, + IN UINTN TimeoutInMicroSeconds, + IN VOID *ProcedureArgument OPTIONAL + ); + +struct _EDKII_PEI_MP_SERVICES2_PPI { + EDKII_PEI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS GetNumberOfProcessors; + EDKII_PEI_MP_SERVICES_GET_PROCESSOR_INFO GetProcessorInfo; + EDKII_PEI_MP_SERVICES_STARTUP_ALL_APS StartupAllAPs; + EDKII_PEI_MP_SERVICES_STARTUP_THIS_AP StartupThisAP; + EDKII_PEI_MP_SERVICES_SWITCH_BSP SwitchBSP; + EDKII_PEI_MP_SERVICES_ENABLEDISABLEAP EnableDisableAP; + EDKII_PEI_MP_SERVICES_WHOAMI WhoAmI; + EDKII_PEI_MP_SERVICES_STARTUP_ALL_CPUS StartupAllCPUs; +}; + +extern EFI_GUID gEdkiiPeiMpServices2PpiGuid; + +#endif diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec index 6ddf0cd224..5a555644b7 100644 --- a/UefiCpuPkg/UefiCpuPkg.dec +++ b/UefiCpuPkg/UefiCpuPkg.dec @@ -75,6 +75,9 @@ # 0x80000001 | Invalid value provided. # =20 +[Ppis] + gEdkiiPeiMpServices2PpiGuid =3D { 0x5cb9cb3d, 0x31a4, 0x480c, { 0x94,= 0x98, 0x29, 0xd2, 0x69, 0xba, 0xcf, 0xba}}=20 + [PcdsFeatureFlag] ## Indicates if SMM Profile will be enabled. # If enabled, instruction executions in and data accesses to memory out= side of SMRAM will be logged. --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#44019): https://edk2.groups.io/g/devel/message/44019 Mute This Topic: https://groups.io/mt/32524459/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 2 22:08:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+44020+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+44020+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1563521300; cv=none; d=zoho.com; s=zohoarc; b=QGtTjuFwTKBLzgd+aO0gdIMvkYrfqr4kWPaoQWDJ6M/ZuCejvw7WDAWXklb0R4Gw0dNqb3hEvl8zPk5R2OViwcQeev+COZNmkMqmvqBsEx9T5tj6JTMIzP8/bcC+pl+vnev+s15rQSw5uM7igD/o2+bUtusGftgQs8y0lv1Fe3Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563521300; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=DiYnGVPf3/uOl4b4ONs5B4rcqO2wDriXFDNDA47VNJI=; b=J5rhNvyCQ4U3BVTLlH29dgM6YadRkP3lkEpRV+5mf3xsK3DxszlvmDnHzW2c2IuY95Eq1q3/w7hNk9Gmp+8YmN0HQSzIaYLz9Fih2rD7tLsT7dz/+FeBDB7Bbb4lHVOfve4TLT/wIFUO/T2nFt2SLji/37SKXm2HWrmjz8CCTq0= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+44020+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1563521300847558.7471895171699; Fri, 19 Jul 2019 00:28:20 -0700 (PDT) Return-Path: X-Received: from mga09.intel.com (mga09.intel.com []) by groups.io with SMTP; Fri, 19 Jul 2019 00:28:20 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jul 2019 00:28:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,281,1559545200"; d="scan'208";a="170828884" X-Received: from ydong10-win10.ccr.corp.intel.com ([10.239.158.133]) by orsmga003.jf.intel.com with ESMTP; 19 Jul 2019 00:28:18 -0700 From: "Dong, Eric" To: devel@edk2.groups.io Cc: Ray Ni , Laszlo Ersek , Chandana Kumar , Star Zeng Subject: [edk2-devel] [Patch 4/5] UefiCpuPkg/CpuMpPei: Produce EDKII_PEI_MP_SERVICES2_PPI. Date: Fri, 19 Jul 2019 15:28:09 +0800 Message-Id: <20190719072811.6352-5-eric.dong@intel.com> In-Reply-To: <20190719072811.6352-1-eric.dong@intel.com> References: <20190719072811.6352-1-eric.dong@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,eric.dong@intel.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1563521300; bh=lVF6xWKiB95xnx5wfrsWN4pEJyk6Df6Uk/Oo9jEe8ic=; h=Cc:Date:From:Reply-To:Subject:To; b=L1uqcyxfF6A3sdMyLxQm4hV9yRTempgD9c7qchuGlNF82sVdkPscFF1IojKvq7ILAhT 0j0kGHTx/h2uY+W17+NCOzHYFxFLvdxMEtOxVNzeFYW4eRezhoHV0r379GKLm1NTyJgSS ee1HnriE0AqftA3EVWzhoT40EPiVpAVRrhU= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1973 Produce new EDKII_PEI_MP_SERVICES2_PPI service. It includes all APIs existed in EFI_PEI_MP_SERVICES_PPI and add new API EDKII_PEI_MP_SERVICES_STARTUP_ALL_CPUS. Cc: Ray Ni Cc: Laszlo Ersek Cc: Chandana Kumar Cc: Star Zeng Signed-off-by: Eric Dong --- UefiCpuPkg/CpuMpPei/CpuMpPei.c | 73 +++++++++++++++++++++++++++++--- UefiCpuPkg/CpuMpPei/CpuMpPei.h | 35 ++++++++++++++- UefiCpuPkg/CpuMpPei/CpuMpPei.inf | 1 + 3 files changed, 102 insertions(+), 7 deletions(-) diff --git a/UefiCpuPkg/CpuMpPei/CpuMpPei.c b/UefiCpuPkg/CpuMpPei/CpuMpPei.c index 926541c937..5ed2297770 100644 --- a/UefiCpuPkg/CpuMpPei/CpuMpPei.c +++ b/UefiCpuPkg/CpuMpPei/CpuMpPei.c @@ -1,7 +1,7 @@ /** @file CPU PEI Module installs CPU Multiple Processor PPI. =20 - Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -21,10 +21,31 @@ EFI_PEI_MP_SERVICES_PPI mMpServicesPpi = =3D { PeiWhoAmI, }; =20 -EFI_PEI_PPI_DESCRIPTOR mPeiCpuMpPpiDesc =3D { - (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), - &gEfiPeiMpServicesPpiGuid, - &mMpServicesPpi +// +// CPU MP2 PPI to be installed +// +EDKII_PEI_MP_SERVICES2_PPI mMpServices2Ppi =3D { + PeiGetNumberOfProcessors, + PeiGetProcessorInfo, + PeiStartupAllAPs, + PeiStartupThisAP, + PeiSwitchBSP, + PeiEnableDisableAP, + PeiWhoAmI, + PeiStartupAllCPUs +}; + +EFI_PEI_PPI_DESCRIPTOR mPeiCpuMpPpiList[] =3D { + { + EFI_PEI_PPI_DESCRIPTOR_PPI, + &gEdkiiPeiMpServices2PpiGuid, + &mMpServices2Ppi + }, + { + (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), + &gEfiPeiMpServicesPpiGuid, + &mMpServicesPpi + } }; =20 /** @@ -402,6 +423,46 @@ PeiWhoAmI ( return MpInitLibWhoAmI (ProcessorNumber); } =20 +/** + This service executes a caller provided function on all enabled CPUs. CP= Us can + run either simultaneously or one at a time in sequence. This service may= only + be called from the BSP. + + @param[in] This A pointer to the EDKII_PEI_MP_SERVICES2_= PPI instance. + @param[in] Procedure A pointer to the function to be run on e= nabled APs of + the system. + @param[in] TimeoutInMicroSeconds + Indicates the time limit in microseconds= for APs to + return from Procedure, for blocking mode= only. Zero + means infinity. If the timeout expires = in blocking + mode, BSP returns EFI_TIMEOUT. + @param[in] ProcedureArgument The parameter passed into Procedure for = all CPUs. + + @retval EFI_SUCCESS In blocking mode, all APs have finished = before the + timeout expired. + @retval EFI_DEVICE_ERROR Caller processor is AP. + @retval EFI_NOT_READY Any enabled APs are busy. + @retval EFI_TIMEOUT In blocking mode, the timeout expired be= fore all + enabled APs have finished. + @retval EFI_INVALID_PARAMETER Procedure is NULL. +**/ +EFI_STATUS +EFIAPI +PeiStartupAllCPUs ( + IN EDKII_PEI_MP_SERVICES2_PPI *This, + IN EFI_AP_PROCEDURE Procedure, + IN UINTN TimeoutInMicroSeconds, + IN VOID *ProcedureArgument OPTIONAL + ) +{ + return MpInitLibStartupAllCPUs ( + Procedure, + TimeoutInMicroSeconds, + ProcedureArgument, + NULL + ); +} + /** Get GDT register value. =20 @@ -667,7 +728,7 @@ InitializeCpuMpWorker ( // // Install CPU MP PPI // - Status =3D PeiServicesInstallPpi(&mPeiCpuMpPpiDesc); + Status =3D PeiServicesInstallPpi(mPeiCpuMpPpiList); ASSERT_EFI_ERROR (Status); =20 return Status; diff --git a/UefiCpuPkg/CpuMpPei/CpuMpPei.h b/UefiCpuPkg/CpuMpPei/CpuMpPei.h index a5d8a755b2..b385c5088b 100644 --- a/UefiCpuPkg/CpuMpPei/CpuMpPei.h +++ b/UefiCpuPkg/CpuMpPei/CpuMpPei.h @@ -1,7 +1,7 @@ /** @file Definitions to install Multiple Processor PPI. =20 - Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -15,6 +15,7 @@ #include #include #include +#include =20 #include #include @@ -431,6 +432,38 @@ MemoryDiscoveredPpiNotifyCallback ( IN VOID *Ppi ); =20 +/** + This service executes a caller provided function on all enabled CPUs. CP= Us can + run either simultaneously or one at a time in sequence. This service may= only + be called from the BSP. + + @param[in] This A pointer to the EDKII_PEI_MP_SERVICES2_= PPI instance. + @param[in] Procedure A pointer to the function to be run on e= nabled APs of + the system. + @param[in] TimeoutInMicroSeconds + Indicates the time limit in microseconds= for APs to + return from Procedure, for blocking mode= only. Zero + means infinity. If the timeout expires = in blocking + mode, BSP returns EFI_TIMEOUT. + @param[in] ProcedureArgument The parameter passed into Procedure for = all CPUs. + + @retval EFI_SUCCESS In blocking mode, all APs have finished = before the + timeout expired. + @retval EFI_DEVICE_ERROR Caller processor is AP. + @retval EFI_NOT_READY Any enabled APs are busy. + @retval EFI_TIMEOUT In blocking mode, the timeout expired be= fore all + enabled APs have finished. + @retval EFI_INVALID_PARAMETER Procedure is NULL. +**/ +EFI_STATUS +EFIAPI +PeiStartupAllCPUs ( + IN EDKII_PEI_MP_SERVICES2_PPI *This, + IN EFI_AP_PROCEDURE Procedure, + IN UINTN TimeoutInMicroSeconds, + IN VOID *ProcedureArgument OPTIONAL + ); + extern EFI_PEI_NOTIFY_DESCRIPTOR mPostMemNotifyList[]; =20 #endif diff --git a/UefiCpuPkg/CpuMpPei/CpuMpPei.inf b/UefiCpuPkg/CpuMpPei/CpuMpPe= i.inf index 4fc4ea77ba..e42ba824e4 100644 --- a/UefiCpuPkg/CpuMpPei/CpuMpPei.inf +++ b/UefiCpuPkg/CpuMpPei/CpuMpPei.inf @@ -54,6 +54,7 @@ gEfiSecPlatformInformation2PpiGuid gEfiVectorHandoffInfoPpiGuid ## SOMETIMES_CONSUMES gEfiPeiMemoryDiscoveredPpiGuid ## CONSUMES + gEdkiiPeiMpServices2PpiGuid ## PRODUCES =20 [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask ##= CONSUMES --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#44020): https://edk2.groups.io/g/devel/message/44020 Mute This Topic: https://groups.io/mt/32524460/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 2 22:08:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+44021+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+44021+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1563521302; cv=none; d=zoho.com; s=zohoarc; b=Q47nKWgHq0O0lWrzBwV/yK50itcRmlstuqovaSnGZ3QcKS56oxTFO4CoFvVLpL6tyHJZYXulak1WcLHm3dfVDDD9ntKJuF5QpWPRl7bHwnS7qQBBh3F1LviALlVMA4o652bbwt4LYsFu5UMa8EZp2LOunTpiPKP84FvJgETn80Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563521302; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=Efp74x7SfRBOE+sORIUY9Id41y/JVW/J1iSX2czS9TM=; b=HGrh8yt7J5IeT57h4wJbOIq9PYjIqs25+W9wH/TL3Wm2vsc0Q66oxn962wi+IpI8QtmqpTh7M4M/giQSoJ9BrHRbbFTBlp5sz4ffPoZ5Ab9kOPJggdxfC3bNyXrZPafVRbgLYrtrqusMeXFV1ZMvjlifah2JR5iKXnnJqFKqa7w= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+44021+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1563521302448942.0685757994438; Fri, 19 Jul 2019 00:28:22 -0700 (PDT) Return-Path: X-Received: from mga09.intel.com (mga09.intel.com []) by groups.io with SMTP; Fri, 19 Jul 2019 00:28:21 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jul 2019 00:28:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,281,1559545200"; d="scan'208";a="170828888" X-Received: from ydong10-win10.ccr.corp.intel.com ([10.239.158.133]) by orsmga003.jf.intel.com with ESMTP; 19 Jul 2019 00:28:19 -0700 From: "Dong, Eric" To: devel@edk2.groups.io Cc: Ray Ni , Laszlo Ersek , Chandana Kumar , Star Zeng Subject: [edk2-devel] [Patch 5/5] UefiCpuPkg/RegisterCpuFeaturesLib: Start all processors simultaneously. Date: Fri, 19 Jul 2019 15:28:10 +0800 Message-Id: <20190719072811.6352-6-eric.dong@intel.com> In-Reply-To: <20190719072811.6352-1-eric.dong@intel.com> References: <20190719072811.6352-1-eric.dong@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,eric.dong@intel.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1563521302; bh=QekTzrxbnseG1hephbL0tPf9ZVT60xPDnrqEaCZClUQ=; h=Cc:Date:From:Reply-To:Subject:To; b=nh5CasyrW21d9nDhDtq5OK5HCupUnNqzVTAzCuHA3Z81u4ZvIBNjAsDXjCCHcMOhe6o hq1dxLQ8FbgdGRu8fW58j8/+bGUQIQInZfMBmQ18cLaNK/lIYySj6hGQugqnukAfj7Z4M +UsU4JuCOtp1shK3ToCvvo1d8nb+Vm6PwoE= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1973 For semaphore type register, it required all processors to do the task at the same time. Current logic begins BSP's task after all APs have finished their tasks. This will caused set semaphore task hang if semaphore has package level type. This patch use new EDKII_PEI_MP_SERVICES2_PPI to start all processors at the same time to fix the potential hang issue. Cc: Ray Ni Cc: Laszlo Ersek Cc: Chandana Kumar Cc: Star Zeng Signed-off-by: Eric Dong --- .../PeiRegisterCpuFeaturesLib.c | 62 ++++++++++++++----- .../PeiRegisterCpuFeaturesLib.inf | 1 + 2 files changed, 47 insertions(+), 16 deletions(-) diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeatur= esLib.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesL= ib.c index 8ad5a40e5a..9ed0fbf381 100644 --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.c +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.c @@ -12,6 +12,8 @@ #include #include #include +#include + #include "RegisterCpuFeatures.h" =20 #define REGISTER_CPU_FEATURES_GUID \ @@ -180,6 +182,48 @@ StartupAPsWorker ( ASSERT_EFI_ERROR (Status); } =20 +/** + Worker function to execute a caller provided function on all enabled APs. + + @param[in] Procedure A pointer to the function to be run = on + enabled APs of the system. + @param[in] MpEvent The Event used to sync the result. + +**/ +VOID +StartupCPUsWorker ( + IN EFI_AP_PROCEDURE Procedure + ) +{ + EFI_STATUS Status; + EDKII_PEI_MP_SERVICES2_PPI *CpuMp2Ppi; + CPU_FEATURES_DATA *CpuFeaturesData; + + CpuFeaturesData =3D GetCpuFeaturesData (); + + // + // Get MP Services2 Ppi + // + Status =3D PeiServicesLocatePpi ( + &gEdkiiPeiMpServices2PpiGuid, + 0, + NULL, + (VOID **)&CpuMp2Ppi + ); + ASSERT_EFI_ERROR (Status); + + // + // Wakeup all APs for data collection. + // + Status =3D CpuMp2Ppi->StartupAllCPUs ( + CpuMp2Ppi, + Procedure, + 0, + CpuFeaturesData + ); + ASSERT_EFI_ERROR (Status); +} + /** Worker function to switch the requested AP to be the BSP from that point= onward. =20 @@ -267,23 +311,9 @@ CpuFeaturesInitialize ( CpuFeaturesData->BspNumber =3D OldBspNumber; =20 // - // Known limitation: In PEI phase, CpuFeatures driver not - // support async mode execute tasks. So semaphore type - // register can't been used for this instance, must use - // DXE type instance. - // - - if (CpuFeaturesData->NumberOfCpus > 1) { - // - // Wakeup all APs for programming. - // - StartupAPsWorker (SetProcessorRegister, NULL); - } - - // - // Programming BSP + // Start to program register for all CPUs. // - SetProcessorRegister (CpuFeaturesData); + StartupCPUsWorker (SetProcessorRegister); =20 // // Switch to new BSP if required diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeatur= esLib.inf b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeature= sLib.inf index 63091dfeb8..61f922bf63 100644 --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.i= nf +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.i= nf @@ -46,6 +46,7 @@ =20 [Ppis] gEfiPeiMpServicesPpiGuid ## = CONSUMES + gEdkiiPeiMpServices2PpiGuid ## = CONSUMES =20 [Pcd] gUefiCpuPkgTokenSpaceGuid.PcdCpuS3DataAddress ## = CONSUMES --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#44021): https://edk2.groups.io/g/devel/message/44021 Mute This Topic: https://groups.io/mt/32524461/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-