mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Lucas Stach <l.stach@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>, barebox@lists.infradead.org
Cc: ore@pengutronix.de, rcz@pengutronix.de
Subject: Re: [PATCH 1/5] ARM: cache-armv7: add work-around for errata 814220
Date: Thu, 25 Apr 2019 12:02:22 +0200	[thread overview]
Message-ID: <1556186542.2584.9.camel@pengutronix.de> (raw)
In-Reply-To: <20190423171852.26126-2-a.fatoum@pengutronix.de>

Am Dienstag, den 23.04.2019, 19:18 +0200 schrieb Ahmad Fatoum:
> The v7 ARM states that all cache and branch predictor maintenance operations
> that do not specify an address execute, relative to each other, in program
> order. However, because of this erratum, an L2 set/way cache maintenance
> operation can overtake an L1 set/way cache maintenance operation, this would
> cause the data corruption.
> 
> This ERRATA affected the Cortex-A7 and present in r0p2, r0p3, r0p4, r0p5.
> 
> This patch is the SW workaround by adding a DSB before changing cache levels as
> the ARM ERRATA: ARM/MP: 814220 told in the ARM ERRATA documentation.
> 
> Signed-off-by: Jason Liu <r64343@freescale.com>
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
> Acked-by: Arnd Bergmann <arnd@arndb.de>
> [afa: picked from LKML: <20190214083145.15148-1-benjamin.gaignard@linaro.org>]
> [afa: edited commit message headline]
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  arch/arm/Kconfig           | 12 ++++++++++++
>  arch/arm/cpu/cache-armv7.S |  3 +++
>  2 files changed, 15 insertions(+)
> 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index a683c9c86661..fc622640aa2b 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -448,4 +448,16 @@ config ARM_PSCI_DEBUG
>  	  putc function.
>  	  Only use for debugging.
>  
> +config ARM_ERRATA_814220
> +       bool "ARM errata: Cache maintenance by set/way operations can execute out of order"
> +       depends on CPU_V7
> +       help
> +         The v7 ARM states that all cache and branch predictor maintenance
> +         operations that do not specify an address execute, relative to
> +         each other, in program order.
> +         However, because of this erratum, an L2 set/way cache maintenance
> +         operation can overtake an L1 set/way cache maintenance operation.
> +         This ERRATA only affected the Cortex-A7 and present in r0p2, r0p3,
> +         r0p4, r0p5.
> +
>  endmenu
> diff --git a/arch/arm/cpu/cache-armv7.S b/arch/arm/cpu/cache-armv7.S
> index 7a1c5c01894c..0eb0ecfee756 100644
> --- a/arch/arm/cpu/cache-armv7.S
> +++ b/arch/arm/cpu/cache-armv7.S
> @@ -120,6 +120,9 @@ THUMB(		ite	eq			)
>  skip:
>  		add	r12, r12, #2		@ increment cache number
>  		cmp	r3, r12
> +#ifdef CONFIG_ARM_ERRATA_814220
> +		dsb
> +#endif

I don't think we need a Kconfig option here. This function is not
really performance critical. The short pipeline stall introduced by the
dsb when switching the cache level is minor compared to the time it
takes to actually move the cache blocks on a clean.

Just always execute the sdb and add a comment on why it is needed.

Regards,
Lucas

>  		bgt	loop1
>  finished:
>  		ldmfd	sp!, {r4-r11}

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

  parent reply	other threads:[~2019-04-25 10:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-23 17:18 [PATCH 0/5] ARM: mmu: misc armv7 cache/MMU fixes Ahmad Fatoum
2019-04-23 17:18 ` [PATCH 1/5] ARM: cache-armv7: add work-around for errata 814220 Ahmad Fatoum
2019-04-23 17:39   ` Sam Ravnborg
2019-04-25 10:38     ` Ahmad Fatoum
2019-04-25 10:02   ` Lucas Stach [this message]
2019-04-23 17:18 ` [PATCH 2/5] ARM: imx: work around i.MX6UL ERR008958 (ARM errata 814220) Ahmad Fatoum
2019-04-23 17:41   ` Sam Ravnborg
2019-04-25 10:39     ` Ahmad Fatoum
2019-04-23 17:18 ` [PATCH 3/5] ARM: cache-armv7: start invalidation from outer levels Ahmad Fatoum
2019-04-23 17:21   ` Ahmad Fatoum
2019-04-25  9:57     ` Lucas Stach
2019-04-23 17:18 ` [PATCH 4/5] ARM: mmu: remove doubly defined macro Ahmad Fatoum
2019-04-23 17:18 ` [PATCH 5/5] ARM: mmu: mark uncached regions as eXecute never on v7 Ahmad Fatoum

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=1556186542.2584.9.camel@pengutronix.de \
    --to=l.stach@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=ore@pengutronix.de \
    --cc=rcz@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