public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: Sughosh Ganu <sughosh.ganu@linaro.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Masami Hiramatsu <masami.hiramatsu@linaro.org>,
	u-boot@lists.denx.de,
	Patrick Delaunay <patrick.delaunay@foss.st.com>,
	Patrice Chotard <patrice.chotard@foss.st.com>,
	Alexander Graf <agraf@csgraf.de>, Simon Glass <sjg@chromium.org>,
	Bin Meng <bmeng.cn@gmail.com>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Jose Marinho <jose.marinho@arm.com>,
	Grant Likely <grant.likely@arm.com>,
	Tom Rini <trini@konsulko.com>,
	Etienne Carriere <etienne.carriere@linaro.org>,
	Paul Liu <paul.liu@linaro.org>
Subject: Re: [PATCH v2 1/2] efi_loader: Avoid using efi_update_capsule() from update capsule on disk
Date: Wed, 2 Feb 2022 08:47:06 +0900	[thread overview]
Message-ID: <20220201234706.GA7063@laputa> (raw)
In-Reply-To: <CADg8p97rrfVDv0nYGMXUCOCJwQT=su6g4tVhMwyUKEBR8f3DHg@mail.gmail.com>

On Tue, Feb 01, 2022 at 10:33:20PM +0530, Sughosh Ganu wrote:
> On Tue, 1 Feb 2022 at 22:14, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> >
> >
> >
> > Am 1. Februar 2022 16:42:43 MEZ schrieb Sughosh Ganu <sughosh.ganu@linaro.org>:
> > >hi Masami,
> > >
> > >On Tue, 1 Feb 2022 at 14:03, Masami Hiramatsu
> > ><masami.hiramatsu@linaro.org> 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 <takahiro.akashi@linaro.org>
> > >> Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
> > >> ---
> > >>  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]);
> > >>

  reply	other threads:[~2022-02-01 23:47 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-01  8:32 [PATCH v2 0/2] EFI: Reset system after capsule-on-disk Masami Hiramatsu
2022-02-01  8:32 ` [PATCH v2 1/2] efi_loader: Avoid using efi_update_capsule() from update capsule on disk Masami Hiramatsu
2022-02-01 15:42   ` Sughosh Ganu
2022-02-01 16:44     ` Heinrich Schuchardt
2022-02-01 17:03       ` Sughosh Ganu
2022-02-01 23:47         ` AKASHI Takahiro [this message]
2022-02-02  5:28           ` Sughosh Ganu
2022-02-02  0:09         ` Masami Hiramatsu
2022-02-02  5:34           ` Sughosh Ganu
2022-02-02  7:03             ` Masami Hiramatsu
2022-02-02  8:28               ` Sughosh Ganu
2022-02-01  8:33 ` [PATCH v2 2/2] efi_loader: Reset system after CapsuleUpdate " Masami Hiramatsu
2022-02-01 11:38   ` AKASHI Takahiro
2022-02-02  1:53     ` Masami Hiramatsu
2022-02-02  4:15       ` AKASHI Takahiro
2022-02-02  7:06         ` Masami Hiramatsu
2022-02-03 17:32         ` Heinrich Schuchardt
2022-02-05 12:33           ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220201234706.GA7063@laputa \
    --to=takahiro.akashi@linaro.org \
    --cc=agraf@csgraf.de \
    --cc=bmeng.cn@gmail.com \
    --cc=etienne.carriere@linaro.org \
    --cc=grant.likely@arm.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jose.marinho@arm.com \
    --cc=masami.hiramatsu@linaro.org \
    --cc=patrice.chotard@foss.st.com \
    --cc=patrick.delaunay@foss.st.com \
    --cc=paul.liu@linaro.org \
    --cc=sjg@chromium.org \
    --cc=sughosh.ganu@linaro.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox