From nobody Mon Feb 9 20:31:48 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+106463+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+106463+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1687942154; cv=none; d=zohomail.com; s=zohoarc; b=niv3fSu5VuyRYYdxoqejRmNXZ1x42XbDENzQt603HzaA+gYs4yd3MOvFj8dfRN/ssi2reaAn7L55pVWtlmQjrR6/OFhF5kGzL48JHyPVNVjmKL0RVK5huhaYvjkFPLIsnSIpuoB2+DPiFBvTlVnMSZVwSeAAldO0JGuSX8ncKPY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687942154; 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=/W81TMvyI9XOSmx6HN+LxcDFF0FXAvHiQ9InBdRgVf0=; b=WWTsQSW8mf04huacxOmxBzpsuGl1YzXnvyBxrmulS0BHfy0TLm2o1/+R3+CXbMy4wEphMT4ZR6wk4KTeku+++e9wyYtQ6ttz8h2Yjx8bXWJlozgAGDIv0VaFCYY2/kaZYuGdM4O7d78zURLGpPZEdmgKDsodNOri9EfVHYKlUwk= 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+106463+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 1687942154126980.5829559737341; Wed, 28 Jun 2023 01:49:14 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id eeF9YY1788612xcAZeqwIJEa; Wed, 28 Jun 2023 01:49:13 -0700 X-Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web11.11789.1687942152264937624 for ; Wed, 28 Jun 2023 01:49:12 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10754"; a="341373574" X-IronPort-AV: E=Sophos;i="6.01,165,1684825200"; d="scan'208";a="341373574" X-Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jun 2023 01:48:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10754"; a="890964606" X-IronPort-AV: E=Sophos;i="6.01,165,1684825200"; d="scan'208";a="890964606" X-Received: from shwdeopenlab705.ccr.corp.intel.com ([10.239.55.55]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jun 2023 01:48:03 -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 V4 4/5] UefiCpuPkg: ApWakeupFunction directly use CpuMpData. Date: Wed, 28 Jun 2023 16:47:23 +0800 Message-Id: <20230628084724.57574-5-yuanhao.xie@intel.com> In-Reply-To: <20230628084724.57574-1-yuanhao.xie@intel.com> References: <20230628084724.57574-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: 0GI15Jn58yvBAKtJFuJsB7rVx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1687942153; bh=LJGJ/fyLWUGqUiIY4hJnQxX8k4G5/HTgZPg53HWy2Hg=; h=Cc:Date:From:Reply-To:Subject:To; b=dgQ5nnqcOd5aMZQO+dOefc9XcL2vZs3qJuHGm6waOaL+1UEOgyWjgAMNTyGtkV+tTmX ebDSBCu3mNR8pZyPhwwP43iW+Ybyx9xduvm3dfmStlJefjpuERem4wazo8TfT/W5itEsK pm3bGxqC/HXYoLCqSRye+yDYG8LXYRdPn1Y= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1687942155061100011 Content-Type: text/plain; charset="utf-8" In the original design, once the APs finished executing their assembly code and switched to executing C code, they would enter a continuous loop within a function. In this function, they would collect CpuMpData using the MP_CPU_EXCHANGE_INFO mechanism. However, in the updated approach, CpuMpData can now be passed directly to the ApWakeUpFunction, bypassing the need for MP_CPU_EXCHANGE_INFO. This modification is made in preparation for eliminating the requirement of a second INIT-SIPI-SIPI sequence in the DXE phase. Cc: Gerd Hoffmann Cc: Eric Dong Cc: Ray Ni Cc: Rahul Kumar Cc: Tom Lendacky Signed-off-by: Yuanhao Xie --- UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm | 4 ++-- UefiCpuPkg/Library/MpInitLib/MpLib.c | 12 +++--------- UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm | 3 +-- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm b/UefiCpuPkg/Li= brary/MpInitLib/Ia32/MpFuncs.nasm index 59db4081d6..d117f09ef5 100644 --- a/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm +++ b/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm @@ -197,8 +197,8 @@ CProcedureInvoke: =20 push ebx ; Push ApIndex mov eax, esi - add eax, MP_CPU_EXCHANGE_INFO_OFFSET - push eax ; push address of exchange info data buff= er + add eax, MP_CPU_EXCHANGE_INFO_FIELD (CpuMpData) + push dword [eax] ; push address of CpuMpData =20 mov edi, esi add edi, MP_CPU_EXCHANGE_INFO_FIELD (CFunction) diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpIn= itLib/MpLib.c index ccc01859f0..f904751b0d 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -710,17 +710,16 @@ PlaceAPInMwaitLoopOrRunLoop ( /** This function will be called from AP reset code if BSP uses WakeUpAP. =20 - @param[in] ExchangeInfo Pointer to the MP exchange info buffer + @param[in] CpuMpData Pointer to CPU MP Data @param[in] ApIndex Number of current executing AP **/ VOID EFIAPI ApWakeupFunction ( - IN MP_CPU_EXCHANGE_INFO *ExchangeInfo, - IN UINTN ApIndex + IN CPU_MP_DATA *CpuMpData, + IN UINTN ApIndex ) { - CPU_MP_DATA *CpuMpData; UINTN ProcessorNumber; EFI_AP_PROCEDURE Procedure; VOID *Parameter; @@ -731,11 +730,6 @@ ApWakeupFunction ( UINTN CurrentApicMode; AP_STACK_DATA *ApStackData; =20 - // - // AP finished assembly code and begin to execute C code - // - CpuMpData =3D ExchangeInfo->CpuMpData; - // // AP's local APIC settings will be lost after received INIT IPI // We need to re-initialize them at here diff --git a/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm b/UefiCpuPkg/Lib= rary/MpInitLib/X64/MpFuncs.nasm index 5bcdf7726b..40e80ffab4 100644 --- a/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm +++ b/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm @@ -259,8 +259,7 @@ CProcedureInvoke: add rsp, 20h =20 mov edx, ebx ; edx is ApIndex - mov ecx, esi - add ecx, MP_CPU_EXCHANGE_INFO_OFFSET ; rcx is address of exchan= ge info data buffer + mov rcx, qword [esi + MP_CPU_EXCHANGE_INFO_FIELD (CpuMpData)] =20 mov edi, esi add edi, MP_CPU_EXCHANGE_INFO_FIELD (CFunction) --=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 (#106463): https://edk2.groups.io/g/devel/message/106463 Mute This Topic: https://groups.io/mt/99826558/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-