From nobody Sun Feb 8 23:57:47 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+100063+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+100063+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1676277869; cv=none; d=zohomail.com; s=zohoarc; b=NYR3oF2vwg19qxt3eHFXMA4K2T+cxP0q+BQJMMv8n51eWVvpYsP+fcDG9lSQGOFqhNdXbEQauGaQKZ85LcQzpJkCDefU5F1x4hhDWZ+SosQMfycyfuy9DSzr/dUrtfzmY6RBL0sNIC84m7s16NZU4yMYwU8nW9FbfYMAeeqTmpM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676277869; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=fhTHE/P7zLyeHwzPmYj4wmmW3ODZtoI0ImA3/W3ZlZo=; b=BCfHsfIGz7R4EB83u2+v3ykM/1dWHqVdNazdoeNzKJlbNvdsfTOFopyyLdvEPw/gAcisPm3XY0L7shHrAd8FDQyQtmHZXvi4ihF+7TEkm6H9uSalK88vl/wfkXTFW9eOuKfdEXvnXTOdFMdHL/0/tExnbKRy/TGagE5igiLYrUg= 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+100063+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 1676277869295472.86317376280397; Mon, 13 Feb 2023 00:44:29 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id SIsHYY1788612xkNNID3RxCT; Mon, 13 Feb 2023 00:44:28 -0800 X-Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web11.10224.1676277864494251584 for ; Mon, 13 Feb 2023 00:44:28 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10619"; a="310474697" X-IronPort-AV: E=Sophos;i="5.97,293,1669104000"; d="scan'208";a="310474697" X-Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Feb 2023 00:44:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10619"; a="646309678" X-IronPort-AV: E=Sophos;i="5.97,293,1669104000"; d="scan'208";a="646309678" X-Received: from sh1gapp1009.ccr.corp.intel.com ([10.239.189.79]) by orsmga006.jf.intel.com with ESMTP; 13 Feb 2023 00:44:26 -0800 From: "Wu, Jiaxin" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Zeng Star , Laszlo Ersek , Gerd Hoffmann , Rahul Kumar Subject: [edk2-devel] [PATCH v6 2/6] UefiCpuPkg/PiSmmCpuDxeSmm: Replace mIsBsp by mBspApicId Date: Mon, 13 Feb 2023 16:44:13 +0800 Message-Id: <20230213084417.9232-3-jiaxin.wu@intel.com> In-Reply-To: <20230213084417.9232-1-jiaxin.wu@intel.com> References: <20230213084417.9232-1-jiaxin.wu@intel.com> 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,jiaxin.wu@intel.com X-Gm-Message-State: viPfXYI2omc9k6jLBGSSI9vKx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1676277868; bh=kI0HR75w2rt3GMJvL8nU6ejXHNVweoeuAa9zKhtKXdY=; h=Cc:Date:From:Reply-To:Subject:To; b=J3A0EDG7pj69ITSJ5EqutK4sF2h80DkZ0Q6urqzBXhpghMS6WtHnCPZmnHi2+TfCOKo eP7jg6/fqDB1+gnnh1jDm58WOxejz2bT5+22bB9GZm/gE4wCxbWAOBRFJiA+KxbqN93AP 3zSWQaFk3taO+QVJHjNY00CGsS3ZFDljhtM= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1676277870931100009 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This patch is to replace mIsBsp by mBspApicId. Cc: Eric Dong Cc: Ray Ni Cc: Zeng Star Cc: Laszlo Ersek Cc: Gerd Hoffmann Cc: Rahul Kumar Signed-off-by: Jiaxin Wu Reviewed-by: Ray Ni --- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c b/UefiCpuPkg/PiSmmC= puDxeSmm/PiSmmCpuDxeSmm.c index 2ac655d032..6e795d1756 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c @@ -57,11 +57,10 @@ SMM_CPU_PRIVATE_DATA *gSmmCpuPrivate =3D &mSmmCpuPriva= teData; =20 // // SMM Relocation variables // volatile BOOLEAN *mRebased; -volatile BOOLEAN mIsBsp; =20 /// /// Handle for the SMM CPU Protocol /// EFI_HANDLE mSmmCpuHandle =3D NULL; @@ -83,10 +82,12 @@ EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL mSmmMemoryAttribut= e =3D { EdkiiSmmClearMemoryAttributes }; =20 EFI_CPU_INTERRUPT_HANDLER mExternalVectorTable[EXCEPTION_VECTOR_NUMBER]; =20 +UINT32 mBspApicId =3D 0; + // // SMM stack information // UINTN mSmmStackArrayBase; UINTN mSmmStackArrayEnd; @@ -341,39 +342,42 @@ VOID EFIAPI SmmInitHandler ( VOID ) { - UINT32 ApicId; - UINTN Index; + UINT32 ApicId; + UINTN Index; + BOOLEAN IsBsp; =20 // // Update SMM IDT entries' code segment and load IDT // AsmWriteIdtr (&gcSmiIdtr); ApicId =3D GetApicId (); =20 + IsBsp =3D (BOOLEAN)(mBspApicId =3D=3D ApicId); + ASSERT (mNumberOfCpus <=3D mMaxNumberOfCpus); =20 for (Index =3D 0; Index < mNumberOfCpus; Index++) { if (ApicId =3D=3D (UINT32)gSmmCpuPrivate->ProcessorInfo[Index].Process= orId) { // // Initialize SMM specific features on the currently executing CPU // SmmCpuFeaturesInitializeProcessor ( Index, - mIsBsp, + IsBsp, gSmmCpuPrivate->ProcessorInfo, &mCpuHotPlugData ); =20 if (!mSmmS3Flag) { // // Check XD and BTS features on each processor on normal boot // CheckFeatureSupported (); - } else if (mIsBsp) { + } else if (IsBsp) { // // BSP rebase is already done above. // Initialize private data during S3 resume // InitializeMpSyncData (); @@ -405,11 +409,10 @@ SmmRelocateBases ( { UINT8 BakBuf[BACK_BUF_SIZE]; SMRAM_SAVE_STATE_MAP BakBuf2; SMRAM_SAVE_STATE_MAP *CpuStatePtr; UINT8 *U8Ptr; - UINT32 ApicId; UINTN Index; UINTN BspIndex; =20 // // Make sure the reserved size is large enough for procedure SmmInitTemp= late. @@ -446,21 +449,20 @@ SmmRelocateBases ( CopyMem (U8Ptr, gcSmmInitTemplate, gcSmmInitSize); =20 // // Retrieve the local APIC ID of current processor // - ApicId =3D GetApicId (); + mBspApicId =3D GetApicId (); =20 // // Relocate SM bases for all APs // This is APs' 1st SMI - rebase will be done here, and APs' default SMI= handler will be overridden by gcSmmInitTemplate // - mIsBsp =3D FALSE; BspIndex =3D (UINTN)-1; for (Index =3D 0; Index < mNumberOfCpus; Index++) { mRebased[Index] =3D FALSE; - if (ApicId !=3D (UINT32)gSmmCpuPrivate->ProcessorInfo[Index].Processor= Id) { + if (mBspApicId !=3D (UINT32)gSmmCpuPrivate->ProcessorInfo[Index].Proce= ssorId) { SendSmiIpi ((UINT32)gSmmCpuPrivate->ProcessorInfo[Index].ProcessorId= ); // // Wait for this AP to finish its 1st SMI // while (!mRebased[Index]) { @@ -475,12 +477,11 @@ SmmRelocateBases ( =20 // // Relocate BSP's SMM base // ASSERT (BspIndex !=3D (UINTN)-1); - mIsBsp =3D TRUE; - SendSmiIpi (ApicId); + SendSmiIpi (mBspApicId); // // Wait for the BSP to finish its 1st SMI // while (!mRebased[BspIndex]) { } --=20 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 (#100063): https://edk2.groups.io/g/devel/message/100063 Mute This Topic: https://groups.io/mt/96932000/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-