Skip to contentSkip to conversation

integratorap: disable dcache

PATCH New Linus Walleij 5 participants 7 messages Jul 13, 2011 – Jul 15, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 integratorap: disable dcache

The Integrator AP with CM920T (ARM920T) does not boot without D-cache disabled throughout, the actual problem comes at "bootm", at this point U-Boot tries to disable D-cache which doesn't work on this machine for some reason. The result is usually an illegal instruction trap or similar as the PC goes astray in memory and crash something like this:

undefined instruction

 pc : [<01ff1c44>]          lr : [<01fd8430>]
 sp : 01fa7e08  ip : 01fa7dc0     fp : 00000000
 r10: 01fef318  r9 : 00000015     r8 : 01fa7f70
 r7 : 00000015  r6 : 00008000     r5 : 01fa7fe8  r4 : 00000000
 r3 : 01fef380  r2 : 01fef8b0     r1 : ffffffff  r0 : fffffffe
 Flags: Nzcv  IRQs off  FIQs off  Mode SVC_32
 Resetting CPU ...

Disabling D-cache brings the board support to a working state that can boot the Linux kernel.

---
 include/configs/integratorap.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
include/configs/integratorap.h +1 -0
index 26eac8b..acdb37c 100644
@@ -48,6 +48,7 @@
 #define CONFIG_CM_INIT		1
 #define CONFIG_CM_REMAP		1
 #undef CONFIG_CM_SPD_DETECT
+#define CONFIG_SYS_DCACHE_OFF
 
 /*
  * Size of malloc() pool
Signature · 1 line
1.7.6
#1 lore raw

PATCH 1/2 integratorap: disable dcache

Dear Linus Walleij,

Quoted 16 lines · In message <[email protected]> you…

The Integrator AP with CM920T (ARM920T) does not boot without D-cache disabled throughout, the actual problem comes at "bootm", at this point U-Boot tries to disable D-cache which doesn't work on this machine for some reason. The result is usually an illegal instruction trap or similar as the PC goes astray in memory and crash something like this:

undefined instruction

 pc : [<01ff1c44>]          lr : [<01fd8430>]
 sp : 01fa7e08  ip : 01fa7dc0     fp : 00000000
 r10: 01fef318  r9 : 00000015     r8 : 01fa7f70
 r7 : 00000015  r6 : 00008000     r5 : 01fa7fe8  r4 : 00000000
 r3 : 01fef380  r2 : 01fef8b0     r1 : ffffffff  r0 : fffffffe
 Flags: Nzcv  IRQs off  FIQs off  Mode SVC_32
 Resetting CPU ...
Quoted 7 lines

Disabling D-cache brings the board support to a working state that can boot the Linux kernel.

---
 include/configs/integratorap.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Sorry, but again I have to point out that I really dislike papering over existing bugs. If the disable D-cache in bootm does not work, _this_ should be analyzed and fixed instead of globally disabling he data cache.

NAK.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
In accord with UNIX philosophy, Perl gives you enough  rope  to  hang
yourself.              - L. Wall & R. L. Schwartz, _Programming Perl_
#2 lore raw

PATCH 1/2 integratorap: disable dcache

Quoted 4 lines · Wolfgang Denk

Sorry, but again I have to point out that I really dislike papering over existing bugs. ?If the disable D-cache in bootm does not work, _this_ should be analyzed and fixed instead of globally disabling he data cache.

No problem, I didn't label it as RFC since what it does is actually fix a regression.

At one point U-boot was working on the Integrator and now it doesn't, it seems commit 880eff5cfb9df6f0855f4e48affd349ca64692e9 "ARM: cp15: setup mmu and enable dcache" is causing it.

Heiko, Alessandro, do you have any hints on how to go about flushing and disabling the D-cache in bootm for ARM920T? It doesn't seem to work on this ARM CPU chip in its current form...

Yours,
Linus Walleij

#3 lore raw

PATCH 1/2 integratorap: disable dcache

Hello Linus,

Quoted 10 lines · Linus Walleij
Quoted 4 lines · Wolfgang Denk

Sorry, but again I have to point out that I really dislike papering over existing bugs. If the disable D-cache in bootm does not work, _this_ should be analyzed and fixed instead of globally disabling he data cache.

No problem, I didn't label it as RFC since what it does is actually fix a regression.

Quoted 7 lines

At one point U-boot was working on the Integrator and now it doesn't, it seems commit 880eff5cfb9df6f0855f4e48affd349ca64692e9 "ARM: cp15: setup mmu and enable dcache" is causing it.

Heiko, Alessandro, do you have any hints on how to go about flushing and disabling the D-cache in bootm for ARM920T? It doesn't seem to work on this ARM CPU chip in its current form...

Hmm.. trying bootm with actual u-boot on a davinci (arm926ejs) based board, there I couldn;t use the Davinci-EMAC (if I disable the dcache it works ...)

Seems above commit introduced problems for other arm architectures, drivers, ...

Hmm... if we globally always enable the dcache, we have a lot of more drivers to fix (I think) ...

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#4 lore raw

PATCH 1/2 integratorap: disable dcache

Quoted 3 lines · Heiko Schocher

Hmm.. trying bootm with actual u-boot on a davinci (arm926ejs) based board, there I couldn;t use the Davinci-EMAC (if I disable the dcache it works ...)

I can confirm there are some cache coherency problems with the DaVinci EMAC driver. I've done a port to a new board based on the DA850 and had problems with corrupt Ethernet packets until I disabled the dcache altogether. The clue was the packets started working when I added a hex dump just before eth_send()!

While I haven't come across any explicit documentation I presume the EMAC controller's independent DMA engine is simply not aware of the ARM's cache.

I haven't yet identified whether there's some mechanism already in U-Boot for marking particular bits of memory as uncacheable, which would seem to be the correct approach, but turning of dcache doesn't really have any side effects that cause problems for me.

Bye for now,

Signature · 3 lines
Laurence Withers, <[email protected]>                http://www.guralp.com/
Direct tel:+447753988197 or tel:+443333408643               Software Engineer
General support queries: <[email protected]>         CMG-DCM CMG-EAM CMG-NAM
#5 lore raw

PATCH 1/2 integratorap: disable dcache

Hi Laurence,

Quoted 5 lines · On Friday 15 July 2011 10:54:41 Laurence Withers wrote:
Quoted 3 lines · Heiko Schocher

Hmm.. trying bootm with actual u-boot on a davinci (arm926ejs) based board, there I couldn;t use the Davinci-EMAC (if I disable the dcache it works ...)

Quoted 8 lines

I can confirm there are some cache coherency problems with the DaVinci EMAC driver. I've done a port to a new board based on the DA850 and had problems with corrupt Ethernet packets until I disabled the dcache altogether. The clue was the packets started working when I added a hex dump just before eth_send()!

While I haven't come across any explicit documentation I presume the EMAC controller's independent DMA engine is simply not aware of the ARM's cache.

Yes.

Quoted 4 lines

I haven't yet identified whether there's some mechanism already in U-Boot for marking particular bits of memory as uncacheable, which would seem to be the correct approach, but turning of dcache doesn't really have any side effects that cause problems for me.

The "side effect" is a slow down on boot time. And it should be avoided if possible.

We have stumbled over this d-cache "problem" on powerpc a while ago. I suggest you take a look at the EHCI driver for example (drivers/usb/host/ehci-hcd.c). Please search for CONFIG_EHCI_DCACHE). We implemented the following functions on powerpc for d-cache handling:

- flush_dcache_range()
- invalidate_dcache_range()

The API was taken from Linux at that time. Now I notice that unfortunately this API seems to be powerpc specific in Linux. IMHO it would make sense to either implement this API for all other platforms using dcache with DMA engines (e.g. USB), or introduce another cache/flush/invalidate API and move powerpc to it as well.

Best regards,
Stefan

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de

#6 lore raw

PATCH 1/2 integratorap: disable dcache

In reply to Heiko Schocher
Quoted 7 lines · Heiko Schocher
Quoted 3 lines

Heiko, Alessandro, do you have any hints on how to go about flushing and disabling the D-cache in bootm for ARM920T? It doesn't seem to work on this ARM CPU chip in its current form...

Hmm.. trying bootm with actual u-boot on a davinci (arm926ejs) based board, there I couldn;t use the Davinci-EMAC (if I disable the dcache it works ...)

I take it that due to the above you cannot even get so far as to testing "bootm" on that platform with recent kernels?

If you upload the kernel with say "loady" over serial (this is what I have to use on this board that has no ethernet) then does the "bootm" command work?

Thanks,
Linus Walleij