From patchwork Mon Sep 9 11:20:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 826577 Delivered-To: patch@linaro.org Received: by 2002:adf:a345:0:b0:367:895a:4699 with SMTP id d5csp1942587wrb; Mon, 9 Sep 2024 04:20:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXggcyovVt+OUrKs6P2pgyMNYjri4TbO3StfqZqdugAQbraNYwX3ytlqmCTmUEhH4NQAXGvlA==@linaro.org X-Google-Smtp-Source: AGHT+IHE0zm8zZei9xYA34QMDr1Ps/ZFdy0MBJD51oxuIrgXclQTKG7dIF2KqFjjETGkuohk8Kkl X-Received: by 2002:a5d:6988:0:b0:374:bde7:d148 with SMTP id ffacd0b85a97d-37892685e63mr4698962f8f.1.1725880838728; Mon, 09 Sep 2024 04:20:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725880838; cv=none; d=google.com; s=arc-20240605; b=ihfaKvki9meC5xURElNgftoDH7HKJoRyB4p0YEi0tSd6mPCUPrPNlKByBD9+fCsCmL FgF1WPM0RUocdK+Pl+OX8weSZY6M5Qnv2XDox/tGT7h+Gaw/oDDZoWTOwJffws3LMx3K /LOZJ3AjIZjMF65jWrk4xWa+JVRTGmzbfHi7zOmGj+FpLtelMXGr31a7cgNex9m1qYQL nJ961uMxVfQZ6VpBXjS9T+bNwb7kI7sM4foePM5bZ3bI7AXeHjOREjilaeiUekQObII7 g7nv0HughCwBk9YH0WBhuf0ou4yWTj3nlNzZ0qVH+okLWyUQ41TzZOEn5pEAdpC6eyip hc3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=xS+gO6ejqjsfusTr5O+82pZyAFU9KmYrt4ugbk3EJB8=; fh=KML96dCI2dDOPHJfp1P5tqe//NaOtRS04jCoF0Bug6A=; b=Pl0d6RRoV4TBN5RpJalmaoe8gkI/gpTyAWyVpsoeJaE7To5hEykdaeTJdUz38KaPBO LVropUk/+VPyPlubEb6xVr31pqM2MRMWcYW82+b8i0SgA5zhJY/LpVxG6rxKPjh8+I11 OAjJHE+mTet3mvdsG4SQWl6bmDfDKVo7MWV1mnzcHQau4oZKTzXPtssYo0de15wkbD81 9xHzaNqzqaOvldvg0TVhgR8TwoRKK/NSKlrx3pLx9pMR0QQEXliyNzrQqVrnNWbq4JJR g9GrfJHN7E5zocO0UXVQF/LO4pMWGXnTU/l4utc90+5lyAVKIacRqX+hv0nUwT0/iPEk k9lA==; dara=google.com 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 5b1f17b1804b1-42caebb03ffsi24296585e9.171.2024.09.09.04.20.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2024 04:20:38 -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 E8FF288D9C; Mon, 9 Sep 2024 13:20:37 +0200 (CEST) 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 5056188D9A; Mon, 9 Sep 2024 13:20:37 +0200 (CEST) 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, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_NONE,SPF_SOFTFAIL 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 5079188CBD for ; Mon, 9 Sep 2024 13:20:35 +0200 (CEST) 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 42453FEC; Mon, 9 Sep 2024 04:21:03 -0700 (PDT) Received: from a079122.blr.arm.com (a079122.arm.com [10.162.17.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 230A93F73B; Mon, 9 Sep 2024 04:20:32 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Michal Simek , Ilias Apalodimas , Heinrich Schuchardt Subject: [PATCH v2 0/6] Miscellaneous FWU fixes Date: Mon, 9 Sep 2024 16:50:15 +0530 Message-Id: <20240909112021.1962801-1-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.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.8 at phobos.denx.de X-Virus-Status: Clean The following set of patches are miscellaneous fixes and some hardening of the FWU update logic. Changes since V1: * Squash patch 1 and 2 in the earlier version into a single patch. * Have a single check for image descriptor offset, and have a log message mention that image descriptor mandatory. * Use a macro FWU_IMG_DESC_OFFSET for the image descriptor offset. * Use the enum names for primary and secondary partitions from fwu.h instead of defining new macros. Sughosh Ganu (6): fwu: v2: try reading both copies of metadata fwu: v1: do a version check for the metadata fwu: check all images for transitioning out of Trial State fwu: add dependency checks for selecting FWU metadata version fwu: do not allow capsule processing on exceeding Trial Counter threshold fwu: print a message if empty capsule checks fail include/fwu.h | 11 +++++ lib/efi_loader/efi_capsule.c | 11 +++-- lib/fwu_updates/Kconfig | 1 + lib/fwu_updates/fwu.c | 31 +++++++++++++- lib/fwu_updates/fwu_v1.c | 18 ++++++-- lib/fwu_updates/fwu_v2.c | 81 ++++++++++++++++++++---------------- 6 files changed, 108 insertions(+), 45 deletions(-) Tested-by: Michal Simek