Skip to content

Commit

Permalink
[arch][arm] Enable caches early if WITH_KERNEL_VM is set
Browse files Browse the repository at this point in the history
Spinlocks and atomic operations may not work on uncached memory. If
WITH_KERNEL_VM is set, the mmu is enabled early (with cached) mappings,
but unless the caches are also enabled in SCTLR they may not work.

Also, initialize SCTLR on secondary cpus.

Change-Id: Icaa186ed582be0df7cb531731334239ea1e19f2e
Signed-off-by: Arve Hjønnevåg <arve@android.com>
  • Loading branch information
arve-android committed Mar 12, 2015
1 parent cfd0bd2 commit 1e912a1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions arch/arm/arm/start.S
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ arm_reset:
/* i/d cache disable, mmu disabled */
bic r12, #(1<<12)
bic r12, #(1<<2 | 1<<0)
#if WITH_KERNEL_VM
/* enable caches so atomics and spinlocks work */
orr r12, r12, #(1<<12)
orr r12, r12, #(1<<2)
#endif
mcr p15, 0, r12, c1, c0, 0

/* calculate phys offset */
Expand Down

0 comments on commit 1e912a1

Please sign in to comment.