Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org,
	Markos Chandras <markos.chandras@imgtec.com>,
	linux-mips@linux-mips.org, Ralf Baechle <ralf@linux-mips.org>
Subject: [PATCH 4.0 037/220] MIPS: Malta: Detect and fix bad memsize values
Date: Sat,  2 May 2015 20:59:12 +0200	[thread overview]
Message-ID: <20150502185855.988941134@linuxfoundation.org> (raw)
In-Reply-To: <20150502185854.333748961@linuxfoundation.org>

4.0-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Markos Chandras <markos.chandras@imgtec.com>

commit f7f8aea4b97c4d48e42f02cb37026bee445f239f upstream.

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: 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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/mips/mti-malta/malta-memory.c |    6 ++++++
 1 file changed, 6 insertions(+)

--- a/arch/mips/mti-malta/malta-memory.c
+++ b/arch/mips/mti-malta/malta-memory.c
@@ -53,6 +53,12 @@ fw_memblock_t * __init fw_getmdesc(int e
 		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;
 	}

  parent reply	other threads:[~2015-05-02 19:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20150502185854.333748961@linuxfoundation.org>
2015-05-02 18:59 ` [PATCH 4.0 035/220] MIPS: KVM: Handle MSA Disabled exceptions from guest Greg Kroah-Hartman
2015-05-02 18:59 ` [PATCH 4.0 036/220] MIPS: lose_fpu(): Disable FPU when MSA enabled Greg Kroah-Hartman
2015-05-02 18:59 ` Greg Kroah-Hartman [this message]
2015-05-02 18:59 ` [PATCH 4.0 038/220] MIPS: asm: asm-eva: Introduce kernel load/store variants Greg Kroah-Hartman
2015-05-02 18:59 ` [PATCH 4.0 039/220] MIPS: unaligned: Prevent EVA instructions on kernel unaligned accesses Greg Kroah-Hartman
2015-05-02 18:59 ` [PATCH 4.0 040/220] MIPS: unaligned: Surround load/store macros in do {} while statements Greg Kroah-Hartman
2015-05-02 18:59 ` [PATCH 4.0 041/220] MIPS: unaligned: Fix regular load/store instruction emulation for EVA Greg Kroah-Hartman
2015-05-02 18:59 ` [PATCH 4.0 042/220] MIPS: Loongson-3: Add IRQF_NO_SUSPEND to Cascade irqaction Greg Kroah-Hartman
2015-05-02 18:59 ` [PATCH 4.0 043/220] MIPS: Hibernate: flush TLB entries earlier Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150502185855.988941134@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=markos.chandras@imgtec.com \
    --cc=ralf@linux-mips.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox