From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id BCCB07803CD for ; Wed, 6 Sep 2023 05:19:18 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=prh/wojDLhEYOAVLxAP0z7b3RaVW+p1QbNFZqkZFheE=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:msip_labels:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type; s=20140610; t=1693977557; v=1; b=jofeC47VNZ08X4B8jmkxanDQKvjUcsPvvbj5HrlefMTFTjmV/5qWWLVwkDqG9LWEKse9D8WM 6/91ds/JeTbEaux03yHkKCRdhH3ylFlWB5vhBANNg4Xd06L6GyAAn6qVGA78A7fjepsbXhBxhF0 iPPwSLZYP1b0xA9WzoB/winw= X-Received: by 127.0.0.2 with SMTP id GDuvYY7687511xQC46u5GC9q; Tue, 05 Sep 2023 22:19:17 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web10.2027.1693977551478003857 for ; Tue, 05 Sep 2023 22:19:16 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10824"; a="463356037" X-IronPort-AV: E=Sophos;i="6.02,231,1688454000"; d="scan'208,217";a="463356037" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Sep 2023 22:19:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10824"; a="770625485" X-IronPort-AV: E=Sophos;i="6.02,231,1688454000"; d="scan'208,217";a="770625485" X-Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga008.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 05 Sep 2023 22:19:16 -0700 X-Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Tue, 5 Sep 2023 22:19:15 -0700 X-Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 5 Sep 2023 22:19:14 -0700 X-Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27 via Frontend Transport; Tue, 5 Sep 2023 22:19:14 -0700 X-Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.102) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.27; Tue, 5 Sep 2023 22:19:14 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AjxhcgH4B9Jq+TU7e4kUlVSjtf9nfPvBA6N642uSDfVO9TW8NVs7XcHvBgeXJdYNHiPWLQu3nroW55bo2hunYo+r6qevJZ9Anl29DD5umbeNz2d3xwE7WuKBExTISB5ahQIZLzyzQR38FaLrOVjvTUXSQLyjsq1AsDa0NyRvUdVJrJVM0MWFFBfvDa8t2prUdw0+ynAr2yXjMUeNx62CcboWaavfYhNsdbo0YgfBOkGcKJALGAQKce9USEY4YVc19rNj1k1Zm9LgZNaAR7C0rrMqkZvdxtALfAyjqqcYyW5TFEeTdGZhPoyus59Y3op+c6C03wtz/4jjou9EDlTJQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RKKTCJ/64HRW990bM7FqM5ss5/r6k4+tsnnWDr1BbZE=; b=KeV03fIB+ivbBJuoK/LDtFT4uP4iLrOrKpTR/W+8kw7IEY5uqvp9eJDY5uNC7SIhKm6T7+xeh9g5pRKFb7sGikDdLjMp3vBtSQtim90BskqmxOFT2/tfK/M/SiOSHAO+EwMH64jc7dmaeDil105UjfAmrfIXX8xcMohKxTwnL3U1FgOtT4Ty1uiBIzdgTFwoN1iv8puS+kawZSUvWQ+mVZUtMMuJnKNGgR+aOszat7nuQXK1v8O+ocahN+6pfQggXfF2WGyxpieUxgUFaN6Dl5y+O8yNda39o12E2Rnja3wQL4IdkQUHV2ScbhC6pjgYnPm8MX88Lg7A/bJI6fBqOQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none X-Received: from MN6PR11MB8244.namprd11.prod.outlook.com (2603:10b6:208:470::14) by CY5PR11MB6281.namprd11.prod.outlook.com (2603:10b6:930:23::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.34; Wed, 6 Sep 2023 05:19:12 +0000 X-Received: from MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::bf9a:54ca:d270:59b]) by MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::bf9a:54ca:d270:59b%5]) with mapi id 15.20.6745.030; Wed, 6 Sep 2023 05:19:12 +0000 From: "Ni, Ray" To: "Tan, Dun" , "devel@edk2.groups.io" CC: "Dong, Eric" , "Kumar, Rahul R" Subject: Re: [edk2-devel] [Patch V3 5/5] UefiCpuPkg/PiSmmCpuDxe: use MpService2Ppi to wakeup AP in s3 Thread-Topic: [Patch V3 5/5] UefiCpuPkg/PiSmmCpuDxe: use MpService2Ppi to wakeup AP in s3 Thread-Index: AQHZ2xR/G0qhXd9OvUyxKomkJVTE3LANTR+2 Date: Wed, 6 Sep 2023 05:19:12 +0000 Message-ID: References: <20230830073418.586-1-dun.tan@intel.com> <20230830073418.586-3-dun.tan@intel.com> In-Reply-To: <20230830073418.586-3-dun.tan@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN6PR11MB8244:EE_|CY5PR11MB6281:EE_ x-ms-office365-filtering-correlation-id: 3ec3e1d6-f51c-473d-2c5b-08dbae98ce4e x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: LvUv6AkDM5klauvBQ6CFfiwVFRV7c4vgpiD/dvCjteVpRfkzG9ytTBnAVJzsj9eIsxS/qGXk5OGmB7qsxw7auzHLoO9kt7Wo8CnXmuQ2VxA+dYXwyvkr3/Rww4Elq3ga/eFeR7PnwDPBDtCDmXc2Of66SnyiRGZpKVJH+aJUtsl6OnGS9kGM8I61uS3IJ86t6eqnhE9uGO2itQ04lYSWOu+sBM9tjk7xnqaTQRLBB8f+laOTyPChQnpKCY9lshXP8+BPpJcaGhcc1SDCoXAVl21XmN/mnw9X6d/pWa0L9smA1DOazEfpQB/raslPZxR0wyRAergt5wzxmTO9/uZhCDNcO8d/Qcn2UdJI9DEkLskI/oQdQaGwdVX35aVftzjyZQL/J/7Hed1q5KhcZlwiTofYovD5o1M59ezaymzIVdJ5cm/jcZPsp7GSbBvE9+yB+0INerkyDoNxqocCO0cuGRqBe1mCQbZc6sp7AVJYH3l+9B9ugBibCaHKkKVsgxI+fwOn3t4L5CIopHyDvQavALhwG5YWNV7rXJu15LksExC5DTO9Qw5pDg29cPj/rTcpcSOWm6RPIZIGWMmCVOkOMGQq//v4/FE1uZOnrK4KCC6hxsv86/LifeBlylT5sCwu x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?bneN7R3LnuFwIKvBHbXznEAXPsupRUe7XowBoN9cAqiFuaKqwDaXjaDENh7A?= =?us-ascii?Q?mabXgTCRYU/XwUnlbMZGumLQ+HhmQBPF4I7LZEvByOT6c8HFNo6Cig3bh3Dx?= =?us-ascii?Q?48+mqUPIAZu6mQKsgLRr/L//uAtsp3gKgQm8cOMDED1TCvaqFs7lkz4g1RXN?= =?us-ascii?Q?QTedZv7hWp9Mkc7vpa3a7mIskfqNPgrRvI27ANmWE0eWP4CqvCPF23MQ89fV?= =?us-ascii?Q?8eIf0Ksd/ysZwFM+qVAWqgRSPfyDfEYaZFNBDroASl/WoQmgi2HU/ALPrqks?= =?us-ascii?Q?jAGDgv9BxW5FgnFDq3r7g+v+NOiMjlWXt735mQdMxiX95nKDcDqSjq9luZjf?= =?us-ascii?Q?M+F/Ukoik42ZH3zleqXohN2TKgB5SzJ6jMLUACaW/nY9LsVUR3/0TES4FB3c?= =?us-ascii?Q?W8sow2DaRxVlm0K/OmoMDriAude2aKxG5p/Po9cQju4wbxhTD1ShD+Qr+Ied?= =?us-ascii?Q?paV99dn3kwUCLSNuowDjlgN1C5pGNNamB4ATJnOOu3e4xZccqtfy6LjZsO6z?= =?us-ascii?Q?EqSEzEjKOawu5KOHmmTO/F/PLbQRvZM95MrOkx+cE6ZUPFbQUrMFFs3gostK?= =?us-ascii?Q?x5fDt6FWmDGXrojQptD8t7IcbhCL5hVyA3nq30pVm7a5YB9RdNCjIC1ovL4Q?= =?us-ascii?Q?GidT1iHp8BRu64hOraVccbqD8j+WGgDIt85/EKmvc8099FOSrMur/AdK7YA6?= =?us-ascii?Q?Lt0pAxdaOOURCkOwg83JR2ERmIrPLqYIRVhS7gA7eGZ8r+r3bBINtvRclaRc?= =?us-ascii?Q?ForRW0bzuX6t6JHKs58MjVouJA+/TAUOh6aAQgzA8UE4HEzuqTqav3l9H7lk?= =?us-ascii?Q?I2pOTlYwz/AMIH3EfoKuaS75Fswta7F6M6BElAfhna3mQ4VVssFy/+j+aQ3q?= =?us-ascii?Q?w5QLB4hG3eOfCwggl82qk0OIsELVlpZ3CuPHmmoKXVfLg7ngGAVo2OfiWVaO?= =?us-ascii?Q?Y77GkE0W7/T/0yovqcRnZBGsYyNY1AlNPr6GAEdq8QqSDQVIDNKOzGLOL4BT?= =?us-ascii?Q?whuP9rhPz/tGxSfVwFnVQQvOd8yYUL+sMzPv7zVhgmYbRq0qlP0+UUMAaMpY?= =?us-ascii?Q?Do39jIky7sNnaM1vLAQOApmQUIMtGB0xaTGJU8Cmr/V8BV1nU29zsG3lRRN/?= =?us-ascii?Q?jO6gH2GpAO/U1P848iR1SSt8nFLBgjkNNwZhRub7/UK7NkyCNE/zAsRsu6OX?= =?us-ascii?Q?NUvmbJ572RoO/LRdkwUsCwicY8xfHKW8OtBar+BtQ8Pf6SEwWcjiF/cXmC2+?= =?us-ascii?Q?uDGY+5/BykIrg4C8YfQ4Z9Rbs5u6/1mPuuFwTqOg0rVumQJu5iBz1Cibygbf?= =?us-ascii?Q?gHValr4yfjDCR3hLHQKObrjbYioIu5gtK2Azghhoqe+Pd1hrE1O7SVp4u8LI?= =?us-ascii?Q?FFhr4PA2YKj7LDMY21GJs0b5PIeJvHVGJM00c1QJwRAvTjQNQrW2Tvh3XPgO?= =?us-ascii?Q?uey8qOsWxDgWz+O0IQnD+VGevJKv0c0HAtMLOj/xuRvnV0hq4VLqiXeLXu1M?= =?us-ascii?Q?+OM3Hv7x2tDWbznokLmWmHmkZmZ7ogYy4e5vtDSw1WEio+UnBRVpL5iLxRjg?= =?us-ascii?Q?Q88F/VOpfLUfSq5RJLw=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN6PR11MB8244.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3ec3e1d6-f51c-473d-2c5b-08dbae98ce4e X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Sep 2023 05:19:12.2376 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: rqg1DQbx1As6oSXUqrHcUZB8x2Xunkj+2TYkJFp2aR7E7hwhuIX7ccMHFWXd2C9uOxY6zJi0RPubqpLgNn2B+Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR11MB6281 X-OriginatorOrg: intel.com Precedence: Bulk List-Subscribe: List-Help: 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,ray.ni@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: vEhm9UV6SdCENZOZFvpAOMNyx7686176AA= Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_MN6PR11MB824447ED71D5C398398B18278CEFAMN6PR11MB8244namp_" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=jofeC47V; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}"); dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io --_000_MN6PR11MB824447ED71D5C398398B18278CEFAMN6PR11MB8244namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ray Ni Thanks, Ray ________________________________ From: Tan, Dun Sent: Wednesday, August 30, 2023 3:34 PM To: devel@edk2.groups.io Cc: Dong, Eric ; Ni, Ray ; Kumar, Ra= hul R Subject: [Patch V3 5/5] UefiCpuPkg/PiSmmCpuDxe: use MpService2Ppi to wakeup= AP in s3 Use MpService2Ppi to wakeup AP in s3 boot flow during initializing CPU. If mSmmS3ResumeState->MpService2Ppi is not 0, then BSP will use MpService2Ppi->StartupAllCPUs to do CPU initialization for both BSP and AP instead of only sending InitSipiSipi for AP. Signed-off-by: Dun Tan Cc: Eric Dong Cc: Ray Ni Cc: Rahul Kumar --- UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 58 +++++++++++++++++++++++++++++++++++= ----------------------- 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c b/UefiCpuPkg/PiSmmCpuDxeSmm/= CpuS3.c index b9dbeaef87..0bae0e33f1 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c @@ -7,6 +7,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ #include "PiSmmCpuDxeSmm.h" +#include +#include #pragma pack(1) typedef struct { @@ -594,18 +596,21 @@ InitializeCpuAfterRebase ( UINT8 Stack[128]; SetRegister (FALSE); - if (IsBsp) { - while (mNumberToFinish > 0) { - CpuPause (); + + if (mSmmS3ResumeState->MpService2Ppi =3D=3D 0) { + if (IsBsp) { + while (mNumberToFinish > 0) { + CpuPause (); + } + } else { + // + // Place AP into the safe code, count down the number with lock mech= anism in the safe code. + // + TopOfStack =3D (UINTN)Stack + sizeof (Stack); + TopOfStack &=3D ~(UINTN)(CPU_STACK_ALIGNMENT - 1); + CopyMem ((VOID *)(UINTN)mApHltLoopCode, mApHltLoopCodeTemplate, size= of (mApHltLoopCodeTemplate)); + TransferApToSafeState ((UINTN)mApHltLoopCode, TopOfStack, (UINTN)&mN= umberToFinish); } - } else { - // - // Place AP into the safe code, count down the number with lock mechan= ism in the safe code. - // - TopOfStack =3D (UINTN)Stack + sizeof (Stack); - TopOfStack &=3D ~(UINTN)(CPU_STACK_ALIGNMENT - 1); - CopyMem ((VOID *)(UINTN)mApHltLoopCode, mApHltLoopCodeTemplate, sizeof= (mApHltLoopCodeTemplate)); - TransferApToSafeState ((UINTN)mApHltLoopCode, TopOfStack, (UINTN)&mNum= berToFinish); } } @@ -783,11 +788,12 @@ SmmRestoreCpu ( VOID ) { - SMM_S3_RESUME_STATE *SmmS3ResumeState; - IA32_DESCRIPTOR Ia32Idtr; - IA32_DESCRIPTOR X64Idtr; - IA32_IDT_GATE_DESCRIPTOR IdtEntryTable[EXCEPTION_VECTOR_NUMBER]; - EFI_STATUS Status; + SMM_S3_RESUME_STATE *SmmS3ResumeState; + IA32_DESCRIPTOR Ia32Idtr; + IA32_DESCRIPTOR X64Idtr; + IA32_IDT_GATE_DESCRIPTOR IdtEntryTable[EXCEPTION_VECTOR_NUMBER]; + EFI_STATUS Status; + EDKII_PEI_MP_SERVICES2_PPI *Mp2ServicePpi; DEBUG ((DEBUG_INFO, "SmmRestoreCpu()\n")); @@ -852,15 +858,21 @@ SmmRestoreCpu ( // mInitApsAfterSmmBaseReloc =3D FALSE; - PrepareApStartupVector (mAcpiCpuData.StartupVector); - // - // Send INIT IPI - SIPI to all APs - // - SendInitSipiSipiAllExcludingSelf ((UINT32)mAcpiCpuData.StartupVector); + if (mSmmS3ResumeState->MpService2Ppi !=3D 0) { + Mp2ServicePpi =3D (EDKII_PEI_MP_SERVICES2_PPI *)(UINTN)mSmmS3ResumeS= tate->MpService2Ppi; + Mp2ServicePpi->StartupAllCPUs (Mp2ServicePpi, InitializeCpuProcedure= , 0, NULL); + } else { + PrepareApStartupVector (mAcpiCpuData.StartupVector); + // + // Send INIT IPI - SIPI to all APs + // + SendInitSipiSipiAllExcludingSelf ((UINT32)mAcpiCpuData.StartupVector= ); + InitializeCpuProcedure (NULL); + } + } else { + InitializeCpuProcedure (NULL); } - InitializeCpuProcedure (NULL); - // // Set a flag to restore SMM configuration in S3 path. // -- 2.31.1.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 (#108304): https://edk2.groups.io/g/devel/message/108304 Mute This Topic: https://groups.io/mt/101047983/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/19134562= 12/xyzzy [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- --_000_MN6PR11MB824447ED71D5C398398B18278CEFAMN6PR11MB8244namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Reviewed= -by: Ray Ni <ray.ni@intel.com>



Thanks,
Ray

From: Tan, Dun <dun.tan@= intel.com>
Sent: Wednesday, August 30, 2023 3:34 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel= .com>; Kumar, Rahul R <rahul.r.kumar@intel.com>
Subject: [Patch V3 5/5] UefiCpuPkg/PiSmmCpuDxe: use MpService2Ppi to= wakeup AP in s3
 
Use MpService2Ppi to wakeup AP in s3 boot flow dur= ing initializing
CPU. If mSmmS3ResumeState->MpService2Ppi is not 0, then BSP will
use MpService2Ppi->StartupAllCPUs to do CPU initialization for both
BSP and AP instead of only sending InitSipiSipi for AP.

Signed-off-by: Dun Tan <dun.tan@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
---
 UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 58 ++++++++++++++++++++++++++++++= +++++-----------------------
 1 file changed, 35 insertions(+), 23 deletions(-)

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c b/UefiCpuPkg/PiSmmCpuDxeSmm/= CpuS3.c
index b9dbeaef87..0bae0e33f1 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
@@ -7,6 +7,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
 #include "PiSmmCpuDxeSmm.h"
+#include <PiPei.h>
+#include <Ppi/MpServices2.h>
 
 #pragma pack(1)
 typedef struct {
@@ -594,18 +596,21 @@ InitializeCpuAfterRebase (
   UINT8  Stack[128];
 
   SetRegister (FALSE);
-  if (IsBsp) {
-    while (mNumberToFinish > 0) {
-      CpuPause ();
+
+  if (mSmmS3ResumeState->MpService2Ppi =3D=3D 0) {
+    if (IsBsp) {
+      while (mNumberToFinish > 0) {
+        CpuPause ();
+      }
+    } else {
+      //
+      // Place AP into the safe code, count down = the number with lock mechanism in the safe code.
+      //
+      TopOfStack  =3D (UINTN)Stack + sizeof = (Stack);
+      TopOfStack &=3D ~(UINTN)(CPU_STACK_ALIG= NMENT - 1);
+      CopyMem ((VOID *)(UINTN)mApHltLoopCode, mAp= HltLoopCodeTemplate, sizeof (mApHltLoopCodeTemplate));
+      TransferApToSafeState ((UINTN)mApHltLoopCod= e, TopOfStack, (UINTN)&mNumberToFinish);
     }
-  } else {
-    //
-    // Place AP into the safe code, count down the number w= ith lock mechanism in the safe code.
-    //
-    TopOfStack  =3D (UINTN)Stack + sizeof (Stack);
-    TopOfStack &=3D ~(UINTN)(CPU_STACK_ALIGNMENT - 1);<= br> -    CopyMem ((VOID *)(UINTN)mApHltLoopCode, mApHltLoopCodeT= emplate, sizeof (mApHltLoopCodeTemplate));
-    TransferApToSafeState ((UINTN)mApHltLoopCode, TopOfStac= k, (UINTN)&mNumberToFinish);
   }
 }
 
@@ -783,11 +788,12 @@ SmmRestoreCpu (
   VOID
   )
 {
-  SMM_S3_RESUME_STATE       *SmmS3Resum= eState;
-  IA32_DESCRIPTOR        &nbs= p;  Ia32Idtr;
-  IA32_DESCRIPTOR        &nbs= p;  X64Idtr;
-  IA32_IDT_GATE_DESCRIPTOR  IdtEntryTable[EXCEPTION_VECTOR_NUMBE= R];
-  EFI_STATUS         &nb= sp;      Status;
+  SMM_S3_RESUME_STATE        = *SmmS3ResumeState;
+  IA32_DESCRIPTOR        &nbs= p;    Ia32Idtr;
+  IA32_DESCRIPTOR        &nbs= p;    X64Idtr;
+  IA32_IDT_GATE_DESCRIPTOR    IdtEntryTable[EXCEPTION_= VECTOR_NUMBER];
+  EFI_STATUS         &nb= sp;        Status;
+  EDKII_PEI_MP_SERVICES2_PPI  *Mp2ServicePpi;
 
   DEBUG ((DEBUG_INFO, "SmmRestoreCpu()\n"));
 
@@ -852,15 +858,21 @@ SmmRestoreCpu (
     //
     mInitApsAfterSmmBaseReloc =3D FALSE;
 
-    PrepareApStartupVector (mAcpiCpuData.StartupVector); -    //
-    // Send INIT IPI - SIPI to all APs
-    //
-    SendInitSipiSipiAllExcludingSelf ((UINT32)mAcpiCpuData.= StartupVector);
+    if (mSmmS3ResumeState->MpService2Ppi !=3D 0) {
+      Mp2ServicePpi =3D (EDKII_PEI_MP_SERVICES2_P= PI *)(UINTN)mSmmS3ResumeState->MpService2Ppi;
+      Mp2ServicePpi->StartupAllCPUs (Mp2Servic= ePpi, InitializeCpuProcedure, 0, NULL);
+    } else {
+      PrepareApStartupVector (mAcpiCpuData.Startu= pVector);
+      //
+      // Send INIT IPI - SIPI to all APs
+      //
+      SendInitSipiSipiAllExcludingSelf ((UINT32)m= AcpiCpuData.StartupVector);
+      InitializeCpuProcedure (NULL);
+    }
+  } else {
+    InitializeCpuProcedure (NULL);
   }
 
-  InitializeCpuProcedure (NULL);
-
   //
   // Set a flag to restore SMM configuration in S3 path.
   //
--
2.31.1.windows.1

_._,_._,_

Groups.io Links:

=20 You receive all messages sent to this group. =20 =20

View/Reply Online (#108304) | =20 | Mute= This Topic | New Topic
Your Subscriptio= n | Contact Group Owner | Unsubscribe [rebecca@openfw.io]

_._,_._,_
--_000_MN6PR11MB824447ED71D5C398398B18278CEFAMN6PR11MB8244namp_--