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 26C8EC433F5 for ; Fri, 21 Jan 2022 01:46:21 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3787A83864; Fri, 21 Jan 2022 02:46:19 +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="zadeG49h"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CB26D83890; Fri, 21 Jan 2022 02:46:17 +0100 (CET) Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) (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 868D483852 for ; Fri, 21 Jan 2022 02:46:14 +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=takahiro.akashi@linaro.org Received: by mail-pj1-x102f.google.com with SMTP id d10-20020a17090a498a00b001b33bc40d01so5119949pjh.1 for ; Thu, 20 Jan 2022 17:46:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=IRg26qoO9GNa36UdnZ0PFB6z5mUcavYF2A2seqcqXoM=; b=zadeG49hkJqVnpa71FpH8mLMnVBe5b/9Cr6EeiE0VLmnktfdXRF73GaVVBVHtXSlAn tzPp2b34U7n0BzPh9bLE8qTvUNr6flizEUj/G03EcapbyKPZA/+QF886MwjD5QiayQQn FKyntPDUpoMK3oE/55WkIM0qahqpOux3lRdD8YHeBjL/Vizap3UZEB+kZ3jAcd+RXHRG 2/m61RuCrJwLGj8lpGNMQeMuiGbfx4E9csUDRViDgkqbio0dlidIdGeYnZ6y4uS05I1R 89cKZVvY0yPFOOU6yB5wsc4GsFzGAlb7Kt1/cM2mbN2MMy/VHyAOO1L3girtIjTbW91F JFCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=IRg26qoO9GNa36UdnZ0PFB6z5mUcavYF2A2seqcqXoM=; b=E6PEFa1K5lD097Bo7C1o/s8b2Hdhpk1fwrLJiRhV2lWiSPwTQW6GfFWPXcyJ6tjx+/ z/WFYLb/F82Ndksnu6tBkhyTFjODANSDxQ5VZcyxWXlP4FZ0Eh/ibfiR8A8bcn6oiHvH z2jmvd3PgkBxjhYBaYyZnVztYQkm0sl5F5PxqP+GP2z54qjCfEqf1j9Tg5bDMdWJVX/t 4/Ut+XJxVGrNmRNi9QJM6vG7bVNEzDJ4MYTnU3In2Jlj/di7JuwekCV9nQXzxZK0BiXf fcRxwOTBMzH3S3msTipoHyCrf+VRn7g98BQYB1Cg6IMu0msrzV12bhIlRKNpXkPWdOJa kgxg== X-Gm-Message-State: AOAM5333L3qUBLdcwzX16SH4DwIoymF4kPoQbTI0P9pllVsOR47DR8Ex Hjz7LN/wB8gBNc5c18fcXUZbnA== X-Google-Smtp-Source: ABdhPJwWFQ7jMFpEITNraKFIFxUqHuLT4acVMrPqj/FxLgc51lqw572UrefUGp10/HnJ5Y1NSg1A1w== X-Received: by 2002:a17:902:be14:b0:149:537f:378 with SMTP id r20-20020a170902be1400b00149537f0378mr1581518pls.97.1642729572725; Thu, 20 Jan 2022 17:46:12 -0800 (PST) Received: from laputa ([2400:4050:c3e1:100:9dfa:ef9c:130b:a92f]) by smtp.gmail.com with ESMTPSA id g11sm4743260pfj.21.2022.01.20.17.46.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jan 2022 17:46:12 -0800 (PST) Date: Fri, 21 Jan 2022 10:46:07 +0900 From: AKASHI Takahiro To: Masami Hiramatsu Cc: u-boot@lists.denx.de, Patrick Delaunay , Patrice Chotard , Heinrich Schuchardt , Alexander Graf , Simon Glass , Bin Meng , Ilias Apalodimas , Jose Marinho , Grant Likely , Tom Rini , Etienne Carriere , Sughosh Ganu , Paul Liu Subject: Re: [RFC PATCH 10/14] FWU: Reboot soon after successfully install the new firmware Message-ID: <20220121014607.GA44335@laputa> Mail-Followup-To: AKASHI Takahiro , Masami Hiramatsu , u-boot@lists.denx.de, Patrick Delaunay , Patrice Chotard , Heinrich Schuchardt , Alexander Graf , Simon Glass , Bin Meng , Ilias Apalodimas , Jose Marinho , Grant Likely , Tom Rini , Etienne Carriere , Sughosh Ganu , Paul Liu References: <164269255955.39378.260729958623102750.stgit@localhost> <164269266038.39378.1931983995518536620.stgit@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <164269266038.39378.1931983995518536620.stgit@localhost> 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.2 at phobos.denx.de X-Virus-Status: Clean On Fri, Jan 21, 2022 at 12:31:00AM +0900, Masami Hiramatsu wrote: > Reboot to the trial state soon after successfully installing > the new firmware to the next bank and updating the active_index. > This is enabled by CONFIG_FWU_REBOOT_AFTER_UPDATE and is a > recommended option. EFI_CAPSULE_HEADER.Flags may have a flag, CAPSULE_FLAGS_INITIATE_RESET. See Section "8.5.3 Update Capsule" in the UEFI specification. I think that we'd better implement the feature rather than adding CONFIG_FWU_REBOOT_AFTER_UPDATE. -Takahiro Akashi > Signed-off-by: Masami Hiramatsu > --- > lib/efi_loader/efi_capsule.c | 10 ++++++++-- > lib/fwu_updates/Kconfig | 9 +++++++++ > 2 files changed, 17 insertions(+), 2 deletions(-) > > diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c > index 83c89a0cbb..0928425b5f 100644 > --- a/lib/efi_loader/efi_capsule.c > +++ b/lib/efi_loader/efi_capsule.c > @@ -1355,10 +1355,16 @@ efi_status_t efi_launch_capsules(void) > } else { > log_debug("Successfully updated the active_index\n"); > status = fwu_trial_state_ctr_start(); > - if (status < 0) > + if (status < 0) { > ret = EFI_DEVICE_ERROR; > - else > + } else { > ret = EFI_SUCCESS; > + if (IS_ENABLED(CONFIG_FWU_REBOOT_AFTER_UPDATE)) { > + log_info("New firmware is installed in bank#%d. Reboot from that bank.\n", > + update_index); > + do_reset(NULL, 0, 0, NULL); > + } > + } > } > } else if (capsule_update == true && update_status == false) { > log_err("All capsules were not updated. Not updating FWU metadata\n"); > diff --git a/lib/fwu_updates/Kconfig b/lib/fwu_updates/Kconfig > index 6de28e0c9c..0940a90747 100644 > --- a/lib/fwu_updates/Kconfig > +++ b/lib/fwu_updates/Kconfig > @@ -29,3 +29,12 @@ config FWU_TRIAL_STATE_CNT > With FWU Multi Bank Update feature enabled, number of times > the platform is allowed to boot in Trial State after an > update. > + > +config FWU_REBOOT_AFTER_UPDATE > + bool "Reboot soon after installing new firmware" > + depends on FWU_MULTI_BANK_UPDATE > + default y > + help > + Reboot the machine soon after installing a new firmware > + and start trial boot. You can disable this option for > + debugging or FWU development, but recommended to enable it. >