public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] ELF_RELOC causes strange I-cache issues
Date: Thu, 21 Oct 2010 11:51:57 +0200	[thread overview]
Message-ID: <4CC00D3D.2090700@denx.de> (raw)
In-Reply-To: <1287652681-4085-1-git-send-email-albert.aribaud@free.fr>

Hello Albert,

Albert Aribaud wrote:
> Wolfgang (and others who can/want),
> 
> Please test this patch; it should add a complete barrier to make
> sure that all fixups are written to RAM before jumping there, and
> that no remnants subsist of the old unfixed code in the instruction
> paths. However, I cannot even do basic testing on it as I have
> no 1136 board, so I cannot rule out even basic mistakes.
> 
> When this works I'll do a proper [PATCH].
> 
> Amicalement,
> Albert.
> 
> diff --git a/arch/arm/cpu/arm1136/start.S b/arch/arm/cpu/arm1136/start.S
> index 8b63192..f49f1de 100644
> --- a/arch/arm/cpu/arm1136/start.S
> +++ b/arch/arm/cpu/arm1136/start.S
> @@ -257,6 +257,11 @@ fixloop:
>  	add	r2, r2, #4
>  	cmp	r2, r3
>  	bne	fixloop
> +	/* fixups done, cleanup caches if used and prefetch buffer */
> +	mov	r3, #0
> +	mcr	p15, 0, r3, c7, c10, 4	/* data synchronization barrier */
> +	mcr	p15, 0, r3, c7, c5, 0	/* invalidate instruction cache */
> +	mcr	p15, 0, r3, c7, c5, 4	/* flush prefetch buffer */
>  #endif
>  #endif	/* #ifndef CONFIG_SKIP_RELOCATE_UBOOT */

Actually I tried an identically patch, but didn;t help :-(

But as reading in the arm manual such a memory barrier should
not be bad here ...

BTW:

I had a fix for this problem, but I completly not understand
what it has to do with relocation (if it really is a problem
introduced through relocation ...), nor why a flush_cache
helps here, because dcache is off and only icache is on ...

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index f44fc4e..3e326ac 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -203,6 +203,8 @@ static inline void ehci_invalidate_dcache(struct QH *qh)
 static int handshake(uint32_t *ptr, uint32_t mask, uint32_t done, int usec)
 {
        uint32_t result;
+
+       flush_cache(0, 0);
        do {
                result = ehci_readl(ptr);
                if (result == ~(uint32_t)0)

and the "usb read 80000000 0 1000" command works fine ...


Maybe Icache flush dosen;t work because the "ARM1136 Errata 411920
Invalidate Instruction Cache operation can fail" interferes here?

bye,
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

  reply	other threads:[~2010-10-21  9:51 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-20 18:49 [U-Boot] ELF_RELOC causes strange I-cache issues Wolfgang Denk
2010-10-20 20:12 ` Albert ARIBAUD
2010-10-20 20:54   ` Wolfgang Denk
2010-10-20 22:20     ` Joakim Tjernlund
2010-10-21  9:18     ` Albert Aribaud
2010-10-21  9:51       ` Heiko Schocher [this message]
2010-10-21 10:11         ` Reinhard Meyer
2010-10-21 10:34           ` Albert ARIBAUD
2010-10-21 10:49             ` Reinhard Meyer
2010-10-21 10:50             ` Heiko Schocher
2010-10-21 11:03             ` Stefan Roese
2010-10-21 10:54           ` Wolfgang Denk
2010-10-21 10:56         ` Albert ARIBAUD
2010-10-21 11:36           ` Wolfgang Denk
2010-10-21 11:45             ` Wolfgang Denk
2010-10-21 11:52               ` Stefano Babic
2010-10-21 11:53           ` Wolfgang Denk
2010-10-21 12:00           ` Wolfgang Denk
2010-10-21 12:53             ` Albert ARIBAUD
2010-10-21 11:28         ` Joakim Tjernlund
2010-10-21 10:05       ` Wolfgang Denk
2010-10-22 12:23 ` [U-Boot] [PATCH] ehci-hcd.c: fix hanging under higher load Wolfgang Denk
2010-10-22 19:51   ` Remy Bohmer
2010-10-22 12:26 ` [U-Boot] ELF_RELOC causes strange I-cache issues Wolfgang Denk
2010-10-22 13:19   ` Albert ARIBAUD
2010-10-22 13:28     ` Wolfgang Denk

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=4CC00D3D.2090700@denx.de \
    --to=hs@denx.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox