From: Abdellatif El Khlifi <[email protected]>

Do not update the acceptance metadata bit after updating an image.

The update agent (secure world) is responsible for setting the acceptance
bit in the metadata. Implement local no-op accept and clear-acceptance
hooks to avoid modifying shared multi-bank FWU metadata.

Signed-off-by: Abdellatif El Khlifi <[email protected]>
Signed-off-by: Alex Chapman <[email protected]>
Signed-off-by: David Hu <[email protected]>
Cc: Heinrich Schuchardt <[email protected]>
Cc: Sughosh Ganu <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Ilias Apalodimas <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Casey Connolly <[email protected]>
Cc: Adriano Cordova <[email protected]>
---
 lib/efi_loader/efi_capsule.c |  7 ++++---
 lib/efi_loader/fwu_arm_psa.c | 38 ++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 3 deletions(-)

diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
index ef2cb7fabe1..fe14eebf867 100644
--- a/lib/efi_loader/efi_capsule.c
+++ b/lib/efi_loader/efi_capsule.c
@@ -676,7 +676,7 @@ static efi_status_t efi_capsule_update_firmware(
                        goto out;
                }
 
-               if (IS_ENABLED(CONFIG_FWU_MULTI_BANK_UPDATE)) {
+               if (IS_ENABLED(CONFIG_FWU_MULTI_BANK_UPDATE) || 
IS_ENABLED(CONFIG_FWU_ARM_PSA)) {
                        image_type_id = &image->update_image_type_id;
                        if (!fw_accept_os) {
                                /*
@@ -698,8 +698,9 @@ static efi_status_t efi_capsule_update_firmware(
                                goto out;
                        }
 
-                       log_debug("%s the accepted bit for Image %pUs\n",
-                                 fw_accept_os ? "Cleared" : "Set",
+                       log_debug("%s %s the accepted bit for Image %pUs\n",
+                                 IS_ENABLED(CONFIG_FWU_ARM_PSA) ? "PSA will" : 
"",
+                                 fw_accept_os ? "clear" : "set",
                                  image_type_id);
                }
 
diff --git a/lib/efi_loader/fwu_arm_psa.c b/lib/efi_loader/fwu_arm_psa.c
index 91ad6ce5b21..83c876d5d8a 100644
--- a/lib/efi_loader/fwu_arm_psa.c
+++ b/lib/efi_loader/fwu_arm_psa.c
@@ -1224,3 +1224,41 @@ efi_status_t efi_fill_image_desc_array(efi_uintn_t 
*image_info_size,
 
        return EFI_SUCCESS;
 }
+
+/**
+ * fwu_accept_image() - Dummy hook for accepting an image
+ * @img_type_id: Unused image type GUID
+ * @bank: Unused bank index
+ *
+ * For Arm PSA, accepting images is either at ExitBootServices() or in the OS.
+ * The setting of the acceptance bit can be skipped as it is not used in Arm 
PSA.
+ *
+ * Return: EFI_SUCCESS always.
+ *
+ */
+int fwu_accept_image(efi_guid_t *img_type_id, u32 bank)
+{
+       (void)img_type_id;
+       (void)bank;
+
+       return EFI_SUCCESS;
+}
+
+/**
+ * fwu_clear_accept_image() - Dummy hook for clearing image acceptance
+ * @img_type_id: Unused image type GUID
+ * @bank: Unused bank index
+ *
+ * For Arm PSA, accepting images is either at ExitBootServices() or in the OS.
+ * The setting of the acceptance bit can be skipped as it is not used in Arm 
PSA.
+ *
+ * Return: EFI_SUCCESS always.
+ *
+ */
+int fwu_clear_accept_image(efi_guid_t *img_type_id, u32 bank)
+{
+       (void)img_type_id;
+       (void)bank;
+
+       return EFI_SUCCESS;
+}
-- 
2.43.0

Reply via email to