public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ilias Apalodimas" <ilias.apalodimas@linaro.org>
To: Sami Mujawar <Sami.Mujawar@arm.com>
Cc: Sughosh Ganu <sughosh.ganu@linaro.org>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>,
	Ard Biesheuvel <Ard.Biesheuvel@arm.com>,
	Leif Lindholm <leif@nuviainc.com>,
	Sahil Malhotra <sahil.malhotra@linaro.org>, nd <nd@arm.com>
Subject: Re: [PATCH edk2-platforms v3 1/2] Drivers/OpTeeRpmb: Add an OP-TEE backed RPMB driver
Date: Tue, 2 Feb 2021 16:49:51 +0200	[thread overview]
Message-ID: <YBlmj35vZjq29i8K@apalos.home> (raw)
In-Reply-To: <YBlGgKD4SY7kWgAu@apalos.home>

Hi Sami, 

Inlining some additional info on my explanation.

> > >
[...]
> > > I actually picked up the error handling from the previous non-FFA code.
> > > I'll check what's on Sughosh latest patches and fix it if there are
> > > any differences.
> > > Looking at it again EFI_BAD_BUFFER_SIZE can change to indicate out of
> > > memory properly anyway.
> > >
> > 
> > Had another look at this. This seems fine if I just change
> > EFI_BAD_BUFFER_SIZE -> EFI OUT_OF_RESOURCES because OP-TEE is only
> > using these errors from FFA. Eventually the OP-TEE code that launches
> > StMM today, will move to FFA and become a separate SP, so that will
> > naturally be handled once that's done. I don't see a point of adding
> > unused error cases.
> > 
> > [SAMI] Referring to the FFA specification, DEN0077A, v1.0, section 10.2 FFA_MSG_SEND_DIRECT_REQ and Table 10.8: FFA_ERROR encoding, I think the 
> > error codes being handled above would be returned in SvcArgs.Arg2. 
> 
> Hmm why ?
> 
> > The message flow would be as follows:
> >     - Caller sends FFA_MSG_SEND_DIRECT_REQ to the target endpoint.
> >     - if the message does not reach the target endpoint, an error code from Table 10.8 may be returned in w2 (i.e. SvcArgs.Arg2)
> 
> That would be in the case you have a working TF-A implementation and the
> message is never dispatched to the endpoint right?
> 
> The current driver is not implementing the whole range of that spec. The
> communication between secure/non secure world is still based on the OP-TEE
> messaging mechanism. 
> The only part that complies to the FFA spec is the communication between the
> driver itself and OP-TEE.
> >     - If the message reaches the target endpoint, then callee shall invoke one of the following interfaces:
> > 	* FFA_MSG_SEND_DIRECT_RESP
> 
> So what's happening here, is that we send an SVC with ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ_AARCH64.
> The op-tee relevant code is located at ./core/arch/arm/kernel/stmm_sp.c
> There's 2 things we handle right now on OP-TEE:
> 1. set the page permissions, after relocating the executable.
> 2. Read/Write data on our RPMB.
> 
> In both cases service_compose_direct_resp() is used to construct the response
> and that set the return value on x3.

What you mention and looking for is the discovery mechanism that FFA
implements. This is not part of the patches (yet) and that's the reason the
driver hardcodes mMemMgrId = 3U and mStorageId = 4U. 
In OP-TEE side the only reason we have to fill in x2 with the error code is if
the request that comes in doesn't match any of these values. But that's never
the case from this driver yet, since there's no SP discovery mechanism
implemented to begin with.

Hope that clears it up now.

Regards
/Ilias
> 
> 
> Regards
> /Ilias
> 
> > 	* FFA_INTERRUPT
> > 	* FFA_SUCCESS
> >     This would mean that if the callee responds with FFA_MSG_SEND_DIRECT_RESP, the callee returned error/status code shall be in w/x3-w/x7 (which I think in this case may be in SvcArgs.Arg3).
> > [/SAMI]
> > 
> > Regards
> > /Ilias

  reply	other threads:[~2021-02-02 14:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-16 11:09 [PATCH edk2-platforms v3 0/2] Add support for running StandaloneMm as OP-TEE TA Sughosh Ganu
2020-12-16 11:09 ` [PATCH edk2-platforms v3 1/2] Drivers/OpTeeRpmb: Add an OP-TEE backed RPMB driver Sughosh Ganu
2021-01-27 17:10   ` Sami Mujawar
2021-01-29  8:02     ` Ilias Apalodimas
2021-01-29 11:45       ` Sami Mujawar
2021-02-01 14:00       ` Ilias Apalodimas
2021-02-02 10:40         ` Sami Mujawar
2021-02-02 12:33           ` Ilias Apalodimas
2021-02-02 14:49             ` Ilias Apalodimas [this message]
2021-02-02 15:13               ` Sami Mujawar
2021-02-02 16:27                 ` Ilias Apalodimas
2020-12-16 11:09 ` [PATCH edk2-platforms v3 2/2] StMMRpmb: Add support for building StandaloneMm image for OP-TEE Sughosh Ganu
2021-01-29 10:29   ` Sami Mujawar
2021-01-29 11:47     ` 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=YBlmj35vZjq29i8K@apalos.home \
    --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