From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web11.58885.1686577140495656780 for ; Mon, 12 Jun 2023 06:39:01 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=cwn1RBzt; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: yuanhao.xie@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686577141; x=1718113141; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vtMsVlqwoof7sRare0d+N5BIdufSmNT1fmg/U2R/qh0=; b=cwn1RBztVtRNww5PVK5DqXjqJ0LcaWO2CXGlEyXxZCsrNgpLDfoNbhFo CdM5U8cVcONKV9MaXi8xm2CJT6bHCZ5RA2xauW2BFXyCUeem+qpWIpeyc z19qTizhfODvB6grel5RHgDUMOtDOOg+a9dLCQ+LhW4fULaXMtlut4gDs H9tShDXjQyVZRh5YDLSXQenxac3JXLUmiZIJYkprDmyBTwmIOq9A35wu0 vitKx32xBTdYR4siDEq2no/ck+oD8pTiXWRT5WoiSa2RWfaVY13s8iho9 5Ogbx2MMtVvH0CqfG6fsteJikjv2HVVDb+UckecHwYvLvFhF/aBRRphiN A==; X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="338400670" X-IronPort-AV: E=Sophos;i="6.00,236,1681196400"; d="scan'208";a="338400670" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2023 06:37:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="958033017" X-IronPort-AV: E=Sophos;i="6.00,236,1681196400"; d="scan'208";a="958033017" Received: from shwdeopenlab705.ccr.corp.intel.com ([10.239.55.55]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2023 06:37:53 -0700 From: "Yuanhao Xie" To: devel@edk2.groups.io Cc: Gerd Hoffmann , Eric Dong , Ray Ni , Rahul Kumar , Tom Lendacky , Yuanhao Xie Subject: [PATCH 4/5] UefiCpuPkg: ApWakeupFunction directly use CpuMpData. Date: Mon, 12 Jun 2023 21:37:19 +0800 Message-Id: <20230612133720.15501-5-yuanhao.xie@intel.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20230612133720.15501-1-yuanhao.xie@intel.com> References: <20230612133720.15501-1-yuanhao.xie@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit CpuMpData can be passed directly to the ApWakeUpFunction instead of through 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/Library/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: push ebx ; Push ApIndex mov eax, esi - add eax, MP_CPU_EXCHANGE_INFO_OFFSET - push eax ; push address of exchange info data buffer + add eax, MP_CPU_EXCHANGE_INFO_FIELD (CpuMpData) + push dword [eax] ; push address of CpuMpData mov edi, esi add edi, MP_CPU_EXCHANGE_INFO_FIELD (CFunction) diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c index 8aecd29a94..e56f2455dc 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. - @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; - // - // AP finished assembly code and begin to execute C code - // - CpuMpData = 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/Library/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 mov edx, ebx ; edx is ApIndex - mov ecx, esi - add ecx, MP_CPU_EXCHANGE_INFO_OFFSET ; rcx is address of exchange info data buffer + mov rcx, qword [esi + MP_CPU_EXCHANGE_INFO_FIELD (CpuMpData)] mov edi, esi add edi, MP_CPU_EXCHANGE_INFO_FIELD (CFunction) -- 2.36.1.windows.1