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 BD8ABC433F5 for ; Wed, 9 Feb 2022 03:13:58 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 44E6D83DA2; Wed, 9 Feb 2022 04:13:56 +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="a5o1Z5ym"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C807B83DCE; Wed, 9 Feb 2022 04:13:54 +0100 (CET) Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) (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 7002B83D48 for ; Wed, 9 Feb 2022 04:13:51 +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-pf1-x435.google.com with SMTP id n32so1862007pfv.11 for ; Tue, 08 Feb 2022 19:13:51 -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=IvZyPCOJA7Y93R84A/J2CHAw6t59HYbtZBSE0kGMDuw=; b=a5o1Z5ympxDvuILTics+Y0juRcwxGGM+TBRPWRZK6bBzlWTa73KeV874tyk0o04QMR /74mvp8sVJBtI2ITYs4fBUNzb13+DMCVqK76kNi+mFEpAZSrVmztCfxo8u05s+2qoeoY NW840asMxhm8nMtdJDsZuUMjH5YM+n49uPtFoRO+Pe05O0iEGVKZR4NHBrn0JLuIIb7L fSqw9Sl3OfUt1BHkbUrbfeGfqgVrKrem57GbYLDErV1ppSRuG3UvqulP21PcsILkTw3u gjwzMT5HL/cyp+tpn4VSg+LrHfrAlAk8WL8g+jj06JjcV/z3rH0KQdw7JX4u5ECEG4yG mUcQ== 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=IvZyPCOJA7Y93R84A/J2CHAw6t59HYbtZBSE0kGMDuw=; b=Zy3pBMBjQtvsQFH6dFDZhjr7DXYb2LLRUHOp+oCdC1BRYSuUiIUAZz+JmqsMm6uPIe voiWaYmiXG0Hp50jiUfFRoVsk81xOm3Bn2hGcXHn1P4RLgXOXa6bxnUU0IBYuhSOBHeN OFOz67U9EyN/LBhHEChAy1EIsfPvAS9osewOmf0WPyjkphJT0hZIsmTv42+CcEAfaoHD 4QskTt+qgPl/imvCiX7P4AtAA1Do4ASF5KcEPku8GZLLU09S0k9+J60pj/Z978+I2W3h EiUHDVgoqGNSNkoGVhLFr2hZNKeRsM6LlWs3ADqgUHeL9F7Ag+Vk+zii73bOSFinjS1h hKxg== X-Gm-Message-State: AOAM533ZxP8AQm0ni6oVKOphwKXAOgk9C0K27NCPc/Si6dYF7p0OqOZB aP8cTp4f9cDPoDYlaYfrehTOdw== X-Google-Smtp-Source: ABdhPJwWsfs6OEi1U++BrVJkhdUHSMK9LBCCvjvAkYgWD+u+Jpwawt4jgclRMyfGKD8gyfGYXJ1jiw== X-Received: by 2002:a05:6a00:1ac9:: with SMTP id f9mr161043pfv.65.1644376429413; Tue, 08 Feb 2022 19:13:49 -0800 (PST) Received: from laputa ([2400:4050:c3e1:100:d885:543e:bfe4:9eb5]) by smtp.gmail.com with ESMTPSA id w10sm15928133pfn.153.2022.02.08.19.13.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Feb 2022 19:13:49 -0800 (PST) Date: Wed, 9 Feb 2022 12:13:43 +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: [PATCH v4 2/2] efi_loader: Reset system after CapsuleUpdate on disk Message-ID: <20220209031343.GB26765@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: <164388018493.446835.11931101380744085380.stgit@localhost> <164388020701.446835.322529861013544459.stgit@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <164388020701.446835.322529861013544459.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.5 at phobos.denx.de X-Virus-Status: Clean On Thu, Feb 03, 2022 at 06:23:27PM +0900, Masami Hiramatsu wrote: > Add a cold reset 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. Once this behavior is enforced on U-Boot, CONFIG_EFI_CAPSULE_ON_DISK_EARLY will make little sense. This option will have to always be set. Otherwise, a user will see a sudden system reboot when he or she types any of efi commands, like "env print -e". -Takahiro Akashi > This also reports the result of each capsule update so that the user can > notice that the capsule update has been succeeded or not from console log. > > Signed-off-by: Masami Hiramatsu > --- > Changes in v4: > - Do not use sysreset because that is a warm reset. > - Fix patch description. > --- > lib/efi_loader/efi_capsule.c | 18 ++++++++++++++++-- > 1 file changed, 16 insertions(+), 2 deletions(-) > > diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c > index 1ec7ea29ff..20d9490dbd 100644 > --- a/lib/efi_loader/efi_capsule.c > +++ b/lib/efi_loader/efi_capsule.c > @@ -14,6 +14,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -1120,8 +1121,11 @@ efi_status_t efi_launch_capsules(void) > if (ret == EFI_SUCCESS) { > ret = efi_capsule_update_firmware(capsule); > if (ret != EFI_SUCCESS) > - log_err("Applying capsule %ls failed\n", > + log_err("Applying capsule %ls failed.\n", > files[i]); > + else > + log_info("Applying capsule %ls succeeded.\n", > + files[i]); > > /* create CapsuleXXXX */ > set_capsule_result(index, capsule, ret); > @@ -1142,6 +1146,16 @@ efi_status_t efi_launch_capsules(void) > free(files[i]); > free(files); > > - return ret; > + /* > + * UEFI spec requires to reset system after complete processing capsule > + * update on the storage. > + */ > + log_info("Reboot after firmware update"); > + /* Cold reset is required for loading the new firmware. */ > + do_reset(NULL, 0, 0, NULL); > + hang(); > + /* not reach here */ > + > + return 0; > } > #endif /* CONFIG_EFI_CAPSULE_ON_DISK */ >