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 E5B86C433F5 for ; Tue, 1 Feb 2022 11:39:08 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B9FEF81EE7; Tue, 1 Feb 2022 12:39: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="YEV3847o"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BCFD581D5D; Tue, 1 Feb 2022 12:39:01 +0100 (CET) Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) (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 D0F0581EE7 for ; Tue, 1 Feb 2022 12:38:44 +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-x629.google.com with SMTP id s6so9603443plg.12 for ; Tue, 01 Feb 2022 03:38:44 -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=DDgV5b9SLInGD5YAUASlg6CKcaCz2BRD8Qm+TnUVNs8=; b=YEV3847osW6opvJJGksaqO5H4xdYEYHri6ffklYKABbuDk05iI7RWnbrE0cthhG9jU +98VxIdODfZZxqHFm+sBYKww0QVt8r+OpF8xQ1kgHNGKtoVjC0wyDwnKX04MwpqQOTcp DJuiV0UqQZ7pRLDMUkEfQMlSMFZhNmmISSIv8uOh+1mCUaFpO65cTb4QC8KXHe+Repab 0MxD54TZRhZegd1ZF2ZDdstS5jdSthFKiuHJ2Jv3kRLsQFyzQWW6IlA/H8TzUb5hP4md SO6pgajpYQsh6h44Hg/mhWQc5DsFJXZHPbK1b2SBdT+G6/U6qy1PHnhasoXirYcWv9X1 C4ew== 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=DDgV5b9SLInGD5YAUASlg6CKcaCz2BRD8Qm+TnUVNs8=; b=QXtLVCJYMuH6+cwC4t0cFmZp4GhS9A365ytD9hcnyPQX0NpUy4+6vAi8DIcLbBE/Kq hwuD6WzPFkgaJ+1FJP4AXkDIeLp8smmYqMYUHwabLFMeo9dtKp+8kX0YHOfHYyEKNm9L 7+r4YpSz7X3PYaaSYj3AOGrdaKE9jiN/G3J2idFdefL4ZoBsS0WnfBPuG/+mY66zi+KZ 8Mf8X1aKJVfva9E2KLrWOyRL62geos57Lqlr1s1jSuGSsV37fZN6IpCpv4XhX5kf+nIz ynWepgcYq6DxvJqnqp4Ii/fJshgg1Dnh8Czr97hx3D00454TWsJDip+PQU3gkMhS4Y81 GCVg== X-Gm-Message-State: AOAM533LcXX/Mt9p4h2oSTk6HtXA62PpxW+autfH/Z+5qxMdVz6drmQ6 i78p1JOhCW3xsX62EdoYx9TsdA== X-Google-Smtp-Source: ABdhPJxH2Yd5ax6KDzVJ6W8/433l/XyjnZrZ1ChOVvaHeHB/4pyEfqNYf7IddFc6K+7NsiTBR70FLw== X-Received: by 2002:a17:90b:1881:: with SMTP id mn1mr1787401pjb.236.1643715523000; Tue, 01 Feb 2022 03:38:43 -0800 (PST) Received: from laputa ([2400:4050:c3e1:100:a8:b825:f6dd:417]) by smtp.gmail.com with ESMTPSA id v9sm22749512pfu.60.2022.02.01.03.38.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Feb 2022 03:38:42 -0800 (PST) Date: Tue, 1 Feb 2022 20:38:37 +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: <20220201113837.GA94173@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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <164370438970.365087.16509597865935044130.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 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. > > /* 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. -Takahiro Akashi > + > return ret; > } > #endif /* CONFIG_EFI_CAPSULE_ON_DISK */ >