From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.groups.io with SMTP id smtpd.web10.1672.1613767443622877768 for ; Fri, 19 Feb 2021 12:44:03 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fofASuuR; spf=pass (domain: redhat.com, ip: 63.128.21.124, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613767442; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zmO7a2IH5fYKev/AypHBx1XtvHbY4iB6tGshm9TMrrU=; b=fofASuuRU8xcmHakLf14hLguwCcH0G3rInVRHq8aLwROW58jag/7qOmaxBQnmtJYg94irD lEL2qixfccSDbm9bxH8GOLPVVsgpDm6Tv+zRiwsaU4u6O+pvj1J+BgIAhBDj+/95opVD3V 9BMusN91kNto3h71nPvEdEkZNUnh8WQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-584-CE0Vrs0cMj2fAWdPsDbA1w-1; Fri, 19 Feb 2021 15:43:58 -0500 X-MC-Unique: CE0Vrs0cMj2fAWdPsDbA1w-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7F98B84E243; Fri, 19 Feb 2021 20:43:57 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-87.ams2.redhat.com [10.36.113.87]) by smtp.corp.redhat.com (Postfix) with ESMTP id 338A110016F9; Fri, 19 Feb 2021 20:43:56 +0000 (UTC) Subject: Re: [PATCH v3 5/5] UefiCpuPkg/SmmCpuFeaturesLib: Add Standalone MM support To: mikuback@linux.microsoft.com, devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Rahul Kumar References: <20210217213227.1277-1-mikuback@linux.microsoft.com> <20210217213227.1277-6-mikuback@linux.microsoft.com> From: "Laszlo Ersek" Message-ID: <30f233ff-f3fe-15e1-2848-188de66af4c8@redhat.com> Date: Fri, 19 Feb 2021 21:43:55 +0100 MIME-Version: 1.0 In-Reply-To: <20210217213227.1277-6-mikuback@linux.microsoft.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lersek@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 02/17/21 22:32, mikuback@linux.microsoft.com wrote: > From: Michael Kubacki > > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3218 > > Adds an INF for StandaloneMmCpuFeaturesLib, which supports building > the SmmCpuFeaturesLib code for Standalone MM. Minimal code changes > are made to allow reuse of existing code for Standalone MM. > > The original INF file names are left intact (continue to use SMM > terminology) to retain backward compatibility with platforms that > use those INFs. Similarly, the pre-existing C file names are > unchanged to be consistent with the INF file names. > > Note that all references in library source files to PiSmm.h have > been changed to PiMm.h for consistency. > > Cc: Eric Dong > Cc: Ray Ni > Cc: Laszlo Ersek > Cc: Rahul Kumar > Signed-off-by: Michael Kubacki > --- > UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmmStmSupport.c | 2 +- > UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c | 2 +- > UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c | 2 +- > UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibNoStm.c | 2 +- > UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c | 2 +- > UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.c | 50 ++++++++++++++++++++ > UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmmStmSupport.c | 2 +- > UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.inf | 38 +++++++++++++++ > UefiCpuPkg/UefiCpuPkg.dsc | 1 + > 9 files changed, 95 insertions(+), 6 deletions(-) > > diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmmStmSupport.c b/UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmmStmSupport.c > index 399ddd742dd7..24bd6d0a946d 100644 > --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmmStmSupport.c > +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmmStmSupport.c > @@ -6,7 +6,7 @@ > > **/ > > -#include > +#include > #include > > #include "SmmStm.h" > diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c > index 00948a191fad..29e3b650acee 100644 > --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c > +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c > @@ -6,7 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > > **/ > > -#include > +#include > #include "CpuFeaturesLib.h" > > /** > diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c > index 50379f3aea19..fa3a866ab6f6 100644 > --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c > +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c > @@ -7,7 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > > **/ > > -#include > +#include > #include > #include > #include > diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibNoStm.c b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibNoStm.c > index c562582ccee0..823dbe906cb8 100644 > --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibNoStm.c > +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibNoStm.c > @@ -7,7 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > > **/ > > -#include > +#include > #include > #include "CpuFeaturesLib.h" > > diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c > index dcc2e9f9a09a..c92387625ddc 100644 > --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c > +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c > @@ -6,7 +6,7 @@ > > **/ > > -#include > +#include > #include > #include > #include > diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.c b/UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.c > new file mode 100644 > index 000000000000..dec6e53e5b55 > --- /dev/null > +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.c > @@ -0,0 +1,50 @@ > +/** @file > +Standalone MM CPU specific programming. > + > +Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
> +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 PcdCpuMaxLogicalProcessorNumber. > + > + 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 FixedPcdGet32 (PcdCpuMaxLogicalProcessorNumber); > +} > + > +/** > + The Standalone MM library constructor. > + > + @param[in] ImageHandle Image handle of this driver. > + @param[in] SystemTable A Pointer to the EFI System Table. > + > + @retval EFI_SUCCESS This constructor always returns success. > + > +**/ > +EFI_STATUS > +EFIAPI > +StandaloneMmCpuFeaturesLibConstructor ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_MM_SYSTEM_TABLE *SystemTable > + ) > +{ > + CpuFeaturesLibInitialization (); > + > + return EFI_SUCCESS; > +} > diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmmStmSupport.c b/UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmmStmSupport.c > index aacc1455a90c..c8a3f58e0ca5 100644 > --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmmStmSupport.c > +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmmStmSupport.c > @@ -6,7 +6,7 @@ > > **/ > > -#include > +#include > #include > > #include "SmmStm.h" > diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.inf b/UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.inf > new file mode 100644 > index 000000000000..ec97041d8b75 > --- /dev/null > +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.inf > @@ -0,0 +1,38 @@ > +## @file > +# Standalone MM CPU specific programming. > +# > +# Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
> +# Copyright (c) Microsoft Corporation.
> +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION = 0x00010005 > + BASE_NAME = StandaloneMmCpuFeaturesLib > + MODULE_UNI_FILE = SmmCpuFeaturesLib.uni > + FILE_GUID = BB554A2D-F5DF-41D3-8C62-46476A2B2B18 > + MODULE_TYPE = MM_STANDALONE > + VERSION_STRING = 1.0 > + PI_SPECIFICATION_VERSION = 0x00010032 > + LIBRARY_CLASS = SmmCpuFeaturesLib > + CONSTRUCTOR = StandaloneMmCpuFeaturesLibConstructor > + > +[Sources] > + CpuFeaturesLib.h > + StandaloneMmCpuFeaturesLib.c > + SmmCpuFeaturesLibCommon.c > + SmmCpuFeaturesLibNoStm.c > + > +[Packages] > + MdePkg/MdePkg.dec > + UefiCpuPkg/UefiCpuPkg.dec > + > +[LibraryClasses] > + BaseLib > + DebugLib > + MemoryAllocationLib > + PcdLib > + > +[FixedPcd] > + gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber ## SOMETIMES_CONSUMES > diff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc > index 9128cef076dd..7db419471deb 100644 > --- a/UefiCpuPkg/UefiCpuPkg.dsc > +++ b/UefiCpuPkg/UefiCpuPkg.dsc > @@ -154,6 +154,7 @@ [Components.IA32, Components.X64] > UefiCpuPkg/Library/SmmCpuPlatformHookLibNull/SmmCpuPlatformHookLibNull.inf > UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf > UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf > + UefiCpuPkg/Library/SmmCpuFeaturesLib/StandaloneMmCpuFeaturesLib.inf > UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.inf > UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationPei.inf > UefiCpuPkg/PiSmmCommunication/PiSmmCommunicationSmm.inf > Reviewed-by: Laszlo Ersek