Hi all, This series adds FF-A runtime transport support so EFI variable runtime services can communicate with the secure world after ExitBootServices(). It also extends tests, documentation, and Corstone-1000 configuration to validate the runtime path and keep boot-time behavior aligned with the runtime flow.
Changes in this series: - Add EFI runtime-safe memset helper and FF-A runtime transport support. - Add runtime-safe FF-A direct-message handling and ExitBootServices setup. - Implement FF-A runtime communication in the EFI variable TEE backend. - Enable EFI runtime SetVariable(), GetVariable(), GetNextVariableName(), and QueryVariableInfo() over the FF-A transport. - Add sandbox FF-A runtime transport tests. - Extend EFI selftests for runtime variables and enable bootefi selftest on Corstone-1000. - Document the FF-A runtime transport and runtime-variable selftest flow. Testing: Tested on Corstone-1000 FVP with the Trusted Services SMM Gateway SP. The instructions to build and run the Corstone-1000 FVP are available at: https://corstone1000.docs.arm.com/en/corstone1000-2026.05/user-guide.html The SMM Gateway SP provides the MM variable service and exposes the MM Communicate endpoint over FF-A direct messages. The EFI runtime variable selftest was run in two phases. The setup phase creates a non-volatile runtime variable before reset. On the U-Boot prompt: corstone1000# setenv efi_selftest 'variables at runtime setup' corstone1000# bootefi selftest Then reset the Corstone-1000 FVP and run the verify phase. The verify phase checks that the variable is available after reset, then exercises the runtime get/set/append/delete paths. On the U-Boot prompt after reset: corstone1000# setenv efi_selftest 'variables at runtime verify' corstone1000# bootefi selftest Both phases completed with Summary: 0 failures. Additional testing: - Tested the OP-TEE/non-FF-A QEMU setup by booting Linux through U-Boot EFI and mounting efivarfs successfully. Changes in v6: Address Ilias Apalodimas's review comments: - Restore the pre-FF-A OP-TEE runtime callback setup when CONFIG_ARM_FFA_RT_MODE is disabled. - Keep the existing common cached-variable runtime callbacks for GetVariable() and GetNextVariableName() in the non-FF-A OP-TEE path. - Keep QueryVariableInfo() and SetVariable() unsupported at runtime in the non-FF-A OP-TEE path, matching the pre-FF-A behavior. - Rename FF-A-specific runtime variable handlers with the _ffa_runtime suffix. Link to v5: https://mail-archive.com/[email protected]/msg05824.html Link to v4: https://www.mail-archive.com/[email protected]/msg01127.html Link to v3: https://lore.kernel.org/u-boot/[email protected]/ Link to v2: https://lore.kernel.org/u-boot/[email protected]/ Link to v1: https://lore.kernel.org/u-boot/[email protected]/ Harsimran Singh Tungal (22): efi_loader: add runtime memset helper arm-ffa: store boot-discovered runtime data separately arm-ffa: add runtime-safe FF-A SMC wrapper arm-ffa: add runtime direct-message support arm-ffa: reuse direct-message helper at boot time arm-ffa: enable runtime context at ExitBootServices arm: cache: keep range maintenance available at EFI runtime efi_loader: add MM SP status mapping for FF-A variables efi_loader: make MM transport selection runtime-safe efi_loader: make FF-A MM SP notification runtime-safe efi_loader: make FF-A MM communication runtime-safe efi_loader: reserve FF-A shared buffer for runtime variables efi_loader: enable TEE runtime SetVariable() over FF-A efi_loader: enable TEE runtime GetVariable() over FF-A efi_loader: enable TEE runtime GetNextVariableName() over FF-A efi_loader: enable TEE runtime QueryVariableInfo() over FF-A charset: mark u16_strsize() as __efi_runtime corstone1000: enable bootefi selftest efi: selftest: add runtime variable tests with non-volatile storage test: dm: add sandbox FF-A runtime transport tests doc: arm64: document FF-A runtime path for EFI variables doc: bootefi: note two-phase runtime variables selftest arch/arm/cpu/armv8/cache.S | 8 + arch/arm/cpu/armv8/cache_v8.c | 20 +- arch/sandbox/include/asm/sandbox_arm_ffa.h | 16 +- configs/corstone1000_defconfig | 3 + doc/arch/arm64.ffa.rst | 88 +- doc/usage/cmd/armffa.rst | 11 + doc/usage/cmd/bootefi.rst | 31 + drivers/firmware/arm-ffa/Kconfig | 11 + drivers/firmware/arm-ffa/Makefile | 4 +- drivers/firmware/arm-ffa/arm-ffa-runtime.c | 294 +++++++ drivers/firmware/arm-ffa/arm-ffa-uclass.c | 114 +-- drivers/firmware/arm-ffa/arm-ffa.c | 16 +- drivers/firmware/arm-ffa/ffa-emul-uclass.c | 49 +- include/arm_ffa.h | 16 +- include/arm_ffa_priv.h | 22 +- include/arm_ffa_runtime.h | 191 +++++ include/efi_loader.h | 3 + lib/charset.c | 2 +- lib/efi_loader/Kconfig | 4 + lib/efi_loader/efi_runtime.c | 20 + lib/efi_loader/efi_variable_tee.c | 796 ++++++++++++++---- .../efi_selftest_variables_runtime.c | 715 +++++++++++----- test/dm/Makefile | 3 +- test/dm/ffa.c | 6 +- test/dm/ffa_runtime.c | 123 +++ 25 files changed, 2039 insertions(+), 527 deletions(-) create mode 100644 drivers/firmware/arm-ffa/arm-ffa-runtime.c create mode 100644 include/arm_ffa_runtime.h create mode 100644 test/dm/ffa_runtime.c -- 2.43.0
