From patchwork Sat Mar 26 06:00:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 554338 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1248:0:0:0:0 with SMTP id z8csp6151218mag; Fri, 25 Mar 2022 23:00:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzI28ln7I28VQ1jEX/i/HHfihsaMDud48m6kumLdgAv62CXTnz/w0rW7gd0JeoayAyBQZyE X-Received: by 2002:a17:906:c0c8:b0:6d0:562c:2894 with SMTP id bn8-20020a170906c0c800b006d0562c2894mr15730284ejb.625.1648274440252; Fri, 25 Mar 2022 23:00:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648274440; cv=none; d=google.com; s=arc-20160816; b=FRPlTV/nQxJydCYAy5wlBOi1+kUoGfaVk4v69BnkXXa3nr3cUE0cgkPoUmhhogJMJ2 oclvis97kp6EEAtHHEorFkRQubaLGudirGKIBHsCjmuSTm+ELONuCFnHBIkb2nmrDO3a r2F+Bt4dxWQsZsaWOQQ/VrQi0OBy1LdZnSN8u09M+C8Pl9v0rTGgkF+/CUkCZ2GKXjvR 5R+sg9Yeo4F4Onq/a6yP1Z/NwUDFct1Thtgx3TGB/e80vZdHw5YudzaOeB2Gk41CKYnR gPBLEZgHbLrJjrBSYtarWGpQAZw3cAFv2BsYbuTCGJezCGzD3hzirlz4nekgYOeYi3tW 7JJQ== 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=FuQKUKO2UCQfsonfonXWyTWpTPed0z2uZTmrrDdnadQ=; b=NleYGZ7tndW/ej07vTeWuouovvwLVx+QYisET/6a5pBHeYFqJU5p56ru/Qg3e/s6OD j95V808nbUmt41iKerXZA4OliVvBC4GwsKWorNkSo86JDla3PNUMejlmURz7T0LnOaDD AZnjsJ27rDec5E6FZJY2KEahKYkbtZUu6ARNqtosaJBttYcSERGni5Gd6Oi9IBmeQAK3 5oTSs6g2itDdvLrLnqYhj0NaF57Kil5dv3g7Nv19I3XGALMhrukQbtS+vHHEd7iNRRAO kNKBr1ibI4GkYV86DpKElDlWdFrpC8VGDT2V1GC+m8jJKOq+wN4I1NE5aW3bWVRvg4hO 6Scg== 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 y16-20020a50f1d0000000b00418c2b5be27si5320290edl.265.2022.03.25.23.00.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 23:00:40 -0700 (PDT) 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 4E28E83C13; Sat, 26 Mar 2022 07:00:36 +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 6504583C13; Sat, 26 Mar 2022 07:00:34 +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 6865B839B3 for ; Sat, 26 Mar 2022 07:00:31 +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 9EF7412FC; Fri, 25 Mar 2022 23:00:30 -0700 (PDT) Received: from a076522.blr.arm.com (a076522.blr.arm.com [10.162.16.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DD0203F73D; Fri, 25 Mar 2022 23:00:26 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , AKASHI Takahiro , Ying-Chun Liu , Tuomas Tynkkynen , Heiko Thiery , Frieder Schrempf , Michael Walle , Masami Hiramatsu , Jassi Brar , Michal Simek , Michal Simek Subject: [PATCH v2 0/6] efi: capsule: Image GUID usage cleanup Date: Sat, 26 Mar 2022 11:30:06 +0530 Message-Id: <20220326060012.689960-1-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.25.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.5 at phobos.denx.de X-Virus-Status: Clean 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. 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. 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. Changes since V1: * Make changes for the xilinx boards as suggested by Michal Simek. * Add a GUID for the sandbox FIT image. * Split the capsule update test cases into two scripts, one for raw images and one for FIT images. * Add the capsule update test case for FIT images on sandbox64 and sandbox_flattree variants. * Add capsule update support on sandbox_flattree variant for enabling FIT capsule update testing as part of the python tests 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. The third patch of the series removes the test cases using the --raw and --fit parameters, removes test case for FIT images, and refactors the test scripts, one for raw images, and one for FIT images. The FIT test case is enabled on sandbox_flattree variant. 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 | 25 +++ board/socionext/developerbox/developerbox.c | 23 +++ board/xilinx/common/board.c | 18 ++ configs/sandbox64_defconfig | 1 - configs/sandbox_defconfig | 1 - configs/sandbox_flattree_defconfig | 5 + 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 | 14 ++ include/configs/synquacer.h | 14 ++ include/configs/xilinx_versal.h | 10 + include/configs/xilinx_zynqmp.h | 10 + include/configs/zynq-common.h | 10 + 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 | 21 +- .../test_capsule_firmware_fit.py | 186 ++++++++++++++++++ ...rmware.py => test_capsule_firmware_raw.py} | 169 ++++++---------- tools/eficapsule.h | 8 - tools/mkeficapsule.c | 26 +-- 32 files changed, 589 insertions(+), 231 deletions(-) create mode 100644 test/py/tests/test_efi_capsule/test_capsule_firmware_fit.py rename test/py/tests/test_efi_capsule/{test_capsule_firmware.py => test_capsule_firmware_raw.py} (76%)