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 3AB509417D2 for ; Wed, 15 Nov 2023 11:16:06 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=tUq1RGcnxjtyxJT2dwtEdiM9S/E7KD/+abXv7E8rDiA=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe; s=20140610; t=1700046964; v=1; b=fK8p1qeKTA2Ae2H/bYZ3y/YnytAG9oM8qjXGRq2ucctncI9wJH7hpN4AJq9buAIVAPoDBlBk f6cHHeDYkd8O1MTLlFTT83PWdT6gjNWCDI/Jm0/D5Uz+Kk2ztCGoo2OimELRq8C4P70mUl3MSCe mU2N01UKwYSQhgeE5vgQqPz8= X-Received: by 127.0.0.2 with SMTP id lcZQYY7687511xUukqlviXgv; Wed, 15 Nov 2023 03:16:04 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web11.10782.1700046959669687038 for ; Wed, 15 Nov 2023 03:16:04 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10894"; a="455148446" X-IronPort-AV: E=Sophos;i="6.03,304,1694761200"; d="scan'208";a="455148446" X-Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Nov 2023 03:16:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10894"; a="1096420858" X-IronPort-AV: E=Sophos;i="6.03,304,1694761200"; d="scan'208";a="1096420858" X-Received: from sh1gapp1009.ccr.corp.intel.com ([10.239.189.219]) by fmsmga005.fm.intel.com with ESMTP; 15 Nov 2023 03:16:02 -0800 From: "Wu, Jiaxin" To: devel@edk2.groups.io Cc: Laszlo Ersek , Eric Dong , Ray Ni , Rahul Kumar , Gerd Hoffmann , Star Zeng Subject: [edk2-devel] [PATCH v2 3/3] UefiCpuPkg/PiSmmCpuDxeSmm: Use processor extended information Date: Wed, 15 Nov 2023 19:15:53 +0800 Message-Id: <20231115111553.6592-4-jiaxin.wu@intel.com> In-Reply-To: <20231115111553.6592-1-jiaxin.wu@intel.com> References: <20231115111553.6592-1-jiaxin.wu@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 Reply-To: devel@edk2.groups.io,jiaxin.wu@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: tj2JiOpVYPvzGv3ciYFQXVc2x7686176AA= X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=fK8p1qeK; 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 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io This patch changes to use the processor extended information, which can reflect the value from CPUID leaf 1FH. The reasons are listed as below: 1. The processor package ID retrieved from CPUID 0x0Bh may be not correct/accurate if CPU has the module & die info, it depends on the CPUID implementation. See SDM statement: EAX Bits 04 - 00: Number of bits to shift right on x2APIC ID to get a unique topology ID of the next level type. ECX Bits 15 - 08: level type Level type field has the following encoding: 0: Invalid. 1: SMT. 2: Core. 3-255: Reserved So, if level type returned from ECX Bits 15 - 08 is 2 (Core), then it's not clear about the next level. It can be Module or Die or Package. SDM doesn't has explanation for the next level of Core. If so, the value will be decided by implementation. The value can be package info for compatibility consideration, but it's not standardized. 2. According SDM declaration, "CPUID leaf 1FH is a preferred superset to leaf 0BH. Intel recommends first checking for the existence of CPUID leaf 1FH before using leaf 0BH." This is perfect match the existing GetProcessorLocation2ByApicId() implementation. Cc: Laszlo Ersek Cc: Eric Dong Cc: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann Cc: Star Zeng Signed-off-by: Jiaxin Wu Reviewed-by: Laszlo Ersek Regression-tested-by: Laszlo Ersek --- UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c index 25d058c5b9..c61562c867 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c @@ -177,11 +177,11 @@ IsPackageFirstThread ( IN UINTN CpuIndex ) { UINT32 PackageIndex; - PackageIndex = gSmmCpuPrivate->ProcessorInfo[CpuIndex].Location.Package; + PackageIndex = gSmmCpuPrivate->ProcessorInfo[CpuIndex].ExtendedInformation.Location2.Package; ASSERT (mPackageFirstThreadIndex != NULL); // // Set the value of mPackageFirstThreadIndex[PackageIndex]. @@ -1834,12 +1834,12 @@ InitPackageFirstThreadIndexInfo ( // // Count the number of package, set to max PackageId + 1 // for (Index = 0; Index < mNumberOfCpus; Index++) { - if (PackageId < gSmmCpuPrivate->ProcessorInfo[Index].Location.Package) { - PackageId = gSmmCpuPrivate->ProcessorInfo[Index].Location.Package; + if (PackageId < gSmmCpuPrivate->ProcessorInfo[Index].ExtendedInformation.Location2.Package) { + PackageId = gSmmCpuPrivate->ProcessorInfo[Index].ExtendedInformation.Location2.Package; } } PackageCount = PackageId + 1; -- 2.16.2.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111259): https://edk2.groups.io/g/devel/message/111259 Mute This Topic: https://groups.io/mt/102602853/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-