9
0
Fork 0
Commit Graph

13 Commits

Author SHA1 Message Date
Sascha Hauer 50d1b2de8e ARM v7: Fix register corruption in v7_mmu_cache_off
v7_mmu_cache_flush stores registers on the stack and restores
them afterwards. Additionally v7_mmu_cache_flush is called
from v7_mmu_cache_off *after* disabling the MMU. With this
the following can happen:

- v7_mmu_cache_off disables the MMU. From now on no new values
  go to the data cache.
- v7_mmu_cache_off calls v7_mmu_cache_flush which in turn puts
  registers on the stack. Due to the MMU being disabled they
  do not go into the data cache.
- In v7_mmu_cache_flush the memory the stack is pointing to is
  overwritten with the values currently being in the cache.
- v7_mmu_cache_flush restores the registers from the stack with
  values from the cache and not the memory where the values have
  previously been written to.

Fix this by storing the registers on the stack *before* we disable
the MMU and restore them after we have called v7_mmu_cache_flush.
This way v7_mmu_cache_flush still restores corrupt register values
for the case when the MMU has been disabled, but we will restore
correct values afterwards.

This has been first observed when switching to gcc-4.7.2 when compiling
in Thumb2 mode, but could explain earlier problems also. The result
here was that the register holding the kernel address in start_linux()
was corrupted so that the kernel could not be started.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-23 20:37:56 +01:00
Sascha Hauer 1dbfd5ed82 ARM: Support multiple ARM architectures
The different ARM architectures need different cache functions. This
patch makes them selectable during runtime.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-13 11:19:13 +02:00
Sascha Hauer 8377958958 ARM __mmu_cache_*: Do not clobber registers
Save/restore the registers used in __mmu_cache_* so that they can
be called as regular C functions.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-08-13 20:27:38 +02:00
Sascha Hauer 7c3e50c83d ARM: Separate assembler functions into their own section
To let the linker remove unused functions.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-07-23 23:57:44 +02:00
Sascha Hauer 023e9f01c7 ARM startup: Do call __mmu_cache_flush during startup
Traditionally we call __mmu_cache_flush in early startup. There
is a problem with armv7 and hierarchical caches though, on these
systems __mmu_cache_flush uses the stack. Appearantly this was
seldomly a problem, because most of these systems have a ROM
bootloader which sets up some stack, but on a special i.MX6 system
this failed badly. We should not have to flush caches here. Every
sane system should pass control to the bootloader without stale
entries in the caches *), so it should be a safe assumption that the
cache flush can be removed.

Since __mmu_cache_flush is not called from early code anymore we can
also move it to the regular text section.

Be brave and give it a try.

*) omap3 seems to be a exception to this, but this has a cache flush
in arch_init_lowlevel already

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-05-23 22:28:11 +02:00
Sascha Hauer 0073723f15 ARM cache-armv7: Add additional ISB
At least OMAP3 needs this to properly work with MMU.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-01-17 18:50:55 +01:00
Sascha Hauer e9557be0c1 ARM cache-armv7: use thumb-2 instructions where necessary
Copied from the Kernel

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-01-02 15:00:28 +01:00
Sascha Hauer acc033704c ARM v7: Fix typos in cache-armv7.S
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-03-08 12:33:16 +01:00
Sascha Hauer 4b74753cce ARM v7: Fix broken mmu initialization
The armv7 specific __mmu_cache_on function accidently sets
the page table pointer with the unitialized value of r3. It seems
that often enough r3 still held the correct value from a previous
call to mmu_init allowing this bug to remain uncovered for longer.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-03-08 12:33:12 +01:00
Jean-Christophe PLAGNIOL-VILLARD e34c1d4fcc init: introduce __BARE_INIT for .section ".text_bare_init.text"
and make init.h availlable for assembly too

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-09-20 08:56:37 +02:00
Sascha Hauer bd9e5ca89e arm: move __mmu_cache_flush to bare_init section
Instead of having seperate cache flush functions in the startup code
we want to call the generic functions. To accomplish this they have
to be in the bare_init section.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-05-03 15:05:38 +02:00
Sascha Hauer bcaabae0f6 ARM: Add a wrapper around dma_* functions
This is a preparation to add second level cache support.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-03-30 14:15:04 +02:00
Sascha Hauer 3f1bf1f058 Use cache functions from kernel
These cache functions have been extracted from
arch/arm/boot/compressed/head.S. The old code only worked
properly on ARMv4. Tested on ARMv4, ARMv5, ARMv6 hardware.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-02-01 17:23:40 +01:00