From patchwork Thu Jan 20 15:31:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masami Hiramatsu X-Patchwork-Id: 533549 Delivered-To: patch@linaro.org Received: by 2002:ad5:5d50:0:0:0:0:0 with SMTP id x16csp1677336imu; Thu, 20 Jan 2022 07:31:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJwBxCrijG9HTjeLmXcl4YUKu8CDM54fGSxrvaxdUCafiooFz9l9jCToHC/1IVwHDtZHfeZc X-Received: by 2002:a17:906:7003:: with SMTP id n3mr2230610ejj.160.1642692679157; Thu, 20 Jan 2022 07:31:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642692679; cv=none; d=google.com; s=arc-20160816; b=beqkCx0lCzsgKfyzMry/mwYrwS49AnibR81UFA2S2vHHplkYKER3HjxEXukfwokoZG 2aJRKK67zFZC2ZDB+O7mlj8FhScF0V1D8sd3WxFCCwB99EHAIUt4Bc4aOjxigvGk5FUm AMqc3sADvu0s2bj0Z+Vf4TPhAVsS3nP+C0hWElH1gZ1Eu7r1Cuz/2Ol7y6h6Sj/Eox79 xn1+HnpyBi+A6ikxyo0xHurQUM51m0blbRc4albD/Q6tbR+5wioxiF7Gcz/TmCrcRU4b fqv49ZfSs8kKP1LZtYrRKTh2msvRTwV7iBtBA0YrHzeEgx9UD6KaH9zFNkRWy8oszp3a MMIQ== 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:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=D4Zki6YkegQ2RC+XsT/lrVRFJ/d4rQXSkd2m50V6YWk=; b=0XJXRQtrPRAImeKGyrF0t96I6ZxXcefnF+fucX9S340KxAiLt39W5NXQI3NYleBXqG QdusHOuCNimknQ8FcGjl1hyT/7R9vC9rKkooBR5k6/2sjPbLL98YXviSIFFrkMWic1f9 rgnA4Es0DEJHTWq0Setx/4ptX7mc41bbaI0hr0oyRCZ4F2TR5OiONfzsPft7W0r6D+2m 8LzfzAIySn96KsIJfV0qPJ1DLGauBp48J/bozKllqjKM2yGXuhZMqIGHJZiawxq5zcJJ 9fcsRTX9QJpMQNaERAhCBMajqTl0+IJzidERvzMVLEIY5oXNmvPkxUd2L0imGmSDRWKw ng8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="vh/H7b4o"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id l24si2184684edc.272.2022.01.20.07.31.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jan 2022 07:31:19 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="vh/H7b4o"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (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 5BF76838D4; Thu, 20 Jan 2022 16:31:11 +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="vh/H7b4o"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 175AE838AE; Thu, 20 Jan 2022 16:31:10 +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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) (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 2210E838DA for ; Thu, 20 Jan 2022 16:31:07 +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-pl1-x62d.google.com with SMTP id n11so5477229plf.4 for ; Thu, 20 Jan 2022 07:31:07 -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=D4Zki6YkegQ2RC+XsT/lrVRFJ/d4rQXSkd2m50V6YWk=; b=vh/H7b4oBUwESRCin+d2QJgZh4T4bWxkYzu6u3ZeoaFggTdllYlbSZs+xLLr9l7uKf PagJCTUjW3sfQRyf2yRO1m4Hoth6s3Y8DdFXI9EoS2cZZWac8j1fNIaT0bhBfRDccc2H nQdsXBKQWiQkzvSSNt0Lg8uhy/R3/aPp4UkTwoCDefkzYuc2JrcYhQG2gVMuTbuZCTdc wikdkc8F+D76qlwr8fSQG2N7MXGLlYn4rRGX1PchEk6SVfYC4svIbILc9KbZlIM23HI6 lTUNGSeU+64Km240Fbl4yOS8g03TSLAyL+6gDXVtHw+NSLZ2H1WZOtkLciN/hcPcStIe NwQA== 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=D4Zki6YkegQ2RC+XsT/lrVRFJ/d4rQXSkd2m50V6YWk=; b=HdQ23/twdIWEJyJXC82dx8G7xRg659ctfp1bzQCbzEpB2TNU6Sfdh9hpnxFoMdej04 JtXNVEslpLI/vfFOrigCEafpOSslQbMTX/s8HJ8xWG5G4TtmVUvM+ZIadze1FAmkMv2V pFXDcDuMSQ3KqLF5HNbyOYbgVBQ/mY3dTOl8BnXbI1g8rJR7bqT288EDCyBgyrFmK8nP 37hCdPjLCeMVyebF/abMLZBjNIuJbjVs+H+Pfh1xAhlY/yPSn4vewPtkV9fEHKyuQOTg rI7UykG6bHPTIg5rZYj+Y8RvD0X6YlF3Lgp6zZzt3Sz3noIFTaXjhFcwlGWjaai+UDyH JABQ== X-Gm-Message-State: AOAM5326qHXkxQhpno5OshjCSEvCd4O2KkImMxf6H9omrgSrSrU+zg7K tejcVpXgF4AWVBMX/cpjlhXCihQbXFCIJQ== X-Received: by 2002:a17:90a:5d17:: with SMTP id s23mr11406455pji.65.1642692665193; Thu, 20 Jan 2022 07:31:05 -0800 (PST) Received: from localhost.localdomain (113x37x226x201.ap113.ftth.ucom.ne.jp. [113.37.226.201]) by smtp.gmail.com with ESMTPSA id g4sm3896513pfv.8.2022.01.20.07.31.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jan 2022 07:31: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: [RFC PATCH 10/14] FWU: Reboot soon after successfully install the new firmware Date: Fri, 21 Jan 2022 00:31:00 +0900 Message-Id: <164269266038.39378.1931983995518536620.stgit@localhost> X-Mailer: git-send-email 2.25.1 In-Reply-To: <164269255955.39378.260729958623102750.stgit@localhost> References: <164269255955.39378.260729958623102750.stgit@localhost> User-Agent: StGit/0.19 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.2 at phobos.denx.de X-Virus-Status: Clean 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. 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.