From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=217.140.101.70; helo=foss.arm.com; envelope-from=jagadeesh.ujja@arm.com; receiver=edk2-devel@lists.01.org Received: from foss.arm.com (foss.arm.com [217.140.101.70]) by ml01.01.org (Postfix) with ESMTP id BA4C3211CF36A for ; Tue, 5 Mar 2019 06:50:41 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 123DE1596 for ; Tue, 5 Mar 2019 06:50:41 -0800 (PST) Received: from mail-it1-f180.google.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EE1793F7BB for ; Tue, 5 Mar 2019 06:50:40 -0800 (PST) Received: by mail-it1-f180.google.com with SMTP id v83so4868430itf.1 for ; Tue, 05 Mar 2019 06:50:40 -0800 (PST) X-Gm-Message-State: APjAAAUMgEEZPklao6Ud6mrQEGFzfEL9xsvHM1ii+kZFLp+LwHAhwW3H fEuJkZitGtZav8vyZTImzSN/E4+zhI4NBIuVRfo= X-Google-Smtp-Source: APXvYqxh6hOxI+CkBJwj7ShixlfFEgZaQfsMEjGFxfC8cB+NcLQbH93mqCwOFdloE1lhT4CH3J3a1rSqJVedXiH8kkA= X-Received: by 2002:a24:68cb:: with SMTP id v194mr2339087itb.145.1551797440229; Tue, 05 Mar 2019 06:50:40 -0800 (PST) MIME-Version: 1.0 References: <1551689639-21446-1-git-send-email-jagadeesh.ujja@arm.com> In-Reply-To: From: Jagadeesh Ujja Date: Tue, 5 Mar 2019 20:20:29 +0530 X-Gmail-Original-Message-ID: Message-ID: To: Ard Biesheuvel , Achin Gupta , "Yao, Jiewen" Cc: "Gao, Liming" , "edk2-devel@lists.01.org" , "Zhang, Chao B" , "Kinney, Michael D" , "Zeng, Star" Subject: Re: [PATCH v3] StandaloneMmPkg/Library: Install Variable Arch Protocol X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Mar 2019 14:50:41 -0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Mar 5, 2019 at 7:39 PM Jagadeesh Ujja wrot= e: > Adding Achin, Jiewen > hi Jiewen, Achin > > On Mon, Mar 4, 2019 at 4:16 PM Ard Biesheuvel = wrote: > > > > (add StandaloneMmPkg maintainers) > > > Please let me know if you have any comments on this patch > > > On Mon, 4 Mar 2019 at 09:54, Jagadeesh Ujja wr= ote: > > > > > > In a system implementing the variable store in MM, there are no varia= ble > > > arch protocol and variable write arch protocol installed into the > > > DXE_SMM protocol database. On such systems, it is not required to > > > locate these protocols by the DXE runtime variable drivers because > > > it can be assumed that these protocols are already installed in the > > > MM context. But then such an implementation will deviate from the > > > existing traditional MM based variable driver implementation. > > > > > > So in order to maintain consistency with the traditional MM variable > > > driver implementation, allow platforms to install these protocols int= o > > > the DXE protocol database but these protocol will not be consumed > > > by non-secure variable service runtime driver. > > > > > > The Platform which uses StandaloneMM based secure variable storage > > > have to include this library > > > > > > Example > > > In edk2-platforms/Platform/ARM/SgiPkg/SgiPlatform.dsc > > > > > > ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf { > > > > > > NULL|StandaloneMmPkg/Library/VariableMmDependency/VariableMmDep= endency.inf > > > } > > > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > > Signed-off-by: Jagadeesh Ujja > > > > Reviewed-by: Ard Biesheuvel > > > > > --- > > > Changes since v2: > > > - Addressed the comments from Ard Biesheuvel and Zeng Star > > > > > > Changes since v1: > > > - This is a next version of patch > > > =E2=80=9CMdeModulePkg/VariableSmmRuntimeDxe: Refactor locating Var= iable Arch Protocol=E2=80=9D. > > > [https://lists.01.org/pipermail/edk2-devel/2019-February/036885.ht= ml] > > > - Addressed the comments from Ard Biesheuvel and Zeng Star > > > - Can this library be placed in MdePkg rather then the StandaloneMmPk= g? > > > > > > StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependency.c = | 54 ++++++++++++++++++++ > > > StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependency.in= f | 46 +++++++++++++++++ > > > 2 files changed, 100 insertions(+) > > > > > > diff --git a/StandaloneMmPkg/Library/VariableMmDependency/VariableMmD= ependency.c b/StandaloneMmPkg/Library/VariableMmDependency/VariableMmDepend= ency.c > > > new file mode 100644 > > > index 0000000..7e0f31b > > > --- /dev/null > > > +++ b/StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependen= cy.c > > > @@ -0,0 +1,54 @@ > > > +/** @file > > > + Runtime DXE part corresponding to StanaloneMM variable module. > > > + > > > +This module installs variable arch protocol and variable write arch = protocol > > > +to StandaloneMM runtime variable service. > > > + > > > +Copyright (c) 2019, ARM Ltd. All rights reserved. > > > + > > > +This program and the accompanying materials > > > +are licensed and made available under the terms and conditions of th= e BSD License > > > +which accompanies this distribution. The full text of the license m= ay be found at > > > +http://opensource.org/licenses/bsd-license.php. > > > + > > > +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS= , > > > +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR= IMPLIED. > > > + > > > +**/ > > > + > > > +#include > > > +#include > > > + > > > +/** > > > + The constructor function installs variable arch protocol and varia= ble > > > + write arch protocol to StandaloneMM runtime variable service > > > + > > > + @param ImageHandle The firmware allocated handle for the EFI im= age. > > > + @param SystemTable A pointer to the Management mode System Tabl= e. > > > + > > > + @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. > > > + > > > +**/ > > > +EFI_STATUS > > > +EFIAPI > > > +VariableMmDependencyLibConstructor ( > > > + IN EFI_HANDLE ImageHandle, > > > + IN EFI_SYSTEM_TABLE *SystemTable > > > + ) > > > +{ > > > + EFI_STATUS Status; > > > + EFI_HANDLE Handle; > > > + > > > + Handle =3D NULL; > > > + Status =3D gBS->InstallMultipleProtocolInterfaces ( > > > + &Handle, > > > + &gEfiSmmVariableProtocolGuid, > > > + NULL, > > > + &gSmmVariableWriteGuid, > > > + NULL, > > > + NULL > > > + ); > > > + ASSERT_EFI_ERROR (Status); > > > + return EFI_SUCCESS; > > > +} > > > + > > > diff --git a/StandaloneMmPkg/Library/VariableMmDependency/VariableMmD= ependency.inf b/StandaloneMmPkg/Library/VariableMmDependency/VariableMmDepe= ndency.inf > > > new file mode 100644 > > > index 0000000..e71c44d > > > --- /dev/null > > > +++ b/StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependen= cy.inf > > > @@ -0,0 +1,46 @@ > > > +## @file > > > +# Runtime DXE part corresponding to StanaloneMM variable module. > > > +# > > > +# This module installs variable arch protocol and variable write ar= ch protocol > > > +# to StandaloneMM runtime variable service. > > > +# > > > +# Copyright (c) 2019, ARM Ltd. All rights reserved. > > > +# This program and the accompanying materials > > > +# are licensed and made available under the terms and conditions of = the BSD License > > > +# which accompanies this distribution. The full text of the license = may be found at > > > +# http://opensource.org/licenses/bsd-license.php > > > +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BAS= IS, > > > +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS = OR IMPLIED. > > > +# > > > +## > > > + > > > +[Defines] > > > + INF_VERSION =3D 0x0001001A > > > + BASE_NAME =3D VariableMmDependency > > > + FILE_GUID =3D 64BC4129-778E-4867-BA07-13999A4= DEC3F > > > + MODULE_TYPE =3D DXE_DRIVER > > > + LIBRARY_CLASS =3D NULL > > > + CONSTRUCTOR =3D VariableMmDependencyLibConstruc= tor > > > + > > > +# > > > +# The following information is for reference only and not required b= y the build tools. > > > +# > > > +# VALID_ARCHITECTURES =3D AARCH64 > > > +# > > > +# > > > + > > > +[Sources] > > > + VariableMmDependency.c > > > + > > > +[Packages] > > > + MdePkg/MdePkg.dec > > > + MdeModulePkg/MdeModulePkg.dec > > > + > > > +[Protocols] > > > + gEfiSmmVariableProtocolGuid ## PRODUCES > > > + > > > +[Guids] > > > + gSmmVariableWriteGuid ## PRODUCES ## GUID= # Install protocol > > > + > > > +[Depex] > > > + TRUE > > > -- > > > 2.7.4 > > > > > _______________________________________________ > > edk2-devel mailing list > > edk2-devel@lists.01.org > > https://lists.01.org/mailman/listinfo/edk2-devel