[PATCH v5 15/24] efi_loader: fwu: fwu_arm_psa: Disable trial state handling

Sughosh Ganu sughosh.ganu at linaro.org
Tue Nov 11 09:51:56 CET 2025


On Fri, 26 Sept 2025 at 19:44, <abdellatif.elkhlifi at arm.com> wrote:
>
> From: Abdellatif El Khlifi <abdellatif.elkhlifi at arm.com>
>
> No need for trial state handling in U-Boot for FWU Arm PSA
>
> In FWU Arm PSA mode, trial state is handled by Secure world.
>
> Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi at arm.com>
> Cc: Heinrich Schuchardt <xypron.glpk at gmx.de>
> Cc: Sughosh Ganu <sughosh.ganu at linaro.org>
> Cc: Tom Rini <trini at konsulko.com>
> Cc: Ilias Apalodimas <ilias.apalodimas at linaro.org>
> Cc: Simon Glass <sjg at chromium.org>
> Cc: Michal Simek <michal.simek at amd.com>
> Cc: Marek Vasut <marek.vasut+renesas at mailbox.org>
> Cc: Casey Connolly <casey.connolly at linaro.org>
> Cc: Adriano Cordova <adrianox at gmail.com>
> ---
>  lib/efi_loader/efi_capsule.c | 7 +++++--
>  lib/fwu_updates/fwu.c        | 8 +++++++-

Why are changes being required in the lib/fwu_updates/fwu.c file? This
file is dealing with the normal-world FWU implementation. For your
implementation, things like bookkeeping for the trial-state etc will
be done by the update agent.

-sughosh

>  2 files changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
> index 06b502e2c25..42effd42628 100644
> --- a/lib/efi_loader/efi_capsule.c
> +++ b/lib/efi_loader/efi_capsule.c
> @@ -562,7 +562,9 @@ static efi_status_t efi_capsule_update_firmware(
>         if (IS_ENABLED(CONFIG_FWU_MULTI_BANK_UPDATE)) {
>                 if (fwu_empty_capsule(capsule_data)) {
>                         if (fwu_empty_capsule_checks_pass()) {
> -                               return fwu_empty_capsule_process(capsule_data);
> +                               return !IS_ENABLED(CONFIG_FWU_ARM_PSA) ?
> +                                       fwu_empty_capsule_process(capsule_data) :
> +                                       0;
>                         } else {
>                                 log_err("FWU empty capsule checks failed. Cannot start update\n");
>                                 return EFI_INVALID_PARAMETER;
> @@ -1375,7 +1377,8 @@ efi_status_t efi_launch_capsules(void)
>
>         efi_capsule_scan_done();
>
> -       if (IS_ENABLED(CONFIG_FWU_MULTI_BANK_UPDATE)) {
> +       if (IS_ENABLED(CONFIG_FWU_MULTI_BANK_UPDATE) &&
> +           !IS_ENABLED(CONFIG_FWU_ARM_PSA)) {
>                 if (capsule_update == true && update_status == true) {
>                         ret = fwu_post_update_process(fw_accept_os);
>                 } else if (capsule_update == true && update_status == false) {
> diff --git a/lib/fwu_updates/fwu.c b/lib/fwu_updates/fwu.c
> index bfbb98c16d7..45d43d424ba 100644
> --- a/lib/fwu_updates/fwu.c
> +++ b/lib/fwu_updates/fwu.c
> @@ -340,6 +340,11 @@ int fwu_get_mdata(struct fwu_mdata *mdata)
>                 if (parts_ok[i])
>                         continue;
>
> +               if (IS_ENABLED(CONFIG_FWU_ARM_PSA)) {
> +                       log_err("FWU metadata copy %d invalid\n", i);
> +                       return -ENOTSYNC;
> +               }
> +
>                 memcpy(parts_mdata[i], parts_mdata[1 - i], mdata_size);
>                 err = fwu_sync_mdata(parts_mdata[i], i ? SECONDARY_PART : PRIMARY_PART);
>                 if (err) {
> @@ -781,7 +786,8 @@ static int fwu_boottime_checks(void)
>
>         in_trial = in_trial_state();
>
> -       ret = in_trial ? fwu_trial_count_update() : trial_counter_update(NULL);
> +       ret = (in_trial && !IS_ENABLED(CONFIG_FWU_ARM_PSA)) ?
> +              fwu_trial_count_update() : trial_counter_update(NULL);
>
>         if (!ret)
>                 boottime_check = 1;
> --
> 2.43.0
>


More information about the U-Boot mailing list