From nobody Fri May 17 00:20:52 2024 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+107083+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+107083+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1689836875; cv=none; d=zohomail.com; s=zohoarc; b=YP7nunAfMYQ638qzXV+WhkmMTwz2cXLpHrwe5Nt70cVwBs2ZT7KQJrlk0Wtd4pCz9D8gu8YpMBFoJNc1uwqosOdbZgwuxXZXS77OgfDxtvAt6J1KplCUz+mVmjbQc1TS0q9HwSVuv8l/UdrqSQaqxxzDZTmL+oqx6hQsd5q9iZ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689836875; 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=LO9BnnmOIrsOgvO9vA/Uo8GoaGcBB83vH5QZl5HcnXc=; b=GJR1LBZ5kW+64W7D5Ja6iZqAldWsznx/PyvF6lwL3r9IjM7oZzkt9tsHXkN2T5uJZnmUweIF2xHl6rKhHu9cxaMrCGYRRWhJXH/lQZz3w94eD7g1IbL/mPZ6RVyZKvxt6e3Kv3z/SXTcUlroEFCY/9Bwz2swW2R4cWZ+/vaKNPg= 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+107083+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 1689836875622785.4602435171888; Thu, 20 Jul 2023 00:07:55 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=Jms+ZA9tO2AsQsl6d35VrkDAzhNCGQS8ikznwocCZf4=; 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-Unsubscribe:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:X-Gm-Message-State:Content-Transfer-Encoding; s=20140610; t=1689836875; v=1; b=FZy1yRbAQzX7u4dFNX0cnPzT/qR1cxVUiOxfw+EbdtPNjAPS85u+2bI4AOAON/T+e4EciQAl 7HZAvKdIt/ROCOWAMqAkEyKp+2vmEGsya+pyQAz5sfpXTMI74FMwXYt8XAmWh1Th+fAaQAm3Ekp ZbUUubCtlWuieJexn2aiHTRY= X-Received: by 127.0.0.2 with SMTP id aIg4YY1788612xqGnf3atcEa; Thu, 20 Jul 2023 00:07:55 -0700 X-Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web11.7517.1689836871629003338 for ; Thu, 20 Jul 2023 00:07:54 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10776"; a="453029663" X-IronPort-AV: E=Sophos;i="6.01,218,1684825200"; d="scan'208";a="453029663" X-Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jul 2023 00:07:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10776"; a="814407488" X-IronPort-AV: E=Sophos;i="6.01,218,1684825200"; d="scan'208";a="814407488" X-Received: from shwdeopenlab705.ccr.corp.intel.com ([10.239.55.55]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jul 2023 00:07:52 -0700 From: "Yuanhao Xie" To: devel@edk2.groups.io Cc: Yuanhao Xie , Guo Dong , Ray Ni , Sean Rhodes , James Lu , Gua Guo Subject: [edk2-devel] [Patch V3 1/4] UefiCpuPkg: Add SendStartupIpiAllExcludingSelf Date: Thu, 20 Jul 2023 15:07:33 +0800 Message-Id: <20230720070736.4562-2-yuanhao.xie@intel.com> In-Reply-To: <20230720070736.4562-1-yuanhao.xie@intel.com> References: <20230720070736.4562-1-yuanhao.xie@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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 X-Gm-Message-State: dJ78H4RxxvQ7YkS349A9osDQx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1689836876223100005 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: Guo Dong Cc: Ray Ni Cc: Sean Rhodes Cc: James Lu Cc: Gua Guo 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 (#107083): https://edk2.groups.io/g/devel/message/107083 Mute This Topic: https://groups.io/mt/100251415/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 Fri May 17 00:20:52 2024 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+107084+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+107084+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1689836878; cv=none; d=zohomail.com; s=zohoarc; b=IoVs2u2/Q/9IR8SgbyxcMGjMlRm+Ygbb/JDJgwnmsm7QnTuCPKhNJFhgyxnSPmjdLy/sZABZVuzi8MygftfCre4tXUAtqQCFip6dqdkoKmdURFzi6vDVrbOHPCGyuqo23x8jCVgViSrZsxsKkfX08jFA1SGXl1UffJcFLy2wfSk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689836878; 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=X+DNfIaLMCSQZ1pVa6CS7BWJWyU7RcEAK18XUgQdlyE=; b=W2FhPdYnnKeKMePMLKKiZY9OUry3lstgpyTmsaegtJA357xJGAg76lsWdPFzOy/9oXT8wswQB+HD+AQSCf95e4ullONC0b5/LlGtMcJwG0igfGTb3PZBBtY0loONSquVdUYvN+AJClo8i7qYU+hsqm+6hzeqOZ3SkBedLF871o8= 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+107084+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 1689836878824178.96859610395109; Thu, 20 Jul 2023 00:07:58 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=GahWA3Cl7d00sGx9JD7rBDQd4v2C3Bx2/gBYD7U4oy8=; 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-Unsubscribe:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:X-Gm-Message-State:Content-Transfer-Encoding; s=20140610; t=1689836878; v=1; b=bKNCYsTUsvQEKepRk28uML2igykK1Oa/GeIToEobWTjGvKiQDTc0gQC5+Qnk1Re49r+EXN7G Sf8ySxRrrwo8R5CZHMTu/jkXJwrmoMkEeg+uGchMTzF8dHGlUHagi0EFE9UY3BP6Yao2U/q8RR1 SKW7h2Dr7XfNIqBXOzWUgvCY= X-Received: by 127.0.0.2 with SMTP id 4RAMYY1788612xDFVRbXPtoW; Thu, 20 Jul 2023 00:07:58 -0700 X-Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web11.7517.1689836871629003338 for ; Thu, 20 Jul 2023 00:07:58 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10776"; a="453029700" X-IronPort-AV: E=Sophos;i="6.01,218,1684825200"; d="scan'208";a="453029700" X-Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jul 2023 00:07:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10776"; a="814407495" X-IronPort-AV: E=Sophos;i="6.01,218,1684825200"; d="scan'208";a="814407495" X-Received: from shwdeopenlab705.ccr.corp.intel.com ([10.239.55.55]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jul 2023 00:07:55 -0700 From: "Yuanhao Xie" To: devel@edk2.groups.io Cc: Guo Dong , Ray Ni , Sean Rhodes , James Lu , Gua Guo , Yuanhao Xie Subject: [edk2-devel] [Patch V3 2/4] UefiCpuPkg: Add PcdFirstTimeWakeUpAPsBySipi Date: Thu, 20 Jul 2023 15:07:34 +0800 Message-Id: <20230720070736.4562-3-yuanhao.xie@intel.com> In-Reply-To: <20230720070736.4562-1-yuanhao.xie@intel.com> References: <20230720070736.4562-1-yuanhao.xie@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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 X-Gm-Message-State: SREpolMMmjOyJNGO9n6ZVmIjx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1689836879864100001 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: Guo Dong Cc: Ray Ni Cc: Sean Rhodes Cc: James Lu Cc: Gua Guo 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..cef0cbd43b 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 + ## 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 is to indicate + # whether to broadcast INIT-SIPI-SIPI or SIPI. + # + # TRUE - Broadcast SIPI in the OVMF environment. + # FALSE - Broadcast INIT-SIPI-SIPI. + # + # @Prompt Ovmf environement Check. + 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 (#107084): https://edk2.groups.io/g/devel/message/107084 Mute This Topic: https://groups.io/mt/100251416/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 Fri May 17 00:20:52 2024 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+107085+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+107085+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1689836884; cv=none; d=zohomail.com; s=zohoarc; b=HVJDWc9FqKyXAEudPNJIHoEGAhPZgCCub0i6xZ6wPtchO/bFBf3WBIeGjypaDyWQ2WJgjder/+9sUaFa3D18wiQl5cFCbuT8i4eI1JJ0a1Ys7AUvPE0rJOcWeuG7kmtmrYXAJ0pf6fH5LoCm3v3K3V3J11PWMkkWfrIlRHSlw8A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689836884; 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=ZBe7uUnbwi8gHidMaOa7tP5/72ebttY2nRDA+IVtuFo=; b=Vx1wKrNqhzZ/YhbdojgEBa4SR0StWDul2V/nLCF8sWLChQ4+CG7fU2CcFwwV68E4KXvfm5P6RineBvP6I1QB+GUEtt9uEbO0qWBH+0cjbdgJxHnHVNRIIuzxqDj1ybPH3DzN6EUj8aLLUvesD8GYEWae/SeV0JA8SZoOavasqaM= 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+107085+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 1689836884598409.6228571260343; Thu, 20 Jul 2023 00:08:04 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=JnM8LDMfzHajfFDS2LkLLFpMXcITRGmiyQ6xySQLXwU=; 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-Unsubscribe:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:X-Gm-Message-State:Content-Transfer-Encoding; s=20140610; t=1689836884; v=1; b=mjY3e/XWY7plMQ0oYHPu4/MNLbxU3VO/9Vm3sf5z53iQzoVYLh9Na99v6wAYRPfec7L5HHKS q4lWku+YhRbfIdcZVv9HVj/VjodTJdWuKdKHP3Wbt8snxOcArphj/fRPDPvgsuLpRJMYuYv1avc JR79kf8VGx+eAuBqoooUl2QE= X-Received: by 127.0.0.2 with SMTP id flLTYY1788612xnUhIKQUW03; Thu, 20 Jul 2023 00:08:04 -0700 X-Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web11.7524.1689836883677067564 for ; Thu, 20 Jul 2023 00:08:03 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10776"; a="453029728" X-IronPort-AV: E=Sophos;i="6.01,218,1684825200"; d="scan'208";a="453029728" X-Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jul 2023 00:08:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10776"; a="814407501" X-IronPort-AV: E=Sophos;i="6.01,218,1684825200"; d="scan'208";a="814407501" X-Received: from shwdeopenlab705.ccr.corp.intel.com ([10.239.55.55]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jul 2023 00:08:00 -0700 From: "Yuanhao Xie" To: devel@edk2.groups.io Cc: Guo Dong , Ray Ni , Sean Rhodes , James Lu , Gua Guo , Yuanhao Xie Subject: [edk2-devel] [Patch V3 3/4] OvmfPkg: Disable PcdFirstTimeWakeUpAPsBySipi. Date: Thu, 20 Jul 2023 15:07:35 +0800 Message-Id: <20230720070736.4562-4-yuanhao.xie@intel.com> In-Reply-To: <20230720070736.4562-1-yuanhao.xie@intel.com> References: <20230720070736.4562-1-yuanhao.xie@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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 X-Gm-Message-State: MkAiUgGg4sX2jflIX3EeA1jwx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1689836885886100001 Content-Type: text/plain; charset="utf-8" Disable PcdFirstTimeWakeUpAPsBySipi for OVMF to let BSP wake up APs by INIT-SIPI-SIPI. Cc: Guo Dong Cc: Ray Ni Cc: Sean Rhodes Cc: James Lu Cc: Gua Guo Signed-off-by: Yuanhao Xie --- OvmfPkg/OvmfPkgIa32.dsc | 4 +++- OvmfPkg/OvmfPkgIa32X64.dsc | 2 ++ OvmfPkg/OvmfPkgX64.dsc | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc index ed36935770..d1ef1d670f 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. # @@ -586,6 +586,8 @@ # 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 } =20 + gUefiCpuPkgTokenSpaceGuid.PcdFirstTimeWakeUpAPsBySipi|FALSE + ##########################################################################= ###### # # Pcd Dynamic Section - list of all EDK II PCD Entries defined by this Pla= tform diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc index 919315e4cb..8c86cf1ac5 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -567,6 +567,8 @@ gEfiSourceLevelDebugPkgTokenSpaceGuid.PcdDebugLoadImageMethod|0x2 !endif =20 + gUefiCpuPkgTokenSpaceGuid.PcdFirstTimeWakeUpAPsBySipi|FALSE + [PcdsFixedAtBuild.IA32] # # The NumberOfPages values below are ad-hoc. They are updated sporadical= ly at diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index 823de0d0f9..6bb5039e86 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -616,6 +616,8 @@ # 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 } =20 + gUefiCpuPkgTokenSpaceGuid.PcdFirstTimeWakeUpAPsBySipi|FALSE + ##########################################################################= ###### # # Pcd Dynamic Section - list of all EDK II PCD Entries defined by this Pla= tform --=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 (#107085): https://edk2.groups.io/g/devel/message/107085 Mute This Topic: https://groups.io/mt/100251420/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 Fri May 17 00:20:52 2024 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+107086+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+107086+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1689836908; cv=none; d=zohomail.com; s=zohoarc; b=QaZg5DyTcmShKvS/tWG/AYxCoxi1kahEPR/BN9Na1yqTVvIACZK54dvOWc8avtDZKdl4lRavYDzUVrdx78WbNi5zguuU8fMBlc5EFVswL67vr3/E9RjzLisTb4oA4/D8NRKfVSfLeXXPp7uOq+22Q+/RVQnUuEtMTjRFUpBmj4I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689836908; 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=lP50EiOSDzvBcUFT8tVLSt9MwbJdl5JJ2SOeaJAwxAY=; b=kNuky4309nTVf13pu76pE4T0zpKHWTo1MLQpgpGXEPnlT7FIZDYfVeZfPW5dxoIgW8SQlqKoDAvyewepNnmVebXb/ItD8lonWP1e1xgzjAqgDCfIjUTMCEKEAttnsl/Ln2YMEaZr1bgvLv/FfeUxa9FIpcyWWrGhLV7/jG+09H8= 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+107086+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 1689836908585641.403217382071; Thu, 20 Jul 2023 00:08:28 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=ISjkoQf9heKgmO61Tgt8aubof3Ax/aWcLASysRfYg88=; 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-Unsubscribe:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:X-Gm-Message-State:Content-Transfer-Encoding; s=20140610; t=1689836908; v=1; b=CC+/NTRXV7HcMCIdmRg0NbbohUGcdHqsd9AmW/YvW6pgne6/dSTD0pJtdIuzIqxUqHXbmqvg /qiJSHeInNCBQih2ah5BDcIFWYu+p0xvpzeCqQFNsjre3b5Hm0QnZ4k9o/q4OYZ+xRIvEnKnMgp 4VPL+jx2rIKofB7+zpG47sFs= X-Received: by 127.0.0.2 with SMTP id 12v8YY1788612x8HRrzDZEmV; Thu, 20 Jul 2023 00:08:28 -0700 X-Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web10.7585.1689836907660520542 for ; Thu, 20 Jul 2023 00:08:27 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10776"; a="453029807" X-IronPort-AV: E=Sophos;i="6.01,218,1684825200"; d="scan'208";a="453029807" X-Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jul 2023 00:08:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10776"; a="814407623" X-IronPort-AV: E=Sophos;i="6.01,218,1684825200"; d="scan'208";a="814407623" X-Received: from shwdeopenlab705.ccr.corp.intel.com ([10.239.55.55]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jul 2023 00:08:19 -0700 From: "Yuanhao Xie" To: devel@edk2.groups.io Cc: Guo Dong , Ray Ni , Sean Rhodes , James Lu , Gua Guo , Yuanhao Xie Subject: [edk2-devel] [Patch V3 4/4] UefiCpuPkg:Wake up APs after power-up or RESET through SIPI. Date: Thu, 20 Jul 2023 15:07:36 +0800 Message-Id: <20230720070736.4562-5-yuanhao.xie@intel.com> In-Reply-To: <20230720070736.4562-1-yuanhao.xie@intel.com> References: <20230720070736.4562-1-yuanhao.xie@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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 X-Gm-Message-State: sd3ceR4YGGIbwa0fLFvJMjtFx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1689836910377100003 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: Guo Dong Cc: Ray Ni Cc: Sean Rhodes Cc: James Lu Cc: Gua Guo 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 737e03ffc5..ce94937e30 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 (#107086): https://edk2.groups.io/g/devel/message/107086 Mute This Topic: https://groups.io/mt/100251422/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-