From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: ray.ni@intel.com) IronPort-SDR: BMZdM40IemcmiH0V/7+cVafdJOuHQYUexNAC2zcZinUa0Ngmuy/iDKw1bh5IG3OHL60AUzBTnQ fG7x/jCMdL6w== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False 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" 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: [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> X-Mailer: git-send-email 2.21.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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/MpInitLib/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; CpuMpData = GetCpuMpData (); CpuInfoInHob = (CPU_INFO_IN_HOB *) (UINTN) CpuMpData->CpuInfoInHob; + // + // Lower 24 bits contains the actual processor number. + // + OriginalProcessorNumber = ProcessorNumber; + ProcessorNumber &= BIT24 - 1; + // // Check whether caller processor is BSP // @@ -1923,6 +1930,18 @@ MpInitLibGetProcessorInfo ( &ProcessorInfoBuffer->Location.Thread ); + if ((OriginalProcessorNumber & CPU_V2_EXTENDED_TOPOLOGY) != 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 != NULL) { HealthData->Uint32 = CpuInfoInHob[ProcessorNumber].Health; } -- 2.21.0.windows.1