summaryrefslogtreecommitdiffstats
path: root/arch/arm/include
diff options
context:
space:
mode:
authorAndrey Smirnov <andrew.smirnov@gmail.com>2018-05-21 20:15:09 -0700
committerSascha Hauer <s.hauer@pengutronix.de>2018-05-22 09:13:55 +0200
commitee9576d2679537a292b8f5e50765eba707be7c87 (patch)
treee8ebafe2bbd3506bb04b57b40df10cc0b8440272 /arch/arm/include
parente3e54c64418076e27b941c2450ef718a377e57da (diff)
downloadbarebox-ee9576d2679537a292b8f5e50765eba707be7c87.tar.gz
barebox-ee9576d2679537a292b8f5e50765eba707be7c87.tar.xz
ARM: mmu: Introduce ARM_TTB_SIZE
Commit 1c33aacf8a247ab45814b43ac0ca903677afffae ("ARM: use memalign to allocate page table"), reasonalby changed TTB allocation size from SZ_32K to SZ_16K (TTB's real size), but it also changed alignment from SZ_16K to SZ_64K for unclear reasons. Reading various TTBR related ARM documentation it seems that worst case alignment for it is 16KiB (bits [0, 13 - N] must be zero) which also matches early TTB allocation code. Since both early and regular MMU code has to share this paramter, introduce ARM_TTB_SIZE and use it in both cases for both size and alignment. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/include')
-rw-r--r--arch/arm/include/asm/barebox-arm.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/arm/include/asm/barebox-arm.h b/arch/arm/include/asm/barebox-arm.h
index 4803237116..bd355f617b 100644
--- a/arch/arm/include/asm/barebox-arm.h
+++ b/arch/arm/include/asm/barebox-arm.h
@@ -32,6 +32,12 @@
#include <linux/compiler.h>
#include <asm/barebox-arm-head.h>
+/*
+ * We have a 4GiB address space split into 1MiB sections, with each
+ * section header taking 4 bytes
+ */
+#define ARM_TTB_SIZE (SZ_4G / SZ_1M * sizeof(u32))
+
unsigned long get_runtime_offset(void);
/* global_variable_offset() - Access global variables when not running at link address
@@ -114,7 +120,7 @@ static inline unsigned long arm_mem_ttb(unsigned long membase,
unsigned long endmem)
{
endmem = arm_mem_stack(membase, endmem);
- endmem = ALIGN_DOWN(endmem, SZ_16K) - SZ_16K;
+ endmem = ALIGN_DOWN(endmem, ARM_TTB_SIZE) - ARM_TTB_SIZE;
return endmem;
}