linux-mips
[Top] [All Lists]

Re: [PATCH] MIPS: Malta: malta-memory: Detect and fix bad memsize values

To: Markos Chandras <markos.chandras@imgtec.com>, linux-mips@linux-mips.org
Subject: Re: [PATCH] MIPS: Malta: malta-memory: Detect and fix bad memsize values
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date: Fri, 27 Feb 2015 15:34:44 +0300
Cc: stable@vger.kernel.org
In-reply-to: <1425023492-23248-1-git-send-email-markos.chandras@imgtec.com>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1425023492-23248-1-git-send-email-markos.chandras@imgtec.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0
Hello.

On 2/27/2015 10:51 AM, Markos Chandras wrote:

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.

Cc: <stable@vger.kernel.org> # v3.15+
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
---
  arch/mips/mti-malta/malta-memory.c | 5 +++++
  1 file changed, 5 insertions(+)

diff --git a/arch/mips/mti-malta/malta-memory.c 
b/arch/mips/mti-malta/malta-memory.c
index 8fddd2cdbff7..3a0a06450ef8 100644
--- a/arch/mips/mti-malta/malta-memory.c
+++ b/arch/mips/mti-malta/malta-memory.c
@@ -53,6 +53,11 @@ fw_memblock_t * __init fw_getmdesc(int eva)
                pr_warn("memsize not set in YAMON, set to default (32Mb)\n");
                physical_memsize = 0x02000000;
        } else {
+               if (memsize > (256 << 20)) { /* memsize should be capped to 
256M */
+                       pr_warn("Unsupported memsize value (0x%lx) detected! Using 
0x10000000 (256M) instead\n",
+                               memsize);
+                       memsize = (256 << 20);

   () not needed here.

[...]

WBR, Sergei


<Prev in Thread] Current Thread [Next in Thread>