Re: [PATCH v10 10/10] arm_ffa: efi: corstone1000: enable MM communication

Abdellatif El Khlifi
2023-04-03T10:34:12Z

On Mon, Apr 03, 2023 at 12:59:06PM +0300, Ilias Apalodimas wrote:
> On Sun, Apr 02, 2023 at 02:41:17PM +1200, Simon Glass wrote:
> > Hi Abdellatif,
> >
> > On Wed, 29 Mar 2023 at 05:12, Abdellatif El Khlifi <
> > abdellatif.elkhlifi@arm.com> wrote:
> > >
> > > turn on EFI MM communication
> > >
> > > On corstone1000 platform MM communication between u-boot
> > > and the secure world (Optee) is done using the FF-A bus.
> > >
> > > Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
> > > Cc: Tom Rini <trini@konsulko.com>
> > > Cc: Simon Glass <sjg@chromium.org>
> > > Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> > > Cc: Jens Wiklander <jens.wiklander@linaro.org>
> > >
> > > ---
> > > Changelog:
> > > ===============
> > >
> > > v9: update copyright string
> > >
> > > v8:
> > >
> > > * drop OP-TEE configs from Corstone-1000 defconfig
> > >
> > > v7:
> > >
> > > * improve the definition of FFA_SHARED_MM_BUFFER_ADDR and
> > > FFA_SHARED_MM_BUFFER_OFFSET
> > > * update FFA_SHARED_MM_BUFFER_ADDR value
> > >
> > > v6:
> > >
> > > * corstone-1000: enable optee driver
> > > * corstone-1000: remove CONFIG_ARM_FFA_EFI_RUNTIME_MODE from the defconfig
> > >
> > > v4:
> > >
> > > * corstone-1000: turn on EFI MM communication
> > >
> > > configs/corstone1000_defconfig | 2 ++
> > > include/configs/corstone1000.h | 15 +++++++++++++--
> > > 2 files changed, 15 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/configs/corstone1000_defconfig
> > b/configs/corstone1000_defconfig
> > > index 74250c7524..a7bfcbb2b9 100644
> > > --- a/configs/corstone1000_defconfig
> > > +++ b/configs/corstone1000_defconfig
> > > @@ -52,3 +52,5 @@ CONFIG_DM_SERIAL=y
> > > CONFIG_USB=y
> > > CONFIG_USB_ISP1760=y
> > > CONFIG_ERRNO_STR=y
> > > +CONFIG_EFI_MM_COMM_TEE=y
> > > +CONFIG_ARM_FFA_TRANSPORT=y
> > > diff --git a/include/configs/corstone1000.h
> > b/include/configs/corstone1000.h
> > > index 3347c11792..4ef1f05e40 100644
> > > --- a/include/configs/corstone1000.h
> > > +++ b/include/configs/corstone1000.h
> > > @@ -1,9 +1,11 @@
> > > /* SPDX-License-Identifier: GPL-2.0+ */
> > > /*
> > > - * (C) Copyright 2022 ARM Limited
> > > * (C) Copyright 2022 Linaro
> > > * Rui Miguel Silva <rui.silva@linaro.org>
> > > - * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
> > > + * Copyright 2022-2023 Arm Limited and/or its affiliates <
> > open-source-office@arm.com>
> > > + *
> > > + * Authors:
> > > + * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
> > > *
> > > * Configuration for Corstone1000. Parts were derived from other ARM
> > > * configurations.
> > > @@ -14,6 +16,15 @@
> > >
> > > #include <linux/sizes.h>
> > >
> > > +#define FFA_SHARED_MM_BUFFER_SIZE SZ_4K /* 4 KB */
> > > +
> > > +/*
> > > + * shared buffer physical address used for communication between
> > > + * u-boot and the MM SP
> > > + */
> > > +#define FFA_SHARED_MM_BUFFER_ADDR 0x02000000UL
> > > +#define FFA_SHARED_MM_BUFFER_OFFSET 0
> > > +
> > > #define V2M_BASE 0x80000000
> > >
> > > #define CFG_PL011_CLOCK 50000000
> > > --
> > > 2.25.1
> > >
> >
> > As a higher-level question, could this whole FFA implementation code be put
> > into Linux or fwupd?
>
> Hi Simon, FF-A is basically a communication mechanism between the secure
> and non-secure world for Arm. Linux has support for it. fwupd should be
> completely agnostic to the protocol

Hi Simon,

I'd like to add to Ilias's explanation the following helpful resources:

- The patchset cover letter for a high level overview of what FF-A is about [1].
- A closer look at the FF-A implementation in U-Boot the readme [2].

Cheers

[1]: https://lore.kernel.org/all/20230328161157.219375-1-abdellatif.elkhlifi@arm.com/
[2]: doc/arch/arm64.ffa.rst

>
> Regards
> /Ilias
> >
> > Regards,
> > Simon