public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "PierreGondois" <pierre.gondois@arm.com>
To: devel@edk2.groups.io,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Sami.Mujawar@arm.com
Cc: ardb+tianocore@kernel.org, sughosh.ganu@linaro.org, leif@nuviainc.com
Subject: Re: [PATCH 1/3 v6] Drivers/OpTeeRpmb: Add an OP-TEE backed RPMB driver
Date: Wed, 10 Mar 2021 09:58:19 +0000	[thread overview]
Message-ID: <c9bb190f-edbe-59f3-262e-facb4016f7ba@arm.com> (raw)
In-Reply-To: <20210309140123.2992772-2-ilias.apalodimas@linaro.org>

Hi Ilias,
Just minor coding style nit picking:

  * Drivers/OpTee/OpteeRpmbPkg/FixupPcd.c:FixPcdMemory() I think the
    error codes are missing in the function header
  * Thanks for adding the IN/OUT function parameter descriptors. Is it
    possible to also add them in the function headers [1] ?

About the FFA/SVC call:

 >> If this is an FFA call, is it possible to:
 >>  - put a reference in the header to the spec (it should be similar 
to the
 >> one at
 >> edk2/ArmPkg/Library/StandaloneMmMmuLib/AArch64/ArmMmuStandaloneMmLib.c)
 >>  - check the return status of the SVC call against the ones available at
 >> edk2/ArmPkg/Include/IndustryStandard/ArmFfaSvc.h
 >>  - if possible, remove the dependency to <IndustryStandard/ArmMmSvc.h>
 >
 > The call is technically an FFA one but at the moment OP-TEE returns 
the StMM
 > return code which is defined in the last header you mention.
 > The relevant code is in ./core/arch/arm/kernel/stmm_sp.c function
 > tee2stmm_ret_val().
 > So unless we redefine that in OP-TEE or (better imho), wait for a 
full FFA
 > mechanism to be in place, I'd prefer leaving it as is.
 > Keep in mind that adding the full FFA will also get rid of the 
hardcoded IDs
 > on the beginning of the file.

The description of a FFA_MSG_SEND_DIRECT_REQ (s10.2 of [2]) doesn't seem 
to return the same error codes as the ones optee returns (in 
optee_os/core/arch/arm/kernel/stmm_sp.c:tee2stmm_ret_val()). I am not 
sure a new FFA specification will change these error codes.
Another thing is that I think the mMemMgrId variable described in 
edk2-platforms/Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.c is currently 
defined as 
edk2/ArmPkg/Include/IndustryStandard/ArmFfaSvc.h:ARM_FFA_DESTINATION_ENDPOINT_ID 
(the name seems to be misleading).
I think it would be better to:

  * align the optee error codes with what is in the FFA spec
  * handle these error codes in edk2 with what is in
    edk2/ArmPkg/Include/IndustryStandard/ArmFfaSvc.h and remove the
    dependendy to edk2/ArmPkg/Include/IndustryStandard/ArmMmSvc.h if
    possible
  * rename
    edk2/ArmPkg/Include/IndustryStandard/ArmFfaSvc.h:ARM_FFA_DESTINATION_ENDPOINT_ID
    define to a proper name, according to what is in
    optee_os/core/arch/arm/kernel/stmm_sp.c, and add one define for
    'mem_mgr_id'
  * remove the mMemMgrId and mStorageId variables from
    edk2-platforms/Drivers/OpTee/OpteeRpmbPkg/OpTeeRpmbFvb.c and use the
    newly created defines from
    edk2/ArmPkg/Include/IndustryStandard/ArmFfaSvc.h

This would allow to be aligned with the current FFA spec and when a new 
one comes, these endpoints IDs (mMemMgrId/mStorageId) can just be 
removed from one location (as you said).
In the end it seems you and Sami will maintain this, so I will let you 
decide what is best.

[1] 
https://edk2-docs.gitbook.io/edk-ii-c-coding-standards-specification/6_documenting_software/610_special_commands#6-10-4-param-in-out-parameter-description
[2] https://developer.arm.com/documentation/den0077/a

Regards,
Pierre

  reply	other threads:[~2021-03-10  9:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-09 14:01 [PATCH 0/3 v6] Add support for running StandaloneMm as OP-TEE TA Ilias Apalodimas
2021-03-09 14:01 ` [PATCH 1/3 v6] Drivers/OpTeeRpmb: Add an OP-TEE backed RPMB driver Ilias Apalodimas
2021-03-10  9:58   ` PierreGondois [this message]
2021-03-10 12:45     ` Ilias Apalodimas
     [not found]     ` <166AFBDD38991A80.19014@groups.io>
2021-03-11 16:37       ` [edk2-devel] " Ilias Apalodimas
2021-03-11 18:25         ` Achin Gupta
2021-03-12 15:49           ` PierreGondois
2021-03-09 14:01 ` [PATCH 2/3 v6] StMMRpmb: Add support for building StandaloneMm image for OP-TEE Ilias Apalodimas
2021-03-09 14:01 ` [PATCH 3/3 v6] Maintainers: Add maintainers for StandAloneMM and RPMD driver Ilias Apalodimas
     [not found] ` <166AB16C6FF3E4E8.3460@groups.io>
2021-03-09 15:19   ` [edk2-devel] " Ilias Apalodimas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c9bb190f-edbe-59f3-262e-facb4016f7ba@arm.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox