From: "Laszlo Ersek" <lersek@redhat.com>
To: mikuback@linux.microsoft.com, devel@edk2.groups.io
Cc: Eric Dong <eric.dong@intel.com>, Ray Ni <ray.ni@intel.com>,
Rahul Kumar <rahul1.kumar@intel.com>
Subject: Re: [PATCH v2 3/4] UefiCpuPkg/SmmCpuFeaturesLib: Abstract PcdCpuMaxLogicalProcessorNumber
Date: Mon, 15 Feb 2021 20:35:14 +0100 [thread overview]
Message-ID: <756c0bb2-e996-1261-a066-709dfd2af292@redhat.com> (raw)
In-Reply-To: <20210213005806.2927-4-mikuback@linux.microsoft.com>
On 02/13/21 01:58, mikuback@linux.microsoft.com wrote:
> From: Michael Kubacki <michael.kubacki@microsoft.com>
>
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3218
>
> 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 <eric.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Rahul Kumar <rahul1.kumar@intel.com>
> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
> ---
> UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.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/SmmCpuFeaturesLib.c b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c
> index e74f87f3f266..a494988898b8 100644
> --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c
> +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c
> @@ -157,7 +157,7 @@ CpuFeaturesLibInitialization (
> //
> // Allocate array for state of SMRR enable on all CPUs
> //
> - mSmrrEnabled = (BOOLEAN *)AllocatePool (sizeof (BOOLEAN) * PcdGet32 (PcdCpuMaxLogicalProcessorNumber));
> + mSmrrEnabled = (BOOLEAN *)AllocatePool (sizeof (BOOLEAN) * GetCpuMaxLogicalProcessorNumber ());
> ASSERT (mSmrrEnabled != NULL);
> }
>
> diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/TraditionalMmCpuFeaturesLib.c b/UefiCpuPkg/Library/SmmCpuFeaturesLib/TraditionalMmCpuFeaturesLib.c
> new file mode 100644
> index 000000000000..6a4eff755d92
> --- /dev/null
> +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/TraditionalMmCpuFeaturesLib.c
> @@ -0,0 +1,28 @@
> +/** @file
> + Traditional MM CPU specific programming.
> +
> + Copyright (c) Microsoft Corporation.<BR>
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include <Base.h>
> +#include <Library/PcdLib.h>
> +#include "CpuFeaturesLib.h"
> +
> +/**
> + Gets the maximum number of logical processors from the PCD PcdCpuMaxLogicalProcessorNumber.
> +
> + This access is abstracted from the PCD services to enforce that the PCD be
> + FixedAtBuild in the Standalone MM build of this driver.
> +
> + @retval The value of PcdCpuMaxLogicalProcessorNumber.
> +
> +**/
> +UINT32
> +GetCpuMaxLogicalProcessorNumber (
> + VOID
> + )
> +{
> + return PcdGet32 (PcdCpuMaxLogicalProcessorNumber);
> +}
> diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/CpuFeaturesLib.h b/UefiCpuPkg/Library/SmmCpuFeaturesLib/CpuFeaturesLib.h
> index f9a758e82558..1a72ba4e2e13 100644
> --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/CpuFeaturesLib.h
> +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/CpuFeaturesLib.h
> @@ -31,4 +31,18 @@ FinishSmmCpuFeaturesInitializeProcessor (
> VOID
> );
>
> +/**
> + Gets the maximum number of logical processors from the PCD PcdCpuMaxLogicalProcessorNumber.
> +
> + This access is abstracted from the PCD services to enforce that the PCD be
> + FixedAtBuild in the Standalone MM build of this driver.
> +
> + @retval The value of PcdCpuMaxLogicalProcessorNumber.
> +
> +**/
> +UINT32
> +GetCpuMaxLogicalProcessorNumber (
> + VOID
> + );
> +
> #endif
> diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf
> index a6d8467d26aa..b32dbeab9383 100644
> --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf
> +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf
> @@ -20,6 +20,7 @@ [Sources]
> CpuFeaturesLib.h
> SmmCpuFeaturesLib.c
> SmmCpuFeaturesLibNoStm.c
> + TraditionalMmCpuFeaturesLib.c
>
> [Packages]
> MdePkg/MdePkg.dec
> diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf
> index 89cd252ef44e..f72ef0a88088 100644
> --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf
> +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf
> @@ -22,6 +22,7 @@ [Sources]
> SmmCpuFeaturesLib.c
> SmmStm.c
> SmmStm.h
> + TraditionalMmCpuFeaturesLib.c
>
> [Sources.Ia32]
> Ia32/SmmStmSupport.c
>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
next prev parent reply other threads:[~2021-02-15 19:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-13 0:58 [PATCH v2 0/4] UefiCpuPkg/StandaloneMmCpuFeaturesLib: Add Standalone MM support Michael Kubacki
2021-02-13 0:58 ` [PATCH v2 1/4] UefiCpuPkg/SmmCpuFeaturesLib: Move multi-instance function decl to header Michael Kubacki
2021-02-15 19:23 ` Laszlo Ersek
2021-02-13 0:58 ` [PATCH v2 2/4] UefiCpuPkg/SmmCpuFeaturesLib: Cleanup library constructors Michael Kubacki
2021-02-15 19:31 ` Laszlo Ersek
2021-02-13 0:58 ` [PATCH v2 3/4] UefiCpuPkg/SmmCpuFeaturesLib: Abstract PcdCpuMaxLogicalProcessorNumber Michael Kubacki
2021-02-15 19:35 ` Laszlo Ersek [this message]
2021-02-13 0:58 ` [PATCH v2 4/4] UefiCpuPkg/SmmCpuFeaturesLib: Add Standalone MM support Michael Kubacki
2021-02-15 20:33 ` Laszlo Ersek
2021-02-16 20:11 ` Michael Kubacki
2021-02-17 14:19 ` Laszlo Ersek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=756c0bb2-e996-1261-a066-709dfd2af292@redhat.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox