From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4864:20::144; helo=mail-it1-x144.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-it1-x144.google.com (mail-it1-x144.google.com [IPv6:2607:f8b0:4864:20::144]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C8D16211CD9AC for ; Mon, 4 Mar 2019 02:17:42 -0800 (PST) Received: by mail-it1-x144.google.com with SMTP id f186so4636179ita.0 for ; Mon, 04 Mar 2019 02:17:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=C4MN2Vi1IbIeOmA4eovT4dLZHBQJ4XstzhcNx5e4sro=; b=HwiRTycuMz9NqslrpEe9VWSaekJ9RuFEy9ala/kMfgEItb6wqAgzTSFaa/570LFY+1 Nq8JkzEHlgbk0oK6KziRTc1hELPVYgd3G0dkAQ8FvlG5r/oVney8hbrJUvbLlgaUu6ig /kJU9bFgE0hR/CRVabAja+UmxATRqtfH4KQcvRrY9H9xNVA6lkQtrkk9VMPqNZmPjt/d dvpExxKTJ2bHmVnA31dm1wJK5WrtifYCy8awJyLKOHBCVSMgLvuVwVMk9A/Ohe7Q35rR PvC7fCizAW4K1rkI1oJRIUqSfdN2YG+oBUQe6jGTxzxGBXTnCeilVyfVL2Pghw7R6Cdf CJ2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=C4MN2Vi1IbIeOmA4eovT4dLZHBQJ4XstzhcNx5e4sro=; b=g0ZlDhHfHL5ydy2ys7fkMaVBt/z4h2ggJ3UFjReZnRmjr71DcLBrKMYVRAkllgVMvC pW0AJOoiIkEzQ8tyS8p+Hyarw2ihc7Nn2EdNhu6OJckhgxVkNBtUYgJDN44AkNH8FrK9 U0noNOf36KVLP/SasPXLdKOyRAR7uiRGNe/Hk0vd9/z/hL3G8qcQYkUYJNdFdvU37mij oX1rdHVixLnnOTrXkhKreoomdMrJZ5n0GBeN9YkJByB4AgA1W/77uiTdZh+wiTR4G7qO oGC2jGQH2bPzxJi/Eo8Kfapx2XMRiRl9TyLIqvDx0Ti5VhcHTV2FG6DQluOd3dihF4dS jcbA== X-Gm-Message-State: APjAAAVxjiDqPTpMPWvvDRuVg83QFo978oyj6Cb83jcB8KiKSkDM7oh5 sZPGBqFgsE+zbZCKxLOQGBpUNXG+A2ah3cjgmFLjyA== X-Google-Smtp-Source: APXvYqy8xEE+BaPXZ+8CXQ09ncUvRxu1Q1A7aFLMrN2LmVKf+7YsAVUdfrjtU9q/GZX/PcS2dwayL+Nj+/dFLJxqrCo= X-Received: by 2002:a02:3342:: with SMTP id k2mr9230149jak.62.1551694661494; Mon, 04 Mar 2019 02:17:41 -0800 (PST) MIME-Version: 1.0 References: <1551689639-21446-1-git-send-email-jagadeesh.ujja@arm.com> In-Reply-To: <1551689639-21446-1-git-send-email-jagadeesh.ujja@arm.com> From: Ard Biesheuvel Date: Mon, 4 Mar 2019 11:17:30 +0100 Message-ID: To: Jagadeesh Ujja , Achin Gupta , "Yao, Jiewen" Cc: "edk2-devel@lists.01.org" , "Gao, Liming" , "Zhang, Chao B" , Leif Lindholm , "Zeng, Star" , "Kinney, Michael D" 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: Mon, 04 Mar 2019 10:17:43 -0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable (add StandaloneMmPkg maintainers) On Mon, 4 Mar 2019 at 09:54, Jagadeesh Ujja wrote: > > In a system implementing the variable store in MM, there are no variable > 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/VariableMmDepende= ncy.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 Variabl= e 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/VariableMmDepen= dency.c b/StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependency= .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 prot= ocol > +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 BS= D License > +which accompanies this distribution. The full text of the license may b= e 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 IMP= LIED. > + > +**/ > + > +#include > +#include > + > +/** > + The constructor function installs variable arch protocol and variable > + write arch protocol to StandaloneMM runtime variable service > + > + @param ImageHandle The firmware allocated handle for the EFI image. > + @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/VariableMmDepen= dency.inf b/StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependen= cy.inf > new file mode 100644 > index 0000000..e71c44d > --- /dev/null > +++ b/StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependency.i= nf > @@ -0,0 +1,46 @@ > +## @file > +# Runtime DXE part corresponding to StanaloneMM variable module. > +# > +# This module installs variable arch protocol and variable write arch p= rotocol > +# 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. > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x0001001A > + BASE_NAME =3D VariableMmDependency > + FILE_GUID =3D 64BC4129-778E-4867-BA07-13999A4DEC3= F > + MODULE_TYPE =3D DXE_DRIVER > + LIBRARY_CLASS =3D NULL > + CONSTRUCTOR =3D VariableMmDependencyLibConstructor > + > +# > +# The following information is for reference only and not required by th= e build tools. > +# > +# VALID_ARCHITECTURES =3D AARCH64 > +# > +# > + > +[Sources] > + VariableMmDependency.c > + > +[Packages] > + MdePkg/MdePkg.dec > + MdeModulePkg/MdeModulePkg.dec > + > +[Protocols] > + gEfiSmmVariableProtocolGuid ## PRODUCES > + > +[Guids] > + gSmmVariableWriteGuid ## PRODUCES ## GUID # I= nstall protocol > + > +[Depex] > + TRUE > -- > 2.7.4 >