From nobody Tue Apr 23 13:24:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+59655+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+59655+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1589528691; cv=none; d=zohomail.com; s=zohoarc; b=e6vahoMJfraYbgZRIiY7W4x4p4SAv3lQLi+AQCMGr4ujDtkIOvMyOzak3t6uIW4SUNXSnFGVxZ782glOOy10NM5WTxxWs00QTNCQIauZ9zvS4ZbzNhhn3ba1YfDIkSRkE7OzXS0rT2xOIetE8d9xmjlzrXKQ0vHfEMfdIViaxms= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589528691; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=/sh5zhVDU00DG8UwztbS3yQzeoUTLTkSj9pEszjwxvM=; b=FpJLYOb++MHde85O/OPyxxnfAdvdef5SwXGzcqdL2Nrl4hybPzCGxb+SmqUlC8PJmFsIVhV+YY72ynXD3T5HMuC0OXLuFtxP9zsWc7WMyJjjPQHLhEzC2tkipuA7zlqsrk46E7u3vBdvfEDIfqCY/ofSOQQp42wNfWDX+X95dyg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+59655+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1589528691836190.9834999223167; Fri, 15 May 2020 00:44:51 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id R9AdYY1788612xem4b84bVgf; Fri, 15 May 2020 00:44:51 -0700 X-Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web12.8953.1589528690978071995 for ; Fri, 15 May 2020 00:44:51 -0700 IronPort-SDR: BMZdM40IemcmiH0V/7+cVafdJOuHQYUexNAC2zcZinUa0Ngmuy/iDKw1bh5IG3OHL60AUzBTnQ fG7x/jCMdL6w== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 May 2020 00:44:50 -0700 IronPort-SDR: u/6F51fIke/rNP9N2kdo1g7LM2FKYmb3vLgIfMxasxeaAG8u21mXf1Wm/eovS5a+M8oZb9W980 YWvhlTzASDjQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,394,1583222400"; d="scan'208";a="298342910" X-Received: from ray-dev.ccr.corp.intel.com ([10.239.158.43]) by fmsmga002.fm.intel.com with ESMTP; 15 May 2020 00:44:48 -0700 From: "Ni, Ray" To: devel@edk2.groups.io Cc: Eric Dong Subject: [edk2-devel] [PATCH] UefiCpuPkg/MpService: GetProcessorInfo returns 6-level topology Date: Fri, 15 May 2020 15:44:11 +0800 Message-Id: <20200515074411.236188-1-ray.ni@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,ray.ni@intel.com X-Gm-Message-State: YhAQKTCyOixqdSETNizadRx2x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1589528691; bh=Pq8ylvWcKJJ9FJvHbiMXSOV2JT3qnoGEpt8EFbA8Vlw=; h=Cc:Date:From:Reply-To:Subject:To; b=d78VAg/HyMyjAHh1IZpioWOIuiEXNCY1/CQ5HAbWsjLQQEe6/ewOlEJhI+q6/WCT7Cx EAO8oVbxBvmZOnCuD7uyaC07aIy1QrO7qmeBJidnUmUV2l6Gz8He3uXXP8roOZhQdeZUI LG3e8ahC/O+nXPvxgOZUf66mK3ZdI3JpxG4= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Intel SDM introduces 6-levels for describing the CPU topology: * Package * Module * Tile * Die * Core * Thread A PI spec ECR was submitted to enhance CPU_MP PPI/Protocol to support returning such information through GetProcessorInfo(). An accordingly change was implemented and pushed to edk2-staging. Now the PI spec has been published. The patch is cherry-picked from edk2-staging to edk2. Signed-off-by: Ray Ni Reviewed-by: Eric Dong --- UefiCpuPkg/Library/MpInitLib/MpLib.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpIn= itLib/MpLib.c index cbc5594c78..ab7a8ed663 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -1879,10 +1879,17 @@ MpInitLibGetProcessorInfo ( CPU_MP_DATA *CpuMpData; UINTN CallerNumber; CPU_INFO_IN_HOB *CpuInfoInHob; + UINTN OriginalProcessorNumber; =20 CpuMpData =3D GetCpuMpData (); CpuInfoInHob =3D (CPU_INFO_IN_HOB *) (UINTN) CpuMpData->CpuInfoInHob; =20 + // + // Lower 24 bits contains the actual processor number. + // + OriginalProcessorNumber =3D ProcessorNumber; + ProcessorNumber &=3D BIT24 - 1; + // // Check whether caller processor is BSP // @@ -1923,6 +1930,18 @@ MpInitLibGetProcessorInfo ( &ProcessorInfoBuffer->Location.Thread ); =20 + if ((OriginalProcessorNumber & CPU_V2_EXTENDED_TOPOLOGY) !=3D 0) { + GetProcessorLocation2ByApicId ( + CpuInfoInHob[ProcessorNumber].ApicId, + &ProcessorInfoBuffer->ExtendedInformation.Location2.Package, + &ProcessorInfoBuffer->ExtendedInformation.Location2.Die, + &ProcessorInfoBuffer->ExtendedInformation.Location2.Tile, + &ProcessorInfoBuffer->ExtendedInformation.Location2.Module, + &ProcessorInfoBuffer->ExtendedInformation.Location2.Core, + &ProcessorInfoBuffer->ExtendedInformation.Location2.Thread + ); + } + if (HealthData !=3D NULL) { HealthData->Uint32 =3D CpuInfoInHob[ProcessorNumber].Health; } --=20 2.21.0.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 (#59655): https://edk2.groups.io/g/devel/message/59655 Mute This Topic: https://groups.io/mt/74222908/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-