All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: Malta: malta-memory: Detect and fix bad memsize values
@ 2015-02-27  7:51 ` Markos Chandras
  0 siblings, 0 replies; 3+ messages in thread
From: Markos Chandras @ 2015-02-27  7:51 UTC (permalink / raw)
  To: linux-mips; +Cc: Markos Chandras, stable

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);
+		}
 		/* If ememsize is set, then set physical_memsize to that */
 		physical_memsize = ememsize ? : memsize;
 	}
-- 
2.3.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] MIPS: Malta: malta-memory: Detect and fix bad memsize values
@ 2015-02-27  7:51 ` Markos Chandras
  0 siblings, 0 replies; 3+ messages in thread
From: Markos Chandras @ 2015-02-27  7:51 UTC (permalink / raw)
  To: linux-mips; +Cc: Markos Chandras, stable

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);
+		}
 		/* If ememsize is set, then set physical_memsize to that */
 		physical_memsize = ememsize ? : memsize;
 	}
-- 
2.3.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] MIPS: Malta: malta-memory: Detect and fix bad memsize values
  2015-02-27  7:51 ` Markos Chandras
  (?)
@ 2015-02-27 12:34 ` Sergei Shtylyov
  -1 siblings, 0 replies; 3+ messages in thread
From: Sergei Shtylyov @ 2015-02-27 12:34 UTC (permalink / raw)
  To: Markos Chandras, linux-mips; +Cc: stable

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-02-27 12:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-27  7:51 [PATCH] MIPS: Malta: malta-memory: Detect and fix bad memsize values Markos Chandras
2015-02-27  7:51 ` Markos Chandras
2015-02-27 12:34 ` Sergei Shtylyov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.