From nobody Mon Apr 29 04:08:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+42584+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+42584+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1560934626; cv=none; d=zoho.com; s=zohoarc; b=QeHr8ymJkP4ZBWEVP4rI9V+oBnVPWGBD37tkT+6Q98+m27U+kEkCt2yJvA9KKl5f3T5eXR5tjCq6yehXOwCcoZj0HJ/23NKEtEz54bKddQ9xZ1ChI5vFiU6LC4tmdu9dvM5hcBzPEChAjB6+Fv1DlUEhwYskSPAYbIv64fn+kUA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560934626; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To:ARC-Authentication-Results; bh=IMmeKMp7DEKiA91KY4EqElFssZVutAU8wa3OOFOuqNY=; b=ehU7GJ6w8xlBYT1NA5bb4J67lhvC7TtYnSeeVtJqBIflkDTWRvfNcSvvSRhgQpPaXRZyhjOhSxs58fzkcM04zaQ/cKL+RH3Q+bSBclq/qaljm0d2hEZ3OTfcO/xX71jggXNyJBDA/Kk0iHUDWG5YO7+5gAB6mU7pc63aFqy1tuE= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+42584+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 1560934626439377.17817362251776; Wed, 19 Jun 2019 01:57:06 -0700 (PDT) Return-Path: X-Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by groups.io with SMTP; Wed, 19 Jun 2019 01:57:05 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jun 2019 01:57:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,392,1557212400"; d="scan'208";a="311298675" X-Received: from ray-dev.ccr.corp.intel.com ([10.239.9.16]) by orsmga004.jf.intel.com with ESMTP; 19 Jun 2019 01:57:03 -0700 From: "Ni, Ray" To: devel@edk2.groups.io Cc: Eric Dong Subject: [edk2-devel] [PATCH] UefiCpuPkg/MpService: GetProcessorInfo returns 6-level topology Date: Wed, 19 Jun 2019 16:56:42 +0800 Message-Id: <20190619085642.188848-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 Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1560934625; bh=vpkWd0O/BbqgwBSXA74oe5cEF8QbX10HnBERZEUIDxw=; h=Cc:Date:From:Reply-To:Subject:To; b=CTMtWMoqOyF+cOoDCoA+oCxk4Kt95PtRrdABQgAQpawxE4XytzVYaAxLxyFuUghJreL zeF4ACL5XUO4M5RpTM7y6jN/Zs7VMUudWfSiTn19nhew26vSQ/forjT4c14rsccaBPNFv FTh+XlboQUm2/K6n6diU2NJ1FykcHpnRkUk= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ray Ni Cc: Eric Dong --- MdePkg/Include/Protocol/MpService.h | 50 +++++++++++++++++++++++++--- UefiCpuPkg/Library/MpInitLib/MpLib.c | 19 +++++++++++ 2 files changed, 64 insertions(+), 5 deletions(-) diff --git a/MdePkg/Include/Protocol/MpService.h b/MdePkg/Include/Protocol/= MpService.h index 10e2405daf..aeab8b0790 100644 --- a/MdePkg/Include/Protocol/MpService.h +++ b/MdePkg/Include/Protocol/MpService.h @@ -27,7 +27,7 @@ APs to help test system memory in parallel with other device initializat= ion. Diagnostics applications may also use this protocol for multi-processor. =20 -Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Revision Reference: @@ -79,7 +79,7 @@ typedef struct _EFI_MP_SERVICES_PROTOCOL EFI_MP_SERVICES_= PROTOCOL; #define PROCESSOR_HEALTH_STATUS_BIT 0x00000004 =20 /// -/// Structure that describes the pyhiscal location of a logical CPU. +/// Structure that describes the physical location of a logical CPU. /// typedef struct { /// @@ -96,6 +96,45 @@ typedef struct { UINT32 Thread; } EFI_CPU_PHYSICAL_LOCATION; =20 +#define CPU_V2_EXTENDED_TOPOLOGY BIT24 + +/// +/// Structure that describes the v2 physical location of a logical CPU. +/// +typedef struct { + /// + /// Zero-based physical package number that identifies the cartridge of = the processor. + /// + UINT32 Package; + /// + /// Zero-based physical module number within package of the processor. + /// + UINT32 Module; + /// + /// Zero-based physical tile number within module of the processor. + /// + UINT32 Tile; + /// + /// Zero-based physical die number within tile of the processor. + /// + UINT32 Die; + /// + /// Zero-based physical core number within die of the processor. + /// + UINT32 Core; + /// + /// Zero-based logical thread number within core of the processor. + /// + UINT32 Thread; +} EFI_CPU_PHYSICAL_LOCATION2; + +/// +/// Structure that describes extended processor information. +/// +typedef union { + EFI_CPU_PHYSICAL_LOCATION2 Location2; +} EXTENDED_PROCESSOR_INFORMATION; + /// /// Structure that describes information about a logical CPU. /// @@ -106,7 +145,7 @@ typedef struct { /// are used, and higher bits are reserved. For IPF, the lower 16 bits = contains /// id/eid, and higher bits are reserved. /// - UINT64 ProcessorId; + UINT64 ProcessorId; /// /// Flags indicating if the processor is BSP or AP, if the processor is = enabled /// or disabled, and if the processor is healthy. Bits 3..31 are reserve= d and @@ -125,13 +164,14 @@ typedef struct { /// 1 1 1 Healthy Enabled BSP. /// /// - UINT32 StatusFlag; + UINT32 StatusFlag; /// /// The physical location of the processor, including the physical packa= ge number /// that identifies the cartridge, the physical core number within packa= ge, and /// logical thread number within core. /// - EFI_CPU_PHYSICAL_LOCATION Location; + EFI_CPU_PHYSICAL_LOCATION Location; + EXTENDED_PROCESSOR_INFORMATION ExtendedInformation; } EFI_PROCESSOR_INFORMATION; =20 /** diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpIn= itLib/MpLib.c index 6f51bc4ebf..538d6536e2 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -1774,10 +1774,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 // @@ -1818,6 +1825,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 (#42584): https://edk2.groups.io/g/devel/message/42584 Mute This Topic: https://groups.io/mt/32121076/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-