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 4A649C433F5 for ; Thu, 20 Jan 2022 15:31:19 +0000 (UTC) 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) 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-Google-Smtp-Source: ABdhPJzkeyALMnespPrc0aHkhj0ftW7f+hF46X+14PIMQh+ddA/YFNKeIJnTENSZ/kBr2RMPIZdfmA== 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 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.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.