Merge branch 'linux-linaro-lsk' into linux-linaro-lsk-android
[firefly-linux-kernel-4.4.55.git] / arch / arm64 / mm / init.c
index 109a0442b6a1766d182aea772e03f7d3e51ef1e6..9a9eaadb8634a6f370971d29acd1ac2bd43ec09c 100644 (file)
@@ -143,11 +143,30 @@ static void arm64_memory_present(void)
 }
 #endif
 
+static phys_addr_t memory_limit = (phys_addr_t)ULLONG_MAX;
+
+/*
+ * Limit the memory size that was specified via FDT.
+ */
+static int __init early_mem(char *p)
+{
+       if (!p)
+               return 1;
+
+       memory_limit = memparse(p, &p) & PAGE_MASK;
+       pr_notice("Memory limited to %lldMB\n", memory_limit >> 20);
+
+       return 0;
+}
+early_param("mem", early_mem);
+
 void __init arm64_memblock_init(void)
 {
        u64 *reserve_map, base, size;
        phys_addr_t dma_phys_limit = 0;
 
+       memblock_enforce_memory_limit(memory_limit);
+
        /*
         * Register the kernel text, kernel data, initrd, and initial
         * pagetables with memblock.