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 49FB5C433EF for ; Wed, 2 Feb 2022 04:16:08 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 449B5830B3; Wed, 2 Feb 2022 05:16:01 +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="EmQafRRK"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C0FA583108; Wed, 2 Feb 2022 05:15:59 +0100 (CET) Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) (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 4CFEB83049 for ; Wed, 2 Feb 2022 05:15:50 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pl1-x62e.google.com with SMTP id y17so17135909plg.7 for ; Tue, 01 Feb 2022 20:15:50 -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:content-transfer-encoding :in-reply-to; bh=pNcrULIYo8OOGYSg/T3sAuvoD7IB0b5C7J91wgiU70Y=; b=EmQafRRKRlqha6NTBKAOOwFd2I3rpFZunye745Qeus4mpRL2C05Lf8uB4vDio8Fdf6 Yw0rhbCbxKpU5prJpE5Ezj07DGr5oIwVqJgrbYk41GNlxu4CayK9cqLNowZ2Iczp7tov BmU647uTclFylxJdkuNtAhQh87KqKA9DpPDGUCJqN5YT8o27vH2hMJpxIljF8Tdp6yJS aj3tZ6Y3d3cvF6kYAMYPMFv5QN++s7FdIWD/OjcsQFaYWNgtjOBIFg3Q7orVCUxyFwVV 85O0gR19tIE9rztqIXqkZopizcncnO+4+6BJtCEeIDeerEieKbuwrO8j1jREywz05bw5 99VQ== 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 :content-transfer-encoding:in-reply-to; bh=pNcrULIYo8OOGYSg/T3sAuvoD7IB0b5C7J91wgiU70Y=; b=yjnCztq7KpfCd85MAdjbbQZ3+cI36MRbl59DYV7W577ccwkJvt3jnkK8pMj0BS56TR GO7piXG1MKB3PvZVdDKPJLigorAnynVWHbmJXMHFdBOhGGCQNeb86wPDKRRB4mDXWhSu DGjCpdsJ9btqXNcmHJ7nOUEgh5WyjliakBt7XFyglNFwJubueEPqHG0rhaEIYTKJqroT Lqqd7V5vU9nsPReWJIsRATdN6dAKMIDsGPWYWxDPX/hjsj99W+zODp2kda6oK/X/tatX 2AkMKufYt3ajEAvcHmcaClaXU4gdANnekbe8sThZ2SQ/3uBlgbXpqZ8FVM6LfMMlXToL eGbQ== X-Gm-Message-State: AOAM530H0aQDC2rPURLTT1GIisP16RPsYW2BS75niP4WSPSRXMUaaClJ WkiPTf+HCbwdBV7drs8qQx1tjQ== X-Google-Smtp-Source: ABdhPJzbOQImEsXV5JCW32P6sSISVqftER7Z4D9rWOQjmSxhZ1We1AB6VldrVhYL9pI/n4ZPqliPGw== X-Received: by 2002:a17:902:e806:: with SMTP id u6mr30091977plg.10.1643775348532; Tue, 01 Feb 2022 20:15:48 -0800 (PST) Received: from laputa ([2400:4050:c3e1:100:314e:b83b:fa90:7f2e]) by smtp.gmail.com with ESMTPSA id nh18sm4243441pjb.18.2022.02.01.20.15.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Feb 2022 20:15:48 -0800 (PST) Date: Wed, 2 Feb 2022 13:15:42 +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 v2 2/2] efi_loader: Reset system after CapsuleUpdate on disk Message-ID: <20220202041542.GA47272@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: <164370436957.365087.15139421656192351360.stgit@localhost> <164370438970.365087.16509597865935044130.stgit@localhost> <20220201113837.GA94173@laputa> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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 Wed, Feb 02, 2022 at 10:53:05AM +0900, Masami Hiramatsu wrote: > Hi Takahiro, > > 2022年2月1日(火) 20:38 AKASHI Takahiro : > > > > > On Tue, Feb 01, 2022 at 05:33:09PM +0900, Masami Hiramatsu wrote: > > > 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. > > > > > > 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 v2: > > > - Remove kconfig option to disable this feature. > > > - Use panic() instead of do_reset() so that if the reset fails, > > > the machine halt. > > > - Log the result of each capsule update always. > > > --- > > > lib/efi_loader/efi_capsule.c | 12 +++++++++--- > > > 1 file changed, 9 insertions(+), 3 deletions(-) > > > > > > diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c > > > index 1ec7ea29ff..39bce714f7 100644 > > > --- a/lib/efi_loader/efi_capsule.c > > > +++ b/lib/efi_loader/efi_capsule.c > > > @@ -1119,9 +1119,9 @@ efi_status_t efi_launch_capsules(void) > > > ret = efi_capsule_read_file(files[i], &capsule); > > > if (ret == EFI_SUCCESS) { > > > ret = efi_capsule_update_firmware(capsule); > > > - if (ret != EFI_SUCCESS) > > > - log_err("Applying capsule %ls failed\n", > > > - files[i]); > > > + log_err("Applying capsule %ls %s\n", > > > + files[i], > > > + ret == EFI_SUCCESS ? "succeeded" : "failed"); > > > > log_err()? log_info() is better, I think. > > Hmm, would you think to use log_info() even if it is failed? Or should > we have log_err(failure) and log_info(success)? It is what I meant :) > > > > > > > > /* create CapsuleXXXX */ > > > set_capsule_result(index, capsule, ret); > > > @@ -1142,6 +1142,12 @@ 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. > > > + */ > > > + panic("Reboot after firmware update"); > > > > If CONFIG_PANIC_HANG is enabled, the system won't restart. > > It's not what we want here. > > Indeed. > Heinrich, what would you think if do_reset() doesn't work? > (I think it is OK to get it back here, but needs a warning) If (CONFIG_IS_ENABLED(SYSRESET)) { puts ("resetting ...\n"); sysreset_reset_walk(SYSRESET_WARM); } else { do_reset(...) halt(); } /* not reach here */ -Takahiro Akashi > Thank you, > > > > > -Takahiro Akashi > > > > > + > > > return ret; > > > } > > > #endif /* CONFIG_EFI_CAPSULE_ON_DISK */ > > > > > > > -- > Masami Hiramatsu