From nobody Tue Feb 10 16:22:10 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+106339+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+106339+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1687759043; cv=none; d=zohomail.com; s=zohoarc; b=O+aRjThWwiv9r7RFbTMXUWRu4OwINkbJVunCDKc254xJbWnL5Ez5k3BYbI45i6mfkM5fBKpYz/6+zrtk+hoWr7ddSR2KZK2tAHdcil6mDm2oAeTh0+nLbg4hChy3NaNOc4MljkDHdf/fiTND9QtCtMe/ObtWTmKogAC3tjaMKdI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687759043; 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=5jOCq2vpN5Zgau+Qwbz5edIFOAGxFGNxtweAQwunVs8=; b=DEI1xgjHGiDchWKozxo48ZPgR0Tk76tAQrv4w078nSJgZ1nZnWyoe3WobNkbozt4ozZSh2QXeRDgZw+cL1clBqaxFzm+M1RwIOAcv+w3U9SK63L7YQoK/W2RsoVrzsOPt66FM2F5v+LU8xQkG0bEGxiY0JH8I704njqMXybxtLs= 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+106339+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 1687759043444845.7755670027793; Sun, 25 Jun 2023 22:57:23 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 2KnsYY1788612xbJx7cz9x19; Sun, 25 Jun 2023 22:57:23 -0700 X-Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web10.1822.1687759039189579056 for ; Sun, 25 Jun 2023 22:57:22 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10752"; a="340768935" X-IronPort-AV: E=Sophos;i="6.01,158,1684825200"; d="scan'208";a="340768935" X-Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jun 2023 22:57:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10752"; a="786018009" X-IronPort-AV: E=Sophos;i="6.01,158,1684825200"; d="scan'208";a="786018009" X-Received: from shwdeopenlab705.ccr.corp.intel.com ([10.239.55.55]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jun 2023 22:57:20 -0700 From: "Yuanhao Xie" To: devel@edk2.groups.io Cc: Gerd Hoffmann , Eric Dong , Ray Ni , Rahul Kumar , Tom Lendacky , Yuanhao Xie Subject: [edk2-devel] [Patch V3 1/5] UefiCpuPkg: Refactor the logic for placing APs in HltLoop. Date: Mon, 26 Jun 2023 13:57:01 +0800 Message-Id: <20230626055705.57145-2-yuanhao.xie@intel.com> In-Reply-To: <20230626055705.57145-1-yuanhao.xie@intel.com> References: <20230626055705.57145-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: 0BnQvT3v36RDTJWjGWbIMT9Yx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1687759043; bh=HEyn3i28228WdsPrxsZQ74nbWz5nTD4ceuhluc6QaV0=; h=Cc:Date:From:Reply-To:Subject:To; b=w2aiM847hXkKqulE9rijxB7NTv3WoONoMMxkYgRutoSR+XV8QjsOzRungoJXNlMlxx7 HlMs+1wpu4OvOjbj4zqaVFUvVfpwCzw/PN9o8A6+eZqswaKDZUcHD0/NoAnrHBYr6IBKI qVvTg8cuEIAr1bW6TdvpHR0UOwdM4pBJb+M= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1687759045199100001 Content-Type: text/plain; charset="utf-8" Refactor the logic for placing APs in HltLoop into a separate function. Cc: Gerd Hoffmann Cc: Eric Dong Cc: Ray Ni Cc: Rahul Kumar Cc: Tom Lendacky Signed-off-by: Yuanhao Xie Reviewed-by: Ray Ni --- UefiCpuPkg/Library/MpInitLib/MpLib.c | 35 ++++++++++++++++++++++++--------= --- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpIn= itLib/MpLib.c index f1f2840714..9560b39220 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -636,6 +636,28 @@ InitializeApData ( SetApState (&CpuMpData->CpuData[ProcessorNumber], CpuStateIdle); } =20 +/** + This function place APs in Halt loop. + + @param[in] CpuMpData Pointer to CPU MP Data +**/ +VOID +PlaceAPInHltLoop ( + IN CPU_MP_DATA *CpuMpData + ) +{ + while (TRUE) { + DisableInterrupts (); + if (CpuMpData->UseSevEsAPMethod) { + SevEsPlaceApHlt (CpuMpData); + } else { + CpuSleep (); + } + + CpuPause (); + } +} + /** This function will be called from AP reset code if BSP uses WakeUpAP. =20 @@ -812,19 +834,10 @@ ApWakeupFunction ( // Place AP is specified loop mode // if (CpuMpData->ApLoopMode =3D=3D ApInHltLoop) { + PlaceAPInHltLoop (CpuMpData); // - // Place AP in HLT-loop + // Never run here // - while (TRUE) { - DisableInterrupts (); - if (CpuMpData->UseSevEsAPMethod) { - SevEsPlaceApHlt (CpuMpData); - } else { - CpuSleep (); - } - - CpuPause (); - } } =20 while (TRUE) { --=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 (#106339): https://edk2.groups.io/g/devel/message/106339 Mute This Topic: https://groups.io/mt/99782476/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-