arm: Prevent memory aliasing on non-LPAE kernels

Some LPAE-capable systems may use a Device Tree containing
memory nodes that describe memory extending beyond the 4GB
physical address boundary. Ignore or truncate these memory
nodes on kernels that have not been built with LPAE
support, to prevent the extended physical addresses from
being truncated and aliasing with physical addresses below
the 4GB boundary.

Change-Id: I910d272820344de8b5ba65078fa47528a816a65b
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
This commit is contained in:
Stepan Moskovchenko
2013-05-28 20:15:32 -07:00
parent 900b42fde7
commit ceddedaded
+12
View File
@@ -26,6 +26,18 @@
void __init early_init_dt_add_memory_arch(u64 base, u64 size)
{
#ifndef CONFIG_ARM_LPAE
if (base > ((phys_addr_t)~0)) {
pr_crit("Ignoring memory at 0x%08llx due to lack of LPAE support\n",
base);
return;
}
if (size > ((phys_addr_t)~0))
size = ((phys_addr_t)~0);
/* arm_add_memory() already checks for the case of base + size > 4GB */
#endif
arm_add_memory(base, size);
}