From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 5CEA4D8004F for ; Thu, 23 Nov 2023 03:23:34 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=Tb5nYsgAjkCjHSUk3Y9iq2eFjeCndmWt+kK0LJxO+ls=; 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=1700709813; v=1; b=LRYPPF8TZSvlZ+3TJD8CEXzmCxjkgFnbKeLOJq2GY+q1IaDzutTLr6Orttx17wxRE942f5Rk ugxwNtNtghVCaKDAu7K29Lz4BjX2YW8Ad35jOBYowWcG5HViaqWXd7gdWLGP8c7iYFyRuIxuY7E pljTMebguV29TPRyop7W7MB0= X-Received: by 127.0.0.2 with SMTP id VojUYY7687511xP6EpQAvJaO; Wed, 22 Nov 2023 19:23:33 -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: uFYJn1aRTHP4pSp1mMPadelox7686176AA= Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=LRYPPF8T; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 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) 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 --- UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c b/UefiCpuPkg/PiSmmCpuDxeSmm/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 = (UINT32)-1; + } else { + // + // Use NonSMM BSP as SMM BSP + // + for (CpuIndex = 0; CpuIndex < gSmmCpuPrivate->SmmCoreEntryContext.NumberOfCpus; CpuIndex++) { + if (GetApicId () == gSmmCpuPrivate->ProcessorInfo[CpuIndex].ProcessorId) { + mSmmMpSyncData->BspIndex = (UINT32)CpuIndex; + break; + } + } } mSmmMpSyncData->EffectiveSyncMode = mCpuSmmSyncMode; -- 2.31.1.windows.1 -=-=-=-=-=-=-=-=-=-=-=- 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/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-