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 64A79AC0A68 for ; Mon, 6 May 2024 03:32:12 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=ELdw2hcUm2lV8pH4aQ5T15Sg1oVsJGQmPnHATBl7Foo=; c=relaxed/simple; d=groups.io; h=From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:msip_labels:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type; s=20240206; t=1714966330; v=1; b=jC+FkmEsWODqH/apsK3fWyjwYqxt6DxeY1UA0qgtUJ35hKLCCB2LfigBUl5Ejhl2Gq2SFOHE 4+Zfv+3Z3iQ953svG+syVbaH9UqxosPqPVKmu5UYmkFFnOZMTM/lX5tEhTOe7La3sN7zjCbI4oj 4blVGU9+2FY/Wl3neiJeVOgHLEKJrEvriMTdm5MdkxRp0ertYHTN7i816uhUD/i018pA03bGnMC 9uEoIiayYVwPSGqxpRLlQ8HoH+tZRSJ9I/m9ew1SHWBZ356bGVNKX58RCSU9uup2A6ushH78vZ9 IboRYBzUi5Cb2RPl/7RDgUNSafn4Vu+QuCcpzvBxlpdMQ== X-Received: by 127.0.0.2 with SMTP id oQd0YY7687511xL2MlsyhwCW; Sun, 05 May 2024 20:32:10 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) by mx.groups.io with SMTP id smtpd.web11.12670.1714966325270755808 for ; Sun, 05 May 2024 20:32:05 -0700 X-CSE-ConnectionGUID: 3R3rIAQWSxyTOabVLJ3wSQ== X-CSE-MsgGUID: F3D1bnKGTTa3Ipmd6bs4ZQ== X-IronPort-AV: E=McAfee;i="6600,9927,11064"; a="11229255" X-IronPort-AV: E=Sophos;i="6.07,257,1708416000"; d="scan'208,217";a="11229255" X-Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2024 20:32:04 -0700 X-CSE-ConnectionGUID: /HUkBkKcS8+fAjUlfNY96A== X-CSE-MsgGUID: 0/8id65BScKgrp3uQ0bGNw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,257,1708416000"; d="scan'208,217";a="32828556" X-Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orviesa004.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 05 May 2024 20:32:05 -0700 X-Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Sun, 5 May 2024 20:32:04 -0700 X-Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Sun, 5 May 2024 20:32:04 -0700 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.101) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Sun, 5 May 2024 20:32:03 -0700 X-Received: from MN6PR11MB8244.namprd11.prod.outlook.com (2603:10b6:208:470::14) by IA0PR11MB7815.namprd11.prod.outlook.com (2603:10b6:208:404::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.41; Mon, 6 May 2024 03:32:02 +0000 X-Received: from MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::41a4:c775:32e6:76a8]) by MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::41a4:c775:32e6:76a8%4]) with mapi id 15.20.7544.041; Mon, 6 May 2024 03:32:02 +0000 From: "Ni, Ray" To: "Wu, Jiaxin" , "devel@edk2.groups.io" CC: "Zeng, Star" , Gerd Hoffmann , "Kumar, Rahul R" Subject: Re: [edk2-devel] [PATCH v4 06/14] UefiCpuPkg/SmmRelocationLib: Remove unnecessary CpuIndex Thread-Topic: [PATCH v4 06/14] UefiCpuPkg/SmmRelocationLib: Remove unnecessary CpuIndex Thread-Index: AQHal9PI2cgDGlVhHEOEbAaHiyGeSrGJnC1D Date: Mon, 6 May 2024 03:32:02 +0000 Message-ID: References: <20240426121720.54308-1-jiaxin.wu@intel.com> <20240426121720.54308-7-jiaxin.wu@intel.com> In-Reply-To: <20240426121720.54308-7-jiaxin.wu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN6PR11MB8244:EE_|IA0PR11MB7815:EE_ x-ms-office365-filtering-correlation-id: 0abc1016-a7df-44eb-08b4-08dc6d7d1828 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: =?us-ascii?Q?SZmL4u4IIO1eY71pWSb83yeDOYHf2QH1eceRR6ojzJOQAQtYtlL7WnbDkWeL?= =?us-ascii?Q?HnAXwKmD6CPyACKwCa8BIkVh0F+HTZZ5x1OjwhSJUn3kDGDyt82KW5+L1wDL?= =?us-ascii?Q?TZ2cit9grHFd6poEVuLOeR/6JxkrGuyrV2VMpBQYS+8GYr/u2qDo2XanX7tT?= =?us-ascii?Q?sOJAGFY7ZrLlNU/Ptd+bfZOyLK+8iIxebAZlxEeX8ekv9+pWzwqv+tQahlMX?= =?us-ascii?Q?08pLj+aC7RnSzT2YLg1BQVxSuddbKjGgWqVQ5ZUhy9hXqADLQzCMwRwNER4W?= =?us-ascii?Q?7oPMW+fx3yf0oY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?us-ascii?Q?SI92CufnHiBwG2RqBZDLdbO6X7X0l2ctOkaX+yx5EIIzFNe7aXcpMn3JkETK?= =?us-ascii?Q?i03HVf3TlarOIIFFqvcZB2jlGkXAL8pFrne1mD2/uWvqMqj1sipb0QVoF9k5?= =?us-ascii?Q?5oAffyOJR4cKULNCyASm5/t7+s6fcnuxsCMbWUGKWAdF7A=3D=3D?= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?dyIEH1EKZbjdcQhYeop10c/dCc2U13OLJ2RekOGgkdWVYBiOhqjVORAoftsD?= =?us-ascii?Q?G0pMdgthZMMyVg0aJo2MRsgr4eGpbSkX0mL7SZIF00r5pxSzVvG6yV+ViUhv?= =?us-ascii?Q?0X1AnQ8lfOkdxqhvPDaQTVKKQfDh8BzIhM9Gb4Edztx+gV2n5SE7qPzFH7WZ?= =?us-ascii?Q?9OrxY+a3n2Xi6vOv0+H5c+qAV5axjkCmcGLF7l49N9y74OhylR9IxbKPuEc8?= =?us-ascii?Q?DyDJXrKNZHeIwh+Brqfs1/K/t4Q229ZT57ZzJFbkzTa4nAFyK42KVL5Ipqjo?= =?us-ascii?Q?CncPGnuAsaRySz9GMYqG8OOF0DJT3Qz/5ymXq9yXCAhqn0gXoWudKBIvemz+?= =?us-ascii?Q?8J4QJ4+AdbXkrbRfPocTvL1pIIKBobllJsCIJr6lITbslzbydKdEeFdYhFEZ?= =?us-ascii?Q?V2XrBi77yfYrNTehcIFRVKuLnBym6DaIgogWAwOg7u6Mx3D0oUjoQixUFdIV?= =?us-ascii?Q?O7veHtJPoXyVW4/xysyX/Jlxuw2HqvvSbM6XFSX6CXvMd3isaiXKIkLMWVCD?= =?us-ascii?Q?vi9t4DLvLCu7M+TgG/c1NPpWeQYpe9EliJmx+Dgae211ZlfOTY1NDYD4rX9i?= =?us-ascii?Q?Aj21+D7MUBzAH9hjnpiOajCy5cm6IiSwOQ7FOvPRbaXfZ6OAc+M4oi4+5at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a+PrHlgkBZfbTHsmxFPWyUTy3M0K3ps1n?= =?us-ascii?Q?/yyPQvrDmjIscvTvbAA=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN6PR11MB8244.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0abc1016-a7df-44eb-08b4-08dc6d7d1828 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 May 2024 03:32:02.2806 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: RloFnAVXzbrYw5f7/X0Cul/JaeQggJI+5t+oU3nBnyk6+R2eWmKCNfviuPNWfbDf789KEznUmFQa08Atf/IweQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR11MB7815 X-OriginatorOrg: 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: Sun, 05 May 2024 20:32:05 -0700 Resent-From: ray.ni@intel.com Reply-To: devel@edk2.groups.io,ray.ni@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: j4tSOqtyyti2c0zJsmgxqv7Mx7686176AA= Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_MN6PR11MB8244F703E96A5C1C875E2F328C1C2MN6PR11MB8244namp_" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=jC+FkmEs; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io --_000_MN6PR11MB8244F703E96A5C1C875E2F328C1C2MN6PR11MB8244namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ray Ni Thanks, Ray ________________________________ From: Wu, Jiaxin Sent: Friday, April 26, 2024 20:17 To: devel@edk2.groups.io Cc: Ni, Ray ; Zeng, Star ; Gerd Hoff= mann ; Kumar, Rahul R Subject: [PATCH v4 06/14] UefiCpuPkg/SmmRelocationLib: Remove unnecessary C= puIndex 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/UefiCpu= Pkg/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 =3D RebasedFlag; CpuState =3D (SMRAM_SAVE_STATE_MAP *)(UINTN)(SMM_DE= FAULT_SMBASE + SMRAM_SAVE_STATE_MAP_OFFSET); mSmmRelocationOriginalAddress =3D (UINTN)HookReturnFromSmm ( - CpuIndex, CpuState, (UINT64)(UINTN)&SmmRelocationSe= maphoreComplete, (UINT64)(UINTN)&SmmRelocationSe= maphoreComplete ); } 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 curre= ntly executing CPU. The mode of code executed immediately after RSM must be detected, and the appropriate hook must be selected. Always clear the a= uto HALT restart flag if it is set. - @param[in] CpuIndex The processor index for the curr= ently - 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 re= suming to 32-bit mode from 64-bit SMM. @param[in] NewInstructionPointer Instruction pointer to use if re= suming 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/UefiC= puPkg/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 memo= ry 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 con= text 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 =3D 0; Index < mNumberOfCpus; Index++) { Status =3D MpServices2->GetProcessorInfo (MpServices2, Index | CPU_V2_= EXTENDED_TOPOLOGY, &ProcessorInfo); ASSERT_EFI_ERROR (Status); if (BspApicId !=3D (UINT32)ProcessorInfo.ProcessorId) { - mRebased =3D FALSE; - mSmBase =3D GetSmBase (Index, SmmRelocationStart, TileSize); - mCpuIndex =3D Index; + mRebased =3D FALSE; + mSmBase =3D 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/U= efiCpuPkg/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 curre= ntly executing CPU. The mode of code executed immediately after RSM must be detected, and the appropriate hook must be selected. Always clear the a= uto HALT restart flag if it is set. - @param[in] CpuIndex The processor index for the curr= ently - 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 re= suming to 32-bit mode from 64-bit SMM. @param[in] NewInstructionPointer Instruction pointer to use if re= suming 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/UefiCpuP= kg/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 =3D (SMRAM_SAVE_STATE_MAP *)(UINTN)(SMM_DE= FAULT_SMBASE + SMRAM_SAVE_STATE_MAP_OFFSET); mSmmRelocationOriginalAddress =3D HookReturnFromSmm ( - CpuIndex, CpuState, (UINT64)(UINTN)&SmmRelocationSemaphore= Complete32, (UINT64)(UINTN)&SmmRelocationSemaphore= Complete ); -- 2.16.2.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 (#118587): https://edk2.groups.io/g/devel/message/118587 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] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- --_000_MN6PR11MB8244F703E96A5C1C875E2F328C1C2MN6PR11MB8244namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Reviewed-by: Ray Ni <ray.ni@intel.com>

Thanks,
Ray

From: Wu, Jiaxin <jiaxin= .wu@intel.com>
Sent: Friday, April 26, 2024 20:17
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Ni, Ray <ray.ni@intel.com>; Zeng, Star <star.zeng@intel= .com>; Gerd Hoffmann <kraxel@redhat.com>; Kumar, Rahul R <rahul= .r.kumar@intel.com>
Subject: [PATCH v4 06/14] UefiCpuPkg/SmmRelocationLib: Remove unnece= ssary CpuIndex
 
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  &n= bsp;   |  5 -----
 UefiCpuPkg/Library/SmmRelocationLib/SmmRelocationLib.c  &nb= sp;    | 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/UefiCpu= Pkg/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<= br>    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 t= o TRUE
            &nb= sp;            =   immediately after AP exits SMM.
 
 **/
 VOID
 SemaphoreHook (
-  IN UINTN          = ;   CpuIndex,
   IN volatile BOOLEAN  *RebasedFlag
   )
 {
   SMRAM_SAVE_STATE_MAP  *CpuState;
 
   mRebasedFlag =3D RebasedFlag;
 
   CpuState         =              = =3D (SMRAM_SAVE_STATE_MAP *)(UINTN)(SMM_DEFAULT_SMBASE + SMRAM_SAVE_STATE_M= AP_OFFSET);
   mSmmRelocationOriginalAddress =3D (UINTN)HookReturnFromSmm ( -            &n= bsp;            = ;            &n= bsp;     CpuIndex,
            &nb= sp;            =             &nb= sp;      CpuState,
            &nb= sp;            =             &nb= sp;      (UINT64)(UINTN)&SmmRelocationSemaphor= eComplete,
            &nb= sp;            =             &nb= sp;      (UINT64)(UINTN)&SmmRelocationSemaphor= eComplete
            &nb= sp;            =             &nb= sp;      );
 }
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 aft= er RSM must be
   detected, and the appropriate hook must be selected.  Alw= ays clear the auto
   HALT restart flag if it is set.
 
-  @param[in]     CpuIndex    =              Th= e processor index for the currently
-            &n= bsp;            = ;            &n= bsp;    executing CPU.
   @param[in,out] CpuState      &nb= sp;          Pointer to SMRAM = Save State Map for the
            &nb= sp;            =             &nb= sp;     currently executing CPU.
   @param[in]     NewInstructionPointer32&nbs= p; Instruction pointer to use if resuming to
            &nb= sp;            =             &nb= sp;     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     = ;           NewInstructio= nPointer32,
   IN     UINT64     = ;           NewInstructio= nPointer
   );
 
 /**
   Hook return address of SMM Save State so that semaphore code    can be executed immediately after AP exits SMM to indicate to<= br>    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 t= o TRUE
            &nb= sp;            =   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 f= unction
diff --git a/UefiCpuPkg/Library/SmmRelocationLib/SmmRelocationLib.c b/UefiC= puPkg/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     &= nbsp;      The processor index.
   @param[in]   SmmRelocationStart  The start addr= ess 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 =3D 0; Index < mNumberOfCpus; Index++) {
     Status =3D MpServices2->GetProcessorInfo (MpSer= vices2, Index | CPU_V2_EXTENDED_TOPOLOGY, &ProcessorInfo);
     ASSERT_EFI_ERROR (Status);
 
     if (BspApicId !=3D (UINT32)ProcessorInfo.Processor= Id) {
-      mRebased  =3D FALSE;
-      mSmBase   =3D GetSmBase (Index, S= mmRelocationStart, TileSize);
-      mCpuIndex =3D Index;
+      mRebased =3D FALSE;
+      mSmBase  =3D GetSmBase (Index, SmmRelo= cationStart, TileSize);
       SendSmiIpi ((UINT32)ProcessorInfo.Proc= essorId);
       //
       // Wait for this AP to finish its 1st = SMI
       //
       while (!mRebased) {
diff --git a/UefiCpuPkg/Library/SmmRelocationLib/SmramSaveStateConfig.c b/U= efiCpuPkg/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 aft= er RSM must be
   detected, and the appropriate hook must be selected.  Alw= ays clear the auto
   HALT restart flag if it is set.
 
-  @param[in]     CpuIndex    =              Th= e processor index for the currently
-            &n= bsp;            = ;            &n= bsp;    executing CPU.
   @param[in,out] CpuState      &nb= sp;          Pointer to SMRAM = Save State Map for the
            &nb= sp;            =             &nb= sp;     currently executing CPU.
   @param[in]     NewInstructionPointer32&nbs= p; Instruction pointer to use if resuming to
            &nb= sp;            =             &nb= sp;     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     = ;           NewInstructio= nPointer32,
   IN     UINT64     = ;           NewInstructio= nPointer
   )
 {
diff --git a/UefiCpuPkg/Library/SmmRelocationLib/X64/Semaphore.c b/UefiCpuP= kg/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<= br>    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 t= o TRUE
            &nb= sp;            =   immediately after AP exits SMM.
 
 **/
 VOID
 SemaphoreHook (
-  IN UINTN          = ;   CpuIndex,
   IN volatile BOOLEAN  *RebasedFlag
   )
 {
   SMRAM_SAVE_STATE_MAP  *CpuState;
   UINTN         &nb= sp;       TempValue;
@@ -49,11 +47,10 @@ SemaphoreHook (
     4
     );
 
   CpuState         =              = =3D (SMRAM_SAVE_STATE_MAP *)(UINTN)(SMM_DEFAULT_SMBASE + SMRAM_SAVE_STATE_M= AP_OFFSET);
   mSmmRelocationOriginalAddress =3D HookReturnFromSmm (
-            &n= bsp;            = ;           CpuIndex,
            &nb= sp;            =             CpuState= ,
            &nb= sp;            =             (UINT64)= (UINTN)&SmmRelocationSemaphoreComplete32,
            &nb= sp;            =             (UINT64)= (UINTN)&SmmRelocationSemaphoreComplete
            &nb= sp;            =             );
 
--
2.16.2.windows.1

_._,_._,_

Groups.io Links:

=20 You receive all messages sent to this group. =20 =20

View/Reply Online (#118587) | =20 | Mute= This Topic | New Topic
Your Subscriptio= n | Contact Group Owner | Unsubscribe [rebecca@openfw.io]

_._,_._,_
--_000_MN6PR11MB8244F703E96A5C1C875E2F328C1C2MN6PR11MB8244namp_--