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::d44; helo=mail-io1-xd44.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) (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 E900F211944C3 for ; Tue, 27 Nov 2018 00:38:37 -0800 (PST) Received: by mail-io1-xd44.google.com with SMTP id f6so16318541iob.1 for ; Tue, 27 Nov 2018 00:38:37 -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; bh=K16yYt8k7lyWMs/ZCcF2FaF09sOE6ZJhGASiVvTXxmU=; b=LsGRCPPI8r3qP6xip0DqPeSFepaQgmVRB3BxufRI6AvZVZsi49OGdm0PX3c/j32ajC hJ09DKhVBr45PFEGkdL4nllbH5p8JgHZrvRx0AtzE7UUTQDRqqFWv91ogKq3E1xTMA/v youcScfTbHWfImti/6OyvSpqBtWjks+kwd+7M= 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; bh=K16yYt8k7lyWMs/ZCcF2FaF09sOE6ZJhGASiVvTXxmU=; b=jyiXN++gC76ihtnl17EncIOT7CIGdbYv0aj3i1UowwLG86TIX2wVDCyaE6R9IcGdJ6 dYhpMaMJa+JPO5ZIKaS+VDBarro0qV5ShfGzxaqZsb9cUaWVhpODlhzqjFK/qJtIU2TK jbMErEfLGK1BosIlnqHhfYqRDbTT8PqbeOdkMRsENsjLTaif6uR10T3IhZ9l1a+X0foa HnoN8Ui1KnHi5XsFDn8i8lHC9ZXInIR/rFli6U9D4rXQQPcasX9/5P45VPUJ92SC4OMV RkJbzFzqCmxKKrZCH55m57DJ9Sn2Y28aEUqqf0qJlXD2FRLxHWQOg9ga0Qum1owBfTvw blVw== X-Gm-Message-State: AA+aEWbUFk0ZNfYdT01kz3Gb6OvV6sxBgYMSh2LVMuprnldfYJa74GBu 3DFNUJqtrfa00mW5Ot7IZEpJrWWQ2CDjKpVcl1WR76Of X-Google-Smtp-Source: AFSGD/UCIJuP6I71jvXKMsO4HXHDOJyCO4ow01gFKyF+FimDdZyilcbJHqzqY8+Ah20yroDaIVLaZ/gYfO9w4yn1fnw= X-Received: by 2002:a6b:5d01:: with SMTP id r1mr22986539iob.170.1543307916644; Tue, 27 Nov 2018 00:38:36 -0800 (PST) MIME-Version: 1.0 References: <1543299564-25266-1-git-send-email-sughosh.ganu@arm.com> <1543299564-25266-6-git-send-email-sughosh.ganu@arm.com> <20181127083603.GA27029@arm.com> In-Reply-To: <20181127083603.GA27029@arm.com> From: Ard Biesheuvel Date: Tue, 27 Nov 2018 09:38:24 +0100 Message-ID: To: Sughosh Ganu Cc: "edk2-devel@lists.01.org" , Leif Lindholm , Achin Gupta Subject: Re: [PATCH v4 5/5] ArmPkg/ArmMmuLib: Add MMU Library suitable for use in S-EL0. 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, 27 Nov 2018 08:38:38 -0000 X-List-Received-Date: Tue, 27 Nov 2018 08:38:38 -0000 X-List-Received-Date: Tue, 27 Nov 2018 08:38:38 -0000 X-List-Received-Date: Tue, 27 Nov 2018 08:38:38 -0000 X-List-Received-Date: Tue, 27 Nov 2018 08:38:38 -0000 X-List-Received-Date: Tue, 27 Nov 2018 08:38:38 -0000 X-List-Received-Date: Tue, 27 Nov 2018 08:38:38 -0000 X-List-Received-Date: Tue, 27 Nov 2018 08:38:38 -0000 X-List-Received-Date: Tue, 27 Nov 2018 08:38:38 -0000 X-List-Received-Date: Tue, 27 Nov 2018 08:38:38 -0000 X-List-Received-Date: Tue, 27 Nov 2018 08:38:38 -0000 X-List-Received-Date: Tue, 27 Nov 2018 08:38:38 -0000 X-List-Received-Date: Tue, 27 Nov 2018 08:38:38 -0000 Content-Type: text/plain; charset="UTF-8" On Tue, 27 Nov 2018 at 09:36, Sughosh Ganu wrote: > > hi Ard, > > On Tue Nov 27, 2018 at 09:14:52AM +0100, Ard Biesheuvel wrote: > > On Tue, 27 Nov 2018 at 07:20, Sughosh Ganu wrote: > > > > > > From: Achin Gupta > > > > > > The Standalone MM environment runs in S-EL0 in AArch64 on ARM Standard > > > Platforms. Privileged firmware e.g. ARM Trusted Firmware sets up its > > > architectural context including the initial translation tables for the > > > S-EL1/EL0 translation regime. The MM environment will still request ARM > > > TF to change the memory attributes of memory regions during > > > initialization. > > > > > > The Standalone MM image is a FV that encapsulates the MM foundation > > > and drivers. These are PE-COFF images with data and text segments. > > > To initialise the MM environment, Arm Trusted Firmware has to create > > > translation tables with sane default attributes for the memory > > > occupied by the FV. This library sends SVCs to ARM Trusted Firmware > > > to request memory permissions change for data and text segments. > > > > > > This patch adds a simple MMU library suitable for execution in S-EL0 and > > > requesting memory permissions change operations from Arm Trusted Firmware. > > > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > > Signed-off-by: Sughosh Ganu > > > --- > > > ArmPkg/ArmPkg.dec | 1 + > > > ArmVirtPkg/Library/XenArmGenericTimerVirtCounterLib/XenArmGenericTimerVirtCounterLib.inf => ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.inf | 23 +-- > > > ArmPkg/Include/Library/{ArmMmuLib.h => StandaloneMmMmuLib.h} | 38 +--- > > > ArmPkg/Library/StandaloneMmMmuLib/Aarch64/ArmMmuStandaloneMmLib.c | 185 ++++++++++++++++++++ > > > 4 files changed, 203 insertions(+), 44 deletions(-) > > > > > > > +#endif /* __STANDALONEMM_MMU_LIB__ */ > > > diff --git a/ArmPkg/Library/StandaloneMmMmuLib/Aarch64/ArmMmuStandaloneMmLib.c b/ArmPkg/Library/StandaloneMmMmuLib/Aarch64/ArmMmuStandaloneMmLib.c > > > new file mode 100644 > > > index 000000000000..d7d87b7d5d69 > > > --- /dev/null > > > +++ b/ArmPkg/Library/StandaloneMmMmuLib/Aarch64/ArmMmuStandaloneMmLib.c > > > @@ -0,0 +1,185 @@ > > > +/** @file > > > +* File managing the MMU for ARMv8 architecture in S-EL0 > > > +* > > > +* Copyright (c) 2017 - 2018, ARM Limited. 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 IMPLIED. > > > +* > > > +**/ > > > + > > > +#include > > > +#include > > > > Why do you need this include? If you can drop it, can you also make > > the library generic (i.e., supporting ARM as well as AArch64) ? > > > > (apologies for not spotting this before) > > I can remove the header file if it is superfluous. But regarding your > comment on making this code generic for Arm as well, i guess we > can work on refactoring the code when/if we actually require to > support this on Arm. I am not sure if we are going to have a use-case > for StandaloneMM on Arm. Currently, we are only supporting it on > Aarch64 based platforms. Is that fine. Please let me know. Thanks. > I'd strongly prefer this code to be generic if you are not using any AArch64 specific facilities. AFAICT, we'd simply need to move the file out of the AArch64 directory and rename [Sources.AARCH64] to [Sources] in the .inf file if the header dependency is indeed superfluous.