From nobody Sat May 11 09:49:38 2024 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+111645+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+111645+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1700709808; cv=none; d=zohomail.com; s=zohoarc; b=X2IL0BAoZ6eZriRwNWxqqbgwTrN9LAO/He2TYxk0/2q9zb45oiAbSXJUG3tQJh1TcfSWte5Y7oKsXRhZVyfaLvzxc99MYPxZBxlX+yH/vzP/cDSsgeAAPo5mgCSif3K+DzMAa/c6v3Q5RizSxMceg78AvLcI3RW2Qtz6kDBQj/s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1700709808; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Sender:Subject:Subject:To:To:Message-Id; bh=fb+uNXBKTsbfwC0DxVfPUZsUsS6fzvLSmz+oXRIL3zU=; b=KY4wqRfRSvyHJQTj+jas7f7bUG11YkX1ozZZeoVo8/KnWG+s+eS644vwoIIKGY5v9durs+s7a/x5SWIDG3x3eyy1DKfI8VEpR3nf+pElue2uwwmLjUDjqOUk74s+6gGJbLb2r8xwcAwsJnlrXfL/6l1IPqzqRUroO0FP4ki8pCk= 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+111645+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 1700709808310818.3776517253361; Wed, 22 Nov 2023 19:23:28 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=gYLzvTb4uqdYRHWRZrDljWCZUKEmcVSU1jqHCIJNchM=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1700709807; v=1; b=wIWmk5Pl+DNJMcjMTE4H6UShUXNLpPRnXY/gWU5BRB8E8aY74+wxQKpVGx/0xNbBif/1taJO 3SJtIq/TwMZmQRMuZfNkriYQ/SDZRvjCQQjeHAGBcaZhW9pTMPM++RZGj5/eIhBp+FEfECpQqYW 9z9TawAHp2ttuvO7J2MwG1v0= X-Received: by 127.0.0.2 with SMTP id gfy3YY1788612x2b5nhbqGMg; Wed, 22 Nov 2023 19:23:27 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by mx.groups.io with SMTP id smtpd.web10.83938.1700709807218093113 for ; Wed, 22 Nov 2023 19:23:27 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10902"; a="5330929" X-IronPort-AV: E=Sophos;i="6.04,220,1695711600"; d="scan'208";a="5330929" X-Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2023 19:23:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,220,1695711600"; d="scan'208";a="15502868" X-Received: from shwdesfp01.ccr.corp.intel.com ([10.239.158.151]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2023 19:23:25 -0800 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Zhiguang Liu , Ray Ni , Rahul Kumar , Gerd Hoffmann , Laszlo Ersek Subject: [edk2-devel] [PATCH v3] UefiCpuPkg/PiSmmCpuDxeSmm: Use NonSmm BSP as default SMM BSP. Date: Thu, 23 Nov 2023 11:23:14 +0800 Message-Id: <20231123032314.4353-1-zhiguang.liu@intel.com> MIME-Version: 1.0 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 Reply-To: devel@edk2.groups.io,zhiguang.liu@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: FspBZxsVMD0PN6g3yc0K0yczx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1700709809496100001 Content-Type: text/plain; charset="utf-8" Currently, if BSP election is not enabled, will use Core0 as SMM BSP. However, Core0 does not always have the highest performance. So, we can used NonSmm BSP as default BSP. This will take effect in normal SMM init flow and S3 boot flow. In normal SMM flow, the code is executed in Non-SMM mode. In S3 flow, the code is executed in Non-SMM BSP's first SMI, where the gSmmCpuPrivate keeps the data from last boot. V3: Add more commit message explaining S3 flow. Cc: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann Cc: Laszlo Ersek Signed-off-by: Zhiguang Liu Reviewed-by: Ray Ni --- UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c b/UefiCpuPkg/PiSmmCpuDxe= Smm/MpService.c index 25d058c5b9..b279f5dfcc 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c @@ -1953,6 +1953,16 @@ InitializeMpSyncData ( // Enable BSP election by setting BspIndex to -1 // mSmmMpSyncData->BspIndex =3D (UINT32)-1; + } else { + // + // Use NonSMM BSP as SMM BSP + // + for (CpuIndex =3D 0; CpuIndex < gSmmCpuPrivate->SmmCoreEntryContext.= NumberOfCpus; CpuIndex++) { + if (GetApicId () =3D=3D gSmmCpuPrivate->ProcessorInfo[CpuIndex].Pr= ocessorId) { + mSmmMpSyncData->BspIndex =3D (UINT32)CpuIndex; + break; + } + } } =20 mSmmMpSyncData->EffectiveSyncMode =3D mCpuSmmSyncMode; --=20 2.31.1.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 (#111645): https://edk2.groups.io/g/devel/message/111645 Mute This Topic: https://groups.io/mt/102761712/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-