[PATCH v6 00/10] introduce Arm FF-A support

Abdellatif El Khlifi abdellatif.elkhlifi at arm.com
Thu Oct 13 12:38:47 CEST 2022


Adding support for Arm FF-A v1.0 (Arm Firmware Framework for Armv8-A) [6].

FF-A describes interfaces (ABIs) that standardize communication
between the Secure World and Normal World. These interfaces enable a pair of
software sandboxes to communicate with each other. A sandbox aka partition could
be a VM in the Normal or Secure world, an application in S-EL0, or a
Trusted OS in S-EL1.

The FF-A transport is implemented as a data bus and a core driver is provided.

The FF-A driver uses the SMC ABIs defined by the FF-A specification to:

- Discover the presence of secure partitions (SPs) of interest
- Access an SP's service through communication protocols
  e.g. EFI MM communication protocol

The FF-A support provides the following features:

- Being generic by design and can be used by any Arm 64-bit platform
- The FF-A core driver
- The FF-A bus is discoverable on demand at runtime
- The driver provides callbacks to be used by clients to access the FF-A bus
- FF-A driver can be compiled and used without EFI
- Support for SMCCCv1.2 x0-x17 registers
- A new command called armffa is provided as an example of how to access the
  FF-A bus
- An FF-A Sandbox driver is provided with test cases
- Support for FF-A MM communication
- Enabling FF-A and MM communication in Corstone1000 platform

For more details about the FF-A core driver please refer to [7].

Please find at [8] an example of the expected boot logs when enabling
FF-A support for a platform. In this example the platform is
Corstone1000. But it can be any Arm 64-bit platform.

Changelog of the major changes:
===========================

v6:

* remove clearing x0-x17 registers after SMC calls
* drop use of EFI runtime support for FF-A (We decided with Linaro to add this later)
* drop discovery from initcalls (discovery will be on demand by FF-A users)
* add FF-A runtime discovery at MM communication level
* update the documentation and move it to doc/arch/arm64.ffa.rst

v5: [5]

* move changelogs in each commit to the changes section

v4: [4]

* add FF-A support README (doc/README.ffa.drv)
* improving error handling by mapping the FF-A errors to standard errors
  and logs
* replacing panics with an error log
* align sandbox driver and tests with the new FF-A driver interfaces
 and new way of error handling
* use the new FF-A driver interfaces for MM communication
* discover MM partitions at runtime
* copy FF-A driver private data to EFI runtime section at
  ExitBootServices()
* moving the FF-A driver work to drivers/firmware/arm-ffa
* improving features discovery in FFA_FEATURES
* add remove/unbind functions to the FF-A core device
* improve how the driver behaves when bus discovery is done more than
  once
* move clearing x0-x17 registers code into a new macro like done in
   the linux kernel
* enable EFI MM communication for the Corstone1000 platform

v3: [3]

* port x0-x17 registers support from linux kernel as defined by
   SMCCCv1.2
* align the interfaces of the u-boot FF-A driver with those in the linux
   FF-A driver
* remove the FF-A helper layer
* make the u-boot FF-A driver independent from EFI
* provide an optional config that enables copying the driver data to
   EFI runtime section at ExitBootServices service
* use 64-bit version of FFA_RXTX_MAP, FFA_MSG_SEND_DIRECT_{REQ, RESP}
* update armffa command with the new driver interfaces

v2  [2]:

* make FF-A bus discoverable using device_{bind, probe} APIs
* remove device tree support

v1  [1]:

* introduce FF-A bus driver with device tree support
* introduce armffa command
* introduce FF-A Sandbox driver
* add FF-A Sandbox test cases
* introduce FF-A MM communication

Cheers,
Abdellatif

[1]: https://lore.kernel.org/all/20220329151659.16894-1-abdellatif.elkhlifi@arm.com/
[2]: https://lore.kernel.org/all/20220415122803.16666-1-abdellatif.elkhlifi@arm.com/
[3]: https://lore.kernel.org/all/20220801172053.20163-1-abdellatif.elkhlifi@arm.com/
[4]: https://lore.kernel.org/all/20220926101723.9965-1-abdellatif.elkhlifi@arm.com/
[5]: https://lore.kernel.org/all/20220926140827.15125-1-abdellatif.elkhlifi@arm.com/
[6]: https://developer.arm.com/documentation/den0077/latest/
[7]: doc/arch/arm64.ffa.rst
[8]: example of boot logs when enabling FF-A

```
U-Boot 2022.07 (Jul 11 2022 - 13:42:58 +0000) corstone1000 aarch64
...
Hit any key to stop autoboot:  0 
...
[FFA] Conduit is SMC                                                                                                                                                                                                                         
[FFA] FF-A driver 1.0
FF-A framework 1.0
[FFA] Versions are compatible 
[FFA] endpoint ID is 0
[FFA] Using 1 4KB page(s) for RX/TX buffers size
[FFA] RX buffer at virtual address 0xfdf1b000
[FFA] TX buffer at virtual address 0xfdf1d000
[FFA] RX/TX buffers mapped
[FFA] Reading partitions data from the RX buffer
[FFA] Partition ID 8001 : info cached
[FFA] Partition ID 8002 : info cached
[FFA] Partition ID 8003 : info cached
[FFA] 3 partition(s) found and cached
[FFA] Preparing for checking partitions count
[FFA] Searching partitions using the provided UUID
[FFA] No partition found. Querying framework ...
[FFA] Reading partitions data from the RX buffer
[FFA] Number of partition(s) found matching the UUID: 1
EFI: Pre-allocating 1 partition(s) info structures
[FFA] Preparing for filling partitions info
[FFA] Searching partitions using the provided UUID
[FFA] Partition ID 8003 matches the provided UUID
EFI: MM partition ID 0x8003
...
EFI stub: Booting Linux Kernel...
...
EFI stub: Exiting boot services...
[FFA] Freeing RX/TX buffers
Booting Linux on physical CPU 0x0000000000 [0x411fd040]
```

Cc: Tom Rini <trini at konsulko.com>
Cc: Simon Glass <sjg at chromium.org>
Cc: Ilias Apalodimas <ilias.apalodimas at linaro.org>
Cc: Jens Wiklander <jens.wiklander at linaro.org>
Cc: Achin Gupta <achin.gupta at arm.com>
Cc: Drew Reed <Drew.Reed at arm.com>
Cc: Vishnu Banavath <vishnu.banavath at arm.com>
Cc: Xueliang Zhong <Xueliang.Zhong at arm.com>

Abdellatif El Khlifi (10):
  arm64: smccc: add support for SMCCCv1.2 x0-x17 registers
  lib: uuid: introduce be_uuid_str_to_le_bin function
  arm_ffa: introduce Arm FF-A low-level driver
  arm_ffa: efi: unmap RX/TX buffers
  arm_ffa: introduce armffa command
  arm_ffa: introduce the FF-A Sandbox driver
  arm_ffa: introduce Sandbox test cases for UCLASS_FFA
  arm_ffa: introduce armffa command Sandbox test
  arm_ffa: efi: introduce FF-A MM communication
  arm_ffa: efi: corstone1000: enable MM communication

 MAINTAINERS                                   |   11 +
 arch/arm/cpu/armv8/smccc-call.S               |   53 +
 arch/arm/lib/asm-offsets.c                    |   14 +
 cmd/Kconfig                                   |   10 +
 cmd/Makefile                                  |    2 +
 cmd/armffa.c                                  |  242 +++
 configs/corstone1000_defconfig                |    4 +
 configs/sandbox64_defconfig                   |    2 +
 configs/sandbox_defconfig                     |    2 +
 doc/arch/arm64.ffa.rst                        |  207 +++
 doc/arch/index.rst                            |    1 +
 doc/arch/sandbox.rst                          |    1 +
 drivers/Kconfig                               |    2 +
 drivers/Makefile                              |    1 +
 drivers/firmware/arm-ffa/Kconfig              |   36 +
 drivers/firmware/arm-ffa/Makefile             |    7 +
 drivers/firmware/arm-ffa/arm-ffa-uclass.c     |   16 +
 drivers/firmware/arm-ffa/arm_ffa_prv.h        |  201 +++
 drivers/firmware/arm-ffa/core.c               | 1351 +++++++++++++++++
 drivers/firmware/arm-ffa/sandbox.c            |  659 ++++++++
 .../firmware/arm-ffa/sandbox_arm_ffa_prv.h    |  144 ++
 include/arm_ffa.h                             |   93 ++
 include/configs/corstone1000.h                |    9 +
 include/dm/uclass-id.h                        |    4 +
 include/linux/arm-smccc.h                     |   43 +
 include/mm_communication.h                    |    5 +
 include/sandbox_arm_ffa.h                     |   91 ++
 include/uuid.h                                |    8 +
 lib/efi_loader/Kconfig                        |   14 +-
 lib/efi_loader/efi_boottime.c                 |   15 +
 lib/efi_loader/efi_variable_tee.c             |  264 +++-
 lib/uuid.c                                    |   64 +
 test/cmd/Makefile                             |    2 +
 test/cmd/armffa.c                             |   40 +
 test/dm/Makefile                              |    2 +
 test/dm/ffa.c                                 |  394 +++++
 36 files changed, 4008 insertions(+), 6 deletions(-)
 create mode 100644 cmd/armffa.c
 create mode 100644 doc/arch/arm64.ffa.rst
 create mode 100644 drivers/firmware/arm-ffa/Kconfig
 create mode 100644 drivers/firmware/arm-ffa/Makefile
 create mode 100644 drivers/firmware/arm-ffa/arm-ffa-uclass.c
 create mode 100644 drivers/firmware/arm-ffa/arm_ffa_prv.h
 create mode 100644 drivers/firmware/arm-ffa/core.c
 create mode 100644 drivers/firmware/arm-ffa/sandbox.c
 create mode 100644 drivers/firmware/arm-ffa/sandbox_arm_ffa_prv.h
 create mode 100644 include/arm_ffa.h
 create mode 100644 include/sandbox_arm_ffa.h
 create mode 100644 test/cmd/armffa.c
 create mode 100644 test/dm/ffa.c

-- 
2.17.1



More information about the U-Boot mailing list