Patchwork [U-Boot,2/2] pxa: fix memory coherency problem after relocation

login
register
mail settings
Submitter Mike Dunn
Date June 21, 2013, 4:12 p.m.
Message ID <1371831148-22380-3-git-send-email-mikedunn@newsguy.com>
Download mbox | patch
Permalink /patch/253260/
State Awaiting Upstream
Delegated to: Marek Vasut
Headers show

Comments

Mike Dunn - June 21, 2013, 4:12 p.m.
On the xscale, the icache must be invalidated and the write buffers drained
after writing code over the data bus, even if the caches are disabled.  Tested
on the pxa270.

Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
---
 arch/arm/lib/relocate.S |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
Marek Vasut - June 22, 2013, 2:29 a.m.
Dear Mike Dunn,

> On the xscale, the icache must be invalidated and the write buffers drained
> after writing code over the data bus, even if the caches are disabled. 
> Tested on the pxa270.
> 
> Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
> ---
>  arch/arm/lib/relocate.S |    9 +++++++++
>  1 files changed, 9 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/lib/relocate.S b/arch/arm/lib/relocate.S
> index 4446da9..eedf314 100644
> --- a/arch/arm/lib/relocate.S
> +++ b/arch/arm/lib/relocate.S
> @@ -92,6 +92,15 @@ fixnext:
> 
>  relocate_done:
> 
> +#ifdef __XSCALE__
> +	/*
> +	 * On xscale, icache must be invalidated and write buffers drained,
> +	 * even with cache disabled - 4.2.7 of xscale core developer's manual
> +	 */
> +	mcr	p15, 0, r0, c7, c7, 0	/* invalidate icache */
> +	mcr	p15, 0, r0, c7, c10, 4	/* drain write buffer */
> +#endif
> +
>  	/* ARMv4- don't know bx lr but the assembler fails to see that */
> 
>  #ifdef __ARM_ARCH_4__

Acked-by: Marek Vasut <marex@denx.de>

Albert, do you want me to pick these or will you?

Best regards,
Marek Vasut
Albert ARIBAUD - June 22, 2013, 5:23 a.m.
Hi Marek,

On Sat, 22 Jun 2013 04:29:56 +0200, Marek Vasut <marex@denx.de> wrote:

> Albert, do you want me to pick these or will you?

Pick them and PR me.

> Best regards,
> Marek Vasut

Amicalement,

Patch

diff --git a/arch/arm/lib/relocate.S b/arch/arm/lib/relocate.S
index 4446da9..eedf314 100644
--- a/arch/arm/lib/relocate.S
+++ b/arch/arm/lib/relocate.S
@@ -92,6 +92,15 @@  fixnext:
 
 relocate_done:
 
+#ifdef __XSCALE__
+	/*
+	 * On xscale, icache must be invalidated and write buffers drained,
+	 * even with cache disabled - 4.2.7 of xscale core developer's manual
+	 */
+	mcr	p15, 0, r0, c7, c7, 0	/* invalidate icache */
+	mcr	p15, 0, r0, c7, c10, 4	/* drain write buffer */
+#endif
+
 	/* ARMv4- don't know bx lr but the assembler fails to see that */
 
 #ifdef __ARM_ARCH_4__