This patch series adds Firmware Update (FWU) support for Arm PSA
Certified platforms [1], enabling U-Boot to serve as
the FWU Client, with the Secure World acting as the Update Agent that
manages the firmware store and its metadata.

This implementation adheres to the Platform Security Firmware Update
specification [3] for the A-profile Arm Architecture and leverages the
Trusted Services framework [4] to interact with the Secure World update
agent. By delegating update management to the Secure World, U-Boot
handles only the client-side coordination, invoking a well-defined set
of ABIs over the FF-A interface [5] to deliver update capsules.

Key features include:

- Generic, platform-agnostic design.
- FF-A-based ABI: All interactions between U-Boot and the update agent
    occur over the FF-A interface, ensuring compatibility across
    PSA-compliant systems.
- Multi-payload capsules: Support for capsules containing multiple
    payloads, start/end markers, signed firmware images.
- ESRT support: Capsule payloads may be signed for authenticity, and
    U-Boot can populate the EFI System Resource Table (ESRT) for
     OS-level firmware management.
- On-disk and standard capsule handling.

For implementation details, please refer to the documentation [6].
Testing logs for standard and on-disk capsule update flows on
Corstone-1000 FVP are included below.

Changes in v6:

* As suggested by Sughosh:
  - Addressed review feedback by separating Arm PSA FWU from the existing
    normal-world FWU multi-bank implementation.
  - Moved PSA FWU code and Kconfig/Makefile integration from lib/fwu_updates to
    lib/efi_loader.
  - Dropped v5 changes to lib/fwu_updates/{Kconfig,Makefile,fwu.c}. PSA FWU no
    longer extends the generic FWU update path.
  - Made CONFIG_FWU_ARM_PSA mutually exclusive with 
CONFIG_FWU_MULTI_BANK_UPDATE.
  - Reworked PSA FWU trial-state and image-acceptance handling to use the cached
    PSA FWU directory from Secure world instead of generic FWU metadata.
  - Reworked Corstone-1000 active-index handling to read and validate FWU
    metadata directly for kernel setup.
* Rebased on master.

Regards,
Harsimran Singh Tungal

[1]: PSA: https://www.psacertified.org
[2]: Corstone-1000: https://developer.arm.com/Processors/Corstone-1000
[3]: DEN0118 v1.0 A specification: 
https://developer.arm.com/documentation/den0118/latest 
[4]: Trusted Services documentation: 
https://trusted-services.readthedocs.io/en/stable
[5]: FF-A interface: doc/arch/arm64.ffa.rst
[6]: Documentation of the FWU for Arm PSA support: 
doc/develop/uefi/fwu_arm_psa.rst
[7]: Arm PSA FWU logs when used for on-disk capsule update in Corstone-1000

Testing:
The implementation has been tested on Corstone-1000 FVP with both
standard capsule update and on-disk capsule update flows.

Tested on Corstone-1000 FVP:
  - Standard capsule update: passed
  - On-disk capsule update: passed
  - ESRT entries verified from Linux after update

Testing logs for standard capsule update:

A trimmed standard capsule update log is included below.

```
CapsuleApp: capsule block/size              0xDCF56040/0x867B5A
FWU: Updating 4 payload(s)
resetting ...
NOTICE:  BL2: v2.14.2(debug):lts-v2.14.2-dirty
...
U-Boot 2026.07 (Sep 08 2026 - 15:59:00 +0000) corstone1000 aarch64 
...
FWU: System booting in Trial State
...
Poky (Yocto Project Reference Distro) 5.2 corstone1000-fvp /dev/ttyAMA0
...
root@corstone1000-fvp:~# reboot
...
U-Boot 2026.07 (Sep 08 2026 - 15:59:00 +0000) corstone1000 aarch64 
...
FWU: System booting in Regular State
...
Poky (Yocto Project Reference Distro) 5.2 corstone1000-fvp /dev/ttyAMA0

corstone1000-fvp login:

root@corstone1000-fvp:~# cat /sys/firmware/efi/esrt/entries/entry*/*
0x0
f1d883f9-dfeb-5363-98d8-686ee3b69f4f
1
6
0
6
0
0x0
7fad470e-5ec5-5c03-a2c1-4756b495de61
1
6
0
6
0
0x0
f1933675-5a8c-5b6d-9ef4-846739e89bc8
1
6
0
6
0
0x0
f771aff9-c7e9-5f99-9eda-2369dd694f61
1
6
0
6
0

root@corstone1000-fvp:~# 
```
 
Testing logs for On-Disk capsule update:

A trimmed on-disk capsule update log is included below for one payload

```
CapsuleApp: capsule block/size              0xDCF61040/0x867B5A
Found EFI system partition on Boot0001: OnDiskFWU
FS2:;HD0b:;BLK4: 
Succeed to write corstone1000-fvp-v6.uefi.capsule
resetting ...
NOTICE:  BL2: v2.14.2(debug):lts-v2.14.2-dirty
...
U-Boot 2026.07 (Sep 08 2026 - 15:59:00 +0000) corstone1000 aarch64 
...
FWU: System booting in Regular State
FWU: ABI version 1.0 detected
FWU: Updating 1 payload(s)
Applying capsule corstone1000-fvp-v6.uefi.capsule succeeded.
Reboot after firmware update.
NOTICE:  BL2: v2.14.2(debug):lts-v2.14.2-dirty
...
U-Boot 2026.07 (Sep 08 2026 - 15:59:00 +0000) corstone1000 aarch64 
...
FWU: System booting in Trial State
...
Poky (Yocto Project Reference Distro) 5.2 corstone1000-fvp /dev/ttyAMA0
...
root@corstone1000-fvp:~# reboot
...
U-Boot 2026.07 (Sep 08 2026 - 15:59:00 +0000) corstone1000 aarch64 
...
FWU: System booting in Regular State
...
Poky (Yocto Project Reference Distro) 5.2 corstone1000-fvp /dev/ttyAMA0

corstone1000-fvp login:

root@corstone1000-fvp:~# cat /sys/firmware/efi/esrt/entries/entry*/*
0x0
f1d883f9-dfeb-5363-98d8-686ee3b69f4f
0
6
0
6
0
0x0
7fad470e-5ec5-5c03-a2c1-4756b495de61
0
0
0
0
0
0x0
f1933675-5a8c-5b6d-9ef4-846739e89bc8
0
0
0
0
0
0x0
f771aff9-c7e9-5f99-9eda-2369dd694f61
0
0
0
0
0
root@corstone1000-fvp:~# 
```
Link to v5: 
https://lore.kernel.org/all/[email protected]/

Cc: Tom Rini <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: Abdellatif El Khlifi <[email protected]>
Cc: Heinrich Schuchardt <[email protected]>
Cc: Ilias Apalodimas <[email protected]>
Cc: Jens Wiklander <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Casey Connolly <[email protected]>
Cc: Adriano Cordova <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Davidson kumaresan <[email protected]>
Cc: Adam Johnston <[email protected]>
Cc: Srinivas Kalaga <[email protected]>
Cc: Alex Chapman <[email protected]>
Cc: David Hu <[email protected]>

Abdellatif El Khlifi (23):
  arm_ffa: Add FFA_MEM_SHARE support
  arm_ffa: Add FFA_MEM_RECLAIM support
  arm_ffa: sandbox: Replace the emulator error log with debug log
  arm_ffa: sandbox: Improve the readability of clearing the X registers
  arm_ffa: sandbox: Add FFA_MEM_SHARE emulation
  arm_ffa: sandbox: Add FFA_MEM_SHARE tests
  arm_ffa: sandbox: Add FFA_MEM_RECLAIM emulation
  arm_ffa: sandbox: Add FFA_MEM_RECLAIM tests
  fwu_arm_psa: Initialize the update agent
  fwu_arm_psa: Read the FWU directory through get_image_info()
  fwu_arm_psa: Add staging ABIs
  efi_loader: fwu_arm_psa: Add set_image() support
  efi_loader: fwu_arm_psa: Allow keeping the FMP payload header
  efi_loader: fwu_arm_psa: Skip accepting payload after set_image()
  efi_loader: fwu_arm_psa: Disable trial state handling
  fwu_arm_psa: Add FWU acceptance mechanism
  fwu_arm_psa: Add ESRT support
  fwu_arm_psa: Add ExitBootServices() notification handler
  fwu_arm_psa: corstone1000: Enable FWU support
  fwu_arm_psa: corstone1000: Read active index for kernel setup
  fwu_arm_psa: corstone1000: Notify SE Proxy SP on ExitBootServices()
  fwu_arm_psa: corstone1000: Set Boot0001 for on-disk FWU
  fwu_arm_psa: Document FWU support for Arm PSA

Emekcan Aras (1):
  efi_loader: capsule: Add runtime capsule flags checks

 MAINTAINERS                                   |    9 +
 .../include/asm/sandbox_arm_ffa_priv.h        |   21 +-
 board/armltd/corstone1000/corstone1000.c      |  406 ++++-
 board/armltd/corstone1000/corstone1000.env    |    8 +
 configs/corstone1000_defconfig                |   15 +-
 doc/arch/arm64.ffa.rst                        |    4 +
 doc/develop/uefi/fwu_arm_psa.rst              |  154 ++
 doc/develop/uefi/index.rst                    |    1 +
 drivers/firmware/arm-ffa/arm-ffa-uclass.c     |  285 ++-
 drivers/firmware/arm-ffa/arm-ffa.c            |    4 +-
 drivers/firmware/arm-ffa/ffa-emul-uclass.c    |  108 +-
 drivers/firmware/arm-ffa/sandbox_ffa.c        |    4 +-
 include/arm_ffa.h                             |  128 +-
 include/arm_ffa_priv.h                        |  153 +-
 include/efi_api.h                             |    3 +
 include/efi_loader.h                          |    3 +
 include/fwu_arm_psa.h                         |  422 +++++
 lib/efi_loader/Kconfig                        |   53 +
 lib/efi_loader/Makefile                       |    1 +
 lib/efi_loader/efi_capsule.c                  |   45 +-
 lib/efi_loader/efi_firmware.c                 |   32 +-
 lib/efi_loader/fwu_arm_psa.c                  | 1616 +++++++++++++++++
 test/dm/ffa.c                                 |   73 +-
 23 files changed, 3458 insertions(+), 90 deletions(-)
 create mode 100644 doc/develop/uefi/fwu_arm_psa.rst
 create mode 100644 include/fwu_arm_psa.h
 create mode 100644 lib/efi_loader/fwu_arm_psa.c

-- 
2.43.0

Reply via email to