From nobody Tue May 21 07:03:38 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+107379+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+107379+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1690757070; cv=none; d=zohomail.com; s=zohoarc; b=ZV1w1QJKNU0+8AGPrpKHr0BqoYcY3yIHmveHfV/e9bvxXkctovCJ+PAc/wYi5mHw8faYzDtzDOUUHTPTCyPa2AgUdqlpu9sWGq9igDAatgTZlo/RsxvEY+O4LVQnmCM1HOGw2sXV0/eGu5+S0hm7FFvzRPoE4AIMRP0HXexULDY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690757070; 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=f2zhZp/dgZEENMx+kx3U+y5y+HXNxqgyphX0gEWcYvA=; b=Wz3f16vOVx32jVJ7aoKZO8gHqUgzajqmUHAbjZVBkTYxDDQXDsxvefwFpM6AVL4H0lskp5ELd1ugpegCGNK0gMzFJgrp6ya829J4p7crNhgaIPz792eXcdxsbU+8q7wvTBRVh23A0CxkmZ4/duqYbd7yQ/ToU5nkx0VOfgbWDLw= 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+107379+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 1690757070688137.5895193179665; Sun, 30 Jul 2023 15:44:30 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=etB0qzD46svYsmolN8QPaVi0qNhRfTlKk7LuAGv2N1s=; 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=1690757070; v=1; b=B8VahNgmYGlrdS10j6nhMfJ3meMb5jy10Jj0lvZQhPipL9iUbQwAAbfrhPNJF4PXvSWg1yKc bEUdUb9+WIT+6APEZacF1foc/3oG11BCMBUF7KTbnEel0xBylWJA8zvNYLbDJtjv4i4jvPAszl8 /u1IRd+6ogmcwlH5XUZ4k9r0= X-Received: by 127.0.0.2 with SMTP id 32TvYY1788612xwHW9FMVDRr; Sun, 30 Jul 2023 15:44:30 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web11.83655.1690757067045435466 for ; Sun, 30 Jul 2023 15:44:29 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10787"; a="368893190" X-IronPort-AV: E=Sophos;i="6.01,243,1684825200"; d="scan'208";a="368893190" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2023 15:44:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10787"; a="757737952" X-IronPort-AV: E=Sophos;i="6.01,243,1684825200"; d="scan'208";a="757737952" 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; 30 Jul 2023 15:44:27 -0700 From: "Yuanhao Xie" To: devel@edk2.groups.io Cc: Yuanhao Xie , Eric Dong , Rahul Kumar , Gerd Hoffmann , Ray Ni Subject: [edk2-devel] [Patch V7 1/4] UefiCpuPkg: Add SendStartupIpiAllExcludingSelf Date: Mon, 31 Jul 2023 06:44:10 +0800 Message-Id: <20230730224413.6411-2-yuanhao.xie@intel.com> In-Reply-To: <20230730224413.6411-1-yuanhao.xie@intel.com> References: <20230730224413.6411-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: B6gqGBcWCCcXpVDBC2ST44XRx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1690757072526100007 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 (#107379): https://edk2.groups.io/g/devel/message/107379 Mute This Topic: https://groups.io/mt/100451985/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 Tue May 21 07:03:38 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+107380+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+107380+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1690757073; cv=none; d=zohomail.com; s=zohoarc; b=JzUIurOuUMH+CFILrllgHjzOAoBdv8d8l2xGrO/eyszVOX7ew9Wxnmei7Owy7cfJipJVkuNyeckkM0xE4oGlk6Rq6srZwn44hc0wwmc9gibfpz41UWvgmRIIF/gMK/Eo+VfliDZRNDW99bEKEB609uEnvzEIVV7o+JdEWh9QnIc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690757073; 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=BDqUBp41Yvrtsxv/SNc6bGkyDSZ0atpMf+KqdbKF+sQ=; b=md7uO9TlNRYSdVhpoIt7nMzAhU3bVxtI8wx9A47jH8lywOC9NhedHXCSizwdqI3Y2o40aEs5p0Iq/enhbuyCdGba6MGy3ErIRPeVq64huY0BfdFXTxIChR1cWge4dhVrxiWmaBooJYOoyYXlc2HefDztFqLURarLuGfxPuPVVVo= 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+107380+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 1690757073396370.569956448594; Sun, 30 Jul 2023 15:44:33 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=ALCr6dYH3UZEwlgGPugbXwZkqZ2p8X+vqPnDGpOCObk=; 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=1690757073; v=1; b=cZWKZyQz9QZ6VEaGeO9Y2hMITT8tAtxhCUuPQzRk27a89DVCohFZSZqsLxalbhmqxN9XWX62 4C9xOFwJlMoQQRSJVOkaVP2H/4JT65ui9dChb6luGMpmKXwuFblHmd9OAqIcEJiljVH2wqnN28e 5ETzH08fJ1ExbuyrdwxJ8xjA= X-Received: by 127.0.0.2 with SMTP id PSQDYY1788612xn6n7kidnrd; Sun, 30 Jul 2023 15:44:33 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web11.83655.1690757067045435466 for ; Sun, 30 Jul 2023 15:44:32 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10787"; a="368893192" X-IronPort-AV: E=Sophos;i="6.01,243,1684825200"; d="scan'208";a="368893192" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2023 15:44:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10787"; a="757737957" X-IronPort-AV: E=Sophos;i="6.01,243,1684825200"; d="scan'208";a="757737957" 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; 30 Jul 2023 15:44:30 -0700 From: "Yuanhao Xie" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Rahul Kumar , Gerd Hoffmann , Yuanhao Xie Subject: [edk2-devel] [Patch V7 2/4] UefiCpuPkg: Add PcdFirstTimeWakeUpAPsBySipi Date: Mon, 31 Jul 2023 06:44:11 +0800 Message-Id: <20230730224413.6411-3-yuanhao.xie@intel.com> In-Reply-To: <20230730224413.6411-1-yuanhao.xie@intel.com> References: <20230730224413.6411-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: mTGDKeLTDro8G410WEttJwALx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1690757074313100010 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..68473fc640 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 APs' first-time wakeup by 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 for the first-time wakeup of APs + 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 (#107380): https://edk2.groups.io/g/devel/message/107380 Mute This Topic: https://groups.io/mt/100451986/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 Tue May 21 07:03:38 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+107381+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+107381+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1690757077; cv=none; d=zohomail.com; s=zohoarc; b=Fr6Gfxf3ytqqYOB2xcYDZJc9Lc99Xt6HW+zmRoENcfxG/SDJrRheIv8j2T7mLU7NmpOF5i1wpOYPx3F+hGtkucArFjywoCnFLIJeAkh0SLzRV1QKYnhndOmcQd0/SjGo/NjG9TLlm5UFrV6ZZVJl6LAcW13Ao66cTrY2zbOCaU0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690757077; 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=lMBHryos4BlueZ96iBfl0AGX49rxsSrDEjkVyu56yNw=; b=GQhDJfp3dw1HjCmkQwkAfHfNUgA2FF7MYNpgc+KGT2SjGisyngFYExXfO8QAPYv9c3pdCyR+tLVFKCtAtL8OYtGCs6rv2BAThj8DK6/I0S7MzF9s4uAs5kVctpIWPPog2e9k0wW98plmvrWZNR6ciSeiiVTgHYmL2nPrdfWUZ8U= 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+107381+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 169075707701890.03735525714058; Sun, 30 Jul 2023 15:44:37 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=STE6vG3jsnl6a8MIP9lpCerJUQkLGH+FWFuC7IxUD90=; 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=1690757076; v=1; b=v/nwx58lgLiRZmud4qpoD3A+boLQlOv+uy8gsPZh6FJckFriQbsh8hHRxXTHdyVTUvc9fK5t ww9I4wKHy0BzeEWOtZxtktpOryrzUdYWgI7iUgsYUGmIwWPESMJhi3LDuJuOweiVNO4Qfj3p8ct 3vir1XWcHYnJxCBfZLOJ8adM= X-Received: by 127.0.0.2 with SMTP id LeKHYY1788612xkJGPemGzU8; Sun, 30 Jul 2023 15:44:36 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web11.83655.1690757067045435466 for ; Sun, 30 Jul 2023 15:44:36 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10787"; a="368893197" X-IronPort-AV: E=Sophos;i="6.01,243,1684825200"; d="scan'208";a="368893197" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2023 15:44:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10787"; a="757737960" X-IronPort-AV: E=Sophos;i="6.01,243,1684825200"; d="scan'208";a="757737960" 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; 30 Jul 2023 15:44:33 -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 V7 3/4] OvmfPkg: Disable PcdFirstTimeWakeUpAPsBySipi. Date: Mon, 31 Jul 2023 06:44:12 +0800 Message-Id: <20230730224413.6411-4-yuanhao.xie@intel.com> In-Reply-To: <20230730224413.6411-1-yuanhao.xie@intel.com> References: <20230730224413.6411-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: BOgFsdPLzQ9xPqeH4rg5UZFHx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1690757078333100003 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 Reviewed-by: Ard Biesheuvel --- 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..80d8e37009 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 + # broadcast INIT-SIPI-SIPI for the first time. + # + gUefiCpuPkgTokenSpaceGuid.PcdFirstTimeWakeUpAPsBySipi|FALSE =20 ##########################################################################= ###### # diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc index 919315e4cb..d9757149e3 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 + # broadcast INIT-SIPI-SIPI for the first time. + # + gUefiCpuPkgTokenSpaceGuid.PcdFirstTimeWakeUpAPsBySipi|FALSE =20 [PcdsFixedAtBuild.IA32] # diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index 823de0d0f9..b12d874daa 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 + # broadcast INIT-SIPI-SIPI for the first time. + # + 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 (#107381): https://edk2.groups.io/g/devel/message/107381 Mute This Topic: https://groups.io/mt/100451989/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 Tue May 21 07:03:38 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+107382+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+107382+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1690757080; cv=none; d=zohomail.com; s=zohoarc; b=k+din68DDUh7mw4mzeBZrPBXBi158StnVeniRY6o8DAb7D5Z6djujeDhZKoGlgBlnFKVwP8tFQs9E+4a69HLopZ+htooNZz/VAHCcXLRUpbMnyTkTOZ01migfygkITqcJnGFGqgPjvGLTnaJViE/TqyBLjt/fh1icF/Vz8Fh0dk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690757080; 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=UKmeIw6b4aNqQjo3VkFvTYfZAJIgGDcICPR35QBWmxI=; b=MDHbAo0BadA48mjrfNwaaEzk2H+HhOdBn4RGKkkFUy/7odKuufbBdZfOBM9sSAToS6yxNlwBfxx7CCq3NIFOrDJW5Y0YhIcIDOgrVWwVI3ZjvdXNH1EYvwnhVXyZNiccuHx4eCaZnBLh2CrUjY5ukpd9bkndY2x2nSJNClZM4o0= 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+107382+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 1690757080032618.4781871888811; Sun, 30 Jul 2023 15:44:40 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=III7mRQ+RIdlpI9Cn7KY8KmZvVnT7AS1/5a16Cgd5Ek=; 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=1690757079; v=1; b=qECyaQnbFVT6gpxVTTsY0oq3hPRTvNdpw3ZnzqNXP8Y6dr00C9QlGobUKPSjtXu5DAYqmQrc 4jp168FdsPS7u6+0EZgtMcTfwDHHMc9YVQRQKP29Wdy+KSySI9vteQQRzRdCUNMllpkbfK0Ld0J rMnnK7RGAtSEWNj98qG8xNMM= X-Received: by 127.0.0.2 with SMTP id 97LSYY1788612xLwIWyuc7ED; Sun, 30 Jul 2023 15:44:39 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web11.83655.1690757067045435466 for ; Sun, 30 Jul 2023 15:44:39 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10787"; a="368893201" X-IronPort-AV: E=Sophos;i="6.01,243,1684825200"; d="scan'208";a="368893201" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2023 15:44:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10787"; a="757737963" X-IronPort-AV: E=Sophos;i="6.01,243,1684825200"; d="scan'208";a="757737963" 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; 30 Jul 2023 15:44:37 -0700 From: "Yuanhao Xie" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Rahul Kumar , Gerd Hoffmann , Yuanhao Xie Subject: [edk2-devel] [Patch V7 4/4] UefiCpuPkg:Wake up APs after power-up or RESET through SIPI. Date: Mon, 31 Jul 2023 06:44:13 +0800 Message-Id: <20230730224413.6411-5-yuanhao.xie@intel.com> In-Reply-To: <20230730224413.6411-1-yuanhao.xie@intel.com> References: <20230730224413.6411-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: oDIFe0ljGrT7BpYclBtgNXpyx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1690757080323100005 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 (#107382): https://edk2.groups.io/g/devel/message/107382 Mute This Topic: https://groups.io/mt/100451990/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-