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 CD023C433EF for ; Thu, 3 Feb 2022 17:33:08 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 916C383388; Thu, 3 Feb 2022 18:33:06 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="OIujpwhz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DCA3281980; Thu, 3 Feb 2022 18:33:04 +0100 (CET) Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 88DD980F94 for ; Thu, 3 Feb 2022 18:33:01 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1643909577; bh=RKO1wrYoEpgb6cM7IxCfo5JtmRbLQbS6/BrCLtdY318=; h=X-UI-Sender-Class:Date:Subject:To:References:From:Cc:In-Reply-To; b=OIujpwhz3fXZN1mLaFG6E3EnMHElbYsv9XLO0f+4un3ScNjR0Q/s4SAwC+iDRX1J2 StExDQWFlCjZAMgNf3XrPc22bg4cQntoSkZFI2wFo295nR+D1St1tWPMrY0NgtzRcA mO1+zewVpBxzYIbRHe/pOy0smJuGpKxIwWtzhj54= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.123.94] ([88.152.144.107]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MuDc7-1mM4W531vJ-00udlJ; Thu, 03 Feb 2022 18:32:56 +0100 Message-ID: <7bfebeac-ee98-855a-9635-41863bc5da78@gmx.de> Date: Thu, 3 Feb 2022 18:32:50 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Subject: Re: [PATCH v2 2/2] efi_loader: Reset system after CapsuleUpdate on disk Content-Language: en-US To: Simon Glass , Tom Rini References: <164370436957.365087.15139421656192351360.stgit@localhost> <164370438970.365087.16509597865935044130.stgit@localhost> <20220201113837.GA94173@laputa> <20220202041542.GA47272@laputa> From: Heinrich Schuchardt Cc: Paul Liu , Jose Marinho , Etienne Carriere , Ilias Apalodimas , Patrick Delaunay , Grant Likely , Bin Meng , Patrice Chotard , Alexander Graf , u-boot@lists.denx.de, Masami Hiramatsu , AKASHI Takahiro , Sughosh Ganu In-Reply-To: <20220202041542.GA47272@laputa> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:2ELcZJOqKfNe6qma4/bMsvcM+jnDbgzY94kx4JoDlfvt1yJncwH /755ZIDKSpm6BB5thVt23N4K5DxswwF1XrT3MdjRyfjP7sNiHJ6A/IRUV630aNN48uIV1Cp dohicB+zmERUxNlTtMrOQYY75wn4f+inmzuGEsR1opQvaulks5DZPmEK0DkLDvRp662rKm6 29NzCL3CjP4T4GJIhDuLg== X-UI-Out-Filterresults: notjunk:1;V03:K0:oEWto0//UJA=:ZEG4Xa9K/GIRVNPJ4pw4yE bmfYnQq6tzQvZ8Y5f1D3MhH/mgCIk4M1mKbmZPfw9Y108wWShDxdPWCyaTF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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 2/2/22 05:15, AKASHI Takahiro wrote: > On Wed, Feb 02, 2022 at 10:53:05AM +0900, Masami Hiramatsu wrote: >> Hi Takahiro, >> >> 2022=E5=B9=B42=E6=9C=881=E6=97=A5(=E7=81=AB) 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 upd= ate >>>> 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 sys= tem 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_capsul= e.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 =3D efi_capsule_read_file(files[i], &capsule); >>>> 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"= , >>>> - files[i]); >>>> + log_err("Applying capsule %ls %s\n", >>>> + files[i], >>>> + ret =3D=3D 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); do_reset() is implemented in many 25 places. drivers/sysreset/sysreset-uclass.c is just one of them. @Tom, @Simon: Is there a migration timeline to replace all other do_reset() implementations? A dummy implementation like in arch/riscv/lib/reset.c should not exist. The sysreset uclass handles the case of no sysreset driver already. Best regards Heinrich > } else { > do_reset(...) > halt(); > } > /* not reach here */ > > -Takahiro Akashi > > >> Thank you, >> >>> >>> -Takahiro Akashi >>> >>>> + >>>> return ret; >>>> } >>>> #endif /* CONFIG_EFI_CAPSULE_ON_DISK */ >>>> >> >> >> >> -- >> Masami Hiramatsu