mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Lucas Stach <l.stach@pengutronix.de>
To: Fabio Estevam <festevam@gmail.com>, s.hauer@pengutronix.de
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] mx5: Implement Spectre v2 workaround for Cortex-A8
Date: Thu, 12 Jul 2018 10:49:43 +0200	[thread overview]
Message-ID: <1531385383.3163.65.camel@pengutronix.de> (raw)
In-Reply-To: <1531348178-4168-1-git-send-email-festevam@gmail.com>

Hi Fabio

Am Mittwoch, den 11.07.2018, 19:29 -0300 schrieb Fabio Estevam:
> Since 4.18-rc1 kernel the following warning is seen on i.MX51 and
> i.MX53:
>     
> CPU0: Spectre v2: firmware did not set auxiliary control register IBE bit, system vulnerable
>     
> Implement the suggested workaround by setting the IBE bit in the
> auxiliary control register.
> 
> Based on commit 7b37a9c732bf ("ARM: Introduce ability to enable ACR::IBE
> on Cortex-A8 for CVE-2017-5715") from U-Boot.
>     
> With this patch applied the kernel now reports:
>     
> CPU0: Spectre v2: using BPIALL workaround
> 
> Tested on a imx51 babbage.
> 
> > Signed-off-by: Fabio Estevam <festevam@gmail.com>
> ---
>  arch/arm/include/asm/errata.h | 9 +++++++++
>  arch/arm/mach-imx/cpu_init.c  | 3 ++-
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/include/asm/errata.h b/arch/arm/include/asm/errata.h
> index 98137b5..c0e0f5a 100644
> --- a/arch/arm/include/asm/errata.h
> +++ b/arch/arm/include/asm/errata.h
> @@ -86,3 +86,12 @@ static inline void enable_arm_errata_845369_war(void)
> > >  		"mcr	p15, 0, r0, c15, c0, 1\n"
> >  	);
>  }
> +
> +static inline void enable_arm_errata_cortexa8_cve_2017_5715(void)

Patch looks mostly good, but I don't like the naming here. CVE 2017-
5715 doesn't have a direct correlation with the Cortex A8. Maybe just
name this _cortexa8_enable_ibe? A comment that this allows the kernel
to flush the BTB properly might also help.

Regards,
Lucas


> +{
> > +	__asm__ __volatile__ (
> > > +		"mrc	p15, 0, r0, c1, c0, 1\n"
> > > +		"orr	r0, r0, #1 << 6\n"
> > > +		"mcr	p15, 0, r0, c1, c0, 1\n"
> > +	);
> +}
> diff --git a/arch/arm/mach-imx/cpu_init.c b/arch/arm/mach-imx/cpu_init.c
> index 5b93d12..e1d88c7 100644
> --- a/arch/arm/mach-imx/cpu_init.c
> +++ b/arch/arm/mach-imx/cpu_init.c
> @@ -22,6 +22,7 @@ void imx5_cpu_lowlevel_init(void)
> >  	arm_cpu_lowlevel_init();
>  
> >  	enable_arm_errata_709718_war();
> > +	enable_arm_errata_cortexa8_cve_2017_5715();
>  }
>  
>  void imx6_cpu_lowlevel_init(void)
> @@ -51,4 +52,4 @@ void vf610_cpu_lowlevel_init(void)
>  {
> >  	arm_cpu_lowlevel_init();
>  }
> -#endif
> \ No newline at end of file
> +#endif

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2018-07-12  8:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-11 22:29 Fabio Estevam
2018-07-12  8:49 ` Lucas Stach [this message]

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=1531385383.3163.65.camel@pengutronix.de \
    --to=l.stach@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=festevam@gmail.com \
    --cc=s.hauer@pengutronix.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