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 E0EEFC433EF for ; Tue, 1 Feb 2022 23:47:27 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 55B5682F70; Wed, 2 Feb 2022 00:47:20 +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="jTX4V6pR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5EC4882FA5; Wed, 2 Feb 2022 00:47:19 +0100 (CET) Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) (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 D9971820F0 for ; Wed, 2 Feb 2022 00:47:14 +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-pj1-x1031.google.com with SMTP id o64so18640455pjo.2 for ; Tue, 01 Feb 2022 15:47:14 -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=bnGgtMO6OiLALsCAE5fcDCZJFfJ5MxPe/oohWMeRnAU=; b=jTX4V6pRvCOmCraaRdN6LUWRChbKYu3MWWUxdKQP6K7/FUbky6WerJzan9SnCPZTTl X5MT40pQM0uRpbCHKIDD3a3qOdKqc3r+DmHEEoxj2V4Pcb+QMJ2Pdz06dfP6YrtGzckR Ad6kc6Mdz5UmjLm9Lg54i65V5MD7NN6EgRM7HH9DIJSJxbWIah60CpDmlZle1YVr8jwR XiV5sG8WyPgs43qBneYC3Lxd5usa71cPWkWZA57g/3Q8Uavn0vmqNUnLqQW+E7qB9C5f /qotSvew0UxXKK/SpCnqzyEoVz1VOAL5OpfG8es0p0lG1CNPirhnnENOEd3O3grlyLk5 f3yg== 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=bnGgtMO6OiLALsCAE5fcDCZJFfJ5MxPe/oohWMeRnAU=; b=ViRMxjwaANkwmKw/R1xV3UzPd8AUD5ufMaBNr4g4K0HtHq8saYOlgbFvWzNhI91iVl c35hati2cHdGELN26Py4IsdXlgnpBEZSD7p6LtxkI9WMrpMV7CTtT+IbT2XiNY4WR6Mk amQ55TIGirVGEOkim/Ktepk/zUb8WumdlsOf5dfrSZ0ptZRyhnSaO8A+a7DbcXEF3ekR O9qA410Dba5T2EgHs+qnHWkvXJZismBmglYz0DYboWvi0DKAfGpFERH+0gBSSLFMpP2G NMpDGu2JBYAwXZvl0XRybU743tDYRF97Xr6C1N800EvMIvQgbdhOk1JP1v0OdvegEltY pMZg== X-Gm-Message-State: AOAM530TnFEcDTGCkwYgHw/B3Fg22qFOvUjHjXF2+kmjc5l2eXP29AsR jP+ZWjD/o+3Sv4wk/EdeQIQ4DA== X-Google-Smtp-Source: ABdhPJyiTYchyxFdi0PClUCvsjagU1xE3pQza7AIbfMZTuzCsPv4rfhnb+ayzgvuQ0SmDdbNzNDEzw== X-Received: by 2002:a17:903:2310:: with SMTP id d16mr28360687plh.20.1643759232740; Tue, 01 Feb 2022 15:47:12 -0800 (PST) Received: from laputa ([2400:4050:c3e1:100:314e:b83b:fa90:7f2e]) by smtp.gmail.com with ESMTPSA id g1sm16373744pfu.32.2022.02.01.15.47.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Feb 2022 15:47:12 -0800 (PST) Date: Wed, 2 Feb 2022 08:47:06 +0900 From: AKASHI Takahiro To: Sughosh Ganu Cc: Heinrich Schuchardt , Masami Hiramatsu , u-boot@lists.denx.de, Patrick Delaunay , Patrice Chotard , Alexander Graf , Simon Glass , Bin Meng , Ilias Apalodimas , Jose Marinho , Grant Likely , Tom Rini , Etienne Carriere , Paul Liu Subject: Re: [PATCH v2 1/2] efi_loader: Avoid using efi_update_capsule() from update capsule on disk Message-ID: <20220201234706.GA7063@laputa> Mail-Followup-To: AKASHI Takahiro , Sughosh Ganu , Heinrich Schuchardt , Masami Hiramatsu , u-boot@lists.denx.de, Patrick Delaunay , Patrice Chotard , Alexander Graf , Simon Glass , Bin Meng , Ilias Apalodimas , Jose Marinho , Grant Likely , Tom Rini , Etienne Carriere , Paul Liu References: <164370436957.365087.15139421656192351360.stgit@localhost> <164370437972.365087.4761473791973948840.stgit@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 Tue, Feb 01, 2022 at 10:33:20PM +0530, Sughosh Ganu wrote: > On Tue, 1 Feb 2022 at 22:14, Heinrich Schuchardt wrote: > > > > > > > > Am 1. Februar 2022 16:42:43 MEZ schrieb Sughosh Ganu : > > >hi Masami, > > > > > >On Tue, 1 Feb 2022 at 14:03, Masami Hiramatsu > > > wrote: > > >> > > >> The efi_update_capsule() may have to handle the capsule flags as an UEFI > > >> runtime and boottime service, but the capsule-on-disk process doesn't. > > >> Thus, the capsule-on-disk should use the efi_capsule_update_firmware() > > >> directly instead of efi_update_capsule(). > > >> > > >> Suggested-by: AKASHI Takahiro > > >> Signed-off-by: Masami Hiramatsu > > >> --- > > >> Changes in v2: > > >> - Fix to pass correct pointer to efi_capsule_update_firmware > > >> - Remove ESRT generation, because this part anyway will be removed > > >> next patch. > > >> --- > > >> lib/efi_loader/efi_capsule.c | 2 +- > > >> 1 file changed, 1 insertion(+), 1 deletion(-) > > >> > > >> diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c > > >> index 4463ae00fd..1ec7ea29ff 100644 > > >> --- a/lib/efi_loader/efi_capsule.c > > >> +++ b/lib/efi_loader/efi_capsule.c > > >> @@ -1118,7 +1118,7 @@ efi_status_t efi_launch_capsules(void) > > >> index = 0; > > >> ret = efi_capsule_read_file(files[i], &capsule); > > >> if (ret == EFI_SUCCESS) { > > >> - ret = EFI_CALL(efi_update_capsule(&capsule, 1, 0)); > > >> + ret = efi_capsule_update_firmware(capsule); > > > > > >I believe this is not fixing any issue as such. If so, I would vote > > >for keeping the call to efi_update_capsule. > > > > No, this is just about reducing code size by avoiding the EFI_CALL(). It should not change behaviour. > > Okay, in that case, I will put a check for the FWU Multi Banks feature > being enabled -- with the feature enabled, the call will be to > efi_update_capsule, and with the feature disabled, the call will be > made to efi_capsule_update_firmware. Please don't do that. Instead, you should carve out a *common* function for UpdateCapsule api and capsule-on-disk. Please note, as I repeatedly said, that I didn't intend to implement the API with my initial commits. I think I should not have added efi_update_capsule() function to avoid any confusion. -Takahiro Akashi > The compiler should compile out > the code whenever the FWU feature is disabled and that will not impact > the code size. > > -sughosh > > > > > Best regards > > > > Heinrich > > > > With the FWU Multi Bank > > >feature enabled, the checks for capsule acceptance and revert are > > >being done in this function. The reason I have put this code in the > > >function is that it caters to both scenarios of capsule-on-disk and > > >the runtime functionality. In addition, the FWU bootup checks are also > > >done in this function through a call to fwu_update_checks_pass. So if > > >this is not a fix, which I don't think it is, I would prefer this call > > >to remain. > > > > > >-sughosh > > > > > >> if (ret != EFI_SUCCESS) > > >> log_err("Applying capsule %ls failed\n", > > >> files[i]); > > >>