[PATCH v3 14/24] efi_loader: fwu: fwu_arm_psa: Skip accepting the payload after set_image()

abdellatif.elkhlifi at arm.com abdellatif.elkhlifi at arm.com
Mon Jul 21 13:18:06 CEST 2025


From: Abdellatif El Khlifi <abdellatif.elkhlifi at arm.com>

Do not update the acceptance metadata bit after updating an image

The update agent (secure world) is responsible of setting the acceptance
bit in the metadata.

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 | 23 +++++++++++++----------
 lib/fwu_updates/fwu.c        | 21 +++++++++++++++++++++
 2 files changed, 34 insertions(+), 10 deletions(-)

diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
index 234e3c1b3c0..1dac691d24d 100644
--- a/lib/efi_loader/efi_capsule.c
+++ b/lib/efi_loader/efi_capsule.c
@@ -696,17 +696,20 @@ static efi_status_t efi_capsule_update_firmware(
 				status = fwu_clear_accept_image(image_type_id,
 								update_index);
 			}
-			ret = fwu_to_efi_error(status);
-			if (ret != EFI_SUCCESS) {
-				log_err("Unable to %s the accept bit for the image %pUs\n",
-					fw_accept_os ? "clear" : "set",
-					image_type_id);
-				goto out;
-			}
 
-			log_debug("%s the accepted bit for Image %pUs\n",
-				  fw_accept_os ? "Cleared" : "Set",
-				  image_type_id);
+			if (!IS_ENABLED(CONFIG_FWU_ARM_PSA)) {
+				ret = fwu_to_efi_error(status);
+				if (ret != EFI_SUCCESS) {
+					log_err("Unable to %s the accept bit for the image %pUs\n",
+						fw_accept_os ? "clear" : "set",
+						image_type_id);
+					goto out;
+				}
+
+				log_debug("%s the accepted bit for Image %pUs\n",
+					  fw_accept_os ? "Cleared" : "Set",
+					  image_type_id);
+			}
 		}
 
 	}
diff --git a/lib/fwu_updates/fwu.c b/lib/fwu_updates/fwu.c
index 7f085a0211f..46b6f9356a7 100644
--- a/lib/fwu_updates/fwu.c
+++ b/lib/fwu_updates/fwu.c
@@ -1,6 +1,11 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) 2022, Linaro Limited
+ *
+ * Copyright 2025 Arm Limited and/or its affiliates <open-source-office at arm.com>
+ *
+ * Author:
+ *   Abdellatif El Khlifi <abdellatif.elkhlifi at arm.com>
  */
 
 #include <dm.h>
@@ -586,6 +591,14 @@ out:
  */
 int fwu_accept_image(efi_guid_t *img_type_id, u32 bank)
 {
+	/*
+	 * In case of Arm PSA accepting images is either
+	 * at ExitBootServices() or in the OS. So, let's skip setting the
+	 * acceptance bit (not used in Arm PSA)
+	 */
+	if (IS_ENABLED(CONFIG_FWU_ARM_PSA))
+		return EFI_SUCCESS;
+
 	return fwu_clrset_image_accept(img_type_id, bank,
 				       IMAGE_ACCEPT_SET);
 }
@@ -606,6 +619,14 @@ int fwu_accept_image(efi_guid_t *img_type_id, u32 bank)
  */
 int fwu_clear_accept_image(efi_guid_t *img_type_id, u32 bank)
 {
+	/*
+	 * In case of Arm PSA accepting images is either
+	 * at ExitBootServices() or in the OS. So, let's skip clearing the
+	 * acceptance bit (not used in Arm PSA)
+	 */
+	if (IS_ENABLED(CONFIG_FWU_ARM_PSA))
+		return EFI_SUCCESS;
+
 	return fwu_clrset_image_accept(img_type_id, bank,
 				       IMAGE_ACCEPT_CLEAR);
 }
-- 
2.25.1



More information about the U-Boot mailing list