From patchwork Thu Apr 30 08:06:09 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 4598 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 2900E3F0D7 for ; Thu, 30 Apr 2026 10:06:53 +0200 (CEST) Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-ba78dfab8aasf52796666b.3 for ; Thu, 30 Apr 2026 01:06:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1777536413; cv=pass; d=google.com; s=arc-20240605; b=D1axemGJVLmJKKxztNkMJ9IWn3lhwqgFWplXntMnYM4GFjooWUp4dHLsCIpgAwQ9l6 3b7T6Szso5qoG3xqJ53KlUM9k6iwQurzWZ3Dwp1ObdmBIww9qc3Ztxnwd94WX73brqta bbz0j9ii1WV8TFpGu6TP/b2da9ejcGVMeLA8shlQ4WJ7rppaofoZ3TwS/cFckCa84Bnq u9qWtn088d/GxT3SK3sGGrraxg8X70KS/iqavjkvgoSDohhnNBr1FS2dQfCRHnIqFcV3 ozTFuEVTY7pcVb88J4p5z6W8Qhn0Xru19595Z+bBXn3V9yx3FK5PwIezU8Z72j3M3CSU h82g== 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=SU1a88xjNbF5FH9JZcJET1fPupOvrRPSawG9YcgbUbc=; fh=VjNivxi7fO63YC/zoEFYLbm8AitHjRnAvtTi6Tvkyxo=; b=GHcTAbBSqLvPyiSfWsKaQtaMy1i1kl3Wddt4vCgy5602wInppmfT5dUB70kj7YfDaB f6iRPLFfdrUmC2yezIgtuvjI+ImbOVx/uFnXP6fhTo1QjbJ9ciQe03i3IliCIlmnuVWR OtmEQ0yB9uOZ/c6Mz4STseOe6q/FwsJvjTo7UFVORzXnpFrlTJqZ+awoNqrkh/WwzQU2 PFkb6QJUMUeNIIkUF903fKb+cJzbZiFGNDFNvPYcVuPO+oYPxifB52OYNvEn3lAEEknT vb7qyxxEoNuF4WtgYbTGzKjDF1Rn4oJjoLZJWjePbFOHnULJB7ME5L9gBXlUfzHz+Nzj X8fg==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=kSP2+2k6; 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=1777536413; x=1778141213; 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=SU1a88xjNbF5FH9JZcJET1fPupOvrRPSawG9YcgbUbc=; b=agwYbzMmPVxrzsZnnGzQ1DNxgXYTbg5lRcgOzchOlYyLQsJ/CvJch9LytB6+afKk+S XqXcA05RHvd3iLyUN3OWDSiC43cX8ws1U8mfSaaytwdp7qznYhuy6ug3IKdPJtLeODv0 beu244gc5aI7R+wxC1JaWS4pH9V/N41UCB89o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777536413; x=1778141213; 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=SU1a88xjNbF5FH9JZcJET1fPupOvrRPSawG9YcgbUbc=; b=IToS8EhaPS+q2I3VxdbhuFYpyG2sqSJMGTjh3tcW6oG7rvGLC37MgBg0lra5X3DIN2 516N+4m8tU/190E5q9Em95c1xBuNfU4RF3cZDvpSxFvTahYBjYS8uDeM+qRJto2juCJG VusCa/1WHOxcdHgMSHVzpO8jnD2UG/mluCDpL0s5Z92i/ImUFoi+fIRDayi1l8Q3qIE8 rbcwOvSNcck6itXpDPu8PSIdg7bQ8S7YvSV68Qktnea1F2ajPpozywy6aPzGdKqn4hjw VGMo6QeEPzaDpyvLW83UIcyUlhekOlXrlZjM24nywr+evp8gstiW9s75lX2uG/LnDXoK UVIw== X-Forwarded-Encrypted: i=2; AFNElJ8lVNPPPwMQhdcLXBuB9RWrbP0L3Ye9j+fo1GNxNc06cOibHUXaL9vf7h8DE7/KcqxVMKETJWuh/G8js410@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yz0IMRYgG3hykrOv7xEzJHcLLJQj+gxcSYFywu0w9SMILO5tAmm PYZBcMKxzzf0QzWxdDzrhStX+3kR5WNmhF+jG2Rj3GUNqddnvCvmPCR4Bpo05MPnfNgyoQ== X-Received: by 2002:a17:907:849:b0:ba6:1412:9326 with SMTP id a640c23a62f3a-bbac67a986bmr119848766b.19.1777536412814; Thu, 30 Apr 2026 01:06:52 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com; h="AUV6zMPTTsQWH9Fwobtqoef85dUGug2psMFyrSAYfoFDUTXfjw==" Received: by 2002:a05:6000:2a82:b0:43d:1ce7:4927 with SMTP id ffacd0b85a97d-4490c62cb25ls325911f8f.2.-pod-prod-07-eu; Thu, 30 Apr 2026 01:06:51 -0700 (PDT) X-Received: by 2002:a05:6000:1789:b0:43f:e7c4:a36e with SMTP id ffacd0b85a97d-4493d031f0fmr2730615f8f.16.1777536410969; Thu, 30 Apr 2026 01:06:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1777536410; cv=none; d=google.com; s=arc-20240605; b=hLU4O0zDpG3+rz4J7jVjxDjJRSgE/uWTwiS2lFGvzq2KeKvvHofIwOTSTeU+wVcv79 5LPpVjZ/H7rNMutpTIu42zMBTm6iUK1o3hsWRCaYmmAcQXcontU8CdeRrLDva/zFVJrF I2xYv2hNnyXOK6/ZjNzMyN8uuF/8MLphMczPlJDIYFxF1E+LOCbwCCy4J9EbXAkit4mm oD2S8tA4zE+aoIS/gvdX9xoyLplqUShlD53f4ru4D3FEuER8oi/HGF0Ink9zhfyQPrtp GavedzYzWpHaxKQgAWzOjZ+fUQq4+QstEtp/UIWmzGhvj7KSm9WVRUQ/ic8h2olvHGk7 n6dg== 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=5S2gUI+yh0xPdb/QwVrb1gySfcxDflQCsZShYuF0V2Q=; fh=z6SRwFgF6SmOB6R6Ln41cEabZggRg20eJjyy89L/HRk=; b=XQg8/MuC+7haK25HQe88iNzAaJVOr7QpJ3Jco3d159HfBEwB8VCD6+OGKFMK9lBBZZ TrPqHWS/V7vDfS0Wgw37y5cMxQTH/ZQv78rtpw6gEh7tdyCwaGuqr14y0HcJwWdlifDC a0EuND2Z1yq5rLquSnWedoKzRpRi+qJIZXanVin++oUkS4Mc+KscfMeuDEsDQHrX9DuT D8C7JMejHPUVnUMWfe8klmrAZlj5qN6hA1HV/QUobFncAOFPnzLLqmgn2nPYpNtm4vQ5 tgGD5A2bCS7PWFIiwcUl+Vgf25QzL2+btn4wZsuxab8k6dLtrhO6gDDHbxDKKkt581Oy jD+Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=kSP2+2k6; 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 ffacd0b85a97d-447b47d925dsor745206f8f.3.2026.04.30.01.06.50 for (Google Transport Security); Thu, 30 Apr 2026 01:06:50 -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: AeBDiethxpxJIJz1momU88700xCJOWZPeBHstzKzSgYt+d68Q18mp8DTLf343fRRMgf D5lShZr9i/Xw0mckH48hPVFQG79r1U7rre0MwR4eCEKT0PMhSlIaQo3ND7vUh9evGJ904BlnYmL xe/5e7HSxcc8HWda1T7vgFkRrp/cgEUnLDBZQxm6gRVuLI9BbsC21OI41iDp9qNeet98Z908Fc8 qAOoeXODtVcmFA+ba0tTm6i3rfwjgrk+2Sn9EovxIMtvUXxIBEvGCyGJAgkK+REgxLFRCnxzbOe F2Ly57ILVTA7/vNTEtifvi4U+hgVvJwi3WNXVjErIfB+kiJrdjA86gCCnnc5e8XqwIrNYy4t3mO vjWVlWbldQ8OEZmd3yRXoc7yaOatBgpTzZ4Gw+0RpkojrKt0ER0IsNlMRrSZ+YUbXGa5KZ1HVyR twJuQ6ZkgDhAOzFq7M/ch7Kd2O/D6ZoyXtgXbx2vVIX4yHhlBQpxRm8bs8v7ZHE0EqX8AgKKtv1 T934g6e2Qolcyu1EvqcnpWahmc3DgLnApG0eGkymPL3VzSN9g+KnswPqR5T2BSw//zz+LwdUjM9 5NC+xBOoMpWpSnIu019DGIucXfc9gyc2IjLZcB3JmqUSSw== X-Received: by 2002:a05:6000:26c4:b0:441:1fa5:457f with SMTP id ffacd0b85a97d-4493e982952mr2858427f8f.28.1777536410433; Thu, 30 Apr 2026 01:06:50 -0700 (PDT) Received: from dario-ThinkPad-P14s-Gen-5.homenet.telecomitalia.it (host-82-56-22-134.retail.telecomitalia.it. [82.56.22.134]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-449c576d0a2sm668071f8f.31.2026.04.30.01.06.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2026 01:06:49 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: linux-amarula@amarulasolutions.com, Dario Binacchi , Simon Glass , Patrice Chotard , Marek Vasut , Patrick Delaunay , Quentin Schulz , Tom Rini , uboot-stm32@st-md-mailman.stormreply.com Subject: [PATCH v8 8/8] board: st: stm32mp25: support dynamic A/B bank bootup Date: Thu, 30 Apr 2026 10:06:09 +0200 Message-ID: <20260430080627.849636-9-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260430080627.849636-1-dario.binacchi@amarulasolutions.com> References: <20260430080627.849636-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=kSP2+2k6; 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: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Enable automatic detection of the active A/B bank by retrieving partition GUIDs from FWU metadata. This ensures the system correctly identifies the bootable partitions even in multi-bank scenarios, falling back to a standard bootable flag scan if the UUIDs are missing. To enable A/B bank bootup on stm32mp25 boards, add the following Kconfig options to the stm32mp25_defconfig: CONFIG_FWU_MULTI_BANK_UPDATE=y CONFIG_FWU_MDATA=y CONFIG_FWU_NUM_BANKS=2 CONFIG_FWU_NUM_IMAGES_PER_BANK=3 CONFIG_CMD_FWU_METADATA=y CONFIG_FWU_MDATA_V2=y Signed-off-by: Dario Binacchi Reviewed-by: Simon Glass Reviewed-by: Patrice Chotard --- Changes in v8: - Add Reviewed-by of Patrice Chotard - Skip cmd_test_part tests for configurations where MMC is not enabled or the device is missing Changes in v5: - Add Acked-by of Ilias Apalodimas to patch 6/8 "fwu: add helper to get image GUID by type and bank index" Changes in v4: - Add patch 7/8 test: dm: fwu_mdata: add test for fwu_mdata_get_image_guid Changes in v3: - Wrap lines exceeding 80 columns in test/cmd/part.c file. - Combine run_command() and ut_asserteq() -> ut_asserteq(1, run_command( - Add kerneldoc comment for fwu_mdata_get_image_guid() above its declaration in fwu.h. - Add log_warning() messages to fwu_platform_hook() to catch inconsistent FWU metadata (boot GUID found but root GUID missing or viceversa), as suggested by Simon Glass. - Add Reviewed-by tag of Simon Glass. Changes in v2: - Add links to the XBOOTLDR specification in the commit message of patch 1/7 lib: uuid: add partition type GUID for extended bootloader. - Update help for 'part start', 'part size' to mention UUID. - Add kerneldoc comment for fwu_mdata_get_image_guid(). - Pass efi_guid_t by pointer in fwu_mdata_get_image_guid(). - Add patches: 5/7 test: cmd: part: add UUID lookup tests 3/7 test: cmd: add unit tests for part command 2/7 test: dm: part: add test for part_get_info_by_uuid - Pass efi_guid_t by pointer in fwu_mdata_get_image_guid() calls. board/st/stm32mp2/stm32mp2.c | 32 +++++++++++++++++++++++++++ include/configs/stm32mp25_st_common.h | 15 +++++++++++++ 2 files changed, 47 insertions(+) diff --git a/board/st/stm32mp2/stm32mp2.c b/board/st/stm32mp2/stm32mp2.c index 43bc583378e6..5cbbbc322a3a 100644 --- a/board/st/stm32mp2/stm32mp2.c +++ b/board/st/stm32mp2/stm32mp2.c @@ -208,4 +208,36 @@ void fwu_plat_get_bootidx(uint *boot_idx) *boot_idx = (readl(TAMP_FWU_BOOT_INFO_REG) >> TAMP_FWU_BOOT_IDX_OFFSET) & TAMP_FWU_BOOT_IDX_MASK; } + +int fwu_platform_hook(struct udevice *dev, struct fwu_data *data) +{ + uint boot_idx; + efi_guid_t boot_uuid, root_uuid; + const efi_guid_t boot_type_guid = PARTITION_XBOOTLDR; + const efi_guid_t root_type_guid = + PARTITION_LINUX_FILE_SYSTEM_DATA_GUID; + char uuidbuf[UUID_STR_LEN + 1]; + int retb, retr; + + fwu_plat_get_bootidx(&boot_idx); + + retb = fwu_mdata_get_image_guid(&boot_uuid, &boot_type_guid, boot_idx); + retr = fwu_mdata_get_image_guid(&root_uuid, &root_type_guid, boot_idx); + + if (!retb && !retr) { + uuid_bin_to_str(boot_uuid.b, uuidbuf, UUID_STR_FORMAT_GUID); + env_set("boot_partuuid", uuidbuf); + + uuid_bin_to_str(root_uuid.b, uuidbuf, UUID_STR_FORMAT_GUID); + env_set("root_partuuid", uuidbuf); + } else if (!retb && retr) { + log_warning("%s: found boot GUID but missing root GUID (%d)\n", + __func__, retr); + } else if (!retr && retb) { + log_warning("%s: found root GUID but missing boot GUID (%d)\n", + __func__, retb); + } + + return 0; +} #endif /* CONFIG_FWU_MULTI_BANK_UPDATE */ diff --git a/include/configs/stm32mp25_st_common.h b/include/configs/stm32mp25_st_common.h index cb679eb1be22..0b0267ae99b0 100644 --- a/include/configs/stm32mp25_st_common.h +++ b/include/configs/stm32mp25_st_common.h @@ -8,7 +8,22 @@ #ifndef __CONFIG_STM32MP25_ST_COMMON_H__ #define __CONFIG_STM32MP25_ST_COMMON_H__ +#ifdef CONFIG_FWU_MULTI_BANK_UPDATE +#define SCAN_DEV_FOR_BOOT_PARTS \ + "setenv devplist; " \ + "env exists boot_partuuid && " \ + "part number ${devtype} ${devnum} ${boot_partuuid} devplist; " \ + "env exists devplist || " \ + "part list ${devtype} ${devnum} -bootable devplist; " + +#define ST_STM32MP25_FWU_ENV \ + "altbootcmd=${bootcmd}\0" +#else +#define ST_STM32MP25_FWU_ENV +#endif + #define STM32MP_BOARD_EXTRA_ENV \ + ST_STM32MP25_FWU_ENV \ "usb_pgood_delay=2000\0" \ "console=ttySTM0\0"