All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <masami.hiramatsu@linaro.org>
To: u-boot@lists.denx.de
Cc: Masami Hiramatsu <masami.hiramatsu@linaro.org>,
	Patrick Delaunay <patrick.delaunay@foss.st.com>,
	Patrice Chotard <patrice.chotard@foss.st.com>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Alexander Graf <agraf@csgraf.de>,
	AKASHI Takahiro <takahiro.akashi@linaro.org>,
	Simon Glass <sjg@chromium.org>, Bin Meng <bmeng.cn@gmail.com>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Jose Marinho <jose.marinho@arm.com>,
	Grant Likely <grant.likely@arm.com>,
	Tom Rini <trini@konsulko.com>,
	Etienne Carriere <etienne.carriere@linaro.org>,
	Sughosh Ganu <sughosh.ganu@linaro.org>,
	Paul Liu <paul.liu@linaro.org>
Subject: [PATCH 2/2] efi_loader: Reset system after CapsuleUpdate on disk
Date: Mon, 31 Jan 2022 18:19:00 +0900	[thread overview]
Message-ID: <164362073982.312714.10153796355309762567.stgit@localhost> (raw)
In-Reply-To: <164362071931.312714.14793570668139727572.stgit@localhost>

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 <masami.hiramatsu@linaro.org>
---
 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();


  parent reply	other threads:[~2022-01-31  9:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-31  9:18 [PATCH 0/2] EFI: Reset system after capsule-on-disk Masami Hiramatsu
2022-01-31  9:18 ` [PATCH 1/2] efi_loader: Avoid using efi_update_capsule() from update capsule on disk Masami Hiramatsu
2022-01-31 19:26   ` Heinrich Schuchardt
2022-02-01  2:21     ` Masami Hiramatsu
2022-01-31  9:19 ` Masami Hiramatsu [this message]
2022-01-31 11:19   ` [PATCH 2/2] efi_loader: Reset system after CapsuleUpdate " Grant Likely
2022-01-31 12:17     ` Heinrich Schuchardt
2022-02-01  2:26       ` Masami Hiramatsu
2022-02-01  3:16         ` AKASHI Takahiro
2022-01-31 12:38     ` Masami Hiramatsu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=164362073982.312714.10153796355309762567.stgit@localhost \
    --to=masami.hiramatsu@linaro.org \
    --cc=agraf@csgraf.de \
    --cc=bmeng.cn@gmail.com \
    --cc=etienne.carriere@linaro.org \
    --cc=grant.likely@arm.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jose.marinho@arm.com \
    --cc=patrice.chotard@foss.st.com \
    --cc=patrick.delaunay@foss.st.com \
    --cc=paul.liu@linaro.org \
    --cc=sjg@chromium.org \
    --cc=sughosh.ganu@linaro.org \
    --cc=takahiro.akashi@linaro.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.