u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
* [PATCH v9 00/15] FWU: Add FWU Multi Bank Update feature support
@ 2022-08-26  9:57 Sughosh Ganu
  2022-08-26  9:57 ` [PATCH v9 01/15] dt/bindings: Add bindings for GPT based FWU Metadata storage device Sughosh Ganu
                   ` (14 more replies)
  0 siblings, 15 replies; 43+ messages in thread
From: Sughosh Ganu @ 2022-08-26  9:57 UTC (permalink / raw)
  To: u-boot
  Cc: Heinrich Schuchardt, Ilias Apalodimas, Takahiro Akashi,
	Patrick Delaunay, Patrice Chotard, Simon Glass, Bin Meng,
	Tom Rini, Etienne Carriere, Michal Simek, Jassi Brar


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 V8:
* Declare the metadata struct on the stack rather than heap
* Move the API's to fwu.c and only keep the DM ops in the uclass
  driver
* Fix return codes as suggested by Simon
* Change log_err to log_debug as suggested by Simon
* Remove the __packed attribute on the metadata structures as
  suggested by Simon
* Add comments to the API functions
* Rename fwu_mdata_gpt_blk.c as gpt_blk.c as suggested by Simon
* Use natural integer types instead of specific width integers as
  suggested by Simon
* Fix return codes as suggested by Simon
* Code cleanup of some superfluous error checks, like for
  dev_get_uclass_plat() function
* Use blk_get_from_parent() for getting the parent of the block device
  containing the FWU metadata
* Use STM32MP_FIP_IMAGE_GUID for the FIP GUID value as suggested by
  Yann
* Update the logic to get the update index as suggested by Jassi
* Call fwu_boottime_checks through the event interface
* Move addition of the FWU Kconfig symbols and Makefile to this patch
* Fixed spelling mistake in the commit message

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                       |  10 +
 board/st/stm32mp1/stm32mp1.c                  |  46 ++
 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              | 165 +++++
 doc/develop/uefi/index.rst                    |   1 +
 doc/develop/uefi/uefi.rst                     |   2 +
 .../firmware/fwu-mdata-gpt.yaml               |  32 +
 doc/mkeficapsule.1                            |  33 +-
 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                   | 378 +++++++++++
 include/configs/stm32mp15_common.h            |   4 +
 include/dm/uclass-id.h                        |   1 +
 include/event.h                               |   3 +
 include/fwu.h                                 | 298 +++++++++
 include/fwu_mdata.h                           |  67 ++
 lib/Kconfig                                   |   6 +
 lib/Makefile                                  |   1 +
 lib/efi_loader/efi_capsule.c                  | 213 ++++++-
 lib/efi_loader/efi_setup.c                    |   4 +-
 lib/fwu_updates/Kconfig                       |  32 +
 lib/fwu_updates/Makefile                      |   7 +
 lib/fwu_updates/fwu.c                         | 600 ++++++++++++++++++
 lib/fwu_updates/fwu_gpt.c                     | 115 ++++
 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 +++-
 44 files changed, 2631 insertions(+), 26 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 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



^ permalink raw reply	[flat|nested] 43+ messages in thread

end of thread, other threads:[~2022-09-22 13:26 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-26  9:57 [PATCH v9 00/15] FWU: Add FWU Multi Bank Update feature support Sughosh Ganu
2022-08-26  9:57 ` [PATCH v9 01/15] dt/bindings: Add bindings for GPT based FWU Metadata storage device Sughosh Ganu
2022-09-04  7:09   ` Ilias Apalodimas
2022-09-06  7:35   ` Etienne Carriere
2022-08-26  9:57 ` [PATCH v9 02/15] FWU: Add FWU metadata structure and driver for accessing metadata Sughosh Ganu
2022-09-06  7:36   ` Etienne Carriere
2022-09-07  6:45   ` Ilias Apalodimas
2022-09-07 11:02     ` Sughosh Ganu
2022-08-26  9:57 ` [PATCH v9 03/15] FWU: Add FWU metadata access driver for GPT partitioned block devices Sughosh Ganu
2022-09-06  7:01   ` Etienne Carriere
2022-09-06  7:12     ` Sughosh Ganu
2022-08-26  9:57 ` [PATCH v9 04/15] stm32mp1: dk2: Add a node for the FWU metadata device Sughosh Ganu
2022-09-06  7:37   ` Etienne Carriere
2022-08-26  9:57 ` [PATCH v9 05/15] stm32mp1: dk2: Add image information for capsule updates Sughosh Ganu
2022-09-04  7:11   ` Ilias Apalodimas
2022-09-05 19:18   ` Etienne Carriere
2022-09-06  7:08     ` Sughosh Ganu
2022-08-26  9:57 ` [PATCH v9 06/15] FWU: Add helper functions for accessing FWU metadata Sughosh Ganu
2022-09-06  7:39   ` Etienne Carriere
2022-09-07  5:59   ` Ilias Apalodimas
2022-09-07 11:05     ` Sughosh Ganu
2022-08-26  9:57 ` [PATCH v9 07/15] FWU: STM32MP1: Add support to read boot index from backup register Sughosh Ganu
2022-09-06  7:27   ` Etienne Carriere
2022-09-06  7:37     ` Sughosh Ganu
2022-09-06  7:44       ` Sughosh Ganu
2022-08-26  9:57 ` [PATCH v9 08/15] event: Add an event for main_loop Sughosh Ganu
2022-08-27  0:20   ` Simon Glass
2022-08-26  9:57 ` [PATCH v9 09/15] FWU: Add boot time checks as highlighted by the FWU specification Sughosh Ganu
2022-09-06  6:58   ` Etienne Carriere
2022-09-06  7:01   ` Etienne Carriere
2022-09-06  7:11     ` Sughosh Ganu
2022-08-26  9:57 ` [PATCH v9 10/15] FWU: Add support for the FWU Multi Bank Update feature Sughosh Ganu
2022-09-07 13:34   ` Ilias Apalodimas
2022-09-08  2:15   ` Takahiro Akashi
2022-09-08  6:34     ` Sughosh Ganu
2022-08-26  9:57 ` [PATCH v9 11/15] FWU: cmd: Add a command to read FWU metadata Sughosh Ganu
2022-09-06  7:59   ` Etienne Carriere
2022-08-26  9:57 ` [PATCH v9 12/15] test: dm: Add test cases for FWU Metadata uclass Sughosh Ganu
2022-09-04  7:10   ` Ilias Apalodimas
2022-08-26  9:57 ` [PATCH v9 13/15] mkeficapsule: Add support for generating empty capsules Sughosh Ganu
2022-09-22 13:26   ` Ilias Apalodimas
2022-08-26  9:57 ` [PATCH v9 14/15] mkeficapsule: Add support for setting OEM flags in capsule header Sughosh Ganu
2022-08-26  9:57 ` [PATCH v9 15/15] FWU: doc: Add documentation for the FWU feature Sughosh Ganu

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).