u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: Sughosh Ganu <sughosh.ganu@linaro.org>
To: u-boot@lists.denx.de
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Takahiro Akashi <takahiro.akashi@linaro.org>,
	Patrick Delaunay <patrick.delaunay@foss.st.com>,
	Patrice Chotard <patrice.chotard@foss.st.com>,
	Simon Glass <sjg@chromium.org>, Bin Meng <bmeng.cn@gmail.com>,
	Tom Rini <trini@konsulko.com>,
	Etienne Carriere <etienne.carriere@linaro.org>,
	Michal Simek <monstr@monstr.eu>,
	Jassi Brar <jaswinder.singh@linaro.org>
Subject: [PATCH v11 00/15] FWU: Add FWU Multi Bank Update feature support
Date: Wed, 28 Sep 2022 14:59:41 +0530	[thread overview]
Message-ID: <20220928092956.2535777-1-sughosh.ganu@linaro.org> (raw)


The patchset adds support for the FWU Multi Bank Update[1]
feature. Certain aspects of the Dependable Boot[2] specification have
also been implemented.

The FWU multi bank update feature is used for supporting multiple
sets(also called banks) of firmware image(s), allowing the platform to
boot from a different bank, in case it fails to boot from the active
bank. This functionality is supported by keeping the relevant
information in a structure called metadata, which provides information
on the images. Among other parameters, the metadata structure contains
information on the currect active bank that is being used to boot
image(s).

Functionality is being added to work with the UEFI capsule driver in
u-boot. The metadata is read to gather information on the update bank,
which is the bank to which the firmware images would be flashed to. On
a successful completion of the update of all components, the active
bank field in the metadata is updated, to reflect the bank from which
the platform will boot on the subsequent boots.

Currently, the feature is being enabled on the STM32MP157C-DK2 and
Synquacer boards. The DK2 board boots a FIP image from a uSD card
partitioned with the GPT partioning scheme, while the Synquacer board
boots a FIP image from a MTD partitioned SPI NOR flash device.

This feature also requires changes in a previous stage of
bootloader, which parses the metadata and selects the bank to boot the
image(s) from. Support has being added in tf-a(BL2 stage) for the
STM32MP157C-DK2 board to boot the active bank images. These changes 
have been merged to the upstream tf-a repository.

The patch for adding a python test for the feature has been developed,
and was sent in the version 5 of the patches[3]. However, the test
script depends on adding support for the feature on MTD SPI NOR
devices, and that is being done as part of the Synquacer
patches. Hence these set of patches do not have the test script for
the feature. That will be added through the patches for adding support
for the feauture on Synquacer platform.

[1] - https://developer.arm.com/documentation/den0118/a
[2] - https://git.codelinaro.org/linaro/dependable-boot/mbfw/uploads/6f7ddfe3be24e18d4319e108a758d02e/mbfw.pdf
[3] - https://lists.denx.de/pipermail/u-boot/2022-June/485992.html

Changes since V10:
* s/fwu_update_active_index/fwu_set_active_index as per comment from
  Jassi
* Change the argument type of fwu_set_active_index() to uint from u32
  as per comment from Jassi
* s/mdata_check/check_mdata as per comment from Jassi
* Fix the typo in the function comment of fwu_mdata_check()
* Use array for storing the metadata partition numbers as suggested by
  Ilias
* Skip a couple of goto's in gpt_check_mdata_validity() as suggested
  by Ilias
* Have the FWU_MDATA_GPT_BLK config symbol depend on FWU_MDATA and BLK
* Remove the comment in fwu_gpt_mdata_check() as it is already
  mentioned in the corresponding API comment
* Remove the casting of boot_idx to a u32 as suggested by Etienne
* Remove the spurious newline addition in efi_setup.c
* Move the assignment of trial_state outside the if() as suggested by
  Jassi
* Move the computation of the image index to the FMP set_image
  function as suggested by Takahiro
* Use true and false booleans for fw_accept_os as suggested by Jassi
* Simplify the logic in efi_capsule_update_firmware() to check for the
  empty capsules before checking for fwu_update_checks_pass() as
  suggested by Jassi
* Address a couple of nits from Jassi
* Fix review comments suggested by Etienne
* Add a paragraph in the capsule update section to highlight the
  difference in ImageIndex correlation with DFU alt num with FWU feature
  enabled


Sughosh Ganu (15):
  dt/bindings: Add bindings for GPT based FWU Metadata storage device
  FWU: Add FWU metadata structure and driver for accessing metadata
  FWU: Add FWU metadata access driver for GPT partitioned block devices
  stm32mp1: dk2: Add a node for the FWU metadata device
  stm32mp1: dk2: Add image information for capsule updates
  FWU: Add helper functions for accessing FWU metadata
  FWU: STM32MP1: Add support to read boot index from backup register
  event: Add an event for main_loop
  FWU: Add boot time checks as highlighted by the FWU specification
  FWU: Add support for the FWU Multi Bank Update feature
  FWU: cmd: Add a command to read FWU metadata
  test: dm: Add test cases for FWU Metadata uclass
  mkeficapsule: Add support for generating empty capsules
  mkeficapsule: Add support for setting OEM flags in capsule header
  FWU: doc: Add documentation for the FWU feature

 arch/arm/dts/stm32mp157c-dk2-u-boot.dtsi      |   7 +
 arch/arm/mach-stm32mp/include/mach/stm32.h    |   5 +
 arch/sandbox/Kconfig                          |   6 +
 arch/sandbox/dts/test.dts                     |   7 +-
 board/sandbox/sandbox.c                       |   8 +
 board/st/stm32mp1/stm32mp1.c                  |  39 ++
 cmd/Kconfig                                   |   6 +
 cmd/Makefile                                  |   1 +
 cmd/fwu_mdata.c                               |  79 +++
 common/board_r.c                              |   3 +
 common/event.c                                |   3 +
 configs/sandbox64_defconfig                   |   5 +-
 doc/develop/uefi/fwu_updates.rst              | 173 +++++
 doc/develop/uefi/index.rst                    |   1 +
 doc/develop/uefi/uefi.rst                     |  10 +
 .../firmware/fwu-mdata-gpt.yaml               |  32 +
 doc/mkeficapsule.1                            |  33 +-
 doc/usage/cmd/fwu_mdata.rst                   |  43 ++
 doc/usage/index.rst                           |   1 +
 drivers/Kconfig                               |   2 +
 drivers/Makefile                              |   1 +
 drivers/fwu-mdata/Kconfig                     |  16 +
 drivers/fwu-mdata/Makefile                    |   8 +
 drivers/fwu-mdata/fwu-mdata-uclass.c          | 107 +++
 drivers/fwu-mdata/gpt_blk.c                   | 356 ++++++++++
 include/configs/stm32mp15_common.h            |   4 +
 include/dm/uclass-id.h                        |   1 +
 include/event.h                               |   3 +
 include/fwu.h                                 | 299 +++++++++
 include/fwu_mdata.h                           |  67 ++
 lib/Kconfig                                   |   6 +
 lib/Makefile                                  |   1 +
 lib/efi_loader/efi_capsule.c                  | 207 +++++-
 lib/efi_loader/efi_firmware.c                 |  14 +
 lib/fwu_updates/Kconfig                       |  33 +
 lib/fwu_updates/Makefile                      |   7 +
 lib/fwu_updates/fwu.c                         | 608 ++++++++++++++++++
 lib/fwu_updates/fwu_gpt.c                     | 114 ++++
 test/dm/Makefile                              |   1 +
 test/dm/fwu_mdata.c                           | 149 +++++
 test/dm/fwu_mdata_disk_image.h                | 112 ++++
 .../test_capsule_firmware_fit.py              |   1 -
 .../test_capsule_firmware_signed_fit.py       |   1 -
 tools/Makefile                                |   2 +-
 tools/eficapsule.h                            |   8 +
 tools/mkeficapsule.c                          | 109 +++-
 46 files changed, 2677 insertions(+), 22 deletions(-)
 create mode 100644 cmd/fwu_mdata.c
 create mode 100644 doc/develop/uefi/fwu_updates.rst
 create mode 100644 doc/device-tree-bindings/firmware/fwu-mdata-gpt.yaml
 create mode 100644 doc/usage/cmd/fwu_mdata.rst
 create mode 100644 drivers/fwu-mdata/Kconfig
 create mode 100644 drivers/fwu-mdata/Makefile
 create mode 100644 drivers/fwu-mdata/fwu-mdata-uclass.c
 create mode 100644 drivers/fwu-mdata/gpt_blk.c
 create mode 100644 include/fwu.h
 create mode 100644 include/fwu_mdata.h
 create mode 100644 lib/fwu_updates/Kconfig
 create mode 100644 lib/fwu_updates/Makefile
 create mode 100644 lib/fwu_updates/fwu.c
 create mode 100644 lib/fwu_updates/fwu_gpt.c
 create mode 100644 test/dm/fwu_mdata.c
 create mode 100644 test/dm/fwu_mdata_disk_image.h

-- 
2.34.1



             reply	other threads:[~2022-09-28  9:30 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-28  9:29 Sughosh Ganu [this message]
2022-09-28  9:29 ` [PATCH v11 01/15] dt/bindings: Add bindings for GPT based FWU Metadata storage device Sughosh Ganu
2022-09-28  9:29 ` [PATCH v11 02/15] FWU: Add FWU metadata structure and driver for accessing metadata Sughosh Ganu
2022-09-30  5:54   ` Etienne Carriere
2022-10-03  6:27     ` Sughosh Ganu
2022-09-28  9:29 ` [PATCH v11 03/15] FWU: Add FWU metadata access driver for GPT partitioned block devices Sughosh Ganu
2022-09-30  6:10   ` Etienne Carriere
2022-09-28  9:29 ` [PATCH v11 04/15] stm32mp1: dk2: Add a node for the FWU metadata device Sughosh Ganu
2022-09-28  9:29 ` [PATCH v11 05/15] stm32mp1: dk2: Add image information for capsule updates Sughosh Ganu
2022-09-30  5:51   ` Etienne Carriere
2022-10-03 10:56   ` Takahiro Akashi
2022-10-03 11:10     ` Sughosh Ganu
2022-10-04  3:04       ` Takahiro Akashi
2022-09-28  9:29 ` [PATCH v11 06/15] FWU: Add helper functions for accessing FWU metadata Sughosh Ganu
2022-10-03  9:51   ` Ilias Apalodimas
2022-09-28  9:29 ` [PATCH v11 07/15] FWU: STM32MP1: Add support to read boot index from backup register Sughosh Ganu
2022-09-28  9:29 ` [PATCH v11 08/15] event: Add an event for main_loop Sughosh Ganu
2022-09-28  9:29 ` [PATCH v11 09/15] FWU: Add boot time checks as highlighted by the FWU specification Sughosh Ganu
2022-10-03  9:56   ` Ilias Apalodimas
2022-10-03 10:31     ` Sughosh Ganu
2022-09-28  9:29 ` [PATCH v11 10/15] FWU: Add support for the FWU Multi Bank Update feature Sughosh Ganu
2022-09-28  9:29 ` [PATCH v11 11/15] FWU: cmd: Add a command to read FWU metadata Sughosh Ganu
2022-09-28  9:29 ` [PATCH v11 12/15] test: dm: Add test cases for FWU Metadata uclass Sughosh Ganu
2022-09-28  9:29 ` [PATCH v11 13/15] mkeficapsule: Add support for generating empty capsules Sughosh Ganu
2022-09-28  9:29 ` [PATCH v11 14/15] mkeficapsule: Add support for setting OEM flags in capsule header Sughosh Ganu
2022-09-28  9:29 ` [PATCH v11 15/15] FWU: doc: Add documentation for the FWU feature Sughosh Ganu
2022-09-30  6:27   ` Etienne Carriere
2022-09-30  8:23     ` Sughosh Ganu
2022-10-04  2:54   ` Takahiro Akashi
2022-10-04  6:40     ` Sughosh Ganu
2022-10-04  7:09       ` Takahiro Akashi
2022-10-04  7:46         ` Ilias Apalodimas
2022-10-02 23:50 ` [PATCHv2 0/5] FWU: Add support for mtd backed feature on DeveloperBox jassisinghbrar
2022-10-02 23:51   ` [PATCHv2 1/5] FWU: Add FWU metadata access driver for MTD storage regions jassisinghbrar
2022-10-14  7:07     ` Ilias Apalodimas
2022-10-31 23:37       ` Jassi Brar
2022-10-02 23:51   ` [PATCHv2 2/5] FWU: mtd: Add helper functions for accessing FWU metadata jassisinghbrar
2022-10-14  7:10     ` Ilias Apalodimas
2022-10-02 23:51   ` [PATCHv2 3/5] dt: fwu: developerbox: enable fwu banks and mdata regions jassisinghbrar
2022-10-14  7:33     ` Ilias Apalodimas
2022-10-02 23:52   ` [PATCHv2 4/5] fwu: DeveloperBox: add support for FWU jassisinghbrar
2022-10-03 11:04     ` AKASHI Takahiro
2022-10-03 13:40       ` Jassi Brar
2022-10-03 13:51         ` Ilias Apalodimas
2022-10-04  1:06           ` AKASHI Takahiro
2022-10-04  2:00             ` Jassi Brar
2022-10-04  2:44               ` AKASHI Takahiro
2022-10-04  2:53                 ` Jassi Brar
2022-10-02 23:52   ` [PATCHv2 5/5] tools: Add mkfwumdata tool for FWU metadata image jassisinghbrar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220928092956.2535777-1-sughosh.ganu@linaro.org \
    --to=sughosh.ganu@linaro.org \
    --cc=bmeng.cn@gmail.com \
    --cc=etienne.carriere@linaro.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jaswinder.singh@linaro.org \
    --cc=monstr@monstr.eu \
    --cc=patrice.chotard@foss.st.com \
    --cc=patrick.delaunay@foss.st.com \
    --cc=sjg@chromium.org \
    --cc=takahiro.akashi@linaro.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).