| Message ID | 20260404152640.3297713-7-dario.binacchi@amarulasolutions.com |
|---|---|
| State | New |
| Headers |
Return-Path:
<linux-amarula+bncBCQ4XFG47UFRBSG3YTHAMGQE7H2NZUA@amarulasolutions.com>
X-Original-To: linux-amarula@patchwork.amarulasolutions.com
Delivered-To: linux-amarula@patchwork.amarulasolutions.com
Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com
[209.85.128.72])
by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 74F333F10C
for <linux-amarula@patchwork.amarulasolutions.com>;
Sat, 4 Apr 2026 17:27:05 +0200 (CEST)
Received: by mail-wm1-f72.google.com with SMTP id
5b1f17b1804b1-483786a09b1sf35553555e9.3
for <linux-amarula@patchwork.amarulasolutions.com>;
Sat, 04 Apr 2026 08:27:05 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1775316425; cv=pass;
d=google.com; s=arc-20240605;
b=iDgNTuN1H6wWqT+G4c989yQstHdeCU4ilgN06PuO8b/ny7HbHYe8m2zUdG2E3craVG
OLddFufzITzrc0Sw/CtnKf6xOzPNnnJ877RYtvpKT7o03gGDlSEKfHp4+pZOizL9L0Yt
Ohcm5qOLXG7NZCB9cNqV59TMaO16gbzL+dsfZmR2IPxdHilmEJBlNGeaNrUMl26hDs1V
TcDDrCfbj5ej0uWyGTihTQNo5oq2/PEVfkrrwbh/LFw3nlFrDVamOpbT20g459wXCQrx
5azpcwERhEWisBQxOv93X9D4MsRO9nBX+y7y2WdKGa2Gcb/Vu8JzCvLTYOhSP4jC6TAt
82bA==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20240605;
h=list-unsubscribe:list-archive:list-help:list-post:list-id
:mailing-list:precedence:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:dkim-signature;
bh=m40+xg+IJilco1Flgcm4hog6/ct7WaHSmPpKXfIehB0=;
fh=NkjgiFIuiBuvgyB47hFNWizYGLev4Lp+XqggNs5TLu8=;
b=KiqSv8wFnkGstEsMYWwIegnNgsK0I+Im5/VuvGFakEX2uONE1o+t0l/xMDUsPM5XVg
T/jqnvPVUclKxxio8OhtU2MCL81Jv5mnxGweNKgJqgMw+A+eoNLvcAXKVcBwkvkfjwoW
Zoo0KHFXlZzv7wMk9wDEYfEc23Jrq9YqxxRVjoXe0lvymwtJhZ1YoxaPqvz+4b3kNUan
T/1BPEFi+k9kNWWOR8P5raWv3xdHVphmzOWiwnCR55mOqJH3GlV+p+vSqUuaKQSbx6+z
cXnBhvwU9IYFRYLmxE5VwB2c1bv7uS4rqprIdJSk/+52ppEwP5/mw0onn7COYsdYRM98
lRCQ==;
darn=patchwork.amarulasolutions.com
ARC-Authentication-Results: i=2; mx.google.com;
dkim=pass header.i=@amarulasolutions.com header.s=google
header.b=mSk01yvp;
spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com
designates 209.85.220.41 as permitted sender)
smtp.mailfrom=dario.binacchi@amarulasolutions.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com;
dara=neutral header.i=@amarulasolutions.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=amarulasolutions.com; s=google; t=1775316425; x=1775921225;
darn=patchwork.amarulasolutions.com;
h=list-unsubscribe:list-archive:list-help:list-post:list-id
:mailing-list:precedence:x-original-authentication-results
:x-original-sender:mime-version:references:in-reply-to:message-id
:date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
bh=m40+xg+IJilco1Flgcm4hog6/ct7WaHSmPpKXfIehB0=;
b=nFy6HlYmA/C5Jwe2gNBw3aeeGwyVClI6CPrI4k/rzZKFEUO6ORwav+FDVxvAHTJWPv
sLRg0Kcj8SQoyvb8oMAV1EZKZp3r3YFwG+ejueuj69lFrd9YbVmCVd9CjI3Ayyr6RE9L
HDjbmjhtn0BuHLrPWAdvze8n2my7oEQ6KQckU=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20251104; t=1775316425; x=1775921225;
h=list-unsubscribe:list-archive:list-help:list-post
:x-spam-checked-in-group:list-id:mailing-list:precedence
:x-original-authentication-results:x-original-sender:mime-version
:references:in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg
:x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=m40+xg+IJilco1Flgcm4hog6/ct7WaHSmPpKXfIehB0=;
b=fsG3ELLiaP+9UZSqMzGBlckTZDgdV9qj0uT1y29QMG2JbPxYt0A8xHrCbHbLCDvKry
5wnx1bfNCKzH54AZeixxGjQ3uWBDcXukZ6sGNrAfPDUl6H0NWAlSbR/bTXMUdWFnmJxv
50i1wx4vF0NiuPhMD/NxV05eMs54gvl0T938tmkFKpOuitE1Hn8T/DoK2sgBbv7yGNmM
MqDDyHl6Ql8QjVt+UFqKxb2Q+KUyxbsK66oXIt/ArzoSEjdvL3UfGnQ7WBMfP9DrxKuT
lvXN3zcXyfTPm5b//SkpRMGIvdbjt1+qIYMYXAYC7QjGx/rnC/bHy7xp06FicmQxODEn
CcFg==
X-Forwarded-Encrypted: i=2;
AJvYcCWPXiL4WT+oODH8s5Owhk3J5I8IFPvcX7s0EJOXFFdypOQ+/KFtCtSAnm5O6E+avjW5CB5FlQ6BBPgHN7RD@patchwork.amarulasolutions.com
X-Gm-Message-State: AOJu0Yxu9IrHlMnPRfA3+BRgy6w7Km72z5/YIcshVxQ7fpah7bgpvkq3
RJA+EkS3QxRcczWWSONkONERNSEw9QCSqwoJgx3bhJFofWwT8gTZ4zKvAz0cBpiObAxEyPFJne1
PjA==
X-Received: by 2002:a05:600c:64cd:b0:487:1520:d107 with SMTP id
5b1f17b1804b1-488998f8b3dmr84767055e9.31.1775316425095;
Sat, 04 Apr 2026 08:27:05 -0700 (PDT)
X-BeenThere: linux-amarula@amarulasolutions.com;
h="AYAyTiLqxZI+y6mfJKuZkK44mQ7oyIO5r6N91gN7SKZ8wXeNsg=="
Received: by 2002:a05:600c:3b0a:b0:485:3c80:a97b with SMTP id
5b1f17b1804b1-4888b9942ffls20572395e9.0.-pod-prod-09-eu; Sat, 04 Apr 2026
08:27:03 -0700 (PDT)
X-Received: by 2002:a05:600c:630a:b0:488:8840:e5ae with SMTP id
5b1f17b1804b1-488997eed8bmr104894325e9.24.1775316423438;
Sat, 04 Apr 2026 08:27:03 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1775316423; cv=none;
d=google.com; s=arc-20240605;
b=H+UFJP4IqAEaXITH+OFmS+WMoeQCjjM4GrIMz7gmku8SpVu0Z43B9daWsn/oGnKq0n
kgeSOpkIZrynVoz3in9TSvUiVBMu/u0r+VjpE2+z8HIkuTQ+79A4gcexaVGEbBesq7Dj
lr4ajeR/sR/Fb0KP94zezL4Z3SPH5Di2aithjdKzrYjGdnRpDCISOJsOtDwUyxsj7s9+
AgikDtTAoqiJ/9zkwG4TqeJaDQeaUKQYTCkWmpsu4NrvQbxXYk8UGAvnb3YfYfleLKBp
X47XNvAPWLEaeuwxkVRNVV/RLPRA8LbgrvX+i8eTukbUbTuNO8TEbS0v41e4bJQGCjj9
qBAw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20240605;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:dkim-signature;
bh=oBbe/3O88q4H84p8+vNuWLUC8LxONfOyv9MT1gkDBL4=;
fh=wRznwKej01d9+6aGazqmxhW1igj4DDLjIcwKUY4qreg=;
b=CQE80gHK4v6I79R7PB3dGI5ggqOaxjAUmuA3VzjxljUEfXme/rZyzyM2dhy525AO8k
POgc48YbjqPEES4emB7RG7ws+ik1DUvHgsHSPJo2qGj4kfp0YJVo8YMR9TiBMzB/iu+0
dJoH0Lmvdhpm9OSKGHvsgVwXid25JR99pJM1SYXRNe4xgBqFbekc/XBd9LadGo6j0es9
a85RvdqxIuNsSOXAuv4wHVCC3S8RcwKJ3aKkUZc5mqzlSe4grBVc9RyGHJlGjyMK/BY+
EU5H4/25GEdAgSxxnTiYolbXlwtRY/WXkPFUwn0mVBD8ZYssoRyj/x7Et6sGDFwX30m7
CCag==;
dara=google.com
ARC-Authentication-Results: i=1; mx.google.com;
dkim=pass header.i=@amarulasolutions.com header.s=google
header.b=mSk01yvp;
spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com
designates 209.85.220.41 as permitted sender)
smtp.mailfrom=dario.binacchi@amarulasolutions.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com;
dara=neutral header.i=@amarulasolutions.com
Received: from mail-sor-f41.google.com (mail-sor-f41.google.com.
[209.85.220.41])
by mx.google.com with SMTPS id
5b1f17b1804b1-4888a7061e6sor15242265e9.13.2026.04.04.08.27.03
for <linux-amarula@amarulasolutions.com>
(Google Transport Security);
Sat, 04 Apr 2026 08:27:03 -0700 (PDT)
Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com
designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Gm-Gg: AeBDievtqswkTgCSjV5ItYATcugiFZTmLr1jmNh8wyP4H5mRGi3S4DFVY3kLNUoCNmh
va0bMel1ye6VHfhlE7MDkuDyzBJA9QwSN9b00pRE8ADu2sIukkfhu2j7HosplCCNmcJKeEcS7GV
xE6iLISVJcs3SwhSyzP0pL4DKvpcaTx+XZ1/fB0hrLo+Iap23VE7RGs3XC1fP/58o3pLEtz/drA
mvRA3tlA+TK19cx1TqldO9HMA4nErNVm/4otupZ6YY692ZCUXVb71W/hkJBqGHxb0sjKwqVVlFF
SpWh2x53XtabKfYVHMGChrSEbyhGhR4W1L3paCqQ/d2pYJjMEjX5ZIoCNcwZ/qtOYNA0s4+8Q3E
V5IVNErNdh/HjpgE66Ul7VvUj2Ly1qQPlJdbtr/Tif0nKWqmfm3f3HwiXSmF/yPUlh7WtF14hBy
VmO5pVbqLsQgErDYwPkrv0hRSpHpEkwICF6GMzhPzcGEmM+oRW6JiGjPlN9ffY1M3vwJVhHu0I9
nEZn04ZlG/sjGqhL7CYTsTnc5Tqt3kVxy0CKv6s7/saUfwhIMCSI5ob0dayMbj94FJ+dBysPkJV
8Jif8xJtZ0ZkJhOyYtCeFoIo
X-Received: by 2002:a05:600c:4593:b0:483:7903:c3b1 with SMTP id
5b1f17b1804b1-488997dda87mr108407655e9.20.1775316423025;
Sat, 04 Apr 2026 08:27:03 -0700 (PDT)
Received: from dario-ThinkPad-P14s-Gen-5.homenet.telecomitalia.it
(host-87-9-100-184.retail.telecomitalia.it. [87.9.100.184])
by smtp.gmail.com with ESMTPSA id
ffacd0b85a97d-43d1e4f1a99sm28059462f8f.32.2026.04.04.08.27.01
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Sat, 04 Apr 2026 08:27:01 -0700 (PDT)
From: Dario Binacchi <dario.binacchi@amarulasolutions.com>
To: u-boot@lists.denx.de
Cc: linux-amarula@amarulasolutions.com,
Dario Binacchi <dario.binacchi@amarulasolutions.com>,
Michal Simek <michal.simek@amd.com>,
Padmarao Begari <padmarao.begari@amd.com>,
Sughosh Ganu <sughosh.ganu@arm.com>,
Tom Rini <trini@konsulko.com>
Subject: [PATCH v2 6/7] fwu: add helper to get image GUID by type and bank
index
Date: Sat, 4 Apr 2026 17:23:33 +0200
Message-ID: <20260404152640.3297713-7-dario.binacchi@amarulasolutions.com>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <20260404152640.3297713-1-dario.binacchi@amarulasolutions.com>
References: <20260404152640.3297713-1-dario.binacchi@amarulasolutions.com>
MIME-Version: 1.0
X-Original-Sender: dario.binacchi@amarulasolutions.com
X-Original-Authentication-Results: mx.google.com; dkim=pass
header.i=@amarulasolutions.com header.s=google header.b=mSk01yvp;
spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com
designates 209.85.220.41 as permitted sender)
smtp.mailfrom=dario.binacchi@amarulasolutions.com;
dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com;
dara=neutral header.i=@amarulasolutions.com
Content-Type: text/plain; charset="UTF-8"
Precedence: list
Mailing-list: list linux-amarula@amarulasolutions.com;
contact linux-amarula+owners@amarulasolutions.com
List-ID: <linux-amarula.amarulasolutions.com>
X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com
X-Google-Group-Id: 476853432473
List-Post:
<https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/post>,
<mailto:linux-amarula@amarulasolutions.com>
List-Help:
<https://support.google.com/a/amarulasolutions.com/bin/topic.py?topic=25838>,
<mailto:linux-amarula+help@amarulasolutions.com>
List-Archive:
<https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/>
List-Unsubscribe:
<mailto:googlegroups-manage+476853432473+unsubscribe@googlegroups.com>,
<https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/subscribe>
|
| Series |
Support metadata-driven A/B boot for STM32MP25
|
|
Commit Message
Dario Binacchi
April 4, 2026, 3:23 p.m. UTC
Introduce fwu_mdata_get_image_guid() to retrieve a specific image GUID
from the FWU metadata based on the bank index and image type GUID.
This allows identifying the correct partition in multi-bank (A/B)
scenarios, ensuring the correct image is targeted depending on the
current bank.
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
Changes in v2:
- Add kerneldoc comment for fwu_mdata_get_image_guid().
- Pass efi_guid_t by pointer for consistency.
include/fwu.h | 3 +++
lib/fwu_updates/fwu.c | 33 +++++++++++++++++++++++++++++++++
2 files changed, 36 insertions(+)
Comments
Hi Dario, On 2026-04-04T15:23:27, Dario Binacchi <dario.binacchi@amarulasolutions.com> wrote: > fwu: add helper to get image GUID by type and bank index > > Introduce fwu_mdata_get_image_guid() to retrieve a specific image GUID > from the FWU metadata based on the bank index and image type GUID. > > This allows identifying the correct partition in multi-bank (A/B) > scenarios, ensuring the correct image is targeted depending on the > current bank. > > Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> > > include/fwu.h | 3 +++ > lib/fwu_updates/fwu.c | 33 +++++++++++++++++++++++++++++++++ > test/hooks/bin/u | 1 + > 3 files changed, 37 insertions(+) > diff --git a/include/fwu.h b/include/fwu.h > @@ -396,6 +396,9 @@ void fwu_populate_mdata_image_info(struct fwu_data *data); > +int fwu_mdata_get_image_guid(efi_guid_t *image_guid, > + const efi_guid_t *image_type_guid, u32 bank_index); The cover letter mentions 'Add kerneldoc comment for fwu_mdata_get_image_guid()' but the header declaration has no kerneldoc. Please can you add it before the declaration in fwu.h to match other functions in this file? The comment in fwu.c is good, but the U-Boot convention is to document public APIs in the header. Regards, Simon To unsubscribe from this group and stop receiving emails from it, send an email to linux-amarula+unsubscribe@amarulasolutions.com.
diff --git a/include/fwu.h b/include/fwu.h index e7bd1d492af1..40b12810d5fc 100644 --- a/include/fwu.h +++ b/include/fwu.h @@ -394,6 +394,9 @@ void fwu_populate_mdata_image_info(struct fwu_data *data); */ int fwu_get_mdata_size(uint32_t *mdata_size); +int fwu_mdata_get_image_guid(efi_guid_t *image_guid, + const efi_guid_t *image_type_guid, u32 bank_index); + /** * fwu_state_machine_updates() - Update FWU state of the platform * @trial_state: Is platform transitioning into Trial State diff --git a/lib/fwu_updates/fwu.c b/lib/fwu_updates/fwu.c index 0f5ef2ba5153..b26b244cf855 100644 --- a/lib/fwu_updates/fwu.c +++ b/lib/fwu_updates/fwu.c @@ -243,6 +243,39 @@ int fwu_sync_mdata(struct fwu_mdata *mdata, int part) return 0; } +/** + * fwu_mdata_get_image_guid() - Get image GUID for a type and bank + * @image_guid: Pointer to be filled with the found image GUID + * @image_type_guid: Pointer to the image type GUID to search for + * @bank_index: Index of the bank + * + * Return: 0 if OK, -ve on error + */ +int fwu_mdata_get_image_guid(efi_guid_t *image_guid, + const efi_guid_t *image_type_guid, u32 bank_index) +{ + struct fwu_data *data = &g_fwu_data; + struct fwu_image_entry *image; + int i; + + if (bank_index >= data->num_banks) + return -EINVAL; + + for (i = 0; i < data->num_images; i++) { + image = &data->fwu_images[i]; + + if (!guidcmp(image_type_guid, &image->image_type_guid)) { + struct fwu_image_bank_info *bank; + + bank = &image->img_bank_info[bank_index]; + guidcpy(image_guid, &bank->image_guid); + return 0; + } + } + + return -ENOENT; +} + /** * fwu_mdata_copies_allocate() - Allocate memory for metadata * @mdata_size: Size of the metadata structure