Skip to content

Commit 312bc67

Browse files
Markos Chandrassashalevin
authored andcommitted
MIPS: Malta: Detect and fix bad memsize values
[ Upstream commit f7f8aea ] memsize denotes the amount of RAM we can access from kseg{0,1} and that should be up to 256M. In case the bootloader reports a value higher than that (perhaps reporting all the available RAM) it's best if we fix it ourselves and just warn the user about that. This is usually a problem with the bootloader and/or its environment. [ralf@linux-mips.org: Remove useless parens as suggested bei Sergei. Reformat long pr_warn statement to fit into 80 column limit.] Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Cc: <stable@vger.kernel.org> # v3.15+ Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/9362/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
1 parent 00f1187 commit 312bc67

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎arch/mips/mti-malta/malta-memory.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ fw_memblock_t * __init fw_getmdesc(int eva)
5353
pr_warn("memsize not set in YAMON, set to default (32Mb)\n");
5454
physical_memsize = 0x02000000;
5555
} else {
56+
if (memsize > (256 << 20)) { /* memsize should be capped to 256M */
57+
pr_warn("Unsupported memsize value (0x%lx) detected! "
58+
"Using 0x10000000 (256M) instead\n",
59+
memsize);
60+
memsize = 256 << 20;
61+
}
5662
/* If ememsize is set, then set physical_memsize to that */
5763
physical_memsize = ememsize ? : memsize;
5864
}

0 commit comments

Comments
 (0)