From nobody Sun Feb 8 05:54:06 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+71755+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+71755+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1613597611; cv=none; d=zohomail.com; s=zohoarc; b=R7XfhpZbgbD0mLMnxTEpEpJwMZj2sTW1MvcEYvRG0L0Siwc7JjzTXvsNds71Olix7Gk16JOXBqMqgb/qknPkom91jcBfONwf2s4FZiCbRJ9iposKYA6Fb8tde3M9jSjy72cU7Xse/CYdtUFuXo7e2pSy9kLSLhnKmvnQpkibALc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613597611; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=HFWZPJi2/uOIc5000C8BWXQvmtFBsQs6I7e/lO7iTYs=; b=M+k+A15Bc9wtjSTFoT3QL2E6U6cgCXwCxyBHlyV6j/e/fSH+ON2UoJHiOX9UENmHazcXQzQsxlPN80ZAIuDjptS4K/D8XS9tpU3H2ps8TUbnVFl7IynwWIxisSCUMoWY0soYzhmy2SmJJK7Yw8LHtKxkVU6LSmc+T+1V4enL9SI= 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+71755+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1613597611267562.5152173477682; Wed, 17 Feb 2021 13:33:31 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id JsoeYY1788612x61miGhPONW; Wed, 17 Feb 2021 13:33:30 -0800 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web09.599.1613597605493580068 for ; Wed, 17 Feb 2021 13:33:25 -0800 X-Received: from localhost.localdomain (unknown [131.107.174.202]) by linux.microsoft.com (Postfix) with ESMTPSA id 3F92320B6C40; Wed, 17 Feb 2021 13:33:25 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 3F92320B6C40 From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Laszlo Ersek , Rahul Kumar Subject: [edk2-devel] [PATCH v3 4/5] UefiCpuPkg/SmmCpuFeaturesLib: Abstract PcdCpuMaxLogicalProcessorNumber Date: Wed, 17 Feb 2021 13:32:26 -0800 Message-Id: <20210217213227.1277-5-mikuback@linux.microsoft.com> In-Reply-To: <20210217213227.1277-1-mikuback@linux.microsoft.com> References: <20210217213227.1277-1-mikuback@linux.microsoft.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,mikuback@linux.microsoft.com X-Gm-Message-State: SpO6NVFEykiZ8F0Puh89QBOMx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1613597610; bh=zOvipnTw9KgVicKuxJIP5uPeFXzvm0WfL+OjmJml77k=; h=Cc:Date:From:Reply-To:Subject:To; b=L0+H5jru7KvKdjZQ5tVLZTZ+r/6wv9ChyZqC9VthwZBEF5jJJyXDsHV4O6FC8S4P/MV iVV1+jcZqGjzw+3T1MuGK7GrVpy/zLQQU1CG0sLN+IEOEpcpBs5AKiRqVi4YVnvqUuEX/ tw71Q3lMrAumGCFK3U9A84wTbDX8lVAmZfw= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Michael Kubacki REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3218 Adds a new function called GetCpuMaxLogicalProcessorNumber() to return the number of maximum CPU logical processors (currently gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber). This allows the the mechanism used to retrieve the CPU maximum logical processor number to be abstracted from the logic that needs the value. Cc: Eric Dong Cc: Ray Ni Cc: Laszlo Ersek Cc: Rahul Kumar Signed-off-by: Michael Kubacki Reviewed-by: Laszlo Ersek --- UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c | 2 +- UefiCpuPkg/Library/SmmCpuFeaturesLib/TraditionalMmCpuFeaturesLib.c | 28 ++= ++++++++++++++++++ UefiCpuPkg/Library/SmmCpuFeaturesLib/CpuFeaturesLib.h | 14 ++= ++++++++ UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf | 1 + UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf | 1 + 5 files changed, 45 insertions(+), 1 deletion(-) diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c= b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c index 7a919c5ee70f..50379f3aea19 100644 --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c @@ -157,7 +157,7 @@ CpuFeaturesLibInitialization ( // // Allocate array for state of SMRR enable on all CPUs // - mSmrrEnabled =3D (BOOLEAN *)AllocatePool (sizeof (BOOLEAN) * PcdGet32 (P= cdCpuMaxLogicalProcessorNumber)); + mSmrrEnabled =3D (BOOLEAN *)AllocatePool (sizeof (BOOLEAN) * GetCpuMaxLo= gicalProcessorNumber ()); ASSERT (mSmrrEnabled !=3D NULL); } =20 diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/TraditionalMmCpuFeaturesL= ib.c b/UefiCpuPkg/Library/SmmCpuFeaturesLib/TraditionalMmCpuFeaturesLib.c new file mode 100644 index 000000000000..b7a5c1926e4d --- /dev/null +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/TraditionalMmCpuFeaturesLib.c @@ -0,0 +1,28 @@ +/** @file + Traditional MM CPU specific programming. + + Copyright (c) Microsoft Corporation.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include "CpuFeaturesLib.h" + +/** + Gets the maximum number of logical processors from the PCD PcdCpuMaxLogi= calProcessorNumber. + + This access is abstracted from the PCD services to enforce that the PCD = be + FixedAtBuild in the Standalone MM build of this driver. + + @return The value of PcdCpuMaxLogicalProcessorNumber. + +**/ +UINT32 +GetCpuMaxLogicalProcessorNumber ( + VOID + ) +{ + return PcdGet32 (PcdCpuMaxLogicalProcessorNumber); +} diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/CpuFeaturesLib.h b/UefiCp= uPkg/Library/SmmCpuFeaturesLib/CpuFeaturesLib.h index f9a758e82558..2b6bfa899a48 100644 --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/CpuFeaturesLib.h +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/CpuFeaturesLib.h @@ -31,4 +31,18 @@ FinishSmmCpuFeaturesInitializeProcessor ( VOID ); =20 +/** + Gets the maximum number of logical processors from the PCD PcdCpuMaxLogi= calProcessorNumber. + + This access is abstracted from the PCD services to enforce that the PCD = be + FixedAtBuild in the Standalone MM build of this driver. + + @return The value of PcdCpuMaxLogicalProcessorNumber. + +**/ +UINT32 +GetCpuMaxLogicalProcessorNumber ( + VOID + ); + #endif diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf b/U= efiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf index ddd00eeceb84..35292dac31ba 100644 --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf @@ -21,6 +21,7 @@ [Sources] SmmCpuFeaturesLib.c SmmCpuFeaturesLibCommon.c SmmCpuFeaturesLibNoStm.c + TraditionalMmCpuFeaturesLib.c =20 [Packages] MdePkg/MdePkg.dec diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf = b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf index 78f8e4b42c44..022351f59320 100644 --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf @@ -22,6 +22,7 @@ [Sources] SmmCpuFeaturesLibCommon.c SmmStm.c SmmStm.h + TraditionalMmCpuFeaturesLib.c =20 [Sources.Ia32] Ia32/SmmStmSupport.c --=20 2.28.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 (#71755): https://edk2.groups.io/g/devel/message/71755 Mute This Topic: https://groups.io/mt/80715271/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-