summaryrefslogtreecommitdiff
path: root/arch/arm64/mm/init.c
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2016-03-02 08:47:13 (GMT)
committerCatalin Marinas <catalin.marinas@arm.com>2016-03-02 09:45:52 (GMT)
commit6d2aa549de1fc998581d216de3853aa131aa4446 (patch)
tree76ecfc517079dfe3118bc96e0f523252a5618a82 /arch/arm64/mm/init.c
parent22b39ca3f22ac46a42731447aadc0a5109078241 (diff)
downloadlinux-6d2aa549de1fc998581d216de3853aa131aa4446.tar.xz
arm64: mm: check at build time that PAGE_OFFSET divides the VA space evenly
Commit 8439e62a1561 ("arm64: mm: use bit ops rather than arithmetic in pa/va translations") changed the boundary check against PAGE_OFFSET from an arithmetic comparison to a bit test. This means we now silently assume that PAGE_OFFSET is a power of 2 that divides the kernel virtual address space into two equal halves. So make that assumption explicit. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/mm/init.c')
-rw-r--r--arch/arm64/mm/init.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 22c6758..8c3d7dd 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -171,6 +171,13 @@ void __init arm64_memblock_init(void)
const s64 linear_region_size = -(s64)PAGE_OFFSET;
/*
+ * Ensure that the linear region takes up exactly half of the kernel
+ * virtual address space. This way, we can distinguish a linear address
+ * from a kernel/module/vmalloc address by testing a single bit.
+ */
+ BUILD_BUG_ON(linear_region_size != BIT(VA_BITS - 1));
+
+ /*
* Select a suitable value for the base of physical memory.
*/
memstart_addr = round_down(memblock_start_of_DRAM(),