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 8324DC433FE for ; Mon, 28 Feb 2022 07:54:07 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 143E183C00; Mon, 28 Feb 2022 08:54:05 +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="CBgSQk9Q"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5017283C24; Mon, 28 Feb 2022 08:54:02 +0100 (CET) Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) (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 9E49E83A9F for ; Mon, 28 Feb 2022 08:53:58 +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-io1-xd32.google.com with SMTP id t11so13775820ioi.7 for ; Sun, 27 Feb 2022 23:53:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=bAXcHgri1/yOJEnVvKPl65EwlGg0ygCPu0YECLklWDY=; b=CBgSQk9Qhf0c1aLI6aT84Zg+H/aPzQ2OoT4OXPHlz0KZJsFojQrvHQLZMbxpap01Z6 /j2Rv47TWkqDWw3KWzH9JLsk4d64hhez4H9xx5zYzoQOQ2rTo0LySFG91aGLo6gK0woy xqnzNU33XN8TCgaQSUhE0jEOzTNFd5g4vigTuyDTtim92etTgdj+tLmhAXjDLAsN0KLe uiTqph8mw2yDozsotQ1Yuw5zu6xXzAOGVzmrXmUw/Djr15oZEEWaBxwc4/QBpfhkh5iV LIN7vdzuXRMXw80WBfAD23oKHe7nFy7hYnnu3SIU4O5yeTlX7h/okTdjVilvtAlU0DCG BdFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=bAXcHgri1/yOJEnVvKPl65EwlGg0ygCPu0YECLklWDY=; b=XOUpujaVeaT2SnAZ0ytJMX4FXs0G3s9nJys6bdJHbjsza1yKC0o1anB0dP/i3fV1kf z9lQ3fQkse63vBpO0i7QLETrdkD2tkLb9hy1sbJwB1pHq9X40byBOsrinJmD+xt7r6+z 2Th7EgUvYsfRMAwqD35ux8Ob1qEtrflTVIw6b0mvMHE2YTGKoj+tuB20by8oKSVH1wXy suvaIzcmN2fwAB+G708l060/2m5P339/rSmnnud5BH+wYAQqFcTgFNc1Zxhd8kI1W+rs W7XSB91QHRv4fOUjPxx/8/t7AreCGIqQRk7hwj/BsXVgvxt3GSfVAX3aV5FIqMDUSsut SIVw== X-Gm-Message-State: AOAM5328pOne3c4ZxBK750j4mh9fWO8ht4MU34t0YzNybPVUJD0tXQ8T T90OSqvU+3XAxfIY13g5lJtfPUuCRsRy5nnujkY40g== X-Google-Smtp-Source: ABdhPJzk6Hcsimxp5KKz905zr12p9jRNGqkPGfmlJjv1QTdlv0OOxlRvpN8M5oG8Ss3abDzQjsek6KebwhE1bCfWXg8= X-Received: by 2002:a6b:8e17:0:b0:60d:c43a:6992 with SMTP id q23-20020a6b8e17000000b0060dc43a6992mr14755374iod.24.1646034837337; Sun, 27 Feb 2022 23:53:57 -0800 (PST) MIME-Version: 1.0 References: <164388018493.446835.11931101380744085380.stgit@localhost> <164388020701.446835.322529861013544459.stgit@localhost> In-Reply-To: From: Masami Hiramatsu Date: Mon, 28 Feb 2022 16:53:45 +0900 Message-ID: Subject: Re: [PATCH v4 2/2] efi_loader: Reset system after CapsuleUpdate on disk To: Simon Glass Cc: U-Boot Mailing List , Patrick Delaunay , Patrice Chotard , Heinrich Schuchardt , Alexander Graf , AKASHI Takahiro , Bin Meng , Ilias Apalodimas , Jose Marinho , Grant Likely , Tom Rini , Etienne Carriere , Sughosh Ganu , Paul Liu Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 Hi Simon, BTW, I saw the below code in the sysreset-uclass.c. It seems if I pass 0 to argc, it seems to do SYSRESET_COLD, isn't it? int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { enum sysreset_t reset_type =3D SYSRESET_COLD; if (argc > 2) return CMD_RET_USAGE; if (argc =3D=3D 2 && argv[1][0] =3D=3D '-' && argv[1][1] =3D=3D 'w'= ) { reset_type =3D SYSRESET_WARM; } printf("resetting ...\n"); mdelay(100); sysreset_walk_halt(reset_type); return 0; } 2022=E5=B9=B42=E6=9C=8828=E6=97=A5(=E6=9C=88) 13:19 Masami Hiramatsu : > > Hi Simon, > > 2022=E5=B9=B42=E6=9C=8827=E6=97=A5(=E6=97=A5) 3:37 Simon Glass : > > > > Hi Masami, > > > > On Thu, 3 Feb 2022 at 02:23, 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 syst= em 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 v4: > > > - Do not use sysreset because that is a warm reset. > > > > I don't get that. > > > > You should use sysreset and the SYSRESET_COLD type. > > Thanks, yeah, I found that parameter. > Let's fix that. > > Thank you, > > > > > > - 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_capsul= e.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 =3D=3D EFI_SUCCESS) { > > > ret =3D efi_capsule_update_firmware(capsule); > > > if (ret !=3D EFI_SUCCESS) > > > - log_err("Applying capsule %ls failed\= n", > > > + log_err("Applying capsule %ls failed.= \n", > > > files[i]); > > > + else > > > + log_info("Applying capsule %ls succee= ded.\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 processi= ng 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); > > > > No! This should use sysreset. > > > > > + hang(); > > > + /* not reach here */ > > > + > > > + return 0; > > > } > > > #endif /* CONFIG_EFI_CAPSULE_ON_DISK */ > > > > > > > Regards, > > Simon > > > > -- > Masami Hiramatsu --=20 Masami Hiramatsu