From patchwork Mon Feb 12 07:47:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 772032 Delivered-To: patch@linaro.org Received: by 2002:adf:9dca:0:b0:33b:4db1:f5b3 with SMTP id q10csp2000621wre; Sun, 11 Feb 2024 23:49:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IEfsSwHAvutCuadTXebxf/M9XrfH/72W7m9kTmR9i29XAGGt8mpIOnJYz7gyeLwg/QOF+tu X-Received: by 2002:a17:906:6bc8:b0:a38:51c2:68a5 with SMTP id t8-20020a1709066bc800b00a3851c268a5mr4155976ejs.7.1707724161889; Sun, 11 Feb 2024 23:49:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707724161; cv=none; d=google.com; s=arc-20160816; b=mYBjPlzqaTaYkkOvIFtn7j2W0aspdPsF+S6af7hCU0XR7TOzhZZ8hvsLIqVduvsbbZ 39J5r49Vg8Ci1lQuJvzYqLbB4WzhvUBV0izzKTRNO+JdTGiXZcqfej45nTjx50q3P3DM r23YfMr2W6vNS0nrk3ov6JxhdHD1pp+3pOYfZ5q9oV3HxBYGRWyhfq9r222Yim+Q6MLP oIO+3wrIkU7lP0JbzAt19dD8VhgkjWj2NjKeNTi1g1GKSxyAHMD/dqelRxUJ+S0Hpz7H ep5W8JzzWWdr0+VYHmz3/W9VkCztrIxiAGht5jZ2OWCH43pn3HKZcgCZEELnH/yxa3rD /4Nw== 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:references:in-reply-to:message-id:date:subject:cc:to :from; bh=hKfccGPwyQvSy6DW6EdrLAcho+TBMbk+K9vLaVSughg=; fh=fEg8tQO37IJtiU2MrYFwth8Mlwr8t5PaKaFCgOyFBo4=; b=l17vF0bCrhyrWtuVEpWIZRegtuJCAuJco7DjdjDKt8WWhwHmd1sqntCziQqhjqjwqB 8+ubi+fRJVCPLQbnWQZ+ScVr8bRaXEaTn59O9Deuf1M4NvKDlH2A0UKGw+Nvbiwsm1Mk hW8wZk9c+l1GqFaiPmubQRiD6MbRCsQZp94D08jrIAikn4lxOBDo6Oyh0R/7fEfJOALf BRMZLJniU1wWUJX/8tekWHC6/R2aNHxLlw2IJC2+SxHefKPh6uqM9CFN9RlFuIdUGrLR rPeBo+maoBcei3q7vBt5WaqNUickfDoBu3YUmD9KjZS5RZceg75UriQjfd6v/bsOkIN0 6OXg==; darn=linaro.org 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 X-Forwarded-Encrypted: i=1; AJvYcCUmyJ0pR7rkmbmBrFWUZ/aYZ+7VqATOMElTrjcy5bmOKsUgw6O+Rky1Pqucu5NwIzi2VYMuwH/hZYXG+MwuWRo02sZKvOpozeQ4G5cs6+Du58og+owtk6OrfcnjTf2/gC+CZe4j4Aes2A5Fxo5M52Rz8uhVgRnnJFUuucT70wGIOkjGPadPzqfOWWn9de6NePHRN+APN/ZvTIDRk8uiN6xoEcJwe7fWIMKJ5N0Z9RkrIZqnOBLlThGPmpRd/YX0T2hgNChOUDYvkjDWUd3kcFZcWYI3sFJ+QUxVLYryqFOU1WDWNb/WNYqBz2qWb7cPSm1SQQaPmXWklc9qx3+fafvrN/yxtne2SXtY6FfIcaf/ZCjsDcEPpiDoTUYptoDJ0XgEidu1vPFXjwxmyXdWU+/QAyPmox9CSca3k3v2eVtOe9/si2jQ3anscagau4Defl2wdofv6gNLsxVMJtuSZqiOlyt6QSsLDi+4yxE+IgwZJWcOK0pz8T91ooA7IrAkQg5EtnmLLz4qJVQRCASpQtGjKdWCuZ/0aRvz8c6ZxViJC5nbhbrk/zYqWEQbAVvUqsnM8qR+uK+qZlLIUwqWrJ5Ys1Yt2KEfbweobnrpm/oGCdMbhqXJbJj2yoJK2l6tmpH1bO/+EPHaix7nQbjGK1dG8pZMZm3GM8mMbwxq6SiLT4fhlSSTL+96mQbSjN4yLFJr+GXOmxQ6O8OpDO31ogkYqkti7/sjbkBYqivQ1oVyTCIAPUKONMHNXM6Mlg71R1rWG+eKZCKthjJQe3jpDXq/cb0fJ+M8Rv9miIjYTczrHekffUhHeLBtA3A3fXS4afKmYfMdb8urWb0w4CXsx6XBZjKOHAMR7rqQTPezQGo3Uhw= 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 x6-20020a1709064a8600b00a35dce64af7si3717465eju.211.2024.02.11.23.49.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 23:49:21 -0800 (PST) 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 3AC2A87EED; Mon, 12 Feb 2024 08:48:15 +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 9B9BE87EC9; Mon, 12 Feb 2024 08:48:14 +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 8072A87EED for ; Mon, 12 Feb 2024 08:48:12 +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 19555DA7; Sun, 11 Feb 2024 23:48:53 -0800 (PST) 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 4D09C3F762; Sun, 11 Feb 2024 23:48:08 -0800 (PST) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Masahisa Kojima , Patrice Chotard , Patrick Delaunay , Yann Gautier , Etienne Carriere , Michal Simek , Jassi Brar , Sughosh Ganu Subject: [PATCH v2 10/21] capsule: accept a bank on a successful update Date: Mon, 12 Feb 2024 13:17:01 +0530 Message-Id: <20240212074712.3657076-11-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240212074712.3657076-1-sughosh.ganu@linaro.org> References: <20240212074712.3657076-1-sughosh.ganu@linaro.org> 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 version 2 of the FWU metadata maintains a bank_state field per bank, which keeps an aggregate status of the bank. A bank can either be in a valid, invalid, or accepted state. Update the bank_state field of the metadata once the update has gone through successfully(when skipping Trial State), or once the images in the bank have been accepted. Signed-off-by: Sughosh Ganu --- Changes since V1: None lib/efi_loader/efi_capsule.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c index 0e6a38b441..422bb11162 100644 --- a/lib/efi_loader/efi_capsule.c +++ b/lib/efi_loader/efi_capsule.c @@ -480,6 +480,12 @@ static __maybe_unused efi_status_t fwu_empty_capsule_process( if (ret != EFI_SUCCESS) log_err("Unable to set the Accept bit for the image %pUs\n", image_guid); + + status = fwu_bank_state_update(active_idx); + ret = fwu_to_efi_error(status); + if (ret != EFI_SUCCESS) + log_err("Unable to update the bank_state for bank %u\n", + active_idx); } return ret; @@ -525,6 +531,10 @@ static __maybe_unused efi_status_t fwu_post_update_process(bool fw_accept_os) status = fwu_trial_state_start(update_index); if (status < 0) ret = EFI_DEVICE_ERROR; + } else { + status = fwu_bank_state_update(update_index); + if (status < 0) + ret = EFI_DEVICE_ERROR; } }