summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/emulation/qemu-arm/qemu-arm.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/board/emulation/qemu-arm/qemu-arm.c b/board/emulation/qemu-arm/qemu-arm.c
index 942f1fff571..ecfd19f1a7e 100644
--- a/board/emulation/qemu-arm/qemu-arm.c
+++ b/board/emulation/qemu-arm/qemu-arm.c
@@ -127,6 +127,18 @@ int dram_init(void)
if (fdtdec_setup_mem_size_base() != 0)
return -EINVAL;
+ /*
+ * When LPAE is enabled (ARMv7),
+ * 1:1 mapping is created using 2 MB blocks.
+ *
+ * In case amount of memory provided to QEMU
+ * is not multiple of 2 MB, round down the amount
+ * of available memory to avoid hang during MMU
+ * initialization.
+ */
+ if (CONFIG_IS_ENABLED(ARMV7_LPAE))
+ gd->ram_size -= (gd->ram_size % 0x200000);
+
return 0;
}