From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 3960FD81111 for ; Fri, 26 Apr 2024 12:17:50 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=bZmBO/ExpsgTmDlikzp21rkMRmVdTSrKew6Dj+LPg8k=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe; s=20240206; t=1714133869; v=1; b=PttojUqtDST962yX0Pdv1SHkehhgwfaTXT12AdAQpCvbRmalYqIcj1qnWJtuQdJYpRVAilFa JUwmIUzmH+/mNQKKYogL3PUuTrECY0VDgFw/tnXUbUt+8q+hJ4K661OD7lrIMSNpEIrgnQ/Oi7e PChgH4+VY3lWpmrK9JuL54Vudd5S1elKNzhojHL+bCpIiqZZ4Fi3HdAz0HYFk619ot41U8hgz32 ihDpSVdK8w4u+SuHP9BeP6xNdC6BoxG6hlqM61L0ZDRkvOowm2R/6ovG6t0QfuAJXC1KKd0pR+/ zr7TIRTSbI9xOxpFnelA99cpWKqZGMphPTQRNIQy1TXaw== X-Received: by 127.0.0.2 with SMTP id OkA5YY7687511xpcPmieUQIx; Fri, 26 Apr 2024 05:17:49 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by mx.groups.io with SMTP id smtpd.web11.12554.1714133857432549514 for ; Fri, 26 Apr 2024 05:17:48 -0700 X-CSE-ConnectionGUID: LyvXhHiUTbKBoBrA7ApH9w== X-CSE-MsgGUID: ihlYnG/KRAaq2W6Ezd+o1Q== X-IronPort-AV: E=McAfee;i="6600,9927,11055"; a="10027147" X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="10027147" X-Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 05:17:49 -0700 X-CSE-ConnectionGUID: QnufpL8BStOOyQdYgBveEA== X-CSE-MsgGUID: pVeqWoZaSMyINtGYgz98wg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="62879116" X-Received: from sh1gapp1009.ccr.corp.intel.com ([10.239.189.219]) by orviesa001.jf.intel.com with ESMTP; 26 Apr 2024 05:17:46 -0700 From: "Wu, Jiaxin" To: devel@edk2.groups.io Cc: Ray Ni , Zeng Star , Gerd Hoffmann , Rahul Kumar Subject: [edk2-devel] [PATCH v4 06/14] UefiCpuPkg/SmmRelocationLib: Remove unnecessary CpuIndex Date: Fri, 26 Apr 2024 20:17:12 +0800 Message-Id: <20240426121720.54308-7-jiaxin.wu@intel.com> In-Reply-To: <20240426121720.54308-1-jiaxin.wu@intel.com> References: <20240426121720.54308-1-jiaxin.wu@intel.com> 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 Resent-Date: Fri, 26 Apr 2024 05:17:48 -0700 Resent-From: jiaxin.wu@intel.com Reply-To: devel@edk2.groups.io,jiaxin.wu@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: aS5cC3P34hQ8FvM09RmMzuCGx7686176AA= X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=PttojUqt; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none) This patch is to remove unnecessary CpuIndex. Cc: Ray Ni Cc: Zeng Star Cc: Gerd Hoffmann Cc: Rahul Kumar Signed-off-by: Jiaxin Wu --- UefiCpuPkg/Library/SmmRelocationLib/Ia32/Semaphore.c | 3 --- .../Library/SmmRelocationLib/InternalSmmRelocationLib.h | 5 ----- UefiCpuPkg/Library/SmmRelocationLib/SmmRelocationLib.c | 12 +++--------- UefiCpuPkg/Library/SmmRelocationLib/SmramSaveStateConfig.c | 3 --- UefiCpuPkg/Library/SmmRelocationLib/X64/Semaphore.c | 3 --- 5 files changed, 3 insertions(+), 23 deletions(-) diff --git a/UefiCpuPkg/Library/SmmRelocationLib/Ia32/Semaphore.c b/UefiCpuPkg/Library/SmmRelocationLib/Ia32/Semaphore.c index ba329d6ba2..5d9eea3de9 100644 --- a/UefiCpuPkg/Library/SmmRelocationLib/Ia32/Semaphore.c +++ b/UefiCpuPkg/Library/SmmRelocationLib/Ia32/Semaphore.c @@ -15,28 +15,25 @@ volatile BOOLEAN *mRebasedFlag; /** Hook return address of SMM Save State so that semaphore code can be executed immediately after AP exits SMM to indicate to the BSP that an AP has exited SMM after SMBASE relocation. - @param[in] CpuIndex The processor index. @param[in] RebasedFlag A pointer to a flag that is set to TRUE immediately after AP exits SMM. **/ VOID SemaphoreHook ( - IN UINTN CpuIndex, IN volatile BOOLEAN *RebasedFlag ) { SMRAM_SAVE_STATE_MAP *CpuState; mRebasedFlag = RebasedFlag; CpuState = (SMRAM_SAVE_STATE_MAP *)(UINTN)(SMM_DEFAULT_SMBASE + SMRAM_SAVE_STATE_MAP_OFFSET); mSmmRelocationOriginalAddress = (UINTN)HookReturnFromSmm ( - CpuIndex, CpuState, (UINT64)(UINTN)&SmmRelocationSemaphoreComplete, (UINT64)(UINTN)&SmmRelocationSemaphoreComplete ); } diff --git a/UefiCpuPkg/Library/SmmRelocationLib/InternalSmmRelocationLib.h b/UefiCpuPkg/Library/SmmRelocationLib/InternalSmmRelocationLib.h index ede61b956f..d1387f2dfb 100644 --- a/UefiCpuPkg/Library/SmmRelocationLib/InternalSmmRelocationLib.h +++ b/UefiCpuPkg/Library/SmmRelocationLib/InternalSmmRelocationLib.h @@ -81,12 +81,10 @@ SmmRelocationSemaphoreComplete ( Hook the code executed immediately after an RSM instruction on the currently executing CPU. The mode of code executed immediately after RSM must be detected, and the appropriate hook must be selected. Always clear the auto HALT restart flag if it is set. - @param[in] CpuIndex The processor index for the currently - executing CPU. @param[in,out] CpuState Pointer to SMRAM Save State Map for the currently executing CPU. @param[in] NewInstructionPointer32 Instruction pointer to use if resuming to 32-bit mode from 64-bit SMM. @param[in] NewInstructionPointer Instruction pointer to use if resuming to @@ -96,29 +94,26 @@ SmmRelocationSemaphoreComplete ( **/ UINT64 EFIAPI HookReturnFromSmm ( - IN UINTN CpuIndex, IN OUT SMRAM_SAVE_STATE_MAP *CpuState, IN UINT64 NewInstructionPointer32, IN UINT64 NewInstructionPointer ); /** Hook return address of SMM Save State so that semaphore code can be executed immediately after AP exits SMM to indicate to the BSP that an AP has exited SMM after SMBASE relocation. - @param[in] CpuIndex The processor index. @param[in] RebasedFlag A pointer to a flag that is set to TRUE immediately after AP exits SMM. **/ VOID SemaphoreHook ( - IN UINTN CpuIndex, IN volatile BOOLEAN *RebasedFlag ); /** This function fixes up the address of the global variable or function diff --git a/UefiCpuPkg/Library/SmmRelocationLib/SmmRelocationLib.c b/UefiCpuPkg/Library/SmmRelocationLib/SmmRelocationLib.c index 86df66a280..7e65bbf929 100644 --- a/UefiCpuPkg/Library/SmmRelocationLib/SmmRelocationLib.c +++ b/UefiCpuPkg/Library/SmmRelocationLib/SmmRelocationLib.c @@ -29,15 +29,10 @@ UINT64 mSmBase; // // SmBase Rebased flag for current CPU // volatile BOOLEAN mRebased; -// -// CpuIndex for current CPU -// -UINTN mCpuIndex; - /** This function will get the SmBase for CpuIndex. @param[in] CpuIndex The processor index. @param[in] SmmRelocationStart The start address of Smm relocated memory in SMRAM. @@ -153,11 +148,11 @@ SmmInitHandler ( // // Hook return after RSM to set SMM re-based flag // SMM re-based flag can't be set before RSM, because SMM save state context might be override // by next AP flow before it take effect. // - SemaphoreHook (mCpuIndex, &mRebased); + SemaphoreHook (&mRebased); } /** Relocate SmmBases for each processor. Execute on first boot and all S3 resumes @@ -225,13 +220,12 @@ SmmRelocateBases ( for (Index = 0; Index < mNumberOfCpus; Index++) { Status = MpServices2->GetProcessorInfo (MpServices2, Index | CPU_V2_EXTENDED_TOPOLOGY, &ProcessorInfo); ASSERT_EFI_ERROR (Status); if (BspApicId != (UINT32)ProcessorInfo.ProcessorId) { - mRebased = FALSE; - mSmBase = GetSmBase (Index, SmmRelocationStart, TileSize); - mCpuIndex = Index; + mRebased = FALSE; + mSmBase = GetSmBase (Index, SmmRelocationStart, TileSize); SendSmiIpi ((UINT32)ProcessorInfo.ProcessorId); // // Wait for this AP to finish its 1st SMI // while (!mRebased) { diff --git a/UefiCpuPkg/Library/SmmRelocationLib/SmramSaveStateConfig.c b/UefiCpuPkg/Library/SmmRelocationLib/SmramSaveStateConfig.c index d3a0bb9b89..76d798aba5 100644 --- a/UefiCpuPkg/Library/SmmRelocationLib/SmramSaveStateConfig.c +++ b/UefiCpuPkg/Library/SmmRelocationLib/SmramSaveStateConfig.c @@ -82,12 +82,10 @@ ConfigureSmBase ( Hook the code executed immediately after an RSM instruction on the currently executing CPU. The mode of code executed immediately after RSM must be detected, and the appropriate hook must be selected. Always clear the auto HALT restart flag if it is set. - @param[in] CpuIndex The processor index for the currently - executing CPU. @param[in,out] CpuState Pointer to SMRAM Save State Map for the currently executing CPU. @param[in] NewInstructionPointer32 Instruction pointer to use if resuming to 32-bit mode from 64-bit SMM. @param[in] NewInstructionPointer Instruction pointer to use if resuming to @@ -97,11 +95,10 @@ ConfigureSmBase ( **/ UINT64 EFIAPI HookReturnFromSmm ( - IN UINTN CpuIndex, IN OUT SMRAM_SAVE_STATE_MAP *CpuState, IN UINT64 NewInstructionPointer32, IN UINT64 NewInstructionPointer ) { diff --git a/UefiCpuPkg/Library/SmmRelocationLib/X64/Semaphore.c b/UefiCpuPkg/Library/SmmRelocationLib/X64/Semaphore.c index 53f3084363..cd6778e3fc 100644 --- a/UefiCpuPkg/Library/SmmRelocationLib/X64/Semaphore.c +++ b/UefiCpuPkg/Library/SmmRelocationLib/X64/Semaphore.c @@ -26,18 +26,16 @@ SmmRelocationSemaphoreComplete32 ( /** Hook return address of SMM Save State so that semaphore code can be executed immediately after AP exits SMM to indicate to the BSP that an AP has exited SMM after SMBASE relocation. - @param[in] CpuIndex The processor index. @param[in] RebasedFlag A pointer to a flag that is set to TRUE immediately after AP exits SMM. **/ VOID SemaphoreHook ( - IN UINTN CpuIndex, IN volatile BOOLEAN *RebasedFlag ) { SMRAM_SAVE_STATE_MAP *CpuState; UINTN TempValue; @@ -49,11 +47,10 @@ SemaphoreHook ( 4 ); CpuState = (SMRAM_SAVE_STATE_MAP *)(UINTN)(SMM_DEFAULT_SMBASE + SMRAM_SAVE_STATE_MAP_OFFSET); mSmmRelocationOriginalAddress = HookReturnFromSmm ( - CpuIndex, CpuState, (UINT64)(UINTN)&SmmRelocationSemaphoreComplete32, (UINT64)(UINTN)&SmmRelocationSemaphoreComplete ); -- 2.16.2.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#118330): https://edk2.groups.io/g/devel/message/118330 Mute This Topic: https://groups.io/mt/105748917/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-