From nobody Mon Feb 9 04:09:23 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+107315+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+107315+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1690521506; cv=none; d=zohomail.com; s=zohoarc; b=Bf1chBEShS4/uqVxGcrSvW//ZF/WdA4b7DgTgcLkvwAf5kc2BXro4y5QwMzL/i8V6juafXBgAHajrtfpXKjT7a3gLBNmtT09aj9ZDLNmipjKLDORgdKJ90ZR3ytJKh/qNYLTtcfyh153xvsBr6ZKbNbwm+993pQ6XbKB/el4No8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690521506; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=1dX9bkwR/ajYd2tJ+KC6JjMeBmbK8rot2nVg9bgfodQ=; b=Oiik/MAEEhHtfbO36YmfUjAG/lSN0vu3d72jpoEfhxLYktz1Inora/aEH1be1KN8RVDGHsuWTUS1A5nepMz0872iKzC5s/+1PEL+wJh7bUtAeQzXlm2hWpwLa8tZxGrHoQntpwl/A4FDABws3Z2BPUYmdyIzJGRzS+3OmEL69yw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+107315+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1690521505773938.2045276493743; Thu, 27 Jul 2023 22:18:25 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=0i9voWlrpUh5wUYC69U04ByVdPmn1vDK6EsBPovgazc=; c=relaxed/simple; d=groups.io; h=X-Received:X-Received:X-IronPort-AV:X-IronPort-AV:X-Received:X-ExtLoop1:X-IronPort-AV:X-IronPort-AV:X-Received:From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:X-Gm-Message-State:Content-Transfer-Encoding; s=20140610; t=1690521505; v=1; b=tJ9P7Cvm1m7DvM+RHHN//6GNQc0CVGXOOmVJX5VfmxCu9IJAsHEbx3VVNFhv51SMD9X3fzQj AiJq0w0h9RfBH3nCDogib4NtcSQFJgYJJg6Ph7PP+htVEVAyMpzcfcUatH2DQIP8zd72N0IMy4V GCmeiH7P3xaDBbt/RrQS0h5I= X-Received: by 127.0.0.2 with SMTP id IRosYY1788612xHSkzEp5slx; Thu, 27 Jul 2023 22:18:25 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web10.26393.1690521501693824176 for ; Thu, 27 Jul 2023 22:18:24 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10784"; a="365969182" X-IronPort-AV: E=Sophos;i="6.01,236,1684825200"; d="scan'208";a="365969182" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jul 2023 22:18:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10784"; a="757009106" X-IronPort-AV: E=Sophos;i="6.01,236,1684825200"; d="scan'208";a="757009106" X-Received: from shwdeopenlab705.ccr.corp.intel.com ([10.239.55.55]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jul 2023 22:18:22 -0700 From: "Yuanhao Xie" To: devel@edk2.groups.io Cc: Yuanhao Xie , Eric Dong , Rahul Kumar , Gerd Hoffmann , Ray Ni Subject: [edk2-devel] [Patch V4 1/4] UefiCpuPkg: Add SendStartupIpiAllExcludingSelf Date: Fri, 28 Jul 2023 13:18:02 +0800 Message-Id: <20230728051805.6250-2-yuanhao.xie@intel.com> In-Reply-To: <20230728051805.6250-1-yuanhao.xie@intel.com> References: <20230728051805.6250-1-yuanhao.xie@intel.com> MIME-Version: 1.0 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,yuanhao.xie@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: Wzgm5ppylbzz0yJiKvm9rbcCx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1690521506592100005 Content-Type: text/plain; charset="utf-8" From: Yuanhao Xie Add new API SendStartupIpiAllExcludingSelf(), and modify SendInitSipiSipiAllExcludingSelf() by let it call the new API. Cc: Eric Dong Cc: Rahul Kumar Cc: Gerd Hoffmann Cc: Ray Ni Signed-off-by: Ray Ni Signed-off-by: Yuanhao Xie Reviewed-by: Ray Ni --- UefiCpuPkg/Include/Library/LocalApicLib.h | 17 ++++++++++= ++++++- UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c | 43 ++++++++++= ++++++++++++++++++++------------- UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c | 43 ++++++++++= ++++++++++++++++++++------------- 3 files changed, 76 insertions(+), 27 deletions(-) diff --git a/UefiCpuPkg/Include/Library/LocalApicLib.h b/UefiCpuPkg/Include= /Library/LocalApicLib.h index b55d88b0f5..d7c2ad3f70 100644 --- a/UefiCpuPkg/Include/Library/LocalApicLib.h +++ b/UefiCpuPkg/Include/Library/LocalApicLib.h @@ -4,7 +4,7 @@ Local APIC library assumes local APIC is enabled. It does not handles cases where local APIC is disabled. =20 - Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2023, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -185,6 +185,21 @@ SendInitIpiAllExcludingSelf ( VOID ); =20 +/** + Send a Start-up IPI to all processors excluding self. + This function returns after the IPI has been accepted by the target proc= essors. + if StartupRoutine >=3D 1M, then ASSERT. + if StartupRoutine is not multiple of 4K, then ASSERT. + @param StartupRoutine Points to a start-up routine which is below 1M p= hysical + address and 4K aligned. +**/ + +VOID +EFIAPI +SendStartupIpiAllExcludingSelf ( + IN UINT32 StartupRoutine + ); + /** Send an INIT-Start-up-Start-up IPI sequence to a specified target proces= sor. =20 diff --git a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c b/UefiCpuPkg/Li= brary/BaseXApicLib/BaseXApicLib.c index 008b8a070b..d56c6275cc 100644 --- a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c +++ b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c @@ -3,7 +3,7 @@ =20 This local APIC library instance supports xAPIC mode only. =20 - Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2023, Intel Corporation. All rights reserved.
Copyright (c) 2017 - 2020, AMD Inc. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent @@ -497,6 +497,33 @@ SendInitIpiAllExcludingSelf ( SendIpi (IcrLow.Uint32, 0); } =20 +/** + Send a Start-up IPI to all processors excluding self. + This function returns after the IPI has been accepted by the target proc= essors. + if StartupRoutine >=3D 1M, then ASSERT. + if StartupRoutine is not multiple of 4K, then ASSERT. + @param StartupRoutine Points to a start-up routine which is below 1M p= hysical + address and 4K aligned. +**/ +VOID +EFIAPI +SendStartupIpiAllExcludingSelf ( + IN UINT32 StartupRoutine + ) +{ + LOCAL_APIC_ICR_LOW IcrLow; + + ASSERT (StartupRoutine < 0x100000); + ASSERT ((StartupRoutine & 0xfff) =3D=3D 0); + + IcrLow.Uint32 =3D 0; + IcrLow.Bits.Vector =3D (StartupRoutine >> 12); + IcrLow.Bits.DeliveryMode =3D LOCAL_APIC_DELIVERY_MODE_STARTUP; + IcrLow.Bits.Level =3D 1; + IcrLow.Bits.DestinationShorthand =3D LOCAL_APIC_DESTINATION_SHORTHAND_AL= L_EXCLUDING_SELF; + SendIpi (IcrLow.Uint32, 0); +} + /** Send an INIT-Start-up-Start-up IPI sequence to a specified target proces= sor. =20 @@ -551,22 +578,12 @@ SendInitSipiSipiAllExcludingSelf ( IN UINT32 StartupRoutine ) { - LOCAL_APIC_ICR_LOW IcrLow; - - ASSERT (StartupRoutine < 0x100000); - ASSERT ((StartupRoutine & 0xfff) =3D=3D 0); - SendInitIpiAllExcludingSelf (); MicroSecondDelay (PcdGet32 (PcdCpuInitIpiDelayInMicroSeconds)); - IcrLow.Uint32 =3D 0; - IcrLow.Bits.Vector =3D (StartupRoutine >> 12); - IcrLow.Bits.DeliveryMode =3D LOCAL_APIC_DELIVERY_MODE_STARTUP; - IcrLow.Bits.Level =3D 1; - IcrLow.Bits.DestinationShorthand =3D LOCAL_APIC_DESTINATION_SHORTHAND_AL= L_EXCLUDING_SELF; - SendIpi (IcrLow.Uint32, 0); + SendStartupIpiAllExcludingSelf (StartupRoutine); if (!StandardSignatureIsAuthenticAMD ()) { MicroSecondDelay (200); - SendIpi (IcrLow.Uint32, 0); + SendStartupIpiAllExcludingSelf (StartupRoutine); } } =20 diff --git a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c b/U= efiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c index 0ba0499631..aa4eb11181 100644 --- a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c +++ b/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c @@ -4,7 +4,7 @@ This local APIC library instance supports x2APIC capable processors which have xAPIC and x2APIC modes. =20 - Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2023, Intel Corporation. All rights reserved.
Copyright (c) 2017 - 2020, AMD Inc. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent @@ -736,6 +736,33 @@ SendInitIpiAllExcludingSelf ( SendIpi (IcrLow.Uint32, 0); } =20 +/** + Send a Start-up IPI to all processors excluding self. + This function returns after the IPI has been accepted by the target proc= essors. + if StartupRoutine >=3D 1M, then ASSERT. + if StartupRoutine is not multiple of 4K, then ASSERT. + @param StartupRoutine Points to a start-up routine which is below 1M p= hysical + address and 4K aligned. +**/ +VOID +EFIAPI +SendStartupIpiAllExcludingSelf ( + IN UINT32 StartupRoutine + ) +{ + LOCAL_APIC_ICR_LOW IcrLow; + + ASSERT (StartupRoutine < 0x100000); + ASSERT ((StartupRoutine & 0xfff) =3D=3D 0); + + IcrLow.Uint32 =3D 0; + IcrLow.Bits.Vector =3D (StartupRoutine >> 12); + IcrLow.Bits.DeliveryMode =3D LOCAL_APIC_DELIVERY_MODE_STARTUP; + IcrLow.Bits.Level =3D 1; + IcrLow.Bits.DestinationShorthand =3D LOCAL_APIC_DESTINATION_SHORTHAND_AL= L_EXCLUDING_SELF; + SendIpi (IcrLow.Uint32, 0); +} + /** Send an INIT-Start-up-Start-up IPI sequence to a specified target proces= sor. =20 @@ -790,22 +817,12 @@ SendInitSipiSipiAllExcludingSelf ( IN UINT32 StartupRoutine ) { - LOCAL_APIC_ICR_LOW IcrLow; - - ASSERT (StartupRoutine < 0x100000); - ASSERT ((StartupRoutine & 0xfff) =3D=3D 0); - SendInitIpiAllExcludingSelf (); MicroSecondDelay (PcdGet32 (PcdCpuInitIpiDelayInMicroSeconds)); - IcrLow.Uint32 =3D 0; - IcrLow.Bits.Vector =3D (StartupRoutine >> 12); - IcrLow.Bits.DeliveryMode =3D LOCAL_APIC_DELIVERY_MODE_STARTUP; - IcrLow.Bits.Level =3D 1; - IcrLow.Bits.DestinationShorthand =3D LOCAL_APIC_DESTINATION_SHORTHAND_AL= L_EXCLUDING_SELF; - SendIpi (IcrLow.Uint32, 0); + SendStartupIpiAllExcludingSelf (StartupRoutine); if (!StandardSignatureIsAuthenticAMD ()) { MicroSecondDelay (200); - SendIpi (IcrLow.Uint32, 0); + SendStartupIpiAllExcludingSelf (StartupRoutine); } } =20 --=20 2.36.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 (#107315): https://edk2.groups.io/g/devel/message/107315 Mute This Topic: https://groups.io/mt/100405490/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 Feb 9 04:09:23 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+107316+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+107316+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1690521508; cv=none; d=zohomail.com; s=zohoarc; b=exEVFMGJP3VWnG5hKiYW4UQZBjy3XChSnjPTZfO7/GIazjJaeEKC0cfLS0/1PcsI88nrDeYcayG2QHfPDFrzl/THozUrcyvwAyxtLWsZn7odV6RRUWxfD7zhDPuK+XIgZ4du+Nl3z5sEYDGU0HxlFOLnwZAQWRtGcLXuB8lXjiM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690521508; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=VaI9NOiJUkb4wzyuCvU36gkewu6ftDOmFHB4kVj9sOg=; b=HX5u+9FoiT1aZ8HXBy/Odzmrb82i60oxLfpeemHsdN7gS4j0df+UaaimWZQxSh4MLKLo1cPYlhPdNa4TB40sVfYTIN9tu9yM8XGOkemTiXgXotVwDA1N55BmsjUvXkmpa4ex1bt1k30Ix1QBDUqrBfri+FKHNBzeXOyh2fQwH9w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+107316+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1690521508689948.4740049724642; Thu, 27 Jul 2023 22:18:28 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=jTLBW4sa3OtATlMhdORTWixdaQ0y7BYTMloAW8uyqPU=; c=relaxed/simple; d=groups.io; h=X-Received:X-Received:X-IronPort-AV:X-IronPort-AV:X-Received:X-ExtLoop1:X-IronPort-AV:X-IronPort-AV:X-Received:From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:X-Gm-Message-State:Content-Transfer-Encoding; s=20140610; t=1690521508; v=1; b=oH/KDGYZoG1vyd6rIRqNj+b3+oqgrTiR9+R7dqa5D0QDNpWKSHVJiF5KtsQ3OWpfL86wOC/Y a1IPpqnHdf2Jor7pMMZ7e0aOD4RvRimxXg2fDGMNXvQ4ghArVMMNov/t18YHzHEiJKGBpas5j+B 1uKFUJB9SLGU+msLvUlDjZj4= X-Received: by 127.0.0.2 with SMTP id xQLKYY1788612xAZGMpngWZY; Thu, 27 Jul 2023 22:18:28 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web10.26393.1690521501693824176 for ; Thu, 27 Jul 2023 22:18:27 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10784"; a="365969199" X-IronPort-AV: E=Sophos;i="6.01,236,1684825200"; d="scan'208";a="365969199" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jul 2023 22:18:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10784"; a="757009111" X-IronPort-AV: E=Sophos;i="6.01,236,1684825200"; d="scan'208";a="757009111" X-Received: from shwdeopenlab705.ccr.corp.intel.com ([10.239.55.55]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jul 2023 22:18:25 -0700 From: "Yuanhao Xie" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Rahul Kumar , Gerd Hoffmann , Yuanhao Xie Subject: [edk2-devel] [Patch V4 2/4] UefiCpuPkg: Add PcdFirstTimeWakeUpAPsBySipi Date: Fri, 28 Jul 2023 13:18:03 +0800 Message-Id: <20230728051805.6250-3-yuanhao.xie@intel.com> In-Reply-To: <20230728051805.6250-1-yuanhao.xie@intel.com> References: <20230728051805.6250-1-yuanhao.xie@intel.com> MIME-Version: 1.0 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,yuanhao.xie@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: WUOiiWyBsEuZxKdrcr25qX5tx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1690521510559100001 Content-Type: text/plain; charset="utf-8" Add PcdFirstTimeWakeUpAPsBySipi to check if it is in the OVMF environment and necessary to wake up APs by INIT-SIPI-SIPI. Cc: Eric Dong Cc: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann Signed-off-by: Yuanhao Xie Reviewed-by: Ray Ni --- UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf | 1 + UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf | 1 + UefiCpuPkg/UefiCpuPkg.dec | 11 +++++++++++ 3 files changed, 13 insertions(+) diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf b/UefiCpuPkg/Lib= rary/MpInitLib/DxeMpInitLib.inf index 7d45d3ad4d..55e46d4a1f 100644 --- a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf +++ b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf @@ -81,6 +81,7 @@ gUefiCpuPkgTokenSpaceGuid.PcdCpuApStatusCheckIntervalInMicroSeconds ## = CONSUMES gUefiCpuPkgTokenSpaceGuid.PcdGhcbHypervisorFeatures ## = CONSUMES gUefiCpuPkgTokenSpaceGuid.PcdSevEsWorkAreaBase ## = SOMETIMES_CONSUMES + gUefiCpuPkgTokenSpaceGuid.PcdFirstTimeWakeUpAPsBySipi ## = CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard ## = CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdGhcbBase ## = CONSUMES gEfiMdePkgTokenSpaceGuid.PcdConfidentialComputingGuestAttr ## = CONSUMES diff --git a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf b/UefiCpuPkg/Lib= rary/MpInitLib/PeiMpInitLib.inf index 83e9028d0f..bc3d716aa9 100644 --- a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf +++ b/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf @@ -66,6 +66,7 @@ gUefiCpuPkgTokenSpaceGuid.PcdCpuApTargetCstate ## SOME= TIMES_CONSUMES gUefiCpuPkgTokenSpaceGuid.PcdSevEsWorkAreaBase ## SOME= TIMES_CONSUMES gUefiCpuPkgTokenSpaceGuid.PcdGhcbHypervisorFeatures ## CONS= UMES + gUefiCpuPkgTokenSpaceGuid.PcdFirstTimeWakeUpAPsBySipi ## CON= SUMES gEfiMdeModulePkgTokenSpaceGuid.PcdGhcbBase ## CONS= UMES gEfiMdePkgTokenSpaceGuid.PcdConfidentialComputingGuestAttr ## CONS= UMES =20 diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec index e7726a605c..fcfbd618dc 100644 --- a/UefiCpuPkg/UefiCpuPkg.dec +++ b/UefiCpuPkg/UefiCpuPkg.dec @@ -214,6 +214,17 @@ # @Prompt Configure the SEV-ES work area base gUefiCpuPkgTokenSpaceGuid.PcdSevEsWorkAreaSize|0x0|UINT32|0x30002006 =20 + ## Determining Whether APs Awakened from SIPI or INIT-SIPI-SIPI. + # Following a power-up or RESET of an MP system, The APs complete a + # minimal self-configuration, then wait for a startup signal (a SIPI + # message) from the BSP processor. + # + # TRUE - Broadcast SIPI. + # FALSE - Broadcast INIT-SIPI-SIPI. + # + # @Prompt BSP Broadcast Method. + gUefiCpuPkgTokenSpaceGuid.PcdFirstTimeWakeUpAPsBySipi|TRUE|BOOLEAN|0x300= 02007 + [PcdsFixedAtBuild, PcdsPatchableInModule] ## This value is the CPU Local APIC base address, which aligns the addre= ss on a 4-KByte boundary. # @Prompt Configure base address of CPU Local APIC --=20 2.36.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 (#107316): https://edk2.groups.io/g/devel/message/107316 Mute This Topic: https://groups.io/mt/100405492/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 Feb 9 04:09:23 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+107317+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+107317+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1690521512; cv=none; d=zohomail.com; s=zohoarc; b=FqLHjoXcGYX+U79qLHaFy8fu8w7WoTMa/2txUMY7562bzrLIhE8kTGL5oJhw1lDiG4FeMqTcbRfe2Pb7qj+NjkBLgevpXvqNKayPByPfsF4y02W4X0frN8R79URS3TmQtemib3a0zTLxl/Sgr3CP/Z8SFON60WS8AQIH21+mrdE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690521512; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=UGeHz+RceXO+dP3UZi+lS2y2ZWNZ1LD7jXLAIbW6MPo=; b=HdWJeoJ2hr/nvc7yRii18nimG1l9lxVctBRMUdgyUeuOfSbSqGavQYj+/zMlmoHhEiA25GV9QmhabUu1aR9Fdxr2uG8VSJkhpwcFPpjFw2cNkC8RP0jKZ1sG3BWmVwn73ygFSGiwPzHCgo+IJbafOnxQwa0109eryvqX27U9jeM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+107317+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1690521512295614.9684760647951; Thu, 27 Jul 2023 22:18:32 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=CheOAzahhTaEopfQNQYLy0QtMI9n7s6XG6BLvZlsRnE=; c=relaxed/simple; d=groups.io; h=X-Received:X-Received:X-IronPort-AV:X-IronPort-AV:X-Received:X-ExtLoop1:X-IronPort-AV:X-IronPort-AV:X-Received:From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:X-Gm-Message-State:Content-Transfer-Encoding; s=20140610; t=1690521512; v=1; b=MmB1VKb/irkbuNfCghn4UDJ8sr3BVakAuvb3jjUxzi0y9pCw/wNVHtwB92VoUxUekJsP96OX WZSIXQDMO6FhbTyzuwYYZjP1/NY02khuP72gvjCMumjYRMehXnhvykV/KQ9VSg+ut8fkixZ1oSb 5CpSKzL50jHY+KRhaujEbWlE= X-Received: by 127.0.0.2 with SMTP id 6GJOYY1788612xE04U8TrWXL; Thu, 27 Jul 2023 22:18:32 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web10.26393.1690521501693824176 for ; Thu, 27 Jul 2023 22:18:31 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10784"; a="365969211" X-IronPort-AV: E=Sophos;i="6.01,236,1684825200"; d="scan'208";a="365969211" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jul 2023 22:18:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10784"; a="757009121" X-IronPort-AV: E=Sophos;i="6.01,236,1684825200"; d="scan'208";a="757009121" X-Received: from shwdeopenlab705.ccr.corp.intel.com ([10.239.55.55]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jul 2023 22:18:28 -0700 From: "Yuanhao Xie" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Rahul Kumar , Gerd Hoffmann , Ard Biesheuvel , Jiewen Yao , Jordan Justen , Yuanhao Xie Subject: [edk2-devel] [Patch V4 3/4] OvmfPkg: Disable PcdFirstTimeWakeUpAPsBySipi. Date: Fri, 28 Jul 2023 13:18:04 +0800 Message-Id: <20230728051805.6250-4-yuanhao.xie@intel.com> In-Reply-To: <20230728051805.6250-1-yuanhao.xie@intel.com> References: <20230728051805.6250-1-yuanhao.xie@intel.com> MIME-Version: 1.0 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,yuanhao.xie@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: x0zCtLLLVFE62LKTWzZmjbYPx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1690521514110100001 Content-Type: text/plain; charset="utf-8" Disable PcdFirstTimeWakeUpAPsBySipi for OVMF to let BSP wake up APs by INIT-SIPI-SIPI. Cc: Eric Dong Cc: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann Cc: Ard Biesheuvel Cc: Jiewen Yao Cc: Jordan Justen Signed-off-by: Yuanhao Xie Reviewed-by: Ray Ni --- OvmfPkg/OvmfPkgIa32.dsc | 9 ++++++++- OvmfPkg/OvmfPkgIa32X64.dsc | 7 +++++++ OvmfPkg/OvmfPkgX64.dsc | 7 +++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc index ed36935770..0193ea8af8 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc +++ b/OvmfPkg/OvmfPkgIa32.dsc @@ -1,7 +1,7 @@ ## @file # EFI/Framework Open Virtual Machine Firmware (OVMF) platform # -# Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.
+# Copyright (c) 2006 - 2023, Intel Corporation. All rights reserved.
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
# Copyright (c) Microsoft Corporation. # @@ -585,6 +585,13 @@ =20 # Point to the MdeModulePkg/Application/UiApp/UiApp.inf gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c= , 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0= x31 } + # + # INIT is now triggered before BIOS by ucode/hardware. In the OVMF + # environment, QEMU lacks a simulation for the INIT process. + # To address this, PcdFirstTimeWakeUpAPsBySipi set to FALSE to + # indicate whether to broadcast INIT-SIPI-SIPI or SIPI. + # + gUefiCpuPkgTokenSpaceGuid.PcdFirstTimeWakeUpAPsBySipi|FALSE =20 ##########################################################################= ###### # diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc index 919315e4cb..05ded289ad 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -566,6 +566,13 @@ !if $(SOURCE_DEBUG_ENABLE) =3D=3D TRUE gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdDebugLoadImageMethod|0x2 !endif + # + # INIT is now triggered before BIOS by ucode/hardware. In the OVMF + # environment, QEMU lacks a simulation for the INIT process. + # To address this, PcdFirstTimeWakeUpAPsBySipi set to FALSE to + # indicate whether to broadcast INIT-SIPI-SIPI or SIPI. + # + gUefiCpuPkgTokenSpaceGuid.PcdFirstTimeWakeUpAPsBySipi|FALSE =20 [PcdsFixedAtBuild.IA32] # diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index 823de0d0f9..d588e09da5 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -615,6 +615,13 @@ =20 # Point to the MdeModulePkg/Application/UiApp/UiApp.inf gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c= , 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0= x31 } + # + # INIT is now triggered before BIOS by ucode/hardware. In the OVMF + # environment, QEMU lacks a simulation for the INIT process. + # To address this, PcdFirstTimeWakeUpAPsBySipi set to FALSE to + # indicate whether to broadcast INIT-SIPI-SIPI or SIPI. + # + gUefiCpuPkgTokenSpaceGuid.PcdFirstTimeWakeUpAPsBySipi|FALSE =20 ##########################################################################= ###### # --=20 2.36.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 (#107317): https://edk2.groups.io/g/devel/message/107317 Mute This Topic: https://groups.io/mt/100405496/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 Feb 9 04:09:23 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+107318+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+107318+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1690521515; cv=none; d=zohomail.com; s=zohoarc; b=HzvjEHuTvUYYei/Zs34G8w8KRgbLnEudNjPCYuDPtMVxon9HrjVsFnEd7LgP8nOHT8bB3pTUcJwsVA9aEYyLl2pREvEukdP/Y9cuZIfb4eMXh1TWfi/WvKOqmo5NY80DOBXr8TLwLElB5ZA2jciHIoCixBRG5fCrBKK6S//zy1U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690521515; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=Fda6/GIpLojuKY26Ic3rZIyYLBggTNll8OBAH7DX55Q=; b=HHswt1kRTL9A5rc0VNXgexu6QKNePUu3olea0VKkLWfHs+ZWLEbWai5JqzcsAuqCbjRJ2+j91HaARxu4PX8h/Ubh2m4FWs1XW8IGllZzTQ6/umWGvKamxE0GpBbERC07b66xTfvMNO68GLV93UjG6oPq4UwKcfrTwcG6xnYA3YE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+107318+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1690521515437159.17376085017042; Thu, 27 Jul 2023 22:18:35 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=JdFSoEmdeolIxiWHp8EoEWOa4rT53Lt/gtMC1UPSXJ4=; c=relaxed/simple; d=groups.io; h=X-Received:X-Received:X-IronPort-AV:X-IronPort-AV:X-Received:X-ExtLoop1:X-IronPort-AV:X-IronPort-AV:X-Received:From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:X-Gm-Message-State:Content-Transfer-Encoding; s=20140610; t=1690521515; v=1; b=dUym0UoNI4qiy8jbOilqcxDcaEyhnKpNBnLy9G2OeG5Qu4qEx3EoXZ9IYaoqrUnQNG+Xx5hJ sb60xJsU7ZxjfpLyCtLk04V3+Q+vumNXYYgJG+o4QenakZeTBqWQv8Es7Vv1IKNjgBoOXhQiOCZ rZpcjuRfG5CXwpg9q+ipStrU= X-Received: by 127.0.0.2 with SMTP id gYqMYY1788612xu5QaQ2dFFO; Thu, 27 Jul 2023 22:18:35 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web10.26393.1690521501693824176 for ; Thu, 27 Jul 2023 22:18:34 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10784"; a="365969222" X-IronPort-AV: E=Sophos;i="6.01,236,1684825200"; d="scan'208";a="365969222" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jul 2023 22:18:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10784"; a="757009129" X-IronPort-AV: E=Sophos;i="6.01,236,1684825200"; d="scan'208";a="757009129" X-Received: from shwdeopenlab705.ccr.corp.intel.com ([10.239.55.55]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jul 2023 22:18:32 -0700 From: "Yuanhao Xie" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Rahul Kumar , Gerd Hoffmann , Yuanhao Xie Subject: [edk2-devel] [Patch V4 4/4] UefiCpuPkg:Wake up APs after power-up or RESET through SIPI. Date: Fri, 28 Jul 2023 13:18:05 +0800 Message-Id: <20230728051805.6250-5-yuanhao.xie@intel.com> In-Reply-To: <20230728051805.6250-1-yuanhao.xie@intel.com> References: <20230728051805.6250-1-yuanhao.xie@intel.com> MIME-Version: 1.0 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,yuanhao.xie@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: gpUeHdXcxqSL1k9hEoLicSAhx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1690521516558100007 Content-Type: text/plain; charset="utf-8" The implementation of this new behavior aligns with the guidelines outlined in the Intel SDM. Following a power-up or RESET of an MP system, system hardware dynamically selects one of the processors on the system bus as the BSP. The remaining processors are designated as APs. The APs complete a minimal self-configuration, then wait for a startup signal (a SIPI message) from the BSP processor. Additionally, the MP protocol is executed only after a power-up or RESET. If the MP protocol has completed and a BSP is chosen, subsequent INITs (either to a specific processor or system wide) do not cause the MP protocol to be repeated. Instead, each logical processor examines its BSP flag (in the IA32_APIC_BASE MSR) to determine whether it should execute the BIOS boot-strap code (if it is the BSP) or enter a wait-for-SIPI state (if it is an AP). Cc: Eric Dong Cc: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann Signed-off-by: Ray Ni Signed-off-by: Yuanhao Xie Reviewed-by: Ray Ni --- UefiCpuPkg/Library/MpInitLib/MpLib.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpIn= itLib/MpLib.c index e7054adbcc..6f1456cfe1 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -1294,7 +1294,14 @@ WakeUpAP ( if (CpuMpData->SevSnpIsEnabled && (CpuMpData->InitFlag !=3D ApInitCo= nfig)) { SevSnpCreateAP (CpuMpData, -1); } else { - SendInitSipiSipiAllExcludingSelf ((UINT32)ExchangeInfo->BufferStar= t); + if ((CpuMpData->InitFlag =3D=3D ApInitConfig) && FixedPcdGetBool (= PcdFirstTimeWakeUpAPsBySipi)) { + // + // SIPI can be used for the first time wake up after reset to re= duce boot time. + // + SendStartupIpiAllExcludingSelf ((UINT32)ExchangeInfo->BufferStar= t); + } else { + SendInitSipiSipiAllExcludingSelf ((UINT32)ExchangeInfo->BufferSt= art); + } } } =20 --=20 2.36.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 (#107318): https://edk2.groups.io/g/devel/message/107318 Mute This Topic: https://groups.io/mt/100405497/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-