From nobody Mon Feb 9 09:16:38 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+112067+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+112067+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1701755369; cv=none; d=zohomail.com; s=zohoarc; b=L49+JGr35mpXoIKFzfmImhE5ax95tAwdZwwQDFop4gyGBNDDKldMVORWXQv8Rqac/YuVAMLHuHHrwFxPSh7DsypQgMM7o/mgBJNhb+6+2nOA5mfVgSjnVOgC1ne1EmNWEPwF6041QMXx/aJNsR0LkPgH8L4kbvzc7erXHQWnlmY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1701755369; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=tKH1bZ1+1ZdxTV0lU5Ol3VnROh+RhG619CrHixSsg9s=; b=IaldQaTlonIrWc3/qSmeNlzu3gh0XzFTYKs3eecOgQIlX+y33yWsgv4cvbyDhVHNY0W5rz8AfLNj3hNzaE2BOkfJDTvGNOYovFiI8l06R8jVfFkfX74Fq3lOL3u+hO/0H35L15m5QVGf46GVus5DvI4uXQxGpnVYOg1rpcuV9Ak= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+112067+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 170175536952835.6075682818589; Mon, 4 Dec 2023 21:49:29 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=MQqpnbMRNKp2hLIn+NAe+xGDSmf0p+jT9YSWpBkrQDM=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: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=1701755369; v=1; b=FBFl0iA5Jbpxx8P5MytPko/bUiaPoU8AEKuXuG91Qs531RcbOprjy7OWXMdpL1UhR8NNBDGx KrBjvl+RqeOSb0AFt+p1KBtuXa4kz4FhKnHEXyt9PrzJNc42nYtbeTwdv0BV9H6aWlBB4AF0UCl zzQjScO5tdkVJZohpErdW8LE= X-Received: by 127.0.0.2 with SMTP id 6hmfYY1788612x1zDKZQm5cX; Mon, 04 Dec 2023 21:49:29 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web11.93095.1701755355027796431 for ; Mon, 04 Dec 2023 21:49:28 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="378875436" X-IronPort-AV: E=Sophos;i="6.04,251,1695711600"; d="scan'208";a="378875436" X-Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2023 21:49:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="720580542" X-IronPort-AV: E=Sophos;i="6.04,251,1695711600"; d="scan'208";a="720580542" X-Received: from shwdeopenlab702.ccr.corp.intel.com ([10.239.55.43]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2023 21:49:26 -0800 From: "duntan" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Rahul Kumar , Gerd Hoffmann Subject: [edk2-devel] [PATCH 5/6] UefiCpuPkg: Cache core type in MpInfo2 HOB Date: Tue, 5 Dec 2023 13:48:59 +0800 Message-Id: <20231205054900.926-6-dun.tan@intel.com> In-Reply-To: <20231205054900.926-1-dun.tan@intel.com> References: <20231205054900.926-1-dun.tan@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,dun.tan@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 6XlHrN4xyS5W1d5LC6XEGaPBx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1701755370438100011 Content-Type: text/plain; charset="utf-8" Cache core type in MpInfo2 HOB by CpuMpPei module. Signed-off-by: Dun Tan Cc: Eric Dong Cc: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann --- UefiCpuPkg/CpuMpPei/CpuMpPei.c | 59 ++++++++++++++++++++++++++++++++++++++= +++++++++++++++++++-- UefiCpuPkg/CpuMpPei/CpuMpPei.h | 2 ++ 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/UefiCpuPkg/CpuMpPei/CpuMpPei.c b/UefiCpuPkg/CpuMpPei/CpuMpPei.c index 4d80d52799..8f6863f4d9 100644 --- a/UefiCpuPkg/CpuMpPei/CpuMpPei.c +++ b/UefiCpuPkg/CpuMpPei/CpuMpPei.c @@ -541,6 +541,30 @@ InitializeMpExceptionStackSwitchHandlers ( FreePages (SwitchStackData, EFI_SIZE_TO_PAGES (NumberOfProcessors * size= of (EXCEPTION_STACK_SWITCH_CONTEXT))); } =20 +/** + Get CPU core type. + + @param[in, out] Buffer Argument of the procedure. +**/ +VOID +EFIAPI +GetProcessorCoreType ( + IN OUT VOID *Buffer + ) +{ + EFI_STATUS Status; + UINT8 *CoreType; + CPUID_NATIVE_MODEL_ID_AND_CORE_TYPE_EAX NativeModelIdAndCoreTypeEax; + UINTN ProcessorIndex; + + Status =3D MpInitLibWhoAmI (&ProcessorIndex); + ASSERT_EFI_ERROR (Status); + + CoreType =3D (UINT8 *)Buffer; + AsmCpuidEx (CPUID_HYBRID_INFORMATION, CPUID_HYBRID_INFORMATION_MAIN_LEAF= , &NativeModelIdAndCoreTypeEax.Uint32, NULL, NULL, NULL); + CoreType[ProcessorIndex] =3D (UINT8)NativeModelIdAndCoreTypeEax.Bits.Cor= eType; +} + /** Create gMpInformationHobGuid2. **/ @@ -558,13 +582,36 @@ BuildMpInformationHob ( MP_INFORMATION2_HOB_DATA *MpInformation2HobData; MP_INFORMATION2_ENTRY *MpInformation2Entry; UINTN Index; + UINT8 *CoreType; + UINT32 CpuidMaxInput; + UINTN Pages; =20 ProcessorIndex =3D 0; MpInformation2HobData =3D NULL; MpInformation2Entry =3D NULL; + CoreType =3D NULL; + Pages =3D 0; =20 Status =3D MpInitLibGetNumberOfProcessors (&NumberOfProcessors, &NumberO= fEnabledProcessors); ASSERT_EFI_ERROR (Status); + + // + // Get Processors CoreType + // + AsmCpuid (CPUID_SIGNATURE, &CpuidMaxInput, NULL, NULL, NULL); + if (CpuidMaxInput >=3D CPUID_HYBRID_INFORMATION) { + Pages =3D EFI_SIZE_TO_PAGES (sizeof (UINT8) * NumberOfProcessors); + CoreType =3D AllocatePages (Pages); + ASSERT (CoreType !=3D NULL); + + Status =3D MpInitLibStartupAllCPUs ( + GetProcessorCoreType, + 0, + (VOID *)CoreType + ); + ASSERT_EFI_ERROR (Status); + } + MaxProcessorsPerHob =3D ((MAX_UINT16 & 7) - sizeof (EFI_HOB_GUID_TYP= E) - sizeof (MP_INFORMATION2_HOB_DATA)) / sizeof (MP_INFORMATION2_ENTRY); NumberOfProcessorsInHob =3D MaxProcessorsPerHob; =20 @@ -597,12 +644,16 @@ BuildMpInformationHob ( NULL ); ASSERT_EFI_ERROR (Status); + + MpInformation2Entry->CoreType =3D (CoreType !=3D NULL) ? CoreType[In= dex + ProcessorIndex] : 0; + DEBUG (( DEBUG_INFO, - "ProcessorIndex =3D %x, ProcessorId =3D %lx, StatusFlag =3D %x\n", + "ProcessorIndex =3D %x, ProcessorId =3D %lx, StatusFlag =3D %x, Co= reType =3D %x\n", Index + ProcessorIndex, MpInformation2Entry->ProcessorInfo.ProcessorId, - MpInformation2Entry->ProcessorInfo.StatusFlag + MpInformation2Entry->ProcessorInfo.StatusFlag, + MpInformation2Entry->CoreType )); DEBUG (( DEBUG_INFO, @@ -625,6 +676,10 @@ BuildMpInformationHob ( =20 ProcessorIndex +=3D NumberOfProcessorsInHob; } + + if (CoreType !=3D NULL) { + FreePages (CoreType, Pages); + } } =20 /** diff --git a/UefiCpuPkg/CpuMpPei/CpuMpPei.h b/UefiCpuPkg/CpuMpPei/CpuMpPei.h index a40fd2c077..e7d07ffd64 100644 --- a/UefiCpuPkg/CpuMpPei/CpuMpPei.h +++ b/UefiCpuPkg/CpuMpPei/CpuMpPei.h @@ -32,6 +32,8 @@ =20 #include =20 +#include + extern EFI_PEI_PPI_DESCRIPTOR mPeiCpuMpPpiDesc; =20 /** --=20 2.31.1.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 (#112067): https://edk2.groups.io/g/devel/message/112067 Mute This Topic: https://groups.io/mt/102987141/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-