From patchwork Mon Jan 22 11:54:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 764618 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:10c4:b0:337:62d3:c6d5 with SMTP id b4csp1058813wrx; Mon, 22 Jan 2024 03:55:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IERhdC999tt0q8A4UU5xeCGdkB95YKE1c+RnMMq7jLktFU3/En6boIhoUubzwFENba3naTH X-Received: by 2002:a05:6000:4e:b0:339:39c3:d274 with SMTP id k14-20020a056000004e00b0033939c3d274mr526374wrx.36.1705924516899; Mon, 22 Jan 2024 03:55:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705924516; cv=none; d=google.com; s=arc-20160816; b=fU/pknKBsyBbpEQ7LAKh/xMDM++IcPO8jwVyB7Hd3xCHVtrJa2VIC4FqB02QqkELm8 CBdeZmioPopcgftKZxWnnfxfJlifbA6S7I0QyJ1WXOx8rCP4E3LZ9LcMvp1SDm80MWsL tviLLA6tixsIb1yqVtU4ZcfXRtJg+/yTWpB/psYJL3JjEExsUa9HS7/6qk8OcY2B/h1E a86nA0wYFHLIeP047mXJeNnJ1vQe+x9uP7GC+jtW5yw1tY34OdYdfGJv4ZluA0QktO2s KtVGypkm4i44wwpfkzh3m9AVu51EZZNnosldEjxK3awefCeq7rNyrbWoT6H4TFKkEcwV X7nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from; bh=3SPoPO77JWLMUQfwkVI4qxb4FNBAPuM150pAFFaXmME=; fh=okhZ87lzfIwPGEHCxhZvpVZZn9pOFGzM1SpOSeSGawU=; b=IAOaI9f1SAuNfeyCyhu+kchDPPSbVLHOo1X2JFuCxfvXl8VoZbTCi4z80qdxFIFR+e OOwKaDAa6xIu1BtSO0UhyKkBdb2kOJGf/MTqchnAEEz1gdqcw5OBuyipijmvYQCU9ujm gxMosiQdaueKKMB0OgCBIjL+qPvTOL5mBPYoFwye7yGf6WoRnctQrN5Hrp0ZcA5QOL2Z 17DVTeGFZ4QifdLI3wQWiTEgefvu8J52dEVa6GiNkPSRasKh0fajVrZOFx2OVjCrCOqC 0XTHLOePXae6ExWSUTvGrsRXKdMaPGyl7qIwvg8eDZ66AMRF4k+H+wZu7vo2Z/RAfZ8Y 6OTA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id j15-20020a5d452f000000b0033920d16937si3637147wra.86.2024.01.22.03.55.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 03:55:16 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A77F68799D; Mon, 22 Jan 2024 12:55:15 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id D94D38797C; Mon, 22 Jan 2024 12:55:14 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 5E59587950 for ; Mon, 22 Jan 2024 12:55:12 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sughosh.ganu@linaro.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C4D3B1FB; Mon, 22 Jan 2024 03:55:57 -0800 (PST) Received: from a079122.blr.arm.com (a079122.arm.com [10.162.17.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 587633F73F; Mon, 22 Jan 2024 03:55:09 -0800 (PST) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Masahisa Kojima , Patrice Chotard , Patrick Delaunay , Yann Gautier , Etienne Carriere Subject: [PATCH 00/18] FWU: Migrate FWU metadata to version 2 Date: Mon, 22 Jan 2024 17:24:21 +0530 Message-Id: <20240122115439.653871-1-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The following patches migrate the FWU metadata access code to version 2 of the structure. This is based on the structure definition as defined in the latest rev of the FWU Multi Bank Update specification [1]. Since the version 1 of the structure has currently been adopted on a couple of platforms, it was decided to have a clean migration of the metadata to version 2 only, instead of supporting both the versions of the structure. Also, based on consultations with the main author of the specification, it is expected that any further changes in the structure would be minor tweaks, and not be significant. Hence a migration to version 2. Similar migration is also being done in TF-A, including migrating the ST platform port to support version 2 of the metadata structure [2]. The patches have been tested on STM32MP1 DK2 board and the Synquacer board from Socionext. This covers testing both the GPT and the MTD partitioned storage devices for the metadata access. [1] - https://developer.arm.com/documentation/den0118/latest/ [2] - https://review.trustedfirmware.org/q/topic:%22topics/fwu_metadata_v2_migration%22 Sughosh Ganu (18): configs: fwu: Remove FWU configs for metadata V2 migration fwu: metadata: Migrate to version 2 of the structure drivers: fwu: Add the size parameter to the metadata access API's fwu: Add some API's for metadata version 2 access lib: fwu: Make changes to support version 2 of FWU metadata drivers: fwu: mtd: Allocate buffer for image info dynamically drivers: fwu: Allocate memory for metadata copies fwu: Add a function to put a bank in Trial State capsule: Accept a bank on a successful update fwu: mtd: Modify the DFU API's to align with metadata version 2 efi_firmware: fwu: Do not read FWU metadata on sandbox efi_firmware: fwu: Get the number of FWU banks at runtime cmd: fwu: Align the command with metadata version 2 test: fwu: Align the FWU metadata access test with version 2 fwu: Remove the config symbols for number of banks and images tools: mkfwumdata: Migrate to metadata version 2 configs: fwu: Re-enable FWU configs doc: fwu: Make changes for supporting FWU Metadata version 2 arch/sandbox/Kconfig | 6 - board/armltd/corstone1000/corstone1000.c | 2 +- cmd/fwu_mdata.c | 43 +++- configs/synquacer_developerbox_defconfig | 1 - doc/board/socionext/developerbox.rst | 9 +- doc/develop/uefi/fwu_updates.rst | 12 +- doc/usage/cmd/fwu_mdata.rst | 12 +- drivers/fwu-mdata/fwu-mdata-uclass.c | 10 +- drivers/fwu-mdata/gpt_blk.c | 27 +- drivers/fwu-mdata/raw_mtd.c | 85 ++++--- include/fwu.h | 94 ++++++- include/fwu_mdata.h | 56 +++-- lib/efi_loader/efi_capsule.c | 12 +- lib/efi_loader/efi_firmware.c | 20 +- lib/fwu_updates/Kconfig | 11 - lib/fwu_updates/fwu.c | 308 ++++++++++++++++++----- lib/fwu_updates/fwu_mtd.c | 76 ++++-- test/dm/fwu_mdata.c | 56 +++-- test/dm/fwu_mdata_disk_image.h | 124 ++++----- tools/mkfwumdata.c | 43 +++- 20 files changed, 705 insertions(+), 302 deletions(-)