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 (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by ml01.01.org (Postfix) with ESMTP id 39D8B211D3917 for ; Tue, 5 Mar 2019 06:09:27 -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 1614A165C for ; Tue, 5 Mar 2019 06:09:27 -0800 (PST) Received: from mail-it1-f169.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 EEEFC3F706 for ; Tue, 5 Mar 2019 06:09:26 -0800 (PST) Received: by mail-it1-f169.google.com with SMTP id m137so4265284ita.0 for ; Tue, 05 Mar 2019 06:09:26 -0800 (PST) X-Gm-Message-State: APjAAAXOFYEGSRe593Btl/5SK7xpK8cXgqMH8iqKYE3uR0lL3QOMYHdq Db+azmkbi49+MmfwkVZOkJN4m3OyyC0PRpJW5QQ= X-Google-Smtp-Source: APXvYqy3Xdvievebx1qbZhUn2mrH247mGxDK+JvppcYpABJxSNgfJWGjadP0PVEsUp2dG/kMPMmDdnrjKyKkKDAe6AE= X-Received: by 2002:a24:d51:: with SMTP id 78mr2339494itx.133.1551794966080; Tue, 05 Mar 2019 06:09:26 -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 19:39:13 +0530 X-Gmail-Original-Message-ID: Message-ID: To: Ard Biesheuvel Cc: Achin Gupta , "Yao, Jiewen" , "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:09:28 -0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable hi Jiewen, Achin On Mon, Mar 4, 2019 at 4:16 PM Ard Biesheuvel w= rote: > > (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 wrot= e: > > > > In a system implementing the variable store in MM, there are no variabl= e > > 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 into > > 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/VariableMmDepen= dency.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 Varia= ble Arch Protocol=E2=80=9D. > > [https://lists.01.org/pipermail/edk2-devel/2019-February/036885.html= ] > > - Addressed the comments from Ard Biesheuvel and Zeng Star > > - Can this library be placed in MdePkg rather then the StandaloneMmPkg? > > > > StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependency.c = | 54 ++++++++++++++++++++ > > StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependency.inf = | 46 +++++++++++++++++ > > 2 files changed, 100 insertions(+) > > > > diff --git a/StandaloneMmPkg/Library/VariableMmDependency/VariableMmDep= endency.c b/StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependen= cy.c > > new file mode 100644 > > index 0000000..7e0f31b > > --- /dev/null > > +++ b/StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependency= .c > > @@ -0,0 +1,54 @@ > > +/** @file > > + Runtime DXE part corresponding to StanaloneMM variable module. > > + > > +This module installs variable arch protocol and variable write arch pr= otocol > > +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" BASIS, > > +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR I= MPLIED. > > + > > +**/ > > + > > +#include > > +#include > > + > > +/** > > + The constructor function installs variable arch protocol and variabl= e > > + write arch protocol to StandaloneMM runtime variable service > > + > > + @param ImageHandle The firmware allocated handle for the EFI imag= e. > > + @param SystemTable A pointer to the Management mode System Table. > > + > > + @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/VariableMmDep= endency.inf b/StandaloneMmPkg/Library/VariableMmDependency/VariableMmDepend= ency.inf > > new file mode 100644 > > index 0000000..e71c44d > > --- /dev/null > > +++ b/StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependency= .inf > > @@ -0,0 +1,46 @@ > > +## @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 ma= y 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. > > +# > > +## > > + > > +[Defines] > > + INF_VERSION =3D 0x0001001A > > + BASE_NAME =3D VariableMmDependency > > + FILE_GUID =3D 64BC4129-778E-4867-BA07-13999A4DE= C3F > > + MODULE_TYPE =3D DXE_DRIVER > > + LIBRARY_CLASS =3D NULL > > + CONSTRUCTOR =3D VariableMmDependencyLibConstructo= r > > + > > +# > > +# The following information is for reference only and not required by = 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