public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Wu, Jiaxin" <jiaxin.wu@intel.com>
To: devel@edk2.groups.io
Cc: Ray Ni <ray.ni@intel.com>, Zeng Star <star.zeng@intel.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Rahul Kumar <rahul1.kumar@intel.com>
Subject: [edk2-devel] [PATCH v4 06/14] UefiCpuPkg/SmmRelocationLib: Remove unnecessary CpuIndex
Date: Fri, 26 Apr 2024 20:17:12 +0800	[thread overview]
Message-ID: <20240426121720.54308-7-jiaxin.wu@intel.com> (raw)
In-Reply-To: <20240426121720.54308-1-jiaxin.wu@intel.com>

This patch is to remove unnecessary CpuIndex.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Zeng Star <star.zeng@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
---
 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]
-=-=-=-=-=-=-=-=-=-=-=-



  parent reply	other threads:[~2024-04-26 12:17 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-26 12:17 [edk2-devel] [PATCH v4 00/14] Add SmmRelocationLib Wu, Jiaxin
2024-04-26 12:17 ` [edk2-devel] [PATCH v4 01/14] UefiCpuPkg: Add SmmRelocationLib class Wu, Jiaxin
2024-04-26 12:17 ` [edk2-devel] [PATCH v4 02/14] UefiCpuPkg/SmmRelocationLib: Add SmmRelocationLib library instance Wu, Jiaxin
2024-04-30  5:58   ` Ni, Ray
2024-04-26 12:17 ` [edk2-devel] [PATCH v4 03/14] UefiCpuPkg/SmmRelocationLib: Rename global variables Wu, Jiaxin
2024-04-26 12:17 ` [edk2-devel] [PATCH v4 04/14] UefiCpuPkg/SmmRelocationLib: Avoid unnecessary memory allocation Wu, Jiaxin
2024-04-26 12:17 ` [edk2-devel] [PATCH v4 05/14] UefiCpuPkg/SmmRelocationLib: Remove unnecessary global variable Wu, Jiaxin
2024-05-06  3:30   ` Ni, Ray
2024-04-26 12:17 ` Wu, Jiaxin [this message]
2024-05-06  3:32   ` [edk2-devel] [PATCH v4 06/14] UefiCpuPkg/SmmRelocationLib: Remove unnecessary CpuIndex Ni, Ray
2024-04-26 12:17 ` [edk2-devel] [PATCH v4 07/14] UefiCpuPkg/SmmRelocationLib: Add library instance for AMD Wu, Jiaxin
2024-04-26 12:17 ` [edk2-devel] [PATCH v4 08/14] OvmfPkg/SmmRelocationLib: Add library instance for OVMF Wu, Jiaxin
2024-04-26 12:17 ` [edk2-devel] [PATCH v4 09/14] OvmfPkg/PlatformInitLib: Create gEfiSmmSmramMemoryGuid Wu, Jiaxin
2024-04-26 12:17 ` [edk2-devel] [PATCH v4 10/14] OvmfPkg: Refine SmmAccess implementation Wu, Jiaxin
2024-04-26 12:17 ` [edk2-devel] [PATCH v4 11/14] OvmfPkg/SmmCpuFeaturesLib: Check Smbase Relocation is done or not Wu, Jiaxin
2024-04-26 12:17 ` [edk2-devel] [PATCH v4 12/14] OvmfPkg/PlatformPei: Relocate SmBases in PEI phase Wu, Jiaxin
2024-04-26 12:17 ` [edk2-devel] [PATCH v4 13/14] UefiPayloadPkg/UefiPayloadPkg.dsc: Include SmmRelocationLib Wu, Jiaxin
2024-04-26 12:46   ` Guo, Gua
2024-04-26 12:17 ` [edk2-devel] [PATCH v4 14/14] UefiCpuPkg/PiSmmCpuDxeSmm: Remove SmBases relocation logic Wu, Jiaxin
2024-05-06  3:38   ` Ni, Ray
2024-04-30  6:00 ` [edk2-devel] [PATCH v4 00/14] Add SmmRelocationLib Ni, Ray
2024-04-30 10:14   ` Wu, Jiaxin
2024-05-07  3:39   ` Wu, Jiaxin
2024-05-07  4:59     ` Yao, Jiewen
2024-05-07  5:18       ` Wu, Jiaxin
2024-05-08 16:43         ` Ard Biesheuvel
2024-05-09  7:36           ` 回复: " gaoliming via groups.io
2024-05-09  7:43             ` Ard Biesheuvel
2024-04-30  9:58 ` Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240426121720.54308-7-jiaxin.wu@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox