Skip to content

Conversation

@LeviYeoReum
Copy link
Contributor

@LeviYeoReum LeviYeoReum commented Sep 16, 2025

Introduction

The Firmware Update Feature is based on
[Platform Security Firmware Update for the A-profile Specification 1.0][1] specification.
To update firmware, Firmware Update Feature uses FmpDevicePkg framework
for the firmware to be updated via capsule update framework.

Updates firmware with Capsule update framework in Arm with following steps:

  • Deliver firmware image via UpdateCapsule().
  • firmware image delivered to StandaloneMm via MmCommunication or FF-A.
  • StandaloneMm which is UpdateAgent write new image in firmware update storage
    according to PSA specification.
  • To apply updated firmware, Reset.

This is slight different from other architecture which using
coalescing update firmware with following steps:

  • Deliver the firmware image via UpdateCapsule().
  • Save the firmware image in the variable storage.
  • Warm Reset, and In PEI phase coalesce the firmware image scattered in physical memory.
  • Before EndofDxe, update the firmware by calling ProcessCapsules()
  • To apply the updated firmware, Reset.
    for preventing arbitrary access to firmware storage device locked after EndofDxe phase.

It's the reason Arm doesn't supports coalescing way because
- According to platform UEFI doesn't run in ROM but
it loaded to memory by TF-A
- According to platform, it can skip PEICORE (See EDK2_SKIP_PEICORE)
- Arm doesn't need to lock the firmware storage device because
it's completely isolated in StandaloneMm (at S-EL0).
Therefore, operating system, uefi or any other software components running in
normal world cannot access isolated firmware storage.

By doing so, it can remove WarmReset for unlocking device and support runtime
firmware update in the future.

This implementation is written for platforms where firmware storage's layout
(typical platform is Base FVP platform):

   +----------------------+
    |      GPT-HEADER      |
    +----------------------+
    |    FIP_A (bank0)     |
    +----------------------+
    |    FIP_B (bank1)     |
    +----------------------+
    |    FWU-Metadata      |
    +----------------------+
    |  Bkup-FWU-Metadata   |
    +----------------------+

and uses FwsGptSystemFipLib used to access above firmware storage.

Overview

Here is an overview of Firmware Update Feature.

       UEFI (Normal world)            |          StandaloneMm (Secure world)
     ---------------------------------|--------------------------------------
                                      |                             +-------+
                                      |                    ---------|  Fws  |
                                      |                    |        +-------+
     +------------------+             |                    |       (Gpt parted)
     |   FmpDevicePkg   |             |  Read /Write Image |
     +------------------+             |                    |
       |                              |          +-------------------+
       |  SetTheImage() and etc       |          |  FwsPlatformLib   |
       |  progress via PsaFwuLib      |          +-------------------+
       |                              |                    |
       |                              |    Parsing Request | Access Fws via
       |                              |                    |    FwStore.c
       |                                                   |
       -> +----------------+     PSA ABI (MMC)   +-------------------+
          |   PsaFwuLib    |<------------------> |     FwuStMm       |
          +----------------+    PSA Error code   +-------------------+

When UEFI calls UpdateCapsule(), FmpDevicePkg->SetTheImage() is called.
Through FmpDeviceLib, FmpDevicePkg requests a firmware update to StandaloneMm
according to Firmware Store Update ABI defined in [PSA][1] spec via PsaFwuLib.
Then FwuStMm StandaloneMm driver parses requests from PsaFwuLib and access to firmware
storage via FwsPlatformLib which is platform specific library.

See together:
- tianocore/edk2-platforms#873

Patch Sequence

Patch #1 adds partition helper macro for FF-A
Patch #2 - #4 adds MmiContext used for arm platform
Patch #5 - #6 adds firmware update feature related header and GUID.
Patch #7 adds FmpDeviceLib used with firmware update ABI.

References

[1] https://developer.arm.com/documentation/den0118/latest/

@leiflindholm
Copy link
Member

The documentation link does not point to what it claims to, it points to the FVP marketing overview page.

@leiflindholm
Copy link
Member

The documentation link does not point to what it claims to, it points to the FVP marketing overview page.

I can find DEN011 through internet search, but not when looking through the armdeveloper documentation library.

@LeviYeoReum
Copy link
Contributor Author

The documentation link does not point to what it claims to, it points to the FVP marketing overview page.
I can find DEN011 through internet search, but not when looking through the armdeveloper documentation library.

Oh sorry. I'll update the reference correctly. Thanks

According to the FF-A specification, bit 15 of the partition ID
indicates the partition type:

  - Bit[15] == 0: Identifies a Virtual Machine (VM), used by the Hypervisor.
  - Bit[15] == 1: Identifies a Secure Partition, used by the SPM.

In other words, if bit 15 of the partition ID is set to 1,
it represents a Secure Partition; if it is 0,
   it represents a Normal World partition.

Based on this spec, add helper to check partition id is secure partition
or not.

Signed-off-by: Yeoreum Yun <[email protected]>
…ment

Introduce ArmMmHandlerContext.h, which defines the ARM_MM_HANDLER_CONTEXT
structure passed to each MmHandler’s Context argument. This structure
provides:

 - The current communication protocol type
 - The service type
 - Protocol-specific details

This enables MM drivers to differentiate requests from MM communication
versus DIRECT_MSG_REQ2, support both SPM_MM and FF-A v1.2, and determine
whether a request originated from the secure world.

Signed-off-by: Yeoreum Yun <[email protected]>
Pass ARM_MM_HANDLER_CONTEXT to MmHandler
so it can determine:

  - whether the request came via FF-A or SPM_MM mode
  - the service type
  - whether it is a secure request or the source partition ID

Signed-off-by: Yeoreum Yun <[email protected]>
…text

gGuidedEventContext is only used in EventHandle.c not other.
Therefore change it to static mGuidedEventContext and remove export.

Signed-off-by: Yeoreum Yun <[email protected]>
…aders

The Platform Security Firmware Update specification, 1.0 for A-profile
(https://developer.arm.com/documentation/den0118/latest) describes
a standard mechanism for performing firmware updates on Arm platform.
This mechanism utilises the Arm Firmware Framework for Arm A-profile
specification to transfer the firmware update binaries
from the Normal World to the Secure World.
An update agent on the Secure world then updates the flash area with the new update image.

Add related headers for firmware update feature.

Signed-off-by: Yeoreum Yun <[email protected]>
Add firmware update feature related GUID used in UEFI/StandaloneMm.

Signed-off-by: Yeoreum Yun <[email protected]>
FmpDeviceLib is platform specific library which is used to update
firmware using CapsuleUpdate framework via FmpDevicePkg in edk2.

According to Platform Security Firmware Update for A-profile:
        https://developer.arm.com/documentation/den0118/latest,
FmpPsaFwuLib is implementation of FmpDeviceLib using PsaFwuLib
implementing firmware update ABI.

Here is brief view how it works

  UEFI (Normal world)          |          StandAloneMm (Secure world)
-------------------------------|--------------------------------------
                               |                             +-------+
                               |                    ---------|  Fws  |
                               |                    |        +-------+
+------------------+           |                    |       (Gpt parted)
|   FmpDevicePkg   |           |  Read /Write Image |
+------------------+           |                    |
  |                            |          +-------------------+
  |  SetTheImage and etc       |          |  FwsPlatformLib   |
  |  progress via FmpDeviceLib |          +-------------------+
  |                            |                    |
  |                            |    Parsing Request | Access Fws via
  |                            |                    | FwsPlatformLib
  |                                                 |
  -> +----------------+     PSA ABI (MMC)   +-------------------+
     |  FmpPsaFwuLib  |<------------------> |      FwuSmm.c     |
     +----------------+    PSA Error code   +-------------------+

Signed-off-by: Yeoreum Yun <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants