From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8B158C77B61 for ; Tue, 11 Apr 2023 01:48:54 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9D73585DF4; Tue, 11 Apr 2023 03:48:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="kA2KCimd"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3915385DA6; Tue, 11 Apr 2023 03:48:31 +0200 (CEST) Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D854C85AA1 for ; Tue, 11 Apr 2023 03:48:20 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1a52648fcddso1592605ad.0 for ; Mon, 10 Apr 2023 18:48:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681177699; x=1683769699; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:from:to:cc :subject:date:message-id:reply-to; bh=tw2NMnavDn7sJkZ2gpzhprzGBhDLl+poc6+jKY7fjto=; b=kA2KCimdME28RJSyKtTOVWOqV/Wlk3Ix8aj5r2/bfrRRrvpIrkVSs3WKHZUofUOEqO d5Fi/3l5TViqMI5i2yhqpp9onoQ9TTJbdo0H1BQwBPbiA8zvfyhjvMA+aIu1qDcMidv2 dvwnFo0MTSRnaEwud9r0dk5FGWuuS23r6wL5IRLGGs/6zQ37O1LlsKQ7652wPzDgk1Qt A5WF3EjRWLyTskUVh6+XYEWqBlk+8+fmcgstoFuxTjYYs2s0Pu6Y4c2ywG8i04RC3A/N jAGWcneMziepPdawTzMD9lFl7t/egQL7NB/k7o3qeJdXS/2PDxg6S0neWlo+67Bd9Yca 84Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681177699; x=1683769699; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=tw2NMnavDn7sJkZ2gpzhprzGBhDLl+poc6+jKY7fjto=; b=ApLlRLNT2Zqoe+zCgMA2TYWz6185kGoF2SMP+lZhTZnfEa+SvH7IdHKULjaEPbYoi1 V2muC+PHraVDzKxoefJKG30iKWuE9O6dfjLGV7EZ4z9ObDVqGXicZYBw7QgiMeMU8p+B 0R9Ti+Zva6TwYODF0jMZUE2GzQ1ScEtCCuf+84v5WfgHJUORVSatvXMtwt1CMGbXSwU5 FC5MJ53erU7+tJ4FlNGho4Ih2cXyahHvnhun9G1/viEaQggHP8nkemRWJkSXETGn1OMQ 56mtrrL0OT3E0To5Zopk7j5dDBXETJrhj6MFP1PFYBaZdnl4RYUAVGI37h7khZoQAT9L JbvA== X-Gm-Message-State: AAQBX9fF3d5SCx6J0dLWZSLI+j0cycAmvsLKa/my0e5zl1un/kZOq1R/ z4WAVO+mt1lFf2yy9e7U5nKOhw== X-Google-Smtp-Source: AKy350ZJ/4QryujcgYY1v0dx5pOSYn9Q1Bir+nOxHK0Jwk0eq673/vp1FuMm85nRE7u+6o1G3Rzrcg== X-Received: by 2002:a05:6a20:3c8b:b0:e9:1dd:dafc with SMTP id b11-20020a056a203c8b00b000e901dddafcmr15070698pzj.4.1681177698938; Mon, 10 Apr 2023 18:48:18 -0700 (PDT) Received: from laputa ([2400:4050:c3e1:100:82f4:ef6d:6c7e:b9dc]) by smtp.gmail.com with ESMTPSA id d18-20020aa78152000000b005d61829db4fsm8389682pfn.168.2023.04.10.18.48.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Apr 2023 18:48:18 -0700 (PDT) Date: Tue, 11 Apr 2023 10:48:15 +0900 From: Takahiro Akashi To: Masahisa Kojima Cc: u-boot@lists.denx.de, Heinrich Schuchardt , Ilias Apalodimas Subject: Re: [PATCH v5 0/4] FMP versioning support Message-ID: <20230411014815.GA36196@laputa> Mail-Followup-To: Takahiro Akashi , Masahisa Kojima , u-boot@lists.denx.de, Heinrich Schuchardt , Ilias Apalodimas References: <20230410090732.1676-1-masahisa.kojima@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230410090732.1676-1-masahisa.kojima@linaro.org> 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 Hi Kojima-san, On Mon, Apr 10, 2023 at 06:07:28PM +0900, Masahisa Kojima wrote: > Firmware version management is not implemented in the current > FMP implementation. This series aims to add the versioning support > in FMP. > > There is a major design change in v5. > Until v4, the fw_version and lowest_supported_version are stored > as a EFI variable. If the backing storage is a file we can't trust > any of that information since anyone can tamper with the file, > although the variables are defined as RO. > With that, we store the version information in the device tree > in v5. We can trust the information from dtb as long as the former > stage boot loader verifies the image containing the dtb. I have a basic question here. You said that the former-stage boot loader is responsible for maintaining the dtb with the correct firmware version to be passed to U-Boot. But how can it obtain the new version number of firmware which is only contained in a capsule file (and its header)? Looking into you pytest, you simply always *reboot* the sandbox with an already-modified dtb (test_ver.dtb). (Please note that, at the reboot time, a capsule has not been applied yet.) I believe that your current approach is rather incomplete as a workable solution. -Takahiro Akashi > The disadvantage of this design change is that we need to maintain > the fw_version in both device tree and FMP Payload Header. > It is inevitable since not all the capsule files contain the dtb. > > EDK II reference implementation utilizes the FMP Payload Header > inserted right before the capsule payload. With this series, > U-Boot also follows the EDK II implementation. > > Currently, there is no way to know the current running firmware > version through the EFI interface. FMP->GetImageInfo() returns > always 0 for the version number. So a user can not know that > expected firmware is running after the capsule update. > > With this series applied, version number can be specified > in the capsule file generation with mkeficapsule tool, then > user can know the running firmware version through > FMP->GetImageInfo() and ESRT. > > Note that this series does not mandate the FMP Payload Header, > compatible with boards that are already using the existing > U-Boot FMP implementation. > If no FMP Payload Header is found in the capsule file, fw_version, > lowest supported version, last attempt version and last attempt > status is set to 0 and this is the same behavior as existing FMP > implementation. > > Major Changes in v5: > - major design changes, versioning is implemented with > device tree instead of EFI variable > > Major Changes in v4: > - add python-based test > > Major Changes in v3: > - exclude CONFIG_FWU_MULTI > > Masahisa Kojima (4): > efi_loader: get version information from device tree > efi_loader: check lowest supported version > mkeficapsule: add FMP Payload Header > test/py: efi_capsule: test for FMP versioning > > .../firmware/firmware-version.txt | 25 +++ > doc/mkeficapsule.1 | 10 + > lib/efi_loader/efi_firmware.c | 187 +++++++++++++--- > test/py/tests/test_efi_capsule/conftest.py | 73 +++++++ > .../test_capsule_firmware_fit.py | 187 ++++++++++++++++ > .../test_capsule_firmware_raw.py | 201 ++++++++++++++++++ > .../test_capsule_firmware_signed_fit.py | 165 ++++++++++++++ > .../test_capsule_firmware_signed_raw.py | 169 +++++++++++++++ > test/py/tests/test_efi_capsule/version.dts | 27 +++ > tools/eficapsule.h | 30 +++ > tools/mkeficapsule.c | 37 +++- > 11 files changed, 1082 insertions(+), 29 deletions(-) > create mode 100644 doc/device-tree-bindings/firmware/firmware-version.txt > create mode 100644 test/py/tests/test_efi_capsule/version.dts > > -- > 2.17.1 >