public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: Sughosh Ganu <sughosh.ganu@linaro.org>
Cc: u-boot@lists.denx.de, Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Ying-Chun Liu <paul.liu@linaro.org>,
	Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>,
	Heiko Thiery <heiko.thiery@gmail.com>,
	Frieder Schrempf <frieder.schrempf@kontron.de>,
	Michael Walle <michael@walle.cc>,
	Masami Hiramatsu <masami.hiramatsu@linaro.org>,
	Jassi Brar <jaswinder.singh@linaro.org>,
	Michal Simek <monstr@monstr.eu>,
	Michal Simek <michal.simek@xilinx.com>
Subject: Re: [RFC PATCH 0/6] efi: capsule: Image GUID usage cleanup
Date: Fri, 25 Mar 2022 13:53:04 +0900	[thread overview]
Message-ID: <20220325045304.GA50025@laputa> (raw)
In-Reply-To: <20220324123901.429472-1-sughosh.ganu@linaro.org>

Sughosh,

On Thu, Mar 24, 2022 at 06:08:55PM +0530, Sughosh Ganu wrote:
> 
> This series is cleaning up the usage of the image GUIDs that are used
> in capsule update and the EFI System Resource Table(ESRT).
> 
> Currently, there are two instances of the Firmware Management
> Protocol(FMP), one defined for updating the FIT images, and the other
> for updating raw images. The FMP code defines two GUID values, one for
> all FIT images, and one for raw images. Depending on the FMP instance
> used on a platform, the platform needs to use the corresponding image
> GUID value for all images on the platform, and also across platforms.
> 
> A few issues are being fixed through the patch series. One, that an
> image for a different platform can be flashed on another platform if
> both the platforms are using the same FMP instance. So, for e.g. a
> capsule generated for the Socionext DeveloperBox platform can be
> flashed on the ZynqMP platform, since both the platforms use the
> CONFIG_EFI_CAPSULE_FIRMWARE_RAW instance of the FMP. This can be
> corrected if each firmware image that can be updated through the
> capsule update mechanism has it's own unique image GUID.

Ok although the specification doesn't explicitly require the uniqueness
"across platforms".

> The second issue that this patch series fixes is the value of FwClass
> in the ESRT. With the current logic, all firmware image entries in the
> ESRT display the same GUID value -- either the FIT GUID or the raw
> GUID. This is not in compliance with the UEFI specification, as the
> specification requires all entries to have unique GUID values.

Well, this is *not* a problem of fit FMP driver, but a matter of how
ESRT is populated. Table 23-16 "ESRT and FMP Fields" says,
        The ImageTypeId GUID from the Firmware
        Management Protocol instance for a device is
        used as the Firmware Class GUID in the ESRT.
        Where there are multiple identical devices in
        the system, system firmware must create a
        mapping to ensure that the ESRT FwClass
        GUIDs are unique and consistent.
The second sentence suggests that UEFI implementation, i.e.
efi_esrt_populate(), may and should allow some *mapping*.

That said, I basically accept the requirement that you mention above.

> The third issue being fixed is the population of the
> EFI_FIRMWARE_IMAGE_DESCRIPTOR array. The current code uses the dfu
> framework for populating the image descriptor array. However, there
> might be other images that are not to be updated through the capsule
> update mechanism also registered with the dfu framework. As a result
> of this, the ESRT will show up entries of images that are not to be
> targeted by the capsule update mechanism.
> 
> These issues are being fixed by defining a structure, efi_fw_images. A
> platform can then define image related information like the image GUID
> and image name. Every platform that uses capsule update mechanism
> needs to define fw_images array. This array will then be used to
> populate the image descriptor array, and also in determining if a
> particular capsule's payload can be used for updating an image on the
> platform.

When ESRT support patch was posted, I proposed that we should have
a kind of configuration table that defines all the firmware on the system
for ESRT, but this proposal was rejected.
Your efi_fw_images[] looks quite similar as what I had in mind.
Why not define efi_fw_images[] as ESRT itself.
(Of course, some fields in an entry can still be populated through
GetImageInfo API.)

> The first patch of this series adds the fw_images array in all
> platforms which are using UEFI capsule updates
> 
> The second patch of the series changes the logic for populating the
> image descriptor array, using the information from the fw_images array
> defined by the platform.

So a FIT image can still work as a single binary of firmware
under FIT FMP driver. Correct?

> The third patch of the series removes the test cases using the --raw
> and --fit parameters, removes test case for FIT images, and adds a
> test case for checking that the update happens only with the correct
> image GUID value in the capsule.

Your change in test_capsule_firmware.py tries to remove FIT FMP
driver test and it eventually hides the fact that FIT driver may get broken.

I expect that you should maintain FIT FMP driver properly and it be
tested as before.
# Moreover, you have not yet added capsule authentication support
to FIT FMP driver.

-Takahiro Akashi

> 
> The fourth patch of the series makes corresponding changes in the
> capsule update related documentation.
> 
> The fifth patch of the series removes the now unused FIT and raw image
> GUID values from the FMP module.
> 
> The sixth patch of the series removes the --raw and --fit command line
> parameters in the mkeficapsule utility.
> 
> 
> Sughosh Ganu (6):
>   capsule: Add Image GUIDs for platforms using capsule updates
>   capsule: FMP: Populate the image descriptor array from platform data
>   test: capsule: Modify the capsule tests to use GUID values for sandbox
>   doc: uefi: Update the capsule update related documentation
>   FMP: Remove GUIDs for FIT and raw images
>   mkeficapsule: Remove raw and FIT GUID types
> 
>  .../imx8mp_rsb3720a1/imx8mp_rsb3720a1.c       |  19 ++
>  .../imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c   |  18 ++
>  board/emulation/qemu-arm/qemu-arm.c           |  20 +++
>  board/kontron/pitx_imx8m/pitx_imx8m.c         |  15 +-
>  board/kontron/sl-mx8mm/sl-mx8mm.c             |  14 ++
>  board/kontron/sl28/sl28.c                     |  14 ++
>  board/sandbox/sandbox.c                       |  17 ++
>  board/socionext/developerbox/developerbox.c   |  23 +++
>  board/xilinx/common/board.h                   |  18 ++
>  board/xilinx/zynq/board.c                     |  18 ++
>  board/xilinx/zynqmp/zynqmp.c                  |  18 ++
>  configs/sandbox64_defconfig                   |   1 -
>  configs/sandbox_defconfig                     |   1 -
>  doc/develop/uefi/uefi.rst                     |  10 +-
>  include/configs/imx8mm-cl-iot-gate.h          |  10 ++
>  include/configs/imx8mp_rsb3720.h              |  10 ++
>  include/configs/kontron-sl-mx8mm.h            |   6 +
>  include/configs/kontron_pitx_imx8m.h          |   6 +
>  include/configs/kontron_sl28.h                |   6 +
>  include/configs/qemu-arm.h                    |  10 ++
>  include/configs/sandbox.h                     |  10 ++
>  include/configs/synquacer.h                   |  14 ++
>  include/efi_api.h                             |   8 -
>  include/efi_loader.h                          |  18 ++
>  lib/efi_loader/efi_firmware.c                 |  95 +++-------
>  test/py/tests/test_efi_capsule/conftest.py    |  20 +--
>  .../test_efi_capsule/test_capsule_firmware.py | 167 ++++++------------
>  tools/eficapsule.h                            |   8 -
>  tools/mkeficapsule.c                          |  26 +--
>  29 files changed, 384 insertions(+), 236 deletions(-)
> 
> -- 
> 2.25.1
> 
> 

  parent reply	other threads:[~2022-03-25  4:53 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-24 12:38 [RFC PATCH 0/6] efi: capsule: Image GUID usage cleanup Sughosh Ganu
2022-03-24 12:38 ` [RFC PATCH 1/6] capsule: Add Image GUIDs for platforms using capsule updates Sughosh Ganu
2022-03-24 13:36   ` Michal Simek
2022-03-24 14:44     ` Sughosh Ganu
2022-03-24 14:51       ` Michal Simek
2022-03-24 14:56         ` Sughosh Ganu
2022-03-24 13:44   ` Masami Hiramatsu
2022-03-24 14:40     ` Sughosh Ganu
2022-03-25  1:09       ` Masami Hiramatsu
2022-03-25  5:28         ` Masami Hiramatsu
2022-03-25  9:59           ` Sughosh Ganu
2022-03-26 10:47             ` Masami Hiramatsu
2022-03-27  9:11               ` Sughosh Ganu
2022-03-28  0:01                 ` Masami Hiramatsu
2022-03-24 12:38 ` [RFC PATCH 2/6] capsule: FMP: Populate the image descriptor array from platform data Sughosh Ganu
2022-03-24 12:38 ` [RFC PATCH 3/6] test: capsule: Modify the capsule tests to use GUID values for sandbox Sughosh Ganu
2022-03-24 12:38 ` [RFC PATCH 4/6] doc: uefi: Update the capsule update related documentation Sughosh Ganu
2022-03-24 12:39 ` [RFC PATCH 5/6] FMP: Remove GUIDs for FIT and raw images Sughosh Ganu
2022-03-25 14:33   ` Ilias Apalodimas
2022-03-24 12:39 ` [RFC PATCH 6/6] mkeficapsule: Remove raw and FIT GUID types Sughosh Ganu
2022-03-24 13:30   ` Michal Simek
2022-03-24 14:51     ` Sughosh Ganu
2022-03-24 15:10       ` Michal Simek
2022-03-24 15:34         ` Sughosh Ganu
2022-03-25 14:51           ` Ilias Apalodimas
2022-03-25  4:53 ` AKASHI Takahiro [this message]
2022-03-25  9:44   ` [RFC PATCH 0/6] efi: capsule: Image GUID usage cleanup Sughosh Ganu
2022-03-25 10:41     ` AKASHI Takahiro

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=20220325045304.GA50025@laputa \
    --to=takahiro.akashi@linaro.org \
    --cc=frieder.schrempf@kontron.de \
    --cc=heiko.thiery@gmail.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jaswinder.singh@linaro.org \
    --cc=masami.hiramatsu@linaro.org \
    --cc=michael@walle.cc \
    --cc=michal.simek@xilinx.com \
    --cc=monstr@monstr.eu \
    --cc=paul.liu@linaro.org \
    --cc=sughosh.ganu@linaro.org \
    --cc=tuomas.tynkkynen@iki.fi \
    --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