Re: [PATCH V5] ARM: mach-shmobile: Don't init CNTVOFF/counter if PSCI is available

From: Simon Horman
Date: Tue May 28 2019 - 12:08:36 EST


On Tue, May 28, 2019 at 10:27:56AM +0200, Geert Uytterhoeven wrote:
> Hi Oleksandr,
>
> On Fri, May 17, 2019 at 11:58 AM Oleksandr Tyshchenko
> <olekstysh@xxxxxxxxx> wrote:
> > From: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>
> >
> > If PSCI is available then most likely we are running on PSCI-enabled
> > U-Boot which, we assume, has already taken care of resetting CNTVOFF
> > and updating counter module before switching to non-secure mode
> > and we don't need to.
> >
> > As the psci_smp_available() helper always returns false if CONFIG_SMP
> > is disabled, it can't be used safely as an indicator of PSCI usage.
> > For that reason, we check for the mandatory PSCI operation to be
> > available.
> >
> > Please note, an extra check to prevent secure_cntvoff_init() from
> > being called for secondary CPUs in headsmp-apmu.S is not needed,
> > as SMP code for APMU based system is not executed if PSCI is in use.
> >
> > Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>
>
> > Changes in v5:
> > - Check for psci_ops.cpu_on if CONFIG_ARM_PSCI_FW is defined
>
> Thanks for the update!
>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
>
> Two cosmetic comments below. I'll leave it to Simon to ignore them for
> applying ;-)

Oleksandr, could I trouble you to respin with the
changes suggested by Geert?

>
> > @@ -62,6 +63,21 @@ void __init rcar_gen2_timer_init(void)
> > {
> > void __iomem *base;
> > u32 freq;
> > + bool need_update = true;
>
> Some people like reverse Xmas tree declaration order...
>
> > +
> > + /*
> > + * If PSCI is available then most likely we are running on PSCI-enabled
> > + * U-Boot which, we assume, has already taken care of resetting CNTVOFF
> > + * and updating counter module before switching to non-secure mode
> > + * and we don't need to.
> > + */
> > +#if defined(CONFIG_ARM_PSCI_FW)
>
> #ifdef CONFIG_ARM_PSCI_FW ?
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
> -- Linus Torvalds
>