All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [PATCH 4/4] efi_loader: call smp_kick_all_cpus()
Date: Mon, 18 May 2020 14:30:09 -0400	[thread overview]
Message-ID: <20200518183009.GG14425@bill-the-cat> (raw)
In-Reply-To: <095013977900c8b0c0fceb36e0379a31@walle.cc>

On Sat, May 16, 2020 at 05:54:43PM +0200, Michael Walle wrote:
> [Also adding Tom Rini as ARM maintainer]
> 
> Am 2020-05-14 22:17, schrieb Alexander Graf:
> > On 14.05.20 20:46, Heinrich Schuchardt wrote:
> > > On 5/14/20 2:38 PM, Michael Walle wrote:
> > > > On some architectures, specifically the layerscape, the
> > > > secondary cores
> > > > wait for an interrupt before entering the spin-tables. This
> > > > applies only
> > > > to boards which doesn't have PSCI provided by TF-a and u-boot
> > > > does the
> > > %s/TF-a/TF-A/, %s/u-boot/U-Boot/
> > > 
> > > > secondary cores handling.
> > > > bootm/booti already call that function for ARM architecture;
> > > > also add it
> > > > to bootelf before switching to EL2. Additionally, provide a weak noop
> > > > function so we don't have to have "#ifdef CONFIG_ARM64" guards.
> > > > 
> > > > Signed-off-by: Michael Walle <michael@walle.cc>
> > > > ---
> > > >   common/bootm.c             | 9 +++++++++
> > > >   lib/efi_loader/efi_setup.c | 6 ++++++
> > > >   2 files changed, 15 insertions(+)
> > > > 
> > > > diff --git a/common/bootm.c b/common/bootm.c
> > > > index db4362a643..65adf29329 100644
> > > > --- a/common/bootm.c
> > > > +++ b/common/bootm.c
> > > > @@ -816,6 +816,15 @@ void __weak switch_to_non_secure_mode(void)
> > > >   {
> > > >   }
> > > > 
> > > > +/**
> > > > + * smp_kick_all_cpus() - kick all CPUs
> > > > + *
> > > > + * This routine is overridden by architectures requiring this
> > > > feature.
> > > > + */
> > > > +void __weak smp_kick_all_cpus(void)
> > > > +{
> > > > +}
> > > > +
> > > >   #else /* USE_HOSTCC */
> > > > 
> > > >   #if defined(CONFIG_FIT_SIGNATURE)
> > > > diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c
> > > > index 26a7423203..7e5364adc5 100644
> > > > --- a/lib/efi_loader/efi_setup.c
> > > > +++ b/lib/efi_loader/efi_setup.c
> > > > @@ -132,6 +132,12 @@ efi_status_t efi_init_obj_list(void)
> > > >   	/* Allow unaligned memory access */
> > > >   	allow_unaligned();
> > > > 
> > > > +	/*
> > > > +	 * Some architectures need to kick secondary cores to enter their
> > > > +	 * spin table.
> > > > +	 */
> > > > +	smp_kick_all_cpus();
> > > This will not compile with
> > > 
> > > CONFIG_CMD_BOOTI=n
> > > CONFIG_CMD_BOOTM=n
> > > CONFIG_CMD_BOOTZ=n
> > 
> > 
> > Much worse is that in incurs needless overhead on PSCI capable
> > platforms. Can we move the smp_kick_all_cpus() to the board or soc
> > level of the few systems that use spin tables please? :)
> 
> Ok, I'm not sure where I should put the smp_kick_all_cpus(). In the
> bootm/booti path this is done in boot_jump_linux() (unconditionally
> in do_nonsec_virt_switch()). Therefore, shouldn't the kick be in
> switch_to_non_secure_mode(), too?
> 
> Regarding the overhead, isn't it just called once before starting
> the OS? Is that really worth adding yet another weak function or
> ifdef guards? Isn't it better to behave like the bootm case?

So, I think this shows that there's some consolidation needed as VxWorks
and ELF support have also had to solve this problem and are copying
around the same code that I believe Alex is saying we should in fact not
need on SoCs that handle this via PSCI instead of a spintable?

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200518/8493d743/attachment.sig>

  reply	other threads:[~2020-05-18 18:30 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-14 12:38 [PATCH 0/4] bootefi fixes for aarch64/layerscape Michael Walle
2020-05-14 12:38 ` [PATCH 1/4] efi_loader: aarch64: align runtime section to 64kb Michael Walle
2020-05-14 18:27   ` Heinrich Schuchardt
2020-05-14 19:04     ` Michael Walle
2020-05-14 21:03       ` Heinrich Schuchardt
2020-05-14 22:02         ` Michael Walle
2020-05-14 22:27           ` Heinrich Schuchardt
2020-05-14 23:04             ` Heinrich Schuchardt
2020-05-15 11:39               ` Michael Walle
2020-05-28 17:11     ` Heinrich Schuchardt
2020-05-14 12:38 ` [PATCH 2/4] efi_loader: check alignment in efi_add_memory_map() Michael Walle
2020-05-14 18:35   ` Heinrich Schuchardt
2020-05-14 18:50     ` Michael Walle
2020-05-14 22:02       ` Heinrich Schuchardt
2020-05-14 12:38 ` [PATCH 3/4] fsl-layerscape: align first parameter of efi_add_memory_map() Michael Walle
2020-05-14 18:39   ` Heinrich Schuchardt
2020-05-14 12:38 ` [PATCH 4/4] efi_loader: call smp_kick_all_cpus() Michael Walle
2020-05-14 18:46   ` Heinrich Schuchardt
2020-05-14 20:17     ` Alexander Graf
2020-05-14 20:35       ` Michael Walle
2020-05-16 15:54       ` Michael Walle
2020-05-18 18:30         ` Tom Rini [this message]
2020-05-18 18:45           ` Heinrich Schuchardt
2020-05-18 19:23             ` 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=20200518183009.GG14425@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=u-boot@lists.denx.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.