From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
To: Simon Glass <sjg@chromium.org>, harsimransingh.tungal@arm.com
Cc: u-boot@lists.denx.de, abdellatif.elkhlifi@arm.com,
trini@konsulko.com, ilias.apalodimas@linaro.org,
xypron.glpk@gmx.de, hugues.kambampiana@arm.com
Subject: Re: [PATCH 02/12] arm-ffa: add FF-A bus runtime support
Date: Fri, 8 May 2026 11:18:21 +0100 [thread overview]
Message-ID: <af24bWF2NjwQlUer@e130802.arm.com> (raw)
In-Reply-To: <CAFLszTiBGiJHiw+mv3y=pr+csA3AQoQ_HOG5-R+ZrPXxbPJL4w@mail.gmail.com>
Hi Harsimran,
> On 2026-04-24T17:31:50, Harsimran Singh Tungal
> <harsimransingh.tungal@arm.com> wrote:
> > arm-ffa: add FF-A bus runtime support
> >
> > Enable FF-A runtime transport for EFI services
> >
> > This patch introduces the FF-A runtime infrastructure that enables
> > U-Boot to use the Arm Firmware Framework for Arm A-profile (FF-A)
> > transport layer after ExitBootServices().
> > The runtime transport provides persistent, runtime-safe
> > implementations of key FF-A functions used by EFI runtime services.
> >
> > Summary of key changes:
> > -----------------------
> > - Add drivers/firmware/arm-ffa/arm-ffa-runtime.c implementing FF-A
> > runtime operations.
> > - Introduce include/arm_ffa_runtime.h exporting FF-A runtime
> > functions and data structures.
> > - Move FF-A error mapping into runtime context.
> > - Introduce invoke_ffa_fn_runtime() as runtime safe SMC wrapper.
> > - Add runtime SMC wrapper for sandbox emulation.
> > - Add ARM_FFA_RT_MODE Kconfig to enable runtime support.
> > [...]
> >
> > drivers/firmware/arm-ffa/Kconfig | 11 ++
> > drivers/firmware/arm-ffa/Makefile | 4 +-
> > drivers/firmware/arm-ffa/arm-ffa-runtime.c | 287 +++++++++++++++++++++++++++++
> > drivers/firmware/arm-ffa/arm-ffa-uclass.c | 111 ++---------
> > drivers/firmware/arm-ffa/arm-ffa.c | 16 +-
> > drivers/firmware/arm-ffa/ffa-emul-uclass.c | 12 ++
> > include/arm_ffa.h | 16 +-
> > include/arm_ffa_priv.h | 24 ++-
> > include/arm_ffa_runtime.h | 183 ++++++++++++++++++
> > test/dm/ffa.c | 6 +-
> > 10 files changed, 551 insertions(+), 119 deletions(-)
>
> > diff --git a/drivers/firmware/arm-ffa/arm-ffa-runtime.c b/drivers/firmware/arm-ffa/arm-ffa-runtime.c
> > @@ -0,0 +1,287 @@
> > + if (priv)
> > + ffa_copy_runtime_priv(&priv->rt);
> > + else
> > + log_err("FF-A: Entering RT mode without FF-A runtime data information\n");
> > +
> > + ffa_enable_runtime_context();
>
> This enables the runtime context unconditionally, even after logging
> the priv data is missing. The runtime then comes up with id == 0 and
> fwk_version == 0 and any later FF-A call silently uses bogus values.
> Please return after the log_err() so ffa_get_status_runtime_context()
> keeps returning false on the failure path.
>
> > diff --git a/drivers/firmware/arm-ffa/arm-ffa-runtime.c b/drivers/firmware/arm-ffa/arm-ffa-runtime.c
> > @@ -0,0 +1,287 @@
> > +#include <arm_ffa_runtime.h>
> > +#include <arm_ffa_priv.h>
> > +#include <log.h>
> > +#include <asm/global_data.h>
> > +#include <linux/errno.h>
> > +#include <linux/types.h>
> > +
> > +DECLARE_GLOBAL_DATA_PTR;
>
> gd doesn't seem to be referenced in this file?
>
> > diff --git a/drivers/firmware/arm-ffa/arm-ffa-runtime.c b/drivers/firmware/arm-ffa/arm-ffa-runtime.c
> > @@ -0,0 +1,287 @@
> > + * after the FF-A bus device has successfully probed and U-Boot’s FF-A
>
> This (and the same line in arm_ffa_runtime.h) should use a normal '
> instead of the UTF-8 right single quotation mark.
>
> > diff --git a/drivers/firmware/arm-ffa/arm-ffa-runtime.c b/drivers/firmware/arm-ffa/arm-ffa-runtime.c
> > @@ -0,0 +1,287 @@
> > +#if CONFIG_IS_ENABLED(ARM_FFA_RT_MODE)
> > +static void EFIAPI ffa_rt_exit_boot_services_notify(struct efi_event *event,
> > + void *context)
>
> CONFIG_IS_ENABLED() is only meaningful for symbols with an SPL twin.
> ARM_FFA_RT_MODE has none, and the uclass side already uses
> IS_ENABLED(CONFIG_ARM_FFA_RT_MODE) - please use IS_ENABLED() here and
> in arm_ffa_runtime.h.
>
> > diff --git a/drivers/firmware/arm-ffa/arm-ffa-runtime.c b/drivers/firmware/arm-ffa/arm-ffa-runtime.c
> > @@ -0,0 +1,287 @@
> > + if (is_smc64) {
> > + req_mode = FFA_SMC_64(FFA_MSG_SEND_DIRECT_REQ);
> > + } else {
> > + req_mode = FFA_SMC_32(FFA_MSG_SEND_DIRECT_REQ);
> > + }
>
> Single-statement bodies should not be braced. Please run patman or
> checkpatch.pl on your patches. Also, the two efi_memset_runtime()
> calls below clear fresh stack variables. Please initialise them at
> declaration ('ffa_value_t ffa_args_rt = {}') and drop the explicit
> memset()s; the compiler's zero-init is just as runtime-safe and is
> what the boot path already does.
>
> Also could you run checkpatch / patman over your patches for v2?
>
> > diff --git a/drivers/firmware/arm-ffa/arm-ffa-uclass.c b/drivers/firmware/arm-ffa/arm-ffa-uclass.c
> > @@ -1047,6 +961,11 @@ static int ffa_do_probe(struct udevice *dev)
> > + if (IS_ENABLED(CONFIG_ARM_FFA_RT_MODE)) {
> > + ret = ffa_setup_efi_exit_boot_services_event(uc_priv);
> > + if (ret)
> > + return ret;
> > + }
>
> If event creation fails here, the RX/TX buffers mapped above and the
> partition cache are leaked, i,e. the existing failure path for
> ffa_cache_partitions_info() at least calls
> ffa_unmap_rxtx_buffers_hdlr(). Please follow the same pattern, or move
> event registration before resource allocation.
>
> > diff --git a/drivers/firmware/arm-ffa/Kconfig b/drivers/firmware/arm-ffa/Kconfig
> > @@ -41,3 +44,11 @@ config ARM_FFA_TRANSPORT
> > +config ARM_FFA_RT_MODE
> > + bool "Enable FF-A runtime support"
> > + depends on ARM_FFA_TRANSPORT && EFI_LOADER
> > + default y
>
> Just to check, does every existing FF-A user want this on? 'default y'
> silently enables a new transport path (and the ExitBootServices
> callback) for everyone with ARM_FFA_TRANSPORT && EFI_LOADER. I'd
> suggest defaulting, or at minimum 'default y if CORSTONE1000' or
> similar, until other boards have opted in.
>
> > diff --git a/include/arm_ffa_priv.h b/include/arm_ffa_priv.h
> > @@ -212,9 +227,8 @@ struct ffa_partitions {
> > - u32 fwk_version;
> > + struct ffa_priv_runtime rt;
> > struct udevice *emul;
> > - u16 id;
>
> Just to clarify the model: 'struct ffa_priv' now embeds 'struct
> ffa_priv_runtime rt' at boot, and at ExitBootServices we copy the
> whole sub-struct (including 'use_ffa_runtime', always false here) into
> the resident 'ffa_priv_rt', then immediately overwrite use_ffa_runtime
> via ffa_enable_runtime_context(). Layering would be clearer if
> 'use_ffa_runtime' lived only on the resident copy and ffa_priv_runtime
> carried just the data shipped across the boundary (fwk_version, id).
>
> Regards,
> Simon
Simon’s comments make sense to me. Please address them.
Aside from that, everything looks good in this commit.
Regards,
Abdellatif
next prev parent reply other threads:[~2026-05-08 10:18 UTC|newest]
Thread overview: 84+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-24 17:31 [PATCH 00/12] arm64: FF-A runtime transport for EFI variables Harsimran Singh Tungal
2026-04-24 17:31 ` [PATCH 01/12] efi_loader: add runtime memset helper Harsimran Singh Tungal
2026-04-27 7:54 ` Ilias Apalodimas
2026-04-28 18:08 ` Simon Glass
2026-05-04 20:03 ` Harsimran Singh Tungal
2026-04-24 17:31 ` [PATCH 02/12] arm-ffa: add FF-A bus runtime support Harsimran Singh Tungal
2026-04-28 18:10 ` Simon Glass
2026-05-04 20:25 ` Harsimran Singh Tungal
2026-05-08 10:18 ` Abdellatif El Khlifi [this message]
2026-04-24 17:31 ` [PATCH 03/12] efi_loader: add FF-A runtime support in EFI variable TEE driver Harsimran Singh Tungal
2026-04-27 16:21 ` Ilias Apalodimas
2026-05-04 20:40 ` Harsimran Singh Tungal
2026-05-08 10:23 ` Abdellatif El Khlifi
2026-04-28 18:12 ` Simon Glass
2026-05-05 8:55 ` Harsimran Singh Tungal
2026-04-24 17:31 ` [PATCH 04/12] efi_loader: enable EFI runtime SetVariable()/GetVariable() using FF-A transport Harsimran Singh Tungal
2026-04-28 18:16 ` Simon Glass
2026-05-05 14:30 ` Harsimran Singh Tungal
2026-05-07 15:31 ` Simon Glass
2026-04-24 17:31 ` [PATCH 05/12] efi_loader: move runtime GetVariable() helpers to efi_variable.c Harsimran Singh Tungal
2026-04-28 12:03 ` Ilias Apalodimas
2026-05-06 10:30 ` Harsimran Singh Tungal
2026-04-28 18:25 ` Simon Glass
2026-04-24 17:31 ` [PATCH 06/12] corstone1000: enable bootefi selftest Harsimran Singh Tungal
2026-04-27 7:56 ` Ilias Apalodimas
2026-04-28 18:01 ` Simon Glass
2026-05-06 12:20 ` Harsimran Singh Tungal
2026-05-07 15:32 ` Simon Glass
2026-04-24 17:31 ` [PATCH 07/12] efi: selftest: add runtime variable tests with non-volatile storage Harsimran Singh Tungal
2026-04-28 18:04 ` Simon Glass
2026-05-06 15:14 ` Harsimran Singh Tungal
2026-05-07 15:32 ` Simon Glass
2026-04-24 17:31 ` [PATCH 08/12] test: dm: add sandbox FF-A runtime transport tests Harsimran Singh Tungal
2026-04-28 18:05 ` Simon Glass
2026-05-14 14:58 ` Harsimran Singh Tungal
2026-04-24 17:31 ` [PATCH 09/12] sandbox: ffa: share synthetic partition metadata via macros Harsimran Singh Tungal
2026-04-28 18:07 ` Simon Glass
2026-05-14 15:00 ` Harsimran Singh Tungal
2026-05-15 18:28 ` Simon Glass
2026-04-24 17:31 ` [PATCH 10/12] doc: arm64: document FF-A runtime path for EFI variables Harsimran Singh Tungal
2026-04-28 18:08 ` Simon Glass
2026-05-14 15:05 ` Harsimran Singh Tungal
2026-05-08 10:40 ` Abdellatif El Khlifi
2026-04-24 17:31 ` [PATCH 11/12] doc: bootefi: note two-phase runtime variables selftest Harsimran Singh Tungal
2026-04-28 18:14 ` Simon Glass
2026-05-14 15:07 ` Harsimran Singh Tungal
2026-04-24 17:31 ` [PATCH 12/12] efi_loader: align FF-A cache maintenance with runtime path Harsimran Singh Tungal
2026-04-28 18:14 ` Simon Glass
2026-05-08 10:34 ` Abdellatif El Khlifi
2026-05-14 15:11 ` Harsimran Singh Tungal
2026-04-24 22:18 ` [PATCH 00/12] arm64: FF-A runtime transport for EFI variables Heinrich Schuchardt
2026-05-05 14:37 ` Harsimran Singh Tungal
2026-04-28 18:16 ` [00/12] " Simon Glass
2026-05-14 15:37 ` Harsimran Singh Tungal
2026-05-14 12:49 ` [PATCH v2 00/11] " Harsimran Singh Tungal
2026-05-14 12:49 ` [PATCH v2 01/11] efi_loader: add runtime memset helper Harsimran Singh Tungal
2026-05-15 18:14 ` Simon Glass
2026-05-14 12:49 ` [PATCH v2 02/11] arm-ffa: add FF-A bus runtime support Harsimran Singh Tungal
2026-05-15 18:25 ` Simon Glass
2026-05-26 9:16 ` Harsimran Singh Tungal
2026-05-14 12:49 ` [PATCH v2 03/11] efi_loader: add FF-A runtime support in EFI variable TEE driver Harsimran Singh Tungal
2026-05-15 18:35 ` Simon Glass
2026-06-05 10:46 ` Ilias Apalodimas
2026-05-14 12:49 ` [PATCH v2 04/11] efi_loader: enable EFI runtime SetVariable()/GetVariable() using FF-A transport Harsimran Singh Tungal
2026-05-15 18:26 ` Simon Glass
2026-05-26 14:25 ` Harsimran Singh Tungal
2026-05-14 12:49 ` [PATCH v2 05/11] charset: mark u16_strsize() as __efi_runtime Harsimran Singh Tungal
2026-05-15 18:21 ` Simon Glass
2026-05-14 12:49 ` [PATCH v2 06/11] efi_loader: move runtime variable read helpers to efi_variable.c Harsimran Singh Tungal
2026-05-15 18:21 ` Simon Glass
2026-06-05 11:04 ` Ilias Apalodimas
2026-05-14 12:49 ` [PATCH v2 07/11] corstone1000: enable bootefi selftest Harsimran Singh Tungal
2026-05-15 18:22 ` Simon Glass
2026-05-14 12:49 ` [PATCH v2 08/11] efi: selftest: add runtime variable tests with non-volatile storage Harsimran Singh Tungal
2026-05-15 18:35 ` Simon Glass
2026-05-14 12:49 ` [PATCH v2 09/11] test: dm: add sandbox FF-A runtime transport tests Harsimran Singh Tungal
2026-05-15 18:27 ` Simon Glass
2026-05-26 14:50 ` Harsimran Singh Tungal
2026-05-27 4:45 ` Simon Glass
2026-05-27 8:39 ` Harsimran Singh Tungal
2026-05-14 12:49 ` [PATCH v2 10/11] doc: arm64: document FF-A runtime path for EFI variables Harsimran Singh Tungal
2026-05-15 18:30 ` Simon Glass
2026-05-14 12:49 ` [PATCH v2 11/11] doc: bootefi: note two-phase runtime variables selftest Harsimran Singh Tungal
2026-05-15 18:30 ` Simon Glass
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-all 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=af24bWF2NjwQlUer@e130802.arm.com \
--to=abdellatif.elkhlifi@arm.com \
--cc=harsimransingh.tungal@arm.com \
--cc=hugues.kambampiana@arm.com \
--cc=ilias.apalodimas@linaro.org \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=xypron.glpk@gmx.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.