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 81831C433F5 for ; Mon, 31 Jan 2022 09:19:15 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9300483677; Mon, 31 Jan 2022 10:19:12 +0100 (CET) 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="ebFJjcXU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6D8758342C; Mon, 31 Jan 2022 10:19:09 +0100 (CET) Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) (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 2D6AF831F8 for ; Mon, 31 Jan 2022 10:19:06 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=masami.hiramatsu@linaro.org Received: by mail-pj1-x102d.google.com with SMTP id oa14-20020a17090b1bce00b001b61aed4a03so11811923pjb.5 for ; Mon, 31 Jan 2022 01:19:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=q5iRLj5pXydNTfkMyNfbG+EJFce3wCGI5N7tlf/8VzA=; b=ebFJjcXUYUrsXw7PBs7DVKTnUz1+1DY4DrmQe/Qf7FrXR/MhpOmXHzEkxLK2zbxNPK VBc56IYacYd8907RTo29YxOR0b0yZ7Y5Jwr4nAd4IAoHQ7s32bVDRAfV5SD0xiBFqMDq jFxO+TIdGaBOqLKTLof/b/Pf/ytlaQgjiO0i5wWQJa8I2Ao6f6G/CzbQtn2k6lgGcoPX QQZnJC/Rxj2nejgHma0ldb1nU1Gj4R2CpISh5JFFJ7zVKN1esCLg26bBFEZbRagsX7YO t05SJZbX37kVTCQV6jrQQuUJxrmlF5skWB7961PqpeBlCpMR+wS3vHiecUSvzJKI7yGr xvNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=q5iRLj5pXydNTfkMyNfbG+EJFce3wCGI5N7tlf/8VzA=; b=AUyyvab83YKbbGmUapqNUnDJVkFgdd2MHT+eIPV5Wp4ERlwVk9BLEUdzNF7Z2JB3IR o9Bls5iSnl1XVgFxWLY/Hu4smv04CIfyGpGplnN7M1UWJDIeyMm5apAxONhLMHguz3gX QTc1Z3QmVg0G413m1paA0Jae12K/mc5B3OLHW7hkMsWez00FRXWVkgQg5naea25hgRVD r5t4IinkdYoGXgIvCRxFvgJDsfGunzfk/tnmAdvZ6xLD/KSAoUQdZvwdqeOFDprf9Wml dE2Otae8fcKiFywDrFAOmhZLft9PheiydJX48ZIto75Eb6z6EJSmurwRCGVpb2ZUpGto KC6w== X-Gm-Message-State: AOAM532rObAJb2MZEiAOsUhLGvbmZe3CGuf+q8xp7eNjSpHcQfRj0o5b RGYEGP0TYy9ngZ8hkzs4UJVRqMJgW4meFQ== X-Google-Smtp-Source: ABdhPJwtrlIGEAx+m0TyEbOTkjXa8bVWH3187F8rlc1V7VkkmwP7jOoATKAs2fO/xRV3xzWSgLg/eQ== X-Received: by 2002:a17:902:d507:: with SMTP id b7mr19647936plg.11.1643620744417; Mon, 31 Jan 2022 01:19:04 -0800 (PST) Received: from localhost.localdomain (113x37x226x201.ap113.ftth.ucom.ne.jp. [113.37.226.201]) by smtp.gmail.com with ESMTPSA id 9sm9008049pjg.50.2022.01.31.01.19.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jan 2022 01:19:04 -0800 (PST) From: Masami Hiramatsu To: u-boot@lists.denx.de Cc: Masami Hiramatsu , Patrick Delaunay , Patrice Chotard , Heinrich Schuchardt , Alexander Graf , AKASHI Takahiro , Simon Glass , Bin Meng , Ilias Apalodimas , Jose Marinho , Grant Likely , Tom Rini , Etienne Carriere , Sughosh Ganu , Paul Liu Subject: [PATCH 2/2] efi_loader: Reset system after CapsuleUpdate on disk Date: Mon, 31 Jan 2022 18:19:00 +0900 Message-Id: <164362073982.312714.10153796355309762567.stgit@localhost> X-Mailer: git-send-email 2.25.1 In-Reply-To: <164362071931.312714.14793570668139727572.stgit@localhost> References: <164362071931.312714.14793570668139727572.stgit@localhost> User-Agent: StGit/0.19 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit 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 Add a config option to reset system soon after processing capsule update on disk. This is required in UEFI specification 2.9 Section 8.5.5 "Delivery of Capsules via file on Mass Storage device" as; In all cases that a capsule is identified for processing the system is restarted after capsule processing is completed. Signed-off-by: Masami Hiramatsu --- lib/efi_loader/Kconfig | 10 ++++++++++ lib/efi_loader/efi_capsule.c | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index 24f9a2bb75..db05c3ad90 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -146,6 +146,16 @@ config EFI_IGNORE_OSINDICATIONS without setting the EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED flag in variable OsIndications. +config EFI_RESET_AFTER_CAPSULE_ON_DISK + bool "Reset right after CapsuleUpdate on-disk" + depends on EFI_CAPSULE_ON_DISK + default y + help + UEFI specification requests the system to be restarted after capsule + processing is complete. This implements that, but for some reason, + if you want to keep the (old) system running after the capsule update + on-disk, you can say 'n' here. + config EFI_CAPSULE_ON_DISK_EARLY bool "Initiate capsule-on-disk at U-Boot boottime" depends on EFI_CAPSULE_ON_DISK diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c index 98dab1c6f5..44d4fa2f82 100644 --- a/lib/efi_loader/efi_capsule.c +++ b/lib/efi_loader/efi_capsule.c @@ -1142,6 +1142,15 @@ efi_status_t efi_launch_capsules(void) free(files[i]); free(files); + /* + * UEFI spec requires to reset system after complete processing capsule + * update on the storage. + */ + if (IS_ENABLED(CONFIG_EFI_RESET_AFTER_CAPSULE_ON_DISK)) { + log_info("Restarting the system to boot the updated firmware.\n"); + do_reset(NULL, 0, 0, NULL); + } + if (IS_ENABLED(CONFIG_EFI_ESRT)) { /* Rebuild the ESRT to reflect any updated FW images. */ ret = efi_esrt_populate();