From nobody Mon May 6 04:04:31 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+44100+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+44100+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1563779667; cv=none; d=zoho.com; s=zohoarc; b=FMHXawTZPrsgTFzIo5NsejqMdwu6DxN29vvbI622L+259lgbzmoaR4WyB1TDC2bytsoyWVzv5ZkP7remcjdqfkgULmbGczcullmkwbyzLAwYTnUXt2H3we+r1mt5nzBtNXeXIPzrKZm6TYwCK1lYAnIYLlv4MrrEjwpah7lETg0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563779667; 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=eSeCiDZx9/EolxI3HHhdvx6xdHkegEr5elp7vK5//NY=; b=ng1QnUWipsFF3kJKp4HxOrFik3Vk22fa27e2LlXdFjVPTy6JNdVmQyczd5kiF40k4wnLMMjkFuQnCVPIg4s5m3GsYO41QnZJCZyxU4Xi7fSj3Cc6OzEXTMoAB+umPPs7a+g40NoX4A9id0yteL4xgSUrLjpCOIk8cA6DrmyZIgk= 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+44100+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 156377966788126.25823262851827; Mon, 22 Jul 2019 00:14:27 -0700 (PDT) Return-Path: X-Received: from mga11.intel.com (mga11.intel.com []) by groups.io with SMTP; Mon, 22 Jul 2019 00:14:26 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Jul 2019 00:14:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,294,1559545200"; d="scan'208";a="180313539" X-Received: from ydong10-win10.ccr.corp.intel.com ([10.239.158.133]) by orsmga002.jf.intel.com with ESMTP; 22 Jul 2019 00:14:25 -0700 From: "Dong, Eric" To: devel@edk2.groups.io Cc: Ray Ni , Laszlo Ersek , Chandana Kumar , Star Zeng Subject: [edk2-devel] [Patch v2 1/6] UefiCpuPkg/Include/MpInitLib.h: Add MpInitLibStartupAllCPUs API. Date: Mon, 22 Jul 2019 15:14:18 +0800 Message-Id: <20190722071423.17372-2-eric.dong@intel.com> In-Reply-To: <20190722071423.17372-1-eric.dong@intel.com> References: <20190722071423.17372-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=1563779667; bh=kLlIcMvAQME5EKSMgIxxtb64z1ewXiNLhA+77BrKLnk=; h=Cc:Date:From:Reply-To:Subject:To; b=VzMd2tubYCU653x46FXKQC4vpCUm+yDrYmVOKvFaISWVXdVFheyjuBXxfLirMYR9d47 r4RX+GrQ2OrTG3xau/249GcfQYshe0TzGkabyMrX1Pub3UFJ5RZtT7poKyKXyFKFfw+XK spPOSHVIC6bUa8nTC893gJ+XUStEOjgp/XY= 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 Reviewed-by: Ray Ni --- UefiCpuPkg/Include/Library/MpInitLib.h | 33 ++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/UefiCpuPkg/Include/Library/MpInitLib.h b/UefiCpuPkg/Include/Li= brary/MpInitLib.h index fa82529373..a943fbd9bc 100644 --- a/UefiCpuPkg/Include/Library/MpInitLib.h +++ b/UefiCpuPkg/Include/Library/MpInitLib.h @@ -344,4 +344,37 @@ 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. + + @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 + ); + #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 (#44100): https://edk2.groups.io/g/devel/message/44100 Mute This Topic: https://groups.io/mt/32556151/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 Mon May 6 04:04:31 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+44102+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+44102+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1563779674; cv=none; d=zoho.com; s=zohoarc; b=OalDv+UzqfIZOflz4q2vI0rVmYLchplueP18fScYCXU+SLhZ0cKqioBEFVPq/XdS7EgO9OZkBKYsMt2qRUcT5GiRUABm0g7oV+8B0bYYaCPJRImovGWKpAxUgeZN/RxXpnWBRs7t2W9KZzmScZAorcQrdGSudBWzKFVuHW9CV4s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563779674; 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=CtWtecK4c8kNvyCyWUt8SxWYqkmOBVawuxEK5hrDarE=; b=eY8njM8imcJGuj34MiTcr0TYH77g8YDzT6IuIBShhx7pVHB9jF0bk/rsZ8Mm7loOxATyRKL3alsCQkR+K5b/BGVc9FFTPXbJDIt3P8xnvYfi0C0dWOY3NYMc6OicpbtanmFeK9u1AuAXIT4li1goIcMIZxwUI3Jf2t8H/B+Iju8= 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+44102+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 1563779674848592.3058533921865; Mon, 22 Jul 2019 00:14:34 -0700 (PDT) Return-Path: X-Received: from mga02.intel.com (mga02.intel.com []) by groups.io with SMTP; Mon, 22 Jul 2019 00:14:34 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Jul 2019 00:14:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,294,1559545200"; d="scan'208";a="180313560" X-Received: from ydong10-win10.ccr.corp.intel.com ([10.239.158.133]) by orsmga002.jf.intel.com with ESMTP; 22 Jul 2019 00:14:26 -0700 From: "Dong, Eric" To: devel@edk2.groups.io Cc: Ray Ni , Laszlo Ersek , Chandana Kumar , Star Zeng Subject: [edk2-devel] [Patch v2 2/6] UefiCpuPkg/MpInitLib: Add MpInitLibStartupAllCPUs API. Date: Mon, 22 Jul 2019 15:14:19 +0800 Message-Id: <20190722071423.17372-3-eric.dong@intel.com> In-Reply-To: <20190722071423.17372-1-eric.dong@intel.com> References: <20190722071423.17372-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=1563779674; bh=/uQruLupm+xuXwEluo05QSSJjZqqQ7jxBdOQUtbUKi4=; h=Cc:Date:From:Reply-To:Subject:To; b=bwJaz0p7M6TftBMa67bYtTjnGkamTYXdVIkanaTTe9f4zMFEe9FO/s1600ZED8vJty+ IfpN1lMzCb9/8ORk0In3db6Y/1OZ6B6kVXxfBOxHU1YF3nfNwsCBgXILhMiUd3R4JbZm5 m+2vnwsx9qWOCjXAYnZarMKCCHkd/fds/O8= 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 | 3 +- UefiCpuPkg/Library/MpInitLib/MpLib.c | 60 +++++++++++++++++++++++-- UefiCpuPkg/Library/MpInitLib/MpLib.h | 4 +- UefiCpuPkg/Library/MpInitLib/PeiMpLib.c | 3 +- 4 files changed, 63 insertions(+), 7 deletions(-) diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c b/UefiCpuPkg/Library/M= pInitLib/DxeMpLib.c index 6be1bae464..23adfd0625 100644 --- a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c @@ -568,9 +568,10 @@ MpInitLibStartupAllAPs ( // mStopCheckAllApsStatus =3D TRUE; =20 - Status =3D StartupAllAPsWorker ( + Status =3D StartupAllCpusWorker ( Procedure, SingleThread, + TRUE, WaitEvent, TimeoutInMicroseconds, ProcedureArgument, diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpIn= itLib/MpLib.c index 6f51bc4ebf..51e63e14a3 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] ExcludeBsp 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 @@ -2151,9 +2152,10 @@ MpInitLibGetNumberOfProcessors ( =20 **/ EFI_STATUS -StartupAllAPsWorker ( +StartupAllCpusWorker ( IN EFI_AP_PROCEDURE Procedure, IN BOOLEAN SingleThread, + IN BOOLEAN ExcludeBsp, 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 && ExcludeBsp) { return EFI_NOT_STARTED; } =20 @@ -2218,9 +2220,9 @@ StartupAllAPsWorker ( } } =20 - if (!HasEnabledAp) { + if (!HasEnabledAp && ExcludeBsp) { // - // 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 (!ExcludeBsp) { + // + // Start BSP. + // + Procedure (ProcedureArgument); + } + Status =3D EFI_SUCCESS; if (WaitEvent =3D=3D NULL) { do { @@ -2411,3 +2420,46 @@ 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. + + @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 + ) +{ + return StartupAllCpusWorker ( + Procedure, + FALSE, + FALSE, + NULL, + TimeoutInMicroseconds, + ProcedureArgument, + NULL + ); +} diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h b/UefiCpuPkg/Library/MpIn= itLib/MpLib.h index f89037c59e..81de45c73b 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] ExcludeBsp 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 @@ -426,9 +427,10 @@ InitMpGlobalData ( =20 **/ EFI_STATUS -StartupAllAPsWorker ( +StartupAllCpusWorker ( IN EFI_AP_PROCEDURE Procedure, IN BOOLEAN SingleThread, + IN BOOLEAN ExcludeBsp, 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..5666ad0862 100644 --- a/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c @@ -401,9 +401,10 @@ MpInitLibStartupAllAPs ( return EFI_UNSUPPORTED; } =20 - return StartupAllAPsWorker ( + return StartupAllCpusWorker ( Procedure, SingleThread, + TRUE, 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 (#44102): https://edk2.groups.io/g/devel/message/44102 Mute This Topic: https://groups.io/mt/32556153/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 Mon May 6 04:04:31 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+44101+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+44101+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1563779674; cv=none; d=zoho.com; s=zohoarc; b=c/GS59IJ2cMIj/KzfthZ3zEsABLH4F2KaGbv8VQ2q59Kq/VveOD7l1hvG/xCNOkzYc5Ybj+7oTsp6bdirc9K0zYR8Gy2LwrLdajCgu0S9ILX7SX5FxMNLrzNMDQG7eOjDl5tRYm8cu5At0/tIibF0KzwFkTS1456EltCnx5w/ZE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563779674; 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=an0BnIW2jSkVlvXaS7pmIewe6qtR5Ht7V0mtCLDQC30=; b=YArNrT8dfG4Vg37qtS7BIibJLlXvEBKgy+U30sADjWmPlb6EHxBEMLz76lfjVs6+Qemwz2pwW5TjOApD/aeYJ+xDBiniRRfVEw0H75Itcd5EweoPtg+sxOM+TPlVirKjj0cBN4HlBGRIE334xrlzd5seugAWYk4aGoUf/4RPgj8= 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+44101+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 156377967471092.86053517042603; Mon, 22 Jul 2019 00:14:34 -0700 (PDT) Return-Path: X-Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by groups.io with SMTP; Mon, 22 Jul 2019 00:14:33 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Jul 2019 00:14:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,294,1559545200"; d="scan'208";a="180313568" X-Received: from ydong10-win10.ccr.corp.intel.com ([10.239.158.133]) by orsmga002.jf.intel.com with ESMTP; 22 Jul 2019 00:14:32 -0700 From: "Dong, Eric" To: devel@edk2.groups.io Cc: Ray Ni , Laszlo Ersek , Chandana Kumar , Star Zeng Subject: [edk2-devel] [Patch v2 3/6] UefiCpuPkg/MpInitLibUp: Add MpInitLibStartupAllCPUs API. Date: Mon, 22 Jul 2019 15:14:20 +0800 Message-Id: <20190722071423.17372-4-eric.dong@intel.com> In-Reply-To: <20190722071423.17372-1-eric.dong@intel.com> References: <20190722071423.17372-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=1563779674; bh=9xzncl2vkTrLMKxU+BOZdWtiF57u+UydJtAxh8iJqx4=; h=Cc:Date:From:Reply-To:Subject:To; b=WEOjNcX/YiY19hJxoxcZUTDPxaDUgvplRcG/XwvmxXQn9//fTzKpLJK2epZ0iW3LX/W GebshBJ9bhLsoUVxP3qQ7psOUmuAniWmGVG0RRx0PS2d3itgtWP8pkgfDUzQox5zG9NL4 HSXV4uZNd8XMmD5+T7EOQDziB04U/sDeoYI= 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/MpInitLibUp/MpInitLibUp.c | 38 ++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.c b/UefiCpuPkg/Libr= ary/MpInitLibUp/MpInitLibUp.c index 36c2bb5326..849600d5c2 100644 --- a/UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.c +++ b/UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.c @@ -405,3 +405,41 @@ MpInitLibWhoAmI ( *ProcessorNumber =3D 0; return EFI_SUCCESS; } + +/** + 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. + + @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 + ) +{ + Procedure (ProcedureArgument); + + return EFI_SUCCESS; +} --=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 (#44101): https://edk2.groups.io/g/devel/message/44101 Mute This Topic: https://groups.io/mt/32556152/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 Mon May 6 04:04:31 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+44103+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+44103+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1563779675; cv=none; d=zoho.com; s=zohoarc; b=cOjaUBSqxbOE2QsDfmcmjkKE4aFUpQ0iwmovf6MlybbMhLvki26S4VeYf1bMt5zB+zOiB+iU913pVYLdk8TlEq6tGid2B73mEEzjYFJSSEgk93vgYE1/+G3o8PVM27Cv2ONSXr3NeC/yfjxEQ2Yr2ufeZs7fys0ADM8r35JPpsU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563779675; 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=ht7Rb2kfEEN/EjjykoAMn6LVqPdN9l24xix+MbENeoE=; b=VT26XllZZCLTUKGP3l1/0jTlCqWXAHQi8ELXh1l/A/oXKuGF0fbGMQmayguAAnlduu9KgtaKP7wVlCN3B6hXeSkl8Kl6Vm1N7Bhz2FfqKkireWptoZmyxlzuPR/l4muNAlo7UlIJyo6GTnlhOpw/vxmkt+n6MMtyVHBJQF4HucU= 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+44103+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 1563779675789791.7611326773693; Mon, 22 Jul 2019 00:14:35 -0700 (PDT) Return-Path: X-Received: from mga02.intel.com (mga02.intel.com []) by groups.io with SMTP; Mon, 22 Jul 2019 00:14:35 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Jul 2019 00:14:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,294,1559545200"; d="scan'208";a="180313579" X-Received: from ydong10-win10.ccr.corp.intel.com ([10.239.158.133]) by orsmga002.jf.intel.com with ESMTP; 22 Jul 2019 00:14:33 -0700 From: "Dong, Eric" To: devel@edk2.groups.io Cc: Ray Ni , Laszlo Ersek , Chandana Kumar , Star Zeng Subject: [edk2-devel] [Patch v2 4/6] UefiCpuPkg: Add new EDKII_PEI_MP_SERVICES2_PPI Date: Mon, 22 Jul 2019 15:14:21 +0800 Message-Id: <20190722071423.17372-5-eric.dong@intel.com> In-Reply-To: <20190722071423.17372-1-eric.dong@intel.com> References: <20190722071423.17372-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=1563779675; bh=p8Klt0dLkzdppsist5oxmM4iDrXa52UuWaht9b9Xh8A=; h=Cc:Date:From:Reply-To:Subject:To; b=quo9TMWGJr4UpMb5Xe88TQSc0/kAhnfk4lj0PiBo9z8gqHXqhheZaMnOzgRpufUtY4h eMxUt8xzYrenGJS9+fSXg9cS/yXgZNOWhJEn4LbhIfFjoJ/kSIZduGNQD0mxoKDTiZMYY FH+HtiHecImudTVT0Pxyj5Dl08dEAeyZVx8= 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 (#44103): https://edk2.groups.io/g/devel/message/44103 Mute This Topic: https://groups.io/mt/32556154/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 Mon May 6 04:04:31 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+44104+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+44104+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1563779677; cv=none; d=zoho.com; s=zohoarc; b=GIpPncT6rEq+YsM9tDG2UOqLyPwEMuwPoWIKm4e02AkW3VagVUp6q0V1CvinIRp6okLwIOuRiXUt+eNIVO7KMu97A2Y4vdudAzZRgQ1zsP365HVJtziQUrLkiZGqPyRqs/6r1DJ9dzvyQ33e1MtZB476V85Ct4ROR73wnNtPDGA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563779677; 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=yKZi4+3rgvev1HcgpL1DHcBIoF4I6AHD+tdc3qnrIqk=; b=iynktInLRStzp3VbIrukspfhpInCT6AyMAO0/FFCn5sckBWgc8DI+eUknQ5aAWro2jMjkNY7etTVzuuMUUq1J8GKuuRTDRipJ1nbP+ryCrd6WD1vgFo/EtotlvJLCmijp2sxiwW2ZKZNESEmpH0W+efNRCSVk3zXm/P7jg04flg= 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+44104+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 1563779677255787.0433099870619; Mon, 22 Jul 2019 00:14:37 -0700 (PDT) Return-Path: X-Received: from mga02.intel.com (mga02.intel.com []) by groups.io with SMTP; Mon, 22 Jul 2019 00:14:36 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Jul 2019 00:14:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,294,1559545200"; d="scan'208";a="180313600" X-Received: from ydong10-win10.ccr.corp.intel.com ([10.239.158.133]) by orsmga002.jf.intel.com with ESMTP; 22 Jul 2019 00:14:34 -0700 From: "Dong, Eric" To: devel@edk2.groups.io Cc: Ray Ni , Laszlo Ersek , Chandana Kumar , Star Zeng Subject: [edk2-devel] [Patch v2 5/6] UefiCpuPkg/CpuMpPei: Produce EDKII_PEI_MP_SERVICES2_PPI. Date: Mon, 22 Jul 2019 15:14:22 +0800 Message-Id: <20190722071423.17372-6-eric.dong@intel.com> In-Reply-To: <20190722071423.17372-1-eric.dong@intel.com> References: <20190722071423.17372-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=1563779676; bh=Dr3Ry6Q/dCmkwo69B8/T5xmMqmVKhYDBMGsUSjTGnBw=; h=Cc:Date:From:Reply-To:Subject:To; b=BnkNZS3i7RdQaIbJJ7UEAeUInP5Zk2mtKEf1Ri/narnIpmz5pdr/a+ZkLSyD9mcl+UC Rigaa+Yrs6EvCEffu2LOEyjUFRJtd4JJ3wiw+ZkB1HKv8ToKBaEWKVmYFlVU8K+QotLnE 82wsO2pdl/SM1uVovth1Nqif8p7jsEAlGI4= 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 | 72 +++++++++++++++++++++++++++++--- UefiCpuPkg/CpuMpPei/CpuMpPei.h | 35 +++++++++++++++- UefiCpuPkg/CpuMpPei/CpuMpPei.inf | 1 + 3 files changed, 101 insertions(+), 7 deletions(-) diff --git a/UefiCpuPkg/CpuMpPei/CpuMpPei.c b/UefiCpuPkg/CpuMpPei/CpuMpPei.c index 926541c937..c2f42d5016 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,45 @@ 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 + ); +} + /** Get GDT register value. =20 @@ -667,7 +727,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 (#44104): https://edk2.groups.io/g/devel/message/44104 Mute This Topic: https://groups.io/mt/32556155/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 Mon May 6 04:04:31 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+44105+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+44105+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1563779678; cv=none; d=zoho.com; s=zohoarc; b=CgcLOc9izVbpJBGziqf6ED4NFi0YRufhSLXif4+M17xOLW6mm+elBnKidOgGHCY2xH8pLWtwwLS3+UzX+c4xlrH9epvx4Zsd6q07szr+YCuTrmstJmrMbBJ0Tc5bADckdcm9/yHfvSKvdufKF5gX6VmcjP0A0yhZxOLYiGIY06w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563779678; 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=WX0UiUiKd01jlVZuRBp4tnzaN6tcQ+4u8230h1lq358=; b=N6MY8e+5HXxy+K4wZVM09IqhX2zMC780eRBsqYL/wSM4qmNnjo29br4E3dcsPw6aILnRGGW4C5GQcnZJX0FRicP1JNxWjHHdZaZv2LWh0GfI86AgphAeQq+Nu9nVO1H5D65vGSkp66tuL/1OoAFjUW1Ohl2uH6JUXpKqnVzx+lY= 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+44105+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 1563779678392948.9435691497983; Mon, 22 Jul 2019 00:14:38 -0700 (PDT) Return-Path: X-Received: from mga02.intel.com (mga02.intel.com []) by groups.io with SMTP; Mon, 22 Jul 2019 00:14:37 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Jul 2019 00:14:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,294,1559545200"; d="scan'208";a="180313627" X-Received: from ydong10-win10.ccr.corp.intel.com ([10.239.158.133]) by orsmga002.jf.intel.com with ESMTP; 22 Jul 2019 00:14:36 -0700 From: "Dong, Eric" To: devel@edk2.groups.io Cc: Ray Ni , Laszlo Ersek , Chandana Kumar , Star Zeng Subject: [edk2-devel] [Patch v2 6/6] UefiCpuPkg/RegisterCpuFeaturesLib: Start all processors simultaneously. Date: Mon, 22 Jul 2019 15:14:23 +0800 Message-Id: <20190722071423.17372-7-eric.dong@intel.com> In-Reply-To: <20190722071423.17372-1-eric.dong@intel.com> References: <20190722071423.17372-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=1563779678; bh=s3EqIAEwYaxBYowoW5Liy1jFdV78s+2teoHYyYE5kgs=; h=Cc:Date:From:Reply-To:Subject:To; b=I3WJ0VmUeu4KqsNluQ5y+q2up5AE2+EYf08sXHg6dvA2/urSCLXbLbTJ8Ywb1t+5+PA 6aWlPtic+i1ya3GOF7Xx1JzLsjQeVmoZhNfpAFH7fUvsookz9O3GeGKjQMUo8/Bc4cD+M Vxfyif7uvD3gNb8DiGMjtxhejuXeEC8eEVI= 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 (#44105): https://edk2.groups.io/g/devel/message/44105 Mute This Topic: https://groups.io/mt/32556156/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-