From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by ml01.01.org (Postfix) with ESMTP id 2A7FB20945C0B for ; Fri, 22 Sep 2017 15:09:09 -0700 (PDT) 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 75B531529; Fri, 22 Sep 2017 15:12:17 -0700 (PDT) Received: from [10.0.2.15] (unknown [10.119.48.177]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E00573F483; Fri, 22 Sep 2017 15:12:16 -0700 (PDT) Message-ID: <1506118336.2623.5.camel@arm.com> From: Supreeth Venkatesh To: Achin Gupta Cc: edk2-devel@lists.01.org, leif.lindholm@linaro.org, ard.biesheuvel@linaro.org, nd@arm.com Date: Fri, 22 Sep 2017 17:12:16 -0500 In-Reply-To: <20170922214522.GM26498@e104320-lin> References: <20170922192539.33085-1-supreeth.venkatesh@arm.com> <20170922214522.GM26498@e104320-lin> X-Mailer: Evolution 3.18.5.2-0ubuntu3.2 Mime-Version: 1.0 Subject: Re: [PATCH 1/1] ArmPkg/Include: Add standard SMC and SVC function IDs for MM interface. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Sep 2017 22:09:09 -0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit On Fri, 2017-09-22 at 22:45 +0100, Achin Gupta wrote: > Hi Supreeth, > > On Fri, Sep 22, 2017 at 08:25:39PM +0100, Supreeth Venkatesh wrote: > > > > This patch adds a list of function IDs that fall under the standard > > SMC range as defined in > > http://infocenter.arm.com/help/topic/com.arm.doc.den0060a/DEN0060A_ > > ARM_MM_Interface_Specification.pdf. > > > > SMCs associated with Management Mode are in the range 0xC4000040 - > > 0xC400005f (64 bit) and 0x84000040 - 0x8400005f (32 bit). > > > > The function(s) available to the normal world: > > 1. Request services from the secure MM environment using > > MM_COMMUNICATE. > > > > SVCs are in the range 0xC4000060 - 0xC400007f. > > The functions available to the secure MM partition: > > 1. Signal completion of MM event handling. > > 2. Set/Get memory attributes for a memory region at runtime. > > 3. Get version number of secure partition manager. > > > > Also, it defines memory attributes and MM return codes. > The SVCs in the 0xC4000060 - 0xC400007f range are not a part of the > MM interface > specification. At the moment, these are used to implement an > interface between > ARM TF in EL3 and S-EL0. These should go into a separate patch that > introduces > them as an ARM TF ABI. > > cheers, > Achin Thanks for taking a look at it. This was added in ArmStdSmc.h deliberately to request comments/feedback. I don't think SVC defines belong in this file at all. It should have its own header file. Since it is specific to MM (S-EL0) - EL3 communication, I am tempted to create a new header file  named "ArmMmSvc.h" and put in ArmPkg/Include/IndustryStandard folder. Comments - Maintainers/Anyone?  > > > > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Achin Gupta > > Signed-off-by: Supreeth Venkatesh > > --- > >  ArmPkg/Include/IndustryStandard/ArmStdSmc.h | 46 > > ++++++++++++++++++++++++++++- > >  1 file changed, 45 insertions(+), 1 deletion(-) > > > > diff --git a/ArmPkg/Include/IndustryStandard/ArmStdSmc.h > > b/ArmPkg/Include/IndustryStandard/ArmStdSmc.h > > index 593a3ce729..a625bc2048 100644 > > --- a/ArmPkg/Include/IndustryStandard/ArmStdSmc.h > > +++ b/ArmPkg/Include/IndustryStandard/ArmStdSmc.h > > @@ -1,6 +1,6 @@ > >  /** @file > >  * > > -*  Copyright (c) 2012-2014, ARM Limited. All rights reserved. > > +*  Copyright (c) 2012-2017, 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 > > @@ -40,6 +40,50 @@ > >  #define ARM_SMC_STD_REVISION_MAJOR    0x0 > >  #define ARM_SMC_STD_REVISION_MINOR    0x1 > > > > + > > +/* > > + * Management Mode (MM) calls cover a subset of the Standard > > Service Call range. > > + * The list below is not exhaustive. > > + */ > > +#define ARM_SMC_ID_MM_VERSION_AARCH32              0x84000040 > > +#define ARM_SMC_ID_MM_VERSION_AARCH64              0xC4000040 > > + > > +// Request service from secure standalone MM environment > > +#define ARM_SMC_ID_MM_COMMUNICATE_AARCH32          0x84000041 > > +#define ARM_SMC_ID_MM_COMMUNICATE_AARCH64          0xC4000041 > > + > > +/* > > + * SVC IDs to allow the MM secure partition to initialise itself, > > handle > > + * delegated events and request the Secure partition manager to > > perform > > + * privileged operations on its behalf. > > + */ > > +#define ARM_SVC_ID_SPM_VERSION_AARCH64             0xC4000060 > > +#define ARM_SVC_ID_SP_EVENT_COMPLETE_AARCH64       0xC4000061 > > +#define ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES_AARCH64   0xC4000064 > > +#define ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES_AARCH64   0xC4000065 > > + > > +#define SET_MEM_ATTR_DATA_PERM_MASK       0x3 > > +#define SET_MEM_ATTR_DATA_PERM_SHIFT        0 > > +#define SET_MEM_ATTR_DATA_PERM_NO_ACCESS    0 > > +#define SET_MEM_ATTR_DATA_PERM_RW           1 > > +#define SET_MEM_ATTR_DATA_PERM_RO           3 > > + > > +#define SET_MEM_ATTR_CODE_PERM_MASK   0x1 > > +#define SET_MEM_ATTR_CODE_PERM_SHIFT    2 > > +#define SET_MEM_ATTR_CODE_PERM_X        0 > > +#define SET_MEM_ATTR_CODE_PERM_XN       1 > > + > > +#define SET_MEM_ATTR_MAKE_PERM_REQUEST(d_perm, > > c_perm)                            \ > > +    ((((c_perm) & SET_MEM_ATTR_CODE_PERM_MASK) << > > SET_MEM_ATTR_CODE_PERM_SHIFT) | \ > > +    (( (d_perm) & SET_MEM_ATTR_DATA_PERM_MASK) << > > SET_MEM_ATTR_DATA_PERM_SHIFT)) > > + > > +/* MM return error codes */ > > +#define ARM_SMC_MM_RET_SUCCESS              0 > > +#define ARM_SMC_MM_RET_NOT_SUPPORTED       -1 > > +#define ARM_SMC_MM_RET_INVALID_PARAMS      -2 > > +#define ARM_SMC_MM_RET_DENIED              -3 > > +#define ARM_SMC_MM_RET_NO_MEMORY           -4 > > + > >  /* > >   * Power State Coordination Interface (PSCI) calls cover a subset > > of the > >   * Standard Service Call range. > > -- > > 2.14.1 > >